forked from libhal-google/libhal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
95 lines (84 loc) · 3.41 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
cmake_minimum_required(VERSION 3.1...3.21)
set(CMAKE_C_COMPILER "gcc-11")
set(CMAKE_CXX_COMPILER "g++-11")
project(libembeddedhal VERSION 0.0.1 LANGUAGES CXX)
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE include
include/${PROJECT_NAME}/internal/third_party/units/core/include/
include/${PROJECT_NAME}/internal/third_party/units/systems/isq/include
include/${PROJECT_NAME}/internal/third_party/units/systems/isq-iec80000/include
include/${PROJECT_NAME}/internal/third_party/units/systems/isq-natural/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si-cgs/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si-fps/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si-hep/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si-iau/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si-imperial/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si-international/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si-typographic/include
include/${PROJECT_NAME}/internal/third_party/units/systems/si-uscs/include)
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_20)
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include)
find_package(ut)
find_package(libembeddedhal)
find_package(gsl-lite)
set(TEST_NAME unit_test)
set(CMAKE_BUILD_TYPE Debug)
add_executable(${TEST_NAME}
tests/accelerometer/interface.test.cpp
tests/can/interface.test.cpp
tests/can/interface.test.cpp
tests/pwm/interface.test.cpp
tests/timer/interface.test.cpp
tests/i2c/interface.test.cpp
tests/compass/interface.test.cpp
tests/gyroscope/interface.test.cpp
tests/spi/interface.test.cpp
tests/adc/interface.test.cpp
tests/rtc/interface.test.cpp
tests/temperature/interface.test.cpp
tests/pixel_display/interface.test.cpp
tests/text_display/interface.test.cpp
tests/dac/interface.test.cpp
tests/counter/interface.test.cpp
tests/counter/interface.test.cpp
tests/input_pin/interface.test.cpp
tests/interrupt_pin/interface.test.cpp
tests/output_pin/interface.test.cpp
tests/serial/interface.test.cpp
tests/i2c/util.test.cpp
tests/spi/util.test.cpp
tests/counter/util.test.cpp
tests/serial/util.test.cpp
tests/motor/mock.test.cpp
tests/pwm/mock.test.cpp
tests/timer/mock.test.cpp
tests/spi/mock.test.cpp
tests/dac/mock.test.cpp
tests/adc/mock.test.cpp
tests/static_memory_resource.test.cpp
tests/frequency.test.cpp
tests/enum.test.cpp
tests/percent.test.cpp
tests/timeout.test.cpp
tests/static_callable.test.cpp
tests/testing.test.cpp
tests/main.test.cpp
tests/overflow_counter.test.cpp
tests/units.test.cpp)
enable_testing()
add_test(NAME ${TEST_NAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${TEST_NAME})
target_include_directories(${TEST_NAME} PUBLIC tests)
target_compile_options(${TEST_NAME} PRIVATE -Werror -Wall -Wextra
-Wno-unused-function -Wconversion)
set_target_properties(${TEST_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden)
target_compile_features(${TEST_NAME} PRIVATE cxx_std_20)
set_target_properties(${TEST_NAME} PROPERTIES CXX_EXTENSIONS OFF)
target_link_libraries(${TEST_NAME} PRIVATE ${PROJECT_NAME}
boost::ut gsl::gsl-lite)