-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
64 lines (55 loc) · 2.15 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
cmake_minimum_required(VERSION 3.15)
# Set the toolchain file before the project is declared
if(${CMAKE_BUILD_TYPE} MATCHES OBC)
# Download the toolchain if it doesn't exist
if(NOT EXISTS ${CMAKE_BINARY_DIR}/toolchain)
include(${CMAKE_SOURCE_DIR}/cmake/download_arm_toolchain.cmake)
endif()
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_arm_none_eabi.cmake)
elseif(${CMAKE_BUILD_TYPE} MATCHES GS)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_ground_station_gcc.cmake)
elseif(${CMAKE_BUILD_TYPE} MATCHES HIL)
include(${CMAKE_SOURCE_DIR}/cmake/fetch_googletest.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_hil_gcc.cmake)
elseif(${CMAKE_BUILD_TYPE} MATCHES Test)
include(${CMAKE_SOURCE_DIR}/cmake/fetch_googletest.cmake)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_linux_gcc.cmake)
elseif(${CMAKE_BUILD_TYPE} MATCHES Examples)
if(NOT EXISTS ${CMAKE_BINARY_DIR}/toolchain)
include(${CMAKE_SOURCE_DIR}/cmake/download_arm_toolchain.cmake)
endif()
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchain_arm_none_eabi.cmake)
else()
message(FATAL_ERROR "Invalid build type: ${CMAKE_BUILD_TYPE}")
endif()
project(OrbitalSw)
if(${CMAKE_BUILD_TYPE} MATCHES OBC)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
enable_language(C ASM)
add_subdirectory(obc)
endif()
if(${CMAKE_BUILD_TYPE} MATCHES GS)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
enable_language(C CXX)
add_subdirectory(gs)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/cserialport)
endif()
if(${CMAKE_BUILD_TYPE} MATCHES HIL)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
enable_language(C CXX)
add_subdirectory(hil)
endif()
if(${CMAKE_BUILD_TYPE} MATCHES Test)
enable_language(C CXX)
enable_testing()
add_subdirectory(test)
endif()
if (${CMAKE_BUILD_TYPE} MATCHES Examples)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
enable_language (C ASM)
add_subdirectory (obc)
endif()
# Build tiny-aes and lib-correct libs
add_subdirectory(libs)
# Build interface libs
add_subdirectory(interfaces)