-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
63 lines (52 loc) · 1.77 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
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
include(CheckLanguage)
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
project(baylib)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_MODULE_PATH cmake_module)
# change this option to compile the examples
option(BUILD_EXAMPLES "Build the examples showing how to use baylib" OFF)
# change this option to compile tests
option(BUILD_TESTS "Build tests for baylib" OFF)
#CUDA
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
message(STATUS "Found CUDA installed on your system. Enabling CUDA support for baylib.")
enable_language(CUDA)
add_compile_definitions(BAYLIB_CUDA)
set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_ARCHITECTURES OFF)
else()
message(STATUS "CUDA was not found on your system. Baylib will not use CUDA.")
endif()
#openCL
if(NOT TARGET OpenCL::OpenCL)
set(CMAKE_PREFIX_PATH "${OPENCL_ROOT}")
find_package(OpenCL)
if(OpenCL_FOUND)
message(STATUS "Found OpenCL installed on your system. Enabling OpenCL support for baylib.")
set(BAYLIB_OPENCL ON)
add_compile_definitions(BAYLIB_OPENCL)
set_target_properties(OpenCL::OpenCL PROPERTIES INTERFACE_COMPILE_DEFINITIONS CL_TARGET_OPENCL_VERSION=220)
add_compile_definitions(BAYLIB_OPENCL)
else()
message(STATUS "OpenCL was not found on your system. Baylib will not use OpenCL.")
set(BAYLIB_OPENCL OFF)
endif()
endif()
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
add_subdirectory(baylib)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
unset (BUILD_TESTS CACHE)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
unset (BUILD_EXAMPLES CACHE)