-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
118 lines (95 loc) · 3.78 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
cmake_minimum_required(VERSION 2.6.2)
project (pyramid)
set(PROJECT_NAME pyramid)
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_CONFIG_PATH "${SOURCE_DIR}/cmake")
set(CMAKE_MODULE_PATH "${SOURCE_DIR}/cmake/modules")
set(CMAKE_SOURCE_DIR "${SOURCE_DIR}/src")
set(DOCUMENTATION_DIR "{SOURCE_DIR}/doc")
if(NOT EXISTS ${CMAKE_CONFIG_PATH}/pyramid-config.cmake)
message(FATAL_ERROR "Missing configuration file : ${CMAKE_CONFIG_PATH}/pyramid-config.cmake")
endif()
include(${CMAKE_CONFIG_PATH}/pyramid-config.cmake)
#-------------------------------------------------------------------------------
#Find lib-imtiff
#-------------------------------------------------------------------------------
add_subdirectory (src/lib-utils)
add_subdirectory (src/lib-kmlocal)
add_subdirectory (src/lib-clustering)
#add_subdirectory (src/lib-imtiff)
add_subdirectory (src/lib-image2D)
add_subdirectory (src/lib-mapkernel)
add_subdirectory (src/ihm)
add_subdirectory (src/test)
#-------------------------------------------------------------------------------
# {{{ Manpages
if(GENERATE_MANPAGES)
set(PYRAMID_MAN_SRCS
${SOURCE_DIR}/debian/manpages/pryamid.1.txt
)
set(PYRAMID_MAN_LANGS default fr)
foreach(lang ${PYRAMID_MAN_LANGS})
foreach(txtfile ${PYRAMID_MAN_SRCS})
# figure the base name of the file (ie "songbook-client.1")
GET_FILENAME_COMPONENT(tmpname ${txtfile} NAME)
string(REGEX REPLACE ".txt\$" "" basename ${tmpname})
# figure the relative path of the file
GET_FILENAME_COMPONENT(tmppath ${txtfile} PATH)
string(REPLACE ${SOURCE_DIR}/ "" relpath ${tmppath})
# figure the manpage section to install to from filename
string(REGEX REPLACE "^.*\\.([0-9])$" "\\1" section ${basename})
# construct the language specific versions of the basename and path
if (lang STREQUAL default)
set(basename2 ${basename})
set(relpath2 ${relpath}/man${section})
else()
set(basename2 ${basename}.${lang})
set(relpath2 ${relpath}/${lang}/man${section})
endif()
# create the build directory (if it does not exist)
file(MAKE_DIRECTORY ${BUILD_DIR}/${relpath2})
# set the final filenames
set(txtfile ${SOURCE_DIR}/${relpath}/${basename2}.txt)
set(xmlfile ${BUILD_DIR}/${relpath2}/${basename}.xml)
set(gzfile ${BUILD_DIR}/${relpath2}/${basename}.gz)
set(manfile ${BUILD_DIR}/${relpath2}/${basename})
add_custom_command(
COMMAND ${ASCIIDOC_EXECUTABLE} -d manpage -b docbook -o ${xmlfile} - < ${txtfile}
WORKING_DIRECTORY ${BUILD_DIR}/${relpath2}
OUTPUT ${xmlfile}
DEPENDS ${txtfile}
VERBATIM)
add_custom_command(
COMMAND ${XMLTO_EXECUTABLE} man ${xmlfile}
OUTPUT ${manfile}
WORKING_DIRECTORY ${BUILD_DIR}/${relpath2}
DEPENDS ${xmlfile})
if(COMPRESS_MANPAGES)
add_custom_command(
COMMAND ${GZIP_EXECUTABLE} < ${manfile} > ${gzfile}
OUTPUT ${gzfile}
WORKING_DIRECTORY ${BUILD_DIR}/${relpath2}
DEPENDS ${manfile}
VERBATIM)
set(MAN_FILES ${MAN_FILES} ${gzfile})
else()
set(MAN_FILES ${MAN_FILES} ${manfile})
endif()
endforeach()
endforeach()
add_custom_target(man ALL DEPENDS ${MAN_FILES})
endif()
# }}}
if(GENERATE_MANPAGES)
if(COMPRESS_MANPAGES)
set(regex "\\.(xml|txt|[0-9])$")
else()
set(regex "\\.(xml|txt|gz)$")
endif()
install(DIRECTORY ${BUILD_DIR}/${relpath}/ DESTINATION ${PYRAMID_MAN_PATH}
REGEX ${regex} EXCLUDE)
endif()
install(FILES ${PYRAMID_APPLICATION_NAME}.desktop DESTINATION share/applications)
install(FILES src/ihm/icons/pyramid.png DESTINATION share/icons)
#install(FILES ${COMPILED_TRANSLATIONS} DESTINATION ${PYRAMID_DATA_PATH}/lang)