-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
74 lines (56 loc) · 2.13 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
64
65
66
67
68
69
70
71
72
73
74
cmake_minimum_required(VERSION 3.24)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(PREVIEW_STANDALONE On)
endif()
option(CMAKE_COMPILE_WARNINGS_AS_ERROR "Enable warnings-as-error" On)
option(PREVIEW_BUILD_TESTS "Enable building the tests" Off)
option(PREVIEW_BUILD_EXAMPLES "Enable building the examples" Off)
option(PREVIEW_INCLUDE_SDL "Include SDL support" Off)
if (PREVIEW_BUILD_TESTS)
# CTest cannot be included before the first project() statement, but Embedded Infastructure
# Library needs to see that test utilities need to be built.
set(BUILD_TESTING On)
endif()
if (PREVIEW_STANDALONE)
include(FetchContent)
FetchContent_Declare(
emil
GIT_REPOSITORY https://github.com/philips-software/amp-embedded-infra-lib
GIT_TAG 798ec3da653f955a1eb218279fa93f52f15fcfbf # unreleased
)
FetchContent_MakeAvailable(emil)
if (TARGET_MCU_VENDOR STREQUAL st)
FetchContent_Declare(
halst
GIT_REPOSITORY https://github.com/philips-software/amp-hal-st
GIT_TAG 5f2a467b1ebc215251219d6457023ffa307d5042 # unreleased
)
FetchContent_MakeAvailable(halst)
endif()
endif()
project(preview LANGUAGES C CXX VERSION 1.1.0) # x-release-please-version
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED On)
set_directory_properties(PROPERTY USE_FOLDERS On)
# When building amp-preview by itself do not exclude any targets from all
# Libraries will only be excluded from all when amp-preview is a consumed as a dependency.
if (PREVIEW_STANDALONE)
set(PREVIEW_EXCLUDE_FROM_ALL "")
else()
set(PREVIEW_EXCLUDE_FROM_ALL "EXCLUDE_FROM_ALL")
endif()
if (PREVIEW_BUILD_TESTS)
include(CTest)
emil_enable_testing()
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Suppress warnings about parameter passing for argument of type '...' changed in GCC 7.1
add_compile_options(-Wno-psabi)
endif()
emil_exclude_directory_from_clang_format(.)
add_subdirectory(preview)
add_subdirectory(examples)
emil_clangformat_directories(preview DIRECTORIES .)
if (PREVIEW_STANDALONE)
emil_folderize_all_targets()
endif()