Commit c15a8bd1 by Maarten L. Hekkelman

export source tarballs

parent 64e40e7b
......@@ -59,11 +59,11 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
option(BUILD_FOR_CCP4 "Build a version to be installed in CCP4" OFF)
# Lots of code depend on the availability of the components.cif file
option(CIFPP_DOWNLOAD_CCD "Download the CCD file components.cif during installation" OFF)
option(CIFPP_DOWNLOAD_CCD "Download the CCD file components.cif during installation" ON)
# An optional cron script can be installed to keep the data files up-to-date
if(UNIX)
option(CIFPP_INSTALL_UPDATE_SCRIPT "Install the script to update CCD and dictionary files" OFF)
option(CIFPP_INSTALL_UPDATE_SCRIPT "Install the script to update CCD and dictionary files" ON)
endif()
# When CCP4 is sourced in the environment, we can recreate the symmetry operations table
......@@ -136,7 +136,7 @@ if(GXX_LIBSTDCPP)
message(STATUS "You are probably trying to compile using the g++ standard library which contains a crashing std::regex implementation. Will try to use boost::regex instead")
set(BOOST_REGEX_STANDALONE ON)
add_git_submodule(regex EXCLUDE_FROM_ALL)
add_git_submodule("${PROJECT_SOURCE_DIR}/regex" EXCLUDE_FROM_ALL)
endif()
endif()
......@@ -154,12 +154,15 @@ include(FindAtomic)
list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPATOMIC_LIBRARY})
if(NOT PDB_REDO_META)
find_package(gxrio REQUIRED)
find_package(gxrio QUIET)
if(NOT gxrio_FOUND)
add_git_submodule(${PROJECT_SOURCE_DIR}/gxrio)
endif()
endif()
# Create a revision file, containing the current git version info
include(VersionString)
write_version_header("LibCIFPP")
write_version_header(${PROJECT_SOURCE_DIR}/src/ "LibCIFPP")
# SymOp data table
if(CIFPP_RECREATE_SYMOP_DATA)
......@@ -451,3 +454,13 @@ if(CIFPP_INSTALL_UPDATE_SCRIPT)
target_compile_definitions(cifpp PUBLIC CACHE_DIR="${CIFPP_CACHE_DIR}")
endif()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_SOURCE_TGZ ON)
set(CPACK_SOURCE_TBZ2 OFF)
set(CPACK_SOURCE_TXZ OFF)
set(CPACK_SOURCE_TZ OFF)
set(CPACK_SOURCE_IGNORE_FILES "/data/components.cif;/build;/.vscode;/.git;/regex/doc;/regex/example;/regex/meta;/regex/performance;/regex/test")
set (CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
include(CPack)
......@@ -8,9 +8,12 @@ function(add_git_submodule dir)
#
# include(AddGitSubmodule.cmake)
# add_git_submodule(mysubmod_dir)
find_package(Git REQUIRED)
find_package(Git QUIET)
if(NOT EXISTS ${dir}/CMakeLists.txt)
if(NOT (GIT_FOUND AND IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git"))
message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR} is not a git repository and the submodule ${dir} is not complete. Cannot continue.")
else()
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
......@@ -20,6 +23,7 @@ function(add_git_submodule dir)
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()
endif()
endif()
set(ENABLE_TESTING OFF)
......
......@@ -25,7 +25,12 @@
cmake_minimum_required(VERSION 3.15)
# Create a revision file, containing the current git version info, if any
function(write_version_header)
function(write_version_header dir)
# parameter check
if(NOT IS_DIRECTORY ${dir})
message(FATAL_ERROR "First parameter to write_version_header should be a directory where the final revision.hpp file will be placed")
endif()
include(GetGitRevisionDescription)
if(NOT(GIT-NOTFOUND OR HEAD-HASH-NOTFOUND))
git_describe_working_tree(BUILD_VERSION_STRING --match=build --dirty)
......@@ -39,14 +44,13 @@ function(write_version_header)
endif()
endif()
else()
set(BUILD_VERSION_STRING "no git info available")
message(WARNING "no git info available, cannot update version string")
endif()
include_directories(${PROJECT_BINARY_DIR} PRIVATE)
string(TIMESTAMP BUILD_DATE_TIME "%Y-%m-%dT%H:%M:%SZ" UTC)
if(ARGC GREATER 0)
set(VAR_PREFIX "${ARGV0}")
if(ARGC GREATER 1)
set(VAR_PREFIX "${ARGV1}")
endif()
file(WRITE "${PROJECT_BINARY_DIR}/revision.hpp.in" [[// Generated revision file
......@@ -72,6 +76,6 @@ inline void write_version_string(std::ostream &os, bool verbose)
}
}
]])
configure_file("${PROJECT_BINARY_DIR}/revision.hpp.in" "${PROJECT_BINARY_DIR}/revision.hpp" @ONLY)
configure_file("${PROJECT_BINARY_DIR}/revision.hpp.in" "${dir}/revision.hpp" @ONLY)
endfunction()
Subproject commit a7bb5b5c4b6612215a78267b89e05c39a45429b5
// Generated revision file
#pragma once
#include <ostream>
const char kLibCIFPPProjectName[] = "cifpp";
const char kLibCIFPPVersionNumber[] = "5.0.1";
const char kLibCIFPPVersionGitTag[] = "64e40e7";
const char kLibCIFPPBuildInfo[] = "830*";
const char kLibCIFPPBuildDate[] = "2022-11-07T11:26:40Z";
inline void write_version_string(std::ostream &os, bool verbose)
{
os << kLibCIFPPProjectName << " version " << kLibCIFPPVersionNumber << std::endl;
if (verbose)
{
os << "build: " << kLibCIFPPBuildInfo << ' ' << kLibCIFPPBuildDate << std::endl;
if (kLibCIFPPVersionGitTag[0] != 0)
os << "git tag: " << kLibCIFPPVersionGitTag << std::endl;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment