forked from aestream/aestream
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
38 lines (30 loc) · 1.04 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
cmake_minimum_required(VERSION 3.20)
project(aestream)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
option(USE_TORCH "Build with Torch" OFF)
option(USE_PYTHON "Buid Python lib" OFF)
# set coroutine flags for clang appropriately
# thanks to https://stackoverflow.com/questions/64703866/is-clang-11s-invocation-of-coroutine-headers-via-fcoroutines-flag
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(GCC_COVERAGE_COMPILE_FLAGS "-fcoroutines-ts")
add_compile_definitions(USE_CLANG)
message(STATUS "detected clang, set -ts flag")
else()
set(GCC_COVERAGE_COMPILE_FLAGS "-fcoroutines")
endif()
set(default_build_type Release)
add_definitions(${GCC_COVERAGE_COMPILE_FLAGS})
# Add includes
include_directories("include/")
include(include/CPM.cmake)
# Add tests
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(USE_TORCH ON)
add_subdirectory("test")
else()
set(GCC_COVERAGE_COMPILE_FLAGS ${GCC_COVERAGE_COMPILE_FLAGS} "-03")
endif()
# Add sources
add_subdirectory("src")