-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
138 lines (112 loc) · 4.54 KB
/
CMakeLists.txt
File metadata and controls
138 lines (112 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
cmake_minimum_required(VERSION 2.8.12)
message("Cmake version: ${CMAKE_VERSION}")
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
project(dict-pack C CXX)
find_package(PythonInterp REQUIRED)
# Do we need all of these - none seem to be used
#set(mydefines " -DBIG_ENDIAN_PLATFORM -DHAVE_STRCASECMP -DINCL_TEMPLATE_SRC -DHAVE_PLACEMENT_NEW ")
# Normally we download/build a complete set of dictionaries (unless in distribution). If set, only a subset of dictionaries are uilt
option(MINIMAL_DICTS "If boolean is ON, then only compile a subset of dictionaries")
# In sourcdir/dicts present and dictionary present, it will be used. Force download of all dictionaries
option(ALWAYS_DOWNLOAD_DICTS "If boolean is ON, then will download dictiobaries instead of using cached copy in distribution")
message(STATUS "Compiler flags " ${CMAKE_CXX_FLAGS})
#
# ---------------------------------------------------------------
# WHERE AM I RUNNING
#
message(STATUS "---CMAKE MODULE PATH - " ${CMAKE_MODULE_PATH})
message(STATUS "---CMAKE SOURCE DIR - " ${CMAKE_SOURCE_DIR})
message(STATUS "---CMAKE PROJECT DIR - " ${PROJECT_SOURCE_DIR})
# ---------------------------------------------------------------
#
set(BUILD_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/src")
set(BUILD_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
set(BUILD_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(BUILD_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib")
set(BUILD_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
file(MAKE_DIRECTORY ${BUILD_HTML_DIR})
# For extending installation of dict-obj-file programs
set(BUILD_DICT_PACK_SUPPORT 1)
include(cmake/commonparser.cmake)
# Build dict-pack tools
include(cmake/dictpack.cmake)
# Functions to build dictionaries
include(cmake/dictfunc.cmake)
# Functions to download dictionarys
include(cmake/dictdownload.cmake)
# Custom command to update git submodules
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
add_custom_target(checkout-modules ${GIT_EXECUTABLE} submodule update
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Updating submodules")
set(MODULE_CHECKOUT_DEP checkout-modules)
endif()
# Will checkout specific dictionaries and modules
add_custom_target(checkout
# COMMENT "CHECKOUT"
DEPENDS ${MODULE_CHECKOUT_DEP})
#####################
# Build dictionaries
# List of dictionaries we are building. EXTDICTS are built all the time.
# INTDICTS are not built in distribution.
set(EXTDICTS mmcif_ddl mmcif_pdbx_v5_next mmcif_pdbx_v50)
set(INTDICTS)
if(NOT MINIMAL_DICTS)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/DictPackDist.txt)
set(INTDICTS mmcif_pdbx_v40 mmcif_pdbx_v41 mmcif_pdbx_v42 mmcif_pdbx_v32 mmcif_pdbx_v31 mmcif_ihm mmcif_pdbx_vrpt mmcif_ma mmcif_biosync mmcif_ccp4 mmcif_em mmcif_img mmcif_ndb_ntc mmcif_nef mmcif_nmr-star mmcif_rcsb_nmr mmcif_rcsb_xray mmcif_sas mmcif_std mmcif_sym)
endif()
endif()
set(_SDB_LIST)
set(_ODB_LIST)
set(_XML_LIST)
set(ALLDICTS ${EXTDICTS} ${INTDICTS})
foreach(DICT ${ALLDICTS})
GET_DICTIONARY(${DICT})
BUILD_SDB(${DICT} ${ALLDICTS})
list(APPEND _SDB_LIST ${DICT}_sdb)
# Determine if xml support needed for this dictionary
SHOULD_SUPPRESS_XML(${DICT} RET)
# message(STATUS "SUPPRESS ${RET}")
if (${RET} STREQUAL "False")
BUILD_ODB(${DICT})
BUILD_XML(${DICT})
list(APPEND _ODB_LIST ${DICT}_odb)
list(APPEND _XML_LIST ${DICT}_xml)
endif()
endforeach()
add_custom_target(sdb
DEPENDS ${_SDB_LIST}
)
add_custom_target(odb
DEPENDS ${_ODB_LIST}
)
add_custom_target(xml_v50
DEPENDS ${_XML_LIST}
)
add_custom_target(everything
DEPENDS ${DICTPACK_ALLEXE} sdb odb xml_v50
)
#
#
# Distribution CPack configuration
#
set(CPACK_PACKAGE_VERSION_MAJOR "2")
set(CPACK_PACKAGE_VERSION_MINOR "999")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_SOURCE_GENERATOR "TBZ2;TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_IGNORE_FILES
"/build/;/.bzr/;.git/;/.gitmodules;/.github/;/.gitignore;~$;/.*/.git;/.*/.svn;.idea/;${CPACK_SOURCE_IGNORE_FILES}")
# Inspired by https://jtanx.github.io/2019/08/22/cmake-dist-customisation/ package selected dictionaries
set(CPACK_INSTALL_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/CPackExtraDist.cmake")
configure_file("${CMAKE_SOURCE_DIR}/cmake/ExtraDist.cmake.in" "CPackExtraDist.cmake" @ONLY)
include(CPack)
add_custom_target(dist
COMMAND "${CMAKE_COMMAND}" --build "${CMAKE_BINARY_DIR}" --target package_source
# DEPENDS test_dependencies
VERBATIM
USES_TERMINAL
)