-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCMakeLists.txt
159 lines (127 loc) · 6.07 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
project (hpccsystems-ganglia-monitoring)
cmake_minimum_required (VERSION 2.8.2)
set (HPCC_GM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set (CMAKE_MODULE_PATH "${HPCC_GM_SOURCE_DIR}/cmake_modules/")
###
## Build Level
###
if( NOT BUILD_LEVEL )
set ( BUILD_LEVEL "COMMUNITY" )
endif()
###
option(EXEC_PREFIX "Set the execution prefix")
if (NOT LICENSE_FILE)
set (LICENSE_FILE "LICENSE.txt")
endif()
set (HPCC_SOURCE_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
IF ("${HPCC_SOURCE_DIR}" STREQUAL "")
SET (HPCC_SOURCE_DIR ${HPCC_SOURCE_ROOT_DIR}/HPCC-Platform)
ENDIF()
include (${HPCC_GM_SOURCE_DIR}/version.cmake)
include (${HPCC_GM_SOURCE_DIR}/cmake_modules/optionDefaults.cmake)
include (${HPCC_GM_SOURCE_DIR}/cmake_modules/gmCommonSetup.cmake)
include (${HPCC_SOURCE_DIR}/version.cmake)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fPIC -fmessage-length=0 -Wformat -Wformat-security -Wformat-nonliteral -pthread -Wuninitialized")
MESSAGE (HPCC_SOURCE_DIR: ${HPCC_SOURCE_DIR})
ADD_SUBDIRECTORY(${HPCC_SOURCE_DIR} oss EXCLUDE_FROM_ALL)
CONFIGURE_FILE(${HPCC_SOURCE_DIR}/build-config.h.cmake "build-config.h" )
CONFIGURE_FILE(${HPCC_GM_SOURCE_DIR}/scripts/getMetrics.sh.in "getMetrics.sh" )
INSTALL ( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/getMetrics.sh DESTINATION sbin COMPONENT Runtime)
HPCC_ADD_SUBDIRECTORY (esp)
HPCC_ADD_SUBDIRECTORY (initfiles)
CONFIGURE_FILE( "postinst.in" "postinst" )
CONFIGURE_FILE( "postrm.in" "postrm" )
SET(CPACK_PACKAGE_VERSION_MAJOR ${majorver})
SET(CPACK_PACKAGE_VERSION_MINOR ${minorver})
SET(CPACK_PACKAGE_VERSION_PATCH ${point}-${stagever})
set (CPACK_PACKAGE_CONTACT "HPCCSystems <[email protected]>")
set (CPACK_SOURCE_GENERATOR TGZ )
set (CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CPACK_RPM_PACKAGE_ARCHITECTURE}")
IF ( CMAKE_SYSTEM_NAME MATCHES Linux )
EXECUTE_PROCESS (
COMMAND ${CMAKE_MODULE_PATH}/distrocheck.sh
OUTPUT_VARIABLE packageManagement
ERROR_VARIABLE packageManagement
)
EXECUTE_PROCESS (
COMMAND ${CMAKE_MODULE_PATH}/getpackagerevisionarch.sh
OUTPUT_VARIABLE packageRevisionArch
ERROR_VARIABLE packageRevisionArch
)
EXECUTE_PROCESS (
COMMAND ${CMAKE_MODULE_PATH}/getpackagerevisionarch.sh --noarch
OUTPUT_VARIABLE packageRevision
ERROR_VARIABLE packageRevision
)
MESSAGE ( "-- Auto Detecting Packaging type")
MESSAGE ( "-- distro uses ${packageManagement}, revision is ${packageRevisionArch}" )
IF ( ${packageManagement} STREQUAL "DEB" )
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${version}-${stagever}${packageRevisionArch}")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /usr/lib)
ELSEIF ( ${packageManagement} STREQUAL "RPM" )
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${version}-${stagever}.${packageRevisionArch}")
SET(CMAKE_LIBRARY_PATH "/usr/lib64")
ELSE()
SET(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${version}-${stagever}${CPACK_SYSTEM_NAME}")
ENDIF ()
ENDIF ( CMAKE_SYSTEM_NAME MATCHES Linux )
#MESSAGE ("-- Current release version is ${CPACK_PACKAGE_FILE_NAME}")
#MESSAGE( STATUS "CMAKE_CURRENT_BINARY_DIR: " ${CMAKE_CURRENT_BINARY_DIR} )
#MESSAGE( STATUS "CMAKE_SOURCE_DIR: " ${CMAKE_SOURCE_DIR} )
#MESSAGE( STATUS "CMAKE_LIBRARY_PATH: "${CMAKE_LIBRARY_PATH} )
get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if ("${LIB64}" STREQUAL "TRUE")
set(LIBSUFFIX 64)
else()
set(LIBSUFFIX "")
endif()
set(INSTALL_LIB_DIR lib${LIBSUFFIX} CACHE PATH "Installation directory for libraries")
mark_as_advanced(INSTALL_LIB_DIR)
#message( STATUS "INSTALL_LIB_DIR: ${INSTALL_LIB_DIR}" )
get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
#message( STATUS "lib64: ${LIB64}" )
SET ( CPACK_SOURCE_GENERATOR TGZ )
IF (NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.2")
IF ( CMAKE_SYSTEM MATCHES Linux )
IF ( ${packageManagement} STREQUAL "DEB" )
IF ("${CMAKE_VERSION}" VERSION_EQUAL "2.8.2")
MESSAGE("WARNING: CMAKE 2.8.2 would not build DEB package")
ELSE ()
SET ( CPACK_GENERATOR "${packageManagement}" )
MESSAGE("-- Will build DEB package")
###
## CPack instruction required for Debian
###
MESSAGE ("-- Packing BASH installation files")
SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/postinst;${CMAKE_SOURCE_DIR}/prerm;${CMAKE_BINARY_DIR}/postrm" )
ENDIF ()
ELSEIF ( ${packageManagement} STREQUAL "RPM" )
SET ( CPACK_GENERATOR "${packageManagement}" )
###
## CPack instruction required for RPM
###
MESSAGE("-- Will build RPM package")
MESSAGE ("-- Packing BASH installation files")
SET ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/postinst" )
SET ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_SOURECE_DIR}/prerm" )
SET ( CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/postrm" )
ELSE()
MESSAGE("WARNING: Unsupported package ${packageManagement}.")
ENDIF ()
ENDIF ( CMAKE_SYSTEM MATCHES Linux )
IF ( EXISTS ${CMAKE_MODULE_PATH}/dependencies/${packageRevision}.cmake )
INCLUDE( ${CMAKE_MODULE_PATH}/dependencies/${packageRevision}.cmake )
ELSE()
MESSAGE("-- WARNING: DEPENDENCY FILE FOR ${packageRevision} NOT FOUND")
ENDIF()
IF ( UNIX )
SET ( CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
ENDIF()
SET ( CPACK_MONOLITHIC_INSTALL TRUE )
SET ( CPACK_PACKAGE_VENDOR "HPCC Systems" )
INSTALL( FILES "${CMAKE_CURRENT_SOURCE_DIR}/modroxie.py" DESTINATION ${CMAKE_LIBRARY_PATH}/ganglia/python_modules )
INSTALL( FILES "${CMAKE_CURRENT_SOURCE_DIR}/modroxie.pyconf" DESTINATION /etc/ganglia/conf.d )
INCLUDE ( CPack )
ELSE()
MESSAGE("WARNING: CMAKE 2.8.1 or later required to create RPMs from this project")
ENDIF()