Skip to content

Commit

Permalink
Merge pull request #132 from arkedge/feature/refactor-user-cmake-option
Browse files Browse the repository at this point in the history
Refactor user cmake option
  • Loading branch information
sksat authored Oct 12, 2023
2 parents de027bd + 1a54a0e commit 4220e56
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
15 changes: 7 additions & 8 deletions examples/mobc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ project(C2A)
# !!!注意!!!
# これをONにした状態で,SCIの受け口がない場合(TMTC IFが動いてない状態)
# そちらのバッファが詰まってSILSの動作が止まることがあるので注意すること!
option(USE_SCI_COM_WINGS "Use SCI_COM_WINGS" ON)
option(C2A_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(C2A_USE_SCI_COM_UART "Use SCI_COM_UART" OFF)

option(USE_SILS_MOCKUP "Use SILS mockup for build C2A with minimal user in C89 only" OFF)
option(C2A_BUILD_WITH_SILS_MOCKUP "Build C2A with SILS mockup for check undefined symbols by build minimal C2A user executable(C89 only)" OFF)

option(C2A_BUILD_FOR_SILS "Build C2A for SILS target" ON)

if(USE_SILS_MOCKUP)
if(C2A_BUILD_WITH_SILS_MOCKUP)
set(C2A_BUILD_AS_CXX OFF)
endif()

Expand All @@ -34,9 +34,8 @@ 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)
option(C2A_SHOW_DEBUG_PRINT_ON_SILS "Show debug print" ON)
if(C2A_SHOW_DEBUG_PRINT_ON_SILS)
add_definitions(-DSHOW_DEBUG_PRINT_ON_SILS)
message("Show debug print")
endif()
Expand Down Expand Up @@ -74,7 +73,7 @@ if(C2A_BUILD_AS_CXX)
set_source_files_properties(${C2A_SRCS} PROPERTIES LANGUAGE CXX) # C++
endif()

if(USE_SILS_MOCKUP)
if(C2A_BUILD_WITH_SILS_MOCKUP)
add_definitions(-DDEFINE_MAIN_ON_SILS)
add_executable(${PROJECT_NAME} ${C2A_SRCS})
else()
Expand Down
2 changes: 1 addition & 1 deletion examples/mobc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
.define("C2A_BUILD_FOR_32BIT", "OFF")
.define("C2A_BUILD_AS_C99", "ON")
.define("C2A_BUILD_FOR_SILS", "ON")
.define("USE_SCI_COM_WINGS", "OFF")
.define("C2A_USE_SCI_COM_WINGS", "OFF")
.build_target("C2A");

println!("cargo:rerun-if-changed=./src/src_core");
Expand Down
6 changes: 3 additions & 3 deletions examples/mobc/src/src_user/hal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(C2A_COMMON_SRCS
)

# 通常,S2EではC++ビルドされるが,C2A core開発のため,C2A単体をC89でライブラリビルドする場合は,mockupをビルド対象にする
if(USE_SILS_MOCKUP)
if(C2A_BUILD_WITH_SILS_MOCKUP)
message("USE SILS_MOCKUP")

#target_sources(${PROJECT_NAME} PRIVATE
Expand All @@ -26,7 +26,7 @@ else()
sils/wdt_sils.cpp
)

if(USE_SCI_COM_WINGS)
if(C2A_USE_SCI_COM_WINGS)
add_definitions(-DUSE_SCI_COM_WINGS)
#target_sources(${PROJECT_NAME} PUBLIC
set(C2A_HAL_COM_WINGS_SRCS
Expand All @@ -35,7 +35,7 @@ else()
message("USE SCI_COM_WINGS")
endif()

if(USE_SCI_COM_UART)
if(C2A_USE_SCI_COM_UART)
add_definitions(-DUSE_SCI_COM_UART)
#target_sources(${PROJECT_NAME} PUBLIC
set(C2A_HAL_COM_UART_SRCS
Expand Down
13 changes: 6 additions & 7 deletions examples/subobc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ project(C2A)
# !!!注意!!!
# これをONにした状態で,SCIの受け口がない場合(TMTC IFが動いてない状態)
# そちらのバッファが詰まってSILSの動作が止まることがあるので注意すること!
option(USE_SCI_COM_WINGS "Use SCI_COM_WINGS" ON)
option(C2A_USE_SCI_COM_WINGS "Use SCI_COM_WINGS" ON)

option(USE_SILS_MOCKUP "Use SILS mockup for build C2A with minimal user in C89 only" OFF)
option(C2A_BUILD_WITH_SILS_MOCKUP "Build C2A with SILS mockup for check undefined symbols by build minimal C2A user executable(C89 only)" OFF)

option(C2A_BUILD_FOR_SILS "Build C2A for SILS target" ON)

# Core App のターゲット追加は src_user/applications/CMakeLists.txt で行う
set(C2A_USE_ALL_CORE_APPS OFF)
set(C2A_USE_ALL_CORE_TEST_APPS OFF)

if(USE_SILS_MOCKUP)
if(C2A_BUILD_WITH_SILS_MOCKUP)
set(C2A_BUILD_AS_CXX OFF)
endif()

Expand All @@ -32,9 +32,8 @@ 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)
option(C2A_SHOW_DEBUG_PRINT_ON_SILS "Show debug print" ON)
if(C2A_SHOW_DEBUG_PRINT_ON_SILS)
add_definitions(-DSHOW_DEBUG_PRINT_ON_SILS)
message("Show debug print")
endif()
Expand Down Expand Up @@ -72,7 +71,7 @@ if(C2A_BUILD_AS_CXX)
set_source_files_properties(${C2A_SRCS} PROPERTIES LANGUAGE CXX) # C++
endif()

if(USE_SILS_MOCKUP)
if(C2A_BUILD_WITH_SILS_MOCKUP)
add_definitions(-DDEFINE_MAIN_ON_SILS)
add_executable(${PROJECT_NAME} ${C2A_SRCS})
else()
Expand Down
2 changes: 1 addition & 1 deletion examples/subobc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
.define("C2A_BUILD_FOR_32BIT", "ON")
.define("C2A_BUILD_AS_C99", "ON")
.define("C2A_BUILD_FOR_SILS ", "ON")
.define("USE_SCI_COM_WINGS", "OFF")
.define("C2A_USE_SCI_COM_WINGS", "OFF")
.build_target("C2A");

println!("cargo:rerun-if-changed=./CMakeLists.txt");
Expand Down
4 changes: 2 additions & 2 deletions examples/subobc/src/src_user/hal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(C2A_COMMON_SRCS
)

# 通常,S2EではC++ビルドされるが,C2A core開発のため,C2A単体をC89でライブラリビルドする場合は,mockupをビルド対象にする
if(USE_SILS_MOCKUP)
if(C2A_BUILD_WITH_SILS_MOCKUP)
message("USE SILS_MOCKUP")

#target_sources(${PROJECT_NAME} PRIVATE
Expand All @@ -24,7 +24,7 @@ else()
sils/wdt_sils.cpp
)

if(USE_SCI_COM_WINGS) # TODO: これ USE_SCI_COM_UART では?
if(C2A_USE_SCI_COM_WINGS) # option 名が confusing だが,subobc の upstream(単体試験では WINGS と疎通するポート)は UART
add_definitions(-DUSE_SCI_COM_WINGS)
#target_sources(${PROJECT_NAME} PUBLIC
set(C2A_HAL_COM_UART_SRCS
Expand Down

0 comments on commit 4220e56

Please sign in to comment.