-
Notifications
You must be signed in to change notification settings - Fork 41
/
CMakeLists.txt.in
53 lines (42 loc) · 1.97 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
51
52
# this file is meant to be parsed by python before being a proper CMakeLists.txt file
# in particular, the following strings will be set to their proper values by python when
# making CMakeLists.txt
set(numpy_include __NUMPY_INCLUDE__)
set(PYTHON_INCLUDE_DIRS __PYTHON_INCLUDE__)
set(PYTHON_LDFLAGS "__PYTHON_LDFLAGS__")
#find_package(PythonLibs)
#message("PYTHON_LIBRARIES ${PYTHON_LIBRARIES}")
#message("PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}")
# 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}")
include_directories(${numpy_include})
include_directories(${PYTHON_INCLUDE_DIRS})
# 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 pele include directory
set(pele_include ${CMAKE_CURRENT_SOURCE_DIR}/source)
message("pele include directory: ${pele_include}")
# build the pele library
include_directories(${pele_include})
FILE(GLOB pele_sources ${pele_include}/*.cpp)
add_library(pele_lib SHARED ${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} pele_lib)
set_target_properties(${library_name} PROPERTIES PREFIX "")
message("making library ${library_name} from source ${cython_cxx_source}")
endfunction(make_cython_lib)