This repository has been archived by the owner on Apr 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
126 lines (105 loc) · 3.49 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
## CMake file for RaspberryPi and S2E integration
cmake_minimum_required(VERSION 3.13)
project(C2A)
# options
# SCI COM for connection to WINGS TMTC IF
# !!!注意!!!
# これをONにした状態で,SCIの受け口がない場合(TMTC IFが動いてない状態)
# そちらのバッファが詰まってSILSの動作が止まることがあるので注意すること!
option(USE_SCI_COM_WINGS "Use SCI_COM_WINGS" ON)
# SCI COM for connection to PC UART
# !!!注意!!!
# これをONにした状態で,SCIの受け口がない場合(受けてのTeratermが起動していない状態)
# そちらのバッファが詰まってSILSの動作が止まることがあるので注意すること!
option(USE_SCI_COM_UART "Use SCI_COM_UART" OFF)
option(BUILD_C2A_AS_SILS_FW "Build C2A as SILS firmware" ON)
set(USE_ALL_C2A_CORE_APPS OFF)
set(USE_32BIT_COMPILER ON)
if(BUILD_C2A_AS_CXX)
message("build C2A as C++!")
endif()
set(C2A_CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/src_core)
set(C2A_USER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/src_user)
include_directories(src)
# Output debug print to SILS console window
option(SHOW_DEBUG_PRINT_ON_SILS "Show debug print")
set(SHOW_DEBUG_PRINT_ON_SILS ON)
if(SHOW_DEBUG_PRINT_ON_SILS)
add_definitions(-DSHOW_DEBUG_PRINT_ON_SILS)
message("Show debug print")
endif()
add_subdirectory(${C2A_CORE_DIR})
add_subdirectory(${C2A_USER_DIR}/Applications)
add_subdirectory(${C2A_USER_DIR}/Drivers)
add_subdirectory(${C2A_USER_DIR}/IfWrapper)
add_subdirectory(${C2A_USER_DIR}/Library)
add_subdirectory(${C2A_USER_DIR}/Settings)
add_subdirectory(${C2A_USER_DIR}/TlmCmd)
set(C2A_SRCS
${C2A_USER_DIR}/c2a_main.c
${C2A_CORE_DIR}/System/AnomalyLogger/anomaly_logger.c
)
if(BUILD_C2A_AS_CXX)
message("Build as C++!!!")
set_source_files_properties(${C2A_SRCS} PROPERTIES LANGUAGE CXX) # C++
endif()
if(USE_C2A)
add_library(${PROJECT_NAME} STATIC ${C2A_SRCS})
else()
add_executable(${PROJECT_NAME} ${C2A_SRCS})
endif()
set(C2A_USER_MODULES
C2A_USER_APPS
C2A_USER_CMD_TLM
C2A_USER_DRIVERS
C2A_USER_IF_WRAPPER
C2A_USER_LIB
C2A_USER_SETTINGS
)
# for compile core applicatons
set(C2A_APPS
${C2A_CORE_DIR}/Applications/anomaly_handler.c
${C2A_CORE_DIR}/Applications/divided_cmd_utility.c
${C2A_CORE_DIR}/Applications/gs_command_dispatcher.c
${C2A_CORE_DIR}/Applications/event_utility.c
${C2A_CORE_DIR}/Applications/memory_dump.c
${C2A_CORE_DIR}/Applications/nop.c
${C2A_CORE_DIR}/Applications/realtime_command_dispatcher.c
${C2A_CORE_DIR}/Applications/timeline_command_dispatcher.c
${C2A_CORE_DIR}/Applications/utility_counter.c
${C2A_CORE_DIR}/Applications/telemetry_manager.c
)
add_library(C2A_CORE_APPS_MODULE OBJECT ${C2A_APPS})
if(BUILD_C2A_AS_CXX)
set_source_files_properties(${C2A_APPS} PROPERTIES LANGUAGE CXX) # C++
endif()
if(MSVC)
target_link_options(${PROJECT_NAME} PRIVATE "/WHOLEARCHIVE")
target_link_libraries(${PROJECT_NAME} PRIVATE
C2A_CORE_APPS_MODULE
C2A_CORE
${C2A_USER_MODULES}
)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE
-Wl,--whole-archive
C2A_CORE_APPS_MODULE
C2A_CORE
-Wl,--no-whole-archive
pthread
${C2A_USER_MODULES}
-lm
)
endif()
if(WIN32)
add_custom_command(TARGET ${PROJECT_NAME}
PRE_BUILD
COMMAND git_revision.bat
WORKING_DIRECTORY ${C2A_USER_DIR}/Script)
else()
add_custom_command(TARGET ${PROJECT_NAME}
PRE_BUILD
COMMAND ./git_revision.sh
WORKING_DIRECTORY ${C2A_USER_DIR}/Script)
endif()
include(${C2A_USER_DIR}/common.cmake)