Skip to content

Commit

Permalink
Subbuild refactor - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStarch committed Oct 11, 2023
1 parent f797734 commit 43e7ab2
Show file tree
Hide file tree
Showing 11 changed files with 460 additions and 194 deletions.
7 changes: 5 additions & 2 deletions Ref/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ project(Ref VERSION 1.0.0 LANGUAGES C CXX)
# components will be placed in the F-Prime binary subdirectory to keep them from
# colliding with deployment specific items.
##
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/FPrime.cmake")
#include("${CMAKE_CURRENT_LIST_DIR}/../cmake/FPrime.cmake")
# NOTE: register custom targets between these two lines
include("${CMAKE_CURRENT_LIST_DIR}/../cmake/FPrime-Code.cmake")
#include("${CMAKE_CURRENT_LIST_DIR}/../cmake/FPrime-Code.cmake")

find_package(fprime)
fprime_setup_included_code()
##
# Section 3: Components and Topology
#
Expand Down
11 changes: 11 additions & 0 deletions Ref/SignalGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,20 @@
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/SignalGen.fpp"
"${CMAKE_CURRENT_LIST_DIR}/SignalGen.cpp"


)

register_fprime_module()









### UTs ###
set(UT_SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/SignalGen.fpp"
Expand Down
15 changes: 4 additions & 11 deletions cmake/API.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,7 @@ endfunction(register_fprime_ut)
# **TARGET_FILE_PATH:** include path or file path file defining above functions
###
macro(register_fprime_target TARGET_FILE_PATH)
# Normal registered targets don't run in prescan
if (NOT DEFINED FPRIME_PRESCAN)
register_fprime_list_helper("${TARGET_FILE_PATH}" FPRIME_TARGET_LIST)
setup_global_target("${TARGET_FILE_PATH}")
endif()
register_fprime_list_helper("${TARGET_FILE_PATH}" FPRIME_TARGET_LIST)
endmacro(register_fprime_target)

####
Expand All @@ -502,9 +498,8 @@ endmacro(register_fprime_target)
###
macro(register_fprime_ut_target TARGET_FILE_PATH)
# UT targets only allowed when testing
if (BUILD_TESTING AND NOT DEFINED FPRIME_PRESCAN)
if (BUILD_TESTING)
register_fprime_list_helper("${TARGET_FILE_PATH}" FPRIME_UT_TARGET_LIST)
setup_global_target("${TARGET_FILE_PATH}")
endif()
endmacro(register_fprime_ut_target)

Expand Down Expand Up @@ -544,10 +539,8 @@ endmacro(register_fprime_list_helper)
###
macro(register_fprime_build_autocoder TARGET_FILE_PATH)
# Normal registered targets don't run in prescan
message(STATUS "Registering custom autocoder: ${TARGET_FILE_PATH}")
if (NOT DEFINED FPRIME_PRESCAN)
register_fprime_list_helper("${TARGET_FILE_PATH}" FPRIME_AUTOCODER_TARGET_LIST)
endif()
message(STATUS "[autocoder] Registering custom build target autocoder: ${TARGET_FILE_PATH}")
register_fprime_list_helper("${TARGET_FILE_PATH}" FPRIME_AUTOCODER_TARGET_LIST)
endmacro(register_fprime_build_autocoder)

#### Documentation links
Expand Down
46 changes: 8 additions & 38 deletions cmake/FPrime-Code.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,14 @@
# FPrime-Code:
#
# FPrime code. This cmake file includes the basic directories that make up the mainline F prime framework. This is
# separated from the CMake includes themselves such that this is built after all CMake setup. All F prime core folders
# should be added here and F prime CMake API function should be added elsewhere.
# separated from the CMake includes themselves such that this is built after all CMake setup.
#
# Note: given F prime's historical folder structure, this is not organized as an fprime library.
####
# Libraries that make-up F prime. Hurray!
# Ignore GTest for non-test builds
if (BUILD_TESTING AND NOT DEFINED FPRIME_PRESCAN)
include("${FPRIME_FRAMEWORK_PATH}/cmake/googletest-download/googletest.cmake")
add_subdirectory("${FPRIME_FRAMEWORK_PATH}/STest/" "${CMAKE_BINARY_DIR}/F-Prime/STest")
endif()
# By default we shutoff framework UTs
set(__FPRIME_NO_UT_GEN__ ON)
# Check for autocoder UTs
if (FPRIME_ENABLE_FRAMEWORK_UTS AND FPRIME_ENABLE_AUTOCODER_UTS)
set(__FPRIME_NO_UT_GEN__ OFF)
endif()
add_subdirectory("${FPRIME_FRAMEWORK_PATH}/Autocoders/" "${CMAKE_BINARY_DIR}/F-Prime/Autocoders")
# Check if we are allowing framework UTs
if (FPRIME_ENABLE_FRAMEWORK_UTS)
set(__FPRIME_NO_UT_GEN__ OFF)
endif()
# Faux libraries used as interfaces to non-autocoded fpp items
add_library(Fpp INTERFACE)
set(FPRIME_CURRENT_MODULE config)
add_subdirectory("${FPRIME_CONFIG_DIR}" "${CMAKE_BINARY_DIR}/config")
include_directories("${CMAKE_BINARY_DIR}/config")
set(_FP_CORE_PACKAGES Fw Svc Os Drv CFDP Utils)
foreach (_FP_PACKAGE_DIR IN LISTS _FP_CORE_PACKAGES)
set(FPRIME_CURRENT_MODULE "${_FP_PACKAGE_DIR}")
add_subdirectory("${FPRIME_FRAMEWORK_PATH}/${_FP_PACKAGE_DIR}/" "${CMAKE_BINARY_DIR}/F-Prime/${_FP_PACKAGE_DIR}")
endforeach ()
unset(FPRIME_CURRENT_MODULE)
# Always enable UTs for a project
set(__FPRIME_NO_UT_GEN__ OFF)
foreach (LIBRARY_DIR IN LISTS FPRIME_LIBRARY_LOCATIONS)
file(GLOB MANIFESTS RELATIVE "${LIBRARY_DIR}" CONFIGURE_DEPENDS "${LIBRARY_DIR}/*.cmake")
foreach (MANIFEST IN LISTS MANIFESTS)
include("${LIBRARY_DIR}/${MANIFEST}")
endforeach()
endforeach()
include_guard()

# Ensure that the FPrime build system is setup
include("${CMAKE_CURRENT_LIST_DIR}/FPrime.cmake")

# Setup fprime code followed by all libraries
fprime_setup_included_code()
Loading

0 comments on commit 43e7ab2

Please sign in to comment.