forked from SeisComP3/seiscomp3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
121 lines (100 loc) · 3.51 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
PROJECT(SeisComP3)
# Global options (see below):
# - SC_GLOBAL_PYTHON_WRAPPER
# - SC_GLOBAL_PYTHON_WRAPPER_NUMPY
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
IF (COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
CMAKE_POLICY(SET CMP0005 OLD)
ENDIF (COMMAND CMAKE_POLICY)
#SET(CMAKE_DEBUG_POSTFIX _d)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules)
SET(CMAKEDEFINE "#cmakedefine")
#OPTION(SHARED_LIBRARIES "Build shared libraries" ON)
SET(SHARED_LIBRARIES 1)
ADD_DEFINITIONS(-DSC_ALL_SHARED)
IF (WIN32)
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF (WIN32)
# Find needed packages
FIND_PACKAGE(LibXml2 REQUIRED)
OPTION(SC_GLOBAL_PYTHON_WRAPPER "Create Python wrappers" ON)
OPTION(SC_GLOBAL_PYTHON_WRAPPER_NUMPY "Add Numpy support for Python wrapper" OFF)
FIND_PACKAGE(PythonInterp)
EXEC_PROGRAM(
${PYTHON_EXECUTABLE}
ARGS "-c \"import sys;print sys.version[:3]\""
OUTPUT_VARIABLE PYTHON_VERSION
)
IF (SC_GLOBAL_PYTHON_WRAPPER)
IF (APPLE)
FIND_PACKAGE(PythonLibsApple REQUIRED)
ELSE (APPLE)
FIND_PACKAGE(PythonLibs REQUIRED)
ENDIF (APPLE)
FIND_PACKAGE(PythonInterp REQUIRED)
ENDIF (SC_GLOBAL_PYTHON_WRAPPER)
SET(PYTHON_LIBRARY_SUFFIX /python)
SET(PYTHON_LIBRARY_PATH lib${PYTHON_LIBRARY_SUFFIX})
INCLUDE(AddFileDependencies)
INCLUDE(CreateLibrary)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "")
SET(CPACK_PACKAGE_VENDOR "seiscomp-devel@gfz-potsdam.de")
SET(CPACK_PACKAGE_VERSION_NAME "Potsdam")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "2")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
#SET(CPACK_STRIP_FILES "bin/*")
SET(CPACK_SOURCE_STRIP_FILES "")
#SET(CPACK_PACKAGE_EXECUTABLES "bin/*")
SET(CPACK_PACKAGE_FILE_NAME "seiscomp3-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
INCLUDE(CPack)
SET(PROJECT_CONFIG_DIR etc)
SET(PROJECT_SHARE_DIR share)
SET(PROJECT_API_H api.h)
# Default directories that can be overridden in the
# subprojects
SET(SC3_PACKAGE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
SET(SC3_PACKAGE_BIN_DIR bin)
SET(SC3_PACKAGE_LIB_DIR lib)
SET(SC3_PACKAGE_INCLUDE_DIR include)
SET(SC3_PACKAGE_SHARE_DIR share)
SET(SC3_PACKAGE_CONFIG_DIR etc)
SET(SC3_PACKAGE_TEMPLATES_DIR templates)
# SET(PROJECT_TEST_DATA_DIR ${CMAKE_SOURCE_DIR}/src/core/test/data)
# Platform check
#
IF (APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
SET (MACOSX 1)
MESSAGE(STATUS "MACOSX detected")
ELSEIF (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
SET (LINUX 1)
ENDIF (APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# If gcc is installed add -wall and -pedantic to the commandline
#
IF (CMAKE_COMPILER_IS_GNUCC)
IF ( ${CMAKE_BUILD_TYPE} MATCHES "Debug" )
ADD_DEFINITIONS(-Wall -pedantic -Wno-long-long -Wno-variadic-macros)
#ADD_DEFINITIONS(-Wall -Wno-long-long -Wno-variadic-macros)
ELSE ( ${CMAKE_BUILD_TYPE} MATCHES "Debug" )
ADD_DEFINITIONS(-Wall)
ENDIF ( ${CMAKE_BUILD_TYPE} MATCHES "Debug" )
ENDIF (CMAKE_COMPILER_IS_GNUCC)
# Set the platform specific suffix for dynamic libraries
ADD_DEFINITIONS(
-DSHARED_LIBRARY_SUFFIX="\\"${CMAKE_SHARED_LIBRARY_SUFFIX}\\""
-DSHARED_MODULE_SUFFIX="\\"${CMAKE_SHARED_MODULE_SUFFIX}\\""
)
# Helper for Eclipse CDT
#
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-D_REENTRANT)
SUBDIRS(src doc)