-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (61 loc) · 2.32 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
cmake_minimum_required(VERSION 3.26)
# cmake -G "MinGW Makefiles" ..
# cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
# or cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
project(GaussianUtils)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g") # Debug 模式下的标志
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") # Release 模式下的标志 -march=native 针对特定CPU优化
file(GLOB_RECURSE KERNELS_SOURCE_FILE
"src/kernels/*.cpp"
)
file(GLOB_RECURSE GPRS_SOURCE_FILE
"src/gprs/*.cpp"
)
file(GLOB_RECURSE MATH_SOURCE_FILE
"src/gpr_math/*.cpp"
)
file(GLOB_RECURSE UTILES_SOURCE_FILE
"src/utils/*.cpp"
)
# list(REMOVE_ITEM UTILS_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
# find_package(OpenMP)
# if(OpenMP_CXX_FOUND)
# # 使用 OpenMP
# message("Find OpenMP")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
# endif()
find_package(Eigen3 REQUIRED)
# add_definitions(-DEIGEN_USE_MKL_ALL)
add_library(KernelsLibrary
${KERNELS_SOURCE_FILE}
)
add_library(MathLibrary
${MATH_SOURCE_FILE}
)
add_library(UtilsLibrary
${UTILES_SOURCE_FILE}
)
add_library(GPRLibrary
${GPRS_SOURCE_FILE}
)
message("Eigen3_INCLUDE_DIRS: ${Eigen3_INCLUDE_DIRS}") # It is werid that this one return nothing, while eigen is founded (only in lab pc)
target_include_directories(KernelsLibrary PUBLIC include)
target_include_directories(UtilsLibrary PUBLIC include)
target_include_directories(GPRLibrary PUBLIC include)
target_include_directories(MathLibrary PUBLIC include)
# You have to use this in this pc (lab pc), while my own pc can skip this line by using
#
target_link_libraries (MathLibrary Eigen3::Eigen)
target_link_libraries (UtilsLibrary Eigen3::Eigen)
target_link_libraries (KernelsLibrary MathLibrary)
target_link_libraries (GPRLibrary KernelsLibrary UtilsLibrary)
add_executable(kernel_test src/kernel_test.cpp)
target_link_libraries(kernel_test GPRLibrary)
add_executable(gpr_test src/gpr_test.cpp)
target_link_libraries(gpr_test GPRLibrary)
add_executable(gpr_window_test src/gpr_window_test.cpp)
target_link_libraries(gpr_window_test GPRLibrary)