Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor example user IfWrapper CMake #532

Merged
merged 2 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions Examples/2nd_obc_user/src/src_user/IfWrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13)

project(C2A_USER_IF_WRAPPER)

set(C2A_SRCS
set(C2A_COMMON_SRCS
if_list.c
)

Expand All @@ -11,29 +11,39 @@ if(USE_SILS_MOCKUP)
message("USE SILS_MOCKUP")

#target_sources(${PROJECT_NAME} PRIVATE
list(APPEND C2A_SRCS
set(C2A_IF_IMPL_SRCS
SilsMockup/i2c_sils.c
SilsMockup/uart_sils.c
SilsMockup/wdt_sils.c
)
else()
#target_sources(${PROJECT_NAME} PUBLIC
list(APPEND C2A_SRCS
set(C2A_IF_IMPL_COMMON_SRCS
Sils/i2c_sils.cpp
Sils/uart_sils.cpp
Sils/wdt_sils.cpp
)
endif()

if(USE_SCI_COM_WINGS AND NOT USE_SILS_MOCKUP)
add_definitions(-DUSE_SCI_COM_WINGS)
#target_sources(${PROJECT_NAME} PUBLIC
list(APPEND C2A_SRCS
Sils/uart_sils_sci_if.cpp
if(USE_SCI_COM_WINGS) # TODO: これ USE_SCI_COM_UART では?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文脈次第かな.

MOBC - 2nd OBC を com0com でつなげてSILSするときはそうなんだけど,
2nd OBC を直接WINGSに指すときはこれでいい.(そのOBCに対して,ペリフェラルを操作するためのUARTではなく,upstream 側の UART なんだけど,命名がな...)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ちなみに,ここなおすなら Examples\2nd_obc_user\CMakeLists.txt の L11 も直さないとだめ

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは TODO comment に対する話?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L11 は指摘と現状の書き方の方が嘘で,これが正しい

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if 文のネストが深くなっていることに注意(GitHub の表示だとたしかにちょっとわかりにくいけど)

add_definitions(-DUSE_SCI_COM_WINGS)
#target_sources(${PROJECT_NAME} PUBLIC
set(C2A_IF_COM_UART_SRCS
Sils/uart_sils_sci_if.cpp
)
message("USE SCI_COM_UART")
endif()

set(C2A_IF_IMPL_SRCS
${C2A_IF_IMPL_COMMON_SRCS}
${C2A_IF_COM_UART_SRCS}
)
message("USE SCI_COM_UART")
endif()

set(C2A_SRCS
${C2A_COMMON_SRCS}
${C2A_IF_IMPL_SRCS}
)

if(BUILD_C2A_AS_CXX)
set_source_files_properties(${C2A_SRCS} PROPERTIES LANGUAGE CXX) # C++
endif()
Expand Down
47 changes: 29 additions & 18 deletions Examples/minimum_user/src/src_user/IfWrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13)

project(C2A_USER_IF_WRAPPER)

set(C2A_SRCS
set(C2A_COMMON_SRCS
if_list.c
)

Expand All @@ -11,40 +11,51 @@ if(USE_SILS_MOCKUP)
message("USE SILS_MOCKUP")

#target_sources(${PROJECT_NAME} PRIVATE
list(APPEND C2A_SRCS
set(C2A_IF_IMPL_SRCS
SilsMockup/ccsds_sils.c
SilsMockup/i2c_sils.c
SilsMockup/uart_sils.c
SilsMockup/wdt_sils.c
)
else()
#target_sources(${PROJECT_NAME} PUBLIC
list(APPEND C2A_SRCS
set(C2A_IF_IMPL_COMMON_SRCS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

オプションによって追加する側( C2A_IF_COM_WINGS_SRCS など)に対して,追加される側って,なんかもっといい表現無いかな.

basis でもないしなぁ

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feature とか?でも表現以前に現在の実装が同じディレクトリにベチャッと撒かれてるだけだから,現時点であんまりカッコイイ表現をすべきでもないと思う(過剰な期待を抱いてしまう)

Sils/ccsds_sils.cpp
Sils/i2c_sils.cpp
Sils/uart_sils.cpp
Sils/wdt_sils.cpp
)
endif()

if(USE_SCI_COM_WINGS AND NOT USE_SILS_MOCKUP)
add_definitions(-DUSE_SCI_COM_WINGS)
#target_sources(${PROJECT_NAME} PUBLIC
list(APPEND C2A_SRCS
Sils/ccsds_sils_sci_if.cpp
)
message("USE SCI_COM_WINGS")
endif()
if(USE_SCI_COM_WINGS)
add_definitions(-DUSE_SCI_COM_WINGS)
#target_sources(${PROJECT_NAME} PUBLIC
set(C2A_IF_COM_WINGS_SRCS
Sils/ccsds_sils_sci_if.cpp
)
message("USE SCI_COM_WINGS")
endif()

if(USE_SCI_COM_UART AND NOT USE_SILS_MOCKUP)
add_definitions(-DUSE_SCI_COM_UART)
#target_sources(${PROJECT_NAME} PUBLIC
list(APPEND C2A_SRCS
Sils/uart_sils_sci_if.cpp
if(USE_SCI_COM_UART)
add_definitions(-DUSE_SCI_COM_UART)
#target_sources(${PROJECT_NAME} PUBLIC
set(C2A_IF_COM_UART_SRCS
Sils/uart_sils_sci_if.cpp
)
message("USE SCI_COM_UART")
endif()

set(C2A_IF_IMPL_SRCS
${C2A_IF_IMPL_COMMON_SRCS}
${C2A_IF_COM_WINGS_SRCS}
${C2A_IF_COM_UART_SRCS}
)
message("USE SCI_COM_UART")
endif()

set(C2A_SRCS
${C2A_COMMON_SRCS}
${C2A_IF_IMPL_SRCS}
)

if(BUILD_C2A_AS_CXX)
set_source_files_properties(${C2A_SRCS} PROPERTIES LANGUAGE CXX) # C++
endif()
Expand Down