-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
executable file
·66 lines (52 loc) · 2.85 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
cmake_minimum_required(VERSION 3.10)
project(forward-virieux)
message("PYBIND_INCLUDES=${PYBIND_INCLUDES}")
message("PYTHON_INCLUDES=${PYTHON_INCLUDES}")
message("SUFFIX=${SUFFIX}")
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-undefined dynamic_lookup")
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
# Create test executables
add_executable(test_file_constructor tests/test_file_constructor.cpp src/fdModel.cpp src/contiguous_arrays.cpp src/contiguous_arrays.h src/fdModel.h)
add_executable(test_variable_constructor tests/test_variable_constructor.cpp src/fdModel.cpp src/contiguous_arrays.cpp src/contiguous_arrays.h src/fdModel.h)
add_executable(test_constructor_comparison tests/test_constructor_comparison.cpp src/fdModel.cpp src/contiguous_arrays.cpp src/contiguous_arrays.h src/fdModel.h)
add_executable(test_copy_constructor tests/test_copy_constructor.cpp src/fdModel.cpp src/contiguous_arrays.cpp src/contiguous_arrays.h src/fdModel.h)
# Create the python extension
add_library(psvWave_cpp SHARED src/psvWave.cpp src/fdModel.cpp src/contiguous_arrays.cpp src/contiguous_arrays.h src/fdModel.h)
# Include the appropriate compile time dependencies
include_directories(ext/eigen)
include_directories(ext/inih)
# Make the extension position independent
set_property(TARGET psvWave_cpp PROPERTY POSITION_INDEPENDENT_CODE ON)
set_target_properties(psvWave_cpp PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
IF(DEFINED PYTHON_INCLUDES)
MESSAGE(STATUS "Using passed PYTHON_INCLUDES: ${PYTHON_INCLUDES}")
target_include_directories(psvWave_cpp PRIVATE ${PYTHON_INCLUDES})
ELSE()
MESSAGE(STATUS "Loaded PYTHON_INCLUDES from environment variable: $ENV{PYTHON_INCLUDES}")
target_include_directories(psvWave_cpp PRIVATE $ENV{PYTHON_INCLUDES})
ENDIF()
IF(DEFINED PYBIND_INCLUDES)
MESSAGE(STATUS "Using passed PYBIND_INCLUDES: ${PYBIND_INCLUDES}")
target_include_directories(psvWave_cpp PRIVATE ${PYBIND_INCLUDES})
ELSE()
MESSAGE(STATUS "Loaded PYBIND_INCLUDES from environment variable: $ENV{PYBIND_INCLUDES}")
target_include_directories(psvWave_cpp PRIVATE $ENV{PYBIND_INCLUDES})
ENDIF()
IF(DEFINED SUFFIX)
MESSAGE(STATUS "Using passed SUFFIX: ${SUFFIX}")
set_target_properties(psvWave_cpp PROPERTIES SUFFIX "${SUFFIX}")
ELSE()
MESSAGE(STATUS "Loaded SUFFIX from environment variable: $ENV{SUFFIX}")
set_target_properties(psvWave_cpp PROPERTIES SUFFIX "$ENV{SUFFIX}")
ENDIF()
set_target_properties(psvWave_cpp PROPERTIES PREFIX "")
set_target_properties(psvWave_cpp PROPERTIES OUTPUT_NAME "__psvWave_cpp")
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")