-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (43 loc) · 1.38 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
cmake_minimum_required(VERSION 3.26)
project(b3d_visualisation
VERSION 0.1
LANGUAGES CXX C CUDA
)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
function(add_b3d_renderer)
set(options)
set(oneValueArgs NAME)
set(multiValueArgs SOURCES HEADERS LIBRARIES SHARED_LIBRARIES)
cmake_parse_arguments(TARGET "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT TARGET_NAME)
message(FATAL_ERROR "NAME must be defined")
endif()
set(MODULE_NAME ${TARGET_NAME})
set(SRC ${TARGET_SOURCES})
#TODO: Move static/dynamic to optianal parameter
add_library(${MODULE_NAME} STATIC ${SRC} ${HEADERS})
target_compile_features(${MODULE_NAME} PUBLIC cxx_std_20)
if(MSVC)
set(MSVC_CXX_COMPILER_FLAGS "/Zc:__cplusplus")
target_compile_options(${MODULE_NAME} PUBLIC $<$<COMPILE_LANGUAGE:CXX>:${MSVC_CXX_COMPILER_FLAGS}>)
endif()
target_include_directories(${MODULE_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${MODULE_NAME}
PRIVATE
B3D::Renderer::Library
"${TARGET_LIBRARIES}"
)
set_target_properties(${MODULE_NAME}
PROPERTIES
CUDA_STANDARD 20
FOLDER "Renderer"
)
add_library(B3D::Renderer::${MODULE_NAME} ALIAS ${MODULE_NAME})
endfunction()
add_subdirectory(${PROJECT_SOURCE_DIR}/thirdParty)
add_subdirectory(renderer)
add_subdirectory(viewer)
add_subdirectory(tools)
if(INCLUDE_UNITY_CUDA_INTEROP)
add_subdirectory(unityCUDAInterop)
endif()