-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
48 lines (41 loc) · 1.61 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
cmake_minimum_required(VERSION 3.15)
project(chowdsp_wdf VERSION 1.0.0 LANGUAGES C CXX)
include(cmake/CXXStandard.cmake)
message(STATUS "Configuring ${PROJECT_NAME} library...")
add_library(${PROJECT_NAME} INTERFACE)
add_library(chowdsp::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
if(MSVC)
target_compile_definitions(${PROJECT_NAME}
INTERFACE
_USE_MATH_DEFINES=1 # So that we can have M_PI on MSVC
)
endif()
# Check if this is the top-level project
get_directory_property(parent_dir PARENT_DIRECTORY)
if ("${parent_dir}" STREQUAL "")
set(is_toplevel 1)
else ()
set(is_toplevel 0)
endif ()
# if we are the top-level project, then configure the project tests and benchmarks
option(CHOWDSP_WDF_BUILD_TESTS "Add targets for building and running chowdsp_wdf tests" ${is_toplevel})
option(CHOWDSP_WDF_BUILD_BENCHMARKS "Add targets for building and running chowdsp_wdf benchmarks" ${is_toplevel})
set(CHOWDSP_WDF_TEST_WITH_XSIMD_VERSION "" CACHE STRING "Tests chowdsp_wdf with XSIMD version")
if(NOT ("${CHOWDSP_WDF_TEST_WITH_XSIMD_VERSION}" STREQUAL ""))
include(cmake/CPM.cmake)
message(STATUS "Importing XSIMD version ${CHOWDSP_WDF_TEST_WITH_XSIMD_VERSION} with CPM")
CPMAddPackage(
NAME xsimd
GITHUB_REPOSITORY xtensor-stack/xsimd
GIT_TAG ${CHOWDSP_WDF_TEST_WITH_XSIMD_VERSION}
)
endif()
if (CHOWDSP_WDF_BUILD_TESTS)
include(cmake/CPM.cmake)
add_subdirectory(tests)
endif()
if (CHOWDSP_WDF_BUILD_BENCHMARKS)
include(cmake/CPM.cmake)
add_subdirectory(bench)
endif()