-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt.in
52 lines (42 loc) · 1.98 KB
/
CMakeLists.txt.in
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
# this file is mean to be parsed by python before being a proper CMakeLists.txt file
# in particular, the following strings will be set by python
set(numpy_include __NUMPY_INCLUDE__)
set(PYTHON_INCLUDE_DIRS __PYTHON_INCLUDE__)
set(PYTHON_LDFLAGS "__PYTHON_LDFLAGS__")
set(pele_include __PELE_INCLUDE__)
# osx makes the suffix for shared object libraries .dylib
IF(APPLE)
SET(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
ENDIF(APPLE)
message("python include dirs: ${PYTHON_INCLUDE_DIRS}")
message("python ldflags: ${PYTHON_LDFLAGS}")
message("numpy include dirs: ${numpy_include}")
message("pele include dirs: ${pele_include}")
include_directories(${numpy_include})
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${pele_include})
# note: We set CMAKE_SHARED_LINKER_FLAGS because I couldn't get it to work using
# target_link_librarires(). CMake kept interpreting the flag CoreFoundation
# as a library and appending -l to it and the compiler would complain
unset(CMAKE_SHARED_LINKER_FLAGS CACHE)
set(CMAKE_SHARED_LINKER_FLAGS ${PYTHON_LDFLAGS} CACHE type string)
cmake_minimum_required(VERSION 2.8)
enable_language(CXX)
SET(CMAKE_CXX_FLAGS __COMPILER_EXTRA_ARGS__)
#cmake_policy(SET CMP0015 NEW)
# set the mcpele include directory
set(mcpele_include ${CMAKE_SOURCE_DIR}/source)
include_directories(${mcpele_include})
message("mcpele include directory: ${mcpele_include}")
# build the mcpele library
FILE(GLOB pele_sources ${pele_include}/*.cpp)
FILE(GLOB mcpele_sources ${mcpele_include}/*.cpp)
add_library(mcpele_lib SHARED ${mcpele_sources} ${pele_sources})
function(make_cython_lib cython_cxx_source)
get_filename_component(library_name ${cython_cxx_source} NAME)
string(REGEX REPLACE ".cxx$" "" library_name ${library_name})
add_library(${library_name} SHARED ${cython_cxx_source})
target_link_libraries(${library_name} mcpele_lib)
set_target_properties(${library_name} PROPERTIES PREFIX "")
message("making library ${library_name} from source ${cython_cxx_source}")
endfunction(make_cython_lib)