forked from xmos/lib_xcore_math
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (32 loc) · 1.21 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
cmake_minimum_required(VERSION 3.11)
## Disable in-source build.
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source build is not allowed! Please specify a build folder.\n\tex:cmake -B build")
endif()
project(xmos-lib_xs3_math)
## Set up the build options
include(etc/build_options.cmake)
## Fetch the Unity repo as a dependency
include(etc/fetch_unity.cmake)
find_package( Python3 COMPONENTS Interpreter )
## Compile flags for C/C++ for all libs and apps (for all platforms)
list(APPEND COMPILE_FLAGS -Os -g -MMD )
list(APPEND COMPILE_FLAGS -Wno-format )
## Platform-specific C/C++ compile flags
list(APPEND COMPILE_FLAGS_XCORE -march=xs3a )
list(APPEND COMPILE_FLAGS_Linux -DUSE_REF=1 )
list(APPEND COMPILE_FLAGS ${COMPILE_FLAGS_${CMAKE_SYSTEM_NAME}} )
## CMake configuration stuff
enable_language( C CXX ASM )
set( CMAKE_CXX_STANDARD 11 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )
add_compile_options( ${COMPILE_FLAGS} )
## Add libs and apps
add_subdirectory( lib_xs3_math )
if ( ${BUILD_TESTS} )
add_subdirectory( test )
endif()
if ( ${BUILD_EXAMPLES} )
add_subdirectory( example )
endif()