-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
92 lines (74 loc) · 2.55 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
project(mgunit)
set(VERSION_MAJOR "1")
set(VERSION_MINOR "6")
set(VERSION_PATCH "0")
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
SET(CMAKE_BUILD_TYPE Release)
# required version of CMake
cmake_minimum_required(VERSION 2.8.3)
cmake_policy(SET CMP0017 NEW)
set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/mgcmake/Modules
${CMAKE_ROOT}/Modules
${CMAKE_MODULE_PATH}
)
find_package(Git)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%h
OUTPUT_VARIABLE REVISION
)
else ()
set(REVISION "")
endif ()
find_package(IDL)
find_package(IDLdoc)
include(${CMAKE_SOURCE_DIR}/mgcmake/GetDate.cmake)
LONG_TODAY(mgunit_BUILD_DATE)
message(STATUS "Build date = ${mgunit_BUILD_DATE}")
add_subdirectory(bin)
add_subdirectory(docs)
add_subdirectory(src)
file(GLOB_RECURSE PRO_FILES "src/*.pro")
file(GLOB_RECURSE IDLDOC_FILES "src/*.idldoc")
if (IDLdoc_FOUND)
add_custom_command(
OUTPUT api-docs/index.html
COMMAND ${IDL_EXECUTABLE} -IDL_STARTUP \"\" -IDL_PATH \"+${CMAKE_CURRENT_SOURCE_DIR}${IDL_PATH_SEP}+${IDLdoc_DIR}${IDL_PATH_SEP}<IDL_DEFAULT>\" -e mgunit_build_docs
DEPENDS ${PRO_FILES} ${IDLDOC_FILES}
)
add_custom_target(doc DEPENDS api-docs/index.html)
add_custom_command(
OUTPUT api-userdocs/index.html
COMMAND ${IDL_EXECUTABLE} -IDL_STARTUP \"\" -IDL_PATH \"+${CMAKE_CURRENT_SOURCE_DIR}${IDL_PATH_SEP}+${IDLdoc_DIR}${IDL_PATH_SEP}<IDL_DEFAULT>\" -e mgunit_build_userdocs
DEPENDS ${PRO_FILES} ${IDLDOC_FILES}
)
add_custom_target(userdoc ALL DEPENDS api-userdocs/index.html)
endif ()
set_directory_properties(PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES "api-userdocs;api-docs;mgunit.sav"
)
add_custom_command(
OUTPUT mgunit.sav
COMMAND ${IDL_EXECUTABLE} -IDL_STARTUP \"\" -IDL_PATH \"+${CMAKE_CURRENT_SOURCE_DIR}${IDL_PATH_SEP}<IDL_DEFAULT>\" mgunit_build
DEPENDS ${PROFILES})
add_custom_target(savfile ALL DEPENDS mgunit.sav)
# setup installer
if (WIN32)
set(CPACK_GENERATOR ZIP)
else ()
set(CPACK_GENERATOR TGZ)
endif ()
set(MGUNIT_PACKAGE_VERSION "${VERSION}")
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MGUNIT_PACKAGE_VERSION}")
include(CPack)
configure_file(idlpackage.json.in idlpackage.json @ONLY)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/idlpackage.json
DESTINATION .)
# script to build mgunit.sav only at "make install"
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mgunit.sav DESTINATION lib)
install(FILES README.rst COPYING.rst RELEASE.rst DESTINATION .)
if (IDLdoc_FOUND)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api-userdocs DESTINATION .)
endif ()