-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
165 lines (132 loc) · 4.79 KB
/
CMakeLists.txt
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#...............................................................................
#
# This file is part of the Jancy toolkit.
#
# Jancy is distributed under the MIT license.
# For details see accompanying license.txt file,
# the public copy of which is also available at:
# http://tibbo.com/downloads/archive/jancy/license.txt
#
#...............................................................................
cmake_minimum_required(VERSION 3.16)
project(jancy)
include(cmake/axl_cmake.cmake NO_POLICY_SCOPE)
#. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
if(NOT "${GCC_FLAG_CPP_STANDARD}" MATCHES "-std=")
if(${LLVM_VERSION_MAJOR} LESS 10)
set(CMAKE_CXX_STANDARD 11)
elseif(${LLVM_VERSION_MAJOR} LESS 16)
set(CMAKE_CXX_STANDARD 14)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
endif()
#. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
set(JANCY_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
set(JANCY_SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/src)
set(JANCY_BUILD_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
set(JANCY_LIB_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(JANCY_BIN_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(JANCY_DOC_DIR ${CMAKE_CURRENT_BINARY_DIR}/doc)
set(JANCY_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/package)
if(WIN32)
set(JANCY_DLL_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin)
else()
set(JANCY_DLL_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${JANCY_BIN_BASE_DIR}/${CONFIGURATION_SCG})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${JANCY_DLL_BASE_DIR}/${CONFIGURATION_SCG})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${JANCY_LIB_BASE_DIR}/${CONFIGURATION_SCG})
set(JANCY_INSTALL_BIN_SUBDIR bin)
set(JANCY_INSTALL_LIB_SUBDIR lib)
if(WIN32)
set(JANCY_INSTALL_INC_SUBDIR include)
set(JANCY_INSTALL_CMAKE_SUBDIR cmake)
set(JANCY_INSTALL_DLL_SUBDIR bin)
set(JANCY_INSTALL_JNCX_SUBDIR bin)
set(JANCY_INSTALL_TOOL_SUBDIR tools)
set(JANCY_INSTALL_SAMPLE_SUBDIR samples)
set(JANCY_INSTALL_SPHINX_SUBDIR sphinx)
set(JANCY_INSTALL_DOC_SUBDIR doc)
set(JANCY_INSTALL_LICENSE_SUBDIR license)
else()
set(JANCY_INSTALL_INC_SUBDIR include/${PROJECT_NAME})
set(JANCY_INSTALL_CMAKE_SUBDIR lib/cmake/${PROJECT_NAME})
set(JANCY_INSTALL_DLL_SUBDIR lib)
set(JANCY_INSTALL_JNCX_SUBDIR share/${PROJECT_NAME}/extensions)
set(JANCY_INSTALL_TOOL_SUBDIR share/${PROJECT_NAME}/tools)
set(JANCY_INSTALL_SAMPLE_SUBDIR share/${PROJECT_NAME}/samples)
set(JANCY_INSTALL_SPHINX_SUBDIR share/${PROJECT_NAME}/sphinx)
set(JANCY_INSTALL_DOC_SUBDIR share/${PROJECT_NAME}/doc)
set(JANCY_INSTALL_LICENSE_SUBDIR share/${PROJECT_NAME}/license)
if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path/../lib")
else()
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
endif()
endif()
#. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
add_subdirectory(cmake)
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/jancy_config.cmake)
configure_file(
${JANCY_ROOT_DIR}/include/jnc_Config.h.in
${JANCY_BUILD_INC_DIR}/jnc_Config.h
)
add_subdirectory(src)
add_subdirectory(tools)
add_subdirectory(samples)
add_subdirectory(test)
add_subdirectory(doc)
#. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
install(
DIRECTORY include/
DESTINATION ${JANCY_INSTALL_INC_SUBDIR}
PATTERN "*.h"
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/include/jnc_Config.h
DESTINATION ${JANCY_INSTALL_INC_SUBDIR}
)
install(
DIRECTORY tools/
DESTINATION ${JANCY_INSTALL_TOOL_SUBDIR}
)
install(
DIRECTORY samples/
DESTINATION ${JANCY_INSTALL_SAMPLE_SUBDIR}
PATTERN "CMakeLists.txt" EXCLUDE
)
install(
DIRECTORY sphinx/
DESTINATION ${JANCY_INSTALL_SPHINX_SUBDIR}
PATTERN "*.pyc" EXCLUDE
PATTERN "__pycache__" EXCLUDE
)
install(
DIRECTORY license/
DESTINATION ${JANCY_INSTALL_LICENSE_SUBDIR}
)
#...............................................................................
set(CPACK_PACKAGE_VERSION_MAJOR ${JANCY_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${JANCY_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${JANCY_VERSION_REVISION})
if(WIN32)
set(CPACK_SOURCE_GENERATOR 7Z)
else()
set(CPACK_SOURCE_GENERATOR TXZ)
endif()
set(CPACK_SOURCE_IGNORE_FILES "/[.];[.]user$;/build/;/ci/;/paths.cmake$")
set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PROJECT_NAME}-${JANCY_VERSION_FILE_SUFFIX}-src)
if(APPLE)
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${JANCY_VERSION_FILE_SUFFIX}-mac)
else()
string(TOLOWER ${CMAKE_SYSTEM_NAME} OS_NAME)
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${JANCY_VERSION_FILE_SUFFIX}-${OS_NAME}-${TARGET_CPU})
endif()
include(CPack)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/ci/github-actions/print-package-file-name.cmake
${CMAKE_CURRENT_BINARY_DIR}/print-package-file-name.cmake
COPYONLY
)
#...............................................................................