-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
68 lines (54 loc) · 2.29 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
cmake_minimum_required(VERSION 3.10)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}")
project(voxsol_lib CXX CUDA)
set(CMAKE_BINARY_DIR ${PROJECT_BINARY_DIR})
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
set(CMAKE_USE_RELATIVE_PATHS FALSE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(SOLVER_COMPUTE_CAPABILITY "60" CACHE STRING "The CUDA compute capability that the GPU kernels should be compiled for.")
include(CommonFlags)
include(GetSourceFiles)
include(Cpp11)
include(FindPackageHandleStandardArgs)
include(FindSolverDependencies)
include(PrecompiledHeaders)
SwitchOnCpp11()
if (MSVC)
#Compile in static mode to link with gtest dependency
string(APPEND CMAKE_CXX_FLAGS_DEBUG " /MTd")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /MT")
string(APPEND CMAKE_CXX_FLAGS_RELEASE " /MT")
# enable CUDA memory tracking and debug code
set(CMAKE_CUDA_FLAGS " -Xptxas=-v -Xptxas -dlcm=ca -gencode arch=compute_${SOLVER_COMPUTE_CAPABILITY},code=sm_${SOLVER_COMPUTE_CAPABILITY} -res-usage")
set(CMAKE_CUDA_FLAGS_DEBUG -Xcompiler="-MTd -Zi -Ob0 -Od /RTC1")
string(APPEND CMAKE_CUDA_FLAGS_DEBUG " -G ")
set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO -Xcompiler="-MT -Zi -Ob0 -Od /RTC1")
string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO " -G ")
string(APPEND CMAKE_CUDA_FLAGS_RELEASE " -Xcompiler=-MT -lineinfo")
endif(MSVC)
set(SOLVER_DOUBLE_PRECISION FALSE CACHE BOOL "Compile with double precision rather than single precision.")
# find all directories containing source files
set(FILE_TYPES *.c *.cc *.cu *.cuh *.cpp *.h *.hpp *.tcc)
find_directories(DIRS src "${FILE_TYPES}")
# generate source tree
generate_source_tree(HOST_SOURCES "${DIRS}" "${FILE_TYPES}")
set(STOMECH_SOLVER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
add_subdirectory(test)
include_directories(${LIBMMV_INCLUDE_DIR}
${STOMECH_SOLVER_INCLUDE_DIR}
)
add_library(${PROJECT_NAME}
${HOST_SOURCES}
)
target_link_libraries(${PROJECT_NAME}
${LIBMMV_BOTH_LIBRARIES}
)
IF (SOLVER_DOUBLE_PRECISION)
add_definitions(-DUSE_DOUBLE_PRECISION)
ELSE()
remove_definitions(-DUSE_DOUBLE_PRECISION)
ENDIF()
# precompiled headers
add_precompiled_header(${PROJECT_NAME} stdafx.h)
add_subdirectory(frontend)