Commit c15a8bd1 by Maarten L. Hekkelman

export source tarballs

parent 64e40e7b
...@@ -59,11 +59,11 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) ...@@ -59,11 +59,11 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
option(BUILD_FOR_CCP4 "Build a version to be installed in CCP4" OFF) 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 # 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 # An optional cron script can be installed to keep the data files up-to-date
if(UNIX) 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() endif()
# When CCP4 is sourced in the environment, we can recreate the symmetry operations table # When CCP4 is sourced in the environment, we can recreate the symmetry operations table
...@@ -136,7 +136,7 @@ if(GXX_LIBSTDCPP) ...@@ -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") 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) set(BOOST_REGEX_STANDALONE ON)
add_git_submodule(regex EXCLUDE_FROM_ALL) add_git_submodule("${PROJECT_SOURCE_DIR}/regex" EXCLUDE_FROM_ALL)
endif() endif()
endif() endif()
...@@ -154,12 +154,15 @@ include(FindAtomic) ...@@ -154,12 +154,15 @@ include(FindAtomic)
list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPATOMIC_LIBRARY}) list(APPEND CIFPP_REQUIRED_LIBRARIES ${STDCPPATOMIC_LIBRARY})
if(NOT PDB_REDO_META) 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() endif()
# Create a revision file, containing the current git version info # Create a revision file, containing the current git version info
include(VersionString) include(VersionString)
write_version_header("LibCIFPP") write_version_header(${PROJECT_SOURCE_DIR}/src/ "LibCIFPP")
# SymOp data table # SymOp data table
if(CIFPP_RECREATE_SYMOP_DATA) if(CIFPP_RECREATE_SYMOP_DATA)
...@@ -451,3 +454,13 @@ if(CIFPP_INSTALL_UPDATE_SCRIPT) ...@@ -451,3 +454,13 @@ if(CIFPP_INSTALL_UPDATE_SCRIPT)
target_compile_definitions(cifpp PUBLIC CACHE_DIR="${CIFPP_CACHE_DIR}") target_compile_definitions(cifpp PUBLIC CACHE_DIR="${CIFPP_CACHE_DIR}")
endif() 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,16 +8,20 @@ function(add_git_submodule dir) ...@@ -8,16 +8,20 @@ function(add_git_submodule dir)
# #
# include(AddGitSubmodule.cmake) # include(AddGitSubmodule.cmake)
# add_git_submodule(mysubmod_dir) # add_git_submodule(mysubmod_dir)
find_package(Git REQUIRED) find_package(Git QUIET)
if(NOT EXISTS ${dir}/CMakeLists.txt) if(NOT EXISTS ${dir}/CMakeLists.txt)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19) if(NOT (GIT_FOUND AND IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git"))
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir} message(FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR} is not a git repository and the submodule ${dir} is not complete. Cannot continue.")
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND_ERROR_IS_FATAL ANY)
else() else()
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir} if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND_ERROR_IS_FATAL ANY)
else()
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- ${dir}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif()
endif() endif()
endif() endif()
......
...@@ -25,7 +25,12 @@ ...@@ -25,7 +25,12 @@
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.15)
# Create a revision file, containing the current git version info, if any # 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) include(GetGitRevisionDescription)
if(NOT(GIT-NOTFOUND OR HEAD-HASH-NOTFOUND)) if(NOT(GIT-NOTFOUND OR HEAD-HASH-NOTFOUND))
git_describe_working_tree(BUILD_VERSION_STRING --match=build --dirty) git_describe_working_tree(BUILD_VERSION_STRING --match=build --dirty)
...@@ -39,14 +44,13 @@ function(write_version_header) ...@@ -39,14 +44,13 @@ function(write_version_header)
endif() endif()
endif() endif()
else() else()
set(BUILD_VERSION_STRING "no git info available") message(WARNING "no git info available, cannot update version string")
endif() endif()
include_directories(${PROJECT_BINARY_DIR} PRIVATE)
string(TIMESTAMP BUILD_DATE_TIME "%Y-%m-%dT%H:%M:%SZ" UTC) string(TIMESTAMP BUILD_DATE_TIME "%Y-%m-%dT%H:%M:%SZ" UTC)
if(ARGC GREATER 0) if(ARGC GREATER 1)
set(VAR_PREFIX "${ARGV0}") set(VAR_PREFIX "${ARGV1}")
endif() endif()
file(WRITE "${PROJECT_BINARY_DIR}/revision.hpp.in" [[// Generated revision file 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) ...@@ -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() 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