chore(cmake): CMake cleanup and simplifications (#2620)
* CMake cleanup and simplifications * Position Independent Code is need for radiolib_native * Some more cleanup & repair * Fix SIMU_SRC scope issue * fix: avoid warnings due to assembler statements from StdPeriph on arm64 native
This commit is contained in:
@@ -190,9 +190,17 @@ endif()
|
||||
|
||||
if(RTC_BACKUP_RAM)
|
||||
add_definitions(-DRTC_BACKUP_RAM)
|
||||
set(SRC ${SRC} storage/rlc.cpp)
|
||||
set(FIRMWARE_SRC ${FIRMWARE_SRC} storage/rtc_backup.cpp)
|
||||
set(GTEST_SRC ${GTEST_SRC} ${RADIO_SRC_DIR}/storage/rtc_backup.cpp)
|
||||
|
||||
GenerateDataCopy(datastructs_private.h datacopy.inc)
|
||||
|
||||
set(SRC ${SRC}
|
||||
storage/rlc.cpp
|
||||
storage/rtc_backup.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/datacopy.inc
|
||||
)
|
||||
|
||||
# Add custom target for debugging
|
||||
add_custom_target(datacopy DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/datacopy.cpp)
|
||||
endif()
|
||||
|
||||
if(LUA)
|
||||
@@ -525,6 +533,23 @@ else()
|
||||
endif()
|
||||
|
||||
if(NATIVE_BUILD)
|
||||
|
||||
set(RADIOLIB_NATIVE_SRC ${SRC})
|
||||
if(SIMU_DISKIO)
|
||||
set(RADIOLIB_NATIVE_SRC ${RADIOLIB_NATIVE_SRC}
|
||||
${FATFS_DIR}/ff.c ${FATFS_DIR}/ffunicode.c)
|
||||
endif()
|
||||
|
||||
# Pack all radio sources into an object lib
|
||||
add_library(radiolib_native OBJECT EXCLUDE_FROM_ALL
|
||||
${RADIOLIB_NATIVE_SRC})
|
||||
|
||||
# Add -DSIMU here PUBLIC, so it can be imported by other targets
|
||||
# via INTERFACE_COMPILE_OPTIONS
|
||||
target_compile_options(radiolib_native PUBLIC -DSIMU)
|
||||
add_dependencies(radiolib_native ${RADIO_DEPENDENCIES})
|
||||
set_property(TARGET radiolib_native PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
add_subdirectory(targets/simu)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
@@ -600,7 +625,7 @@ add_definitions(-DFREE_RTOS)
|
||||
|
||||
add_executable(firmware ${SRC} ${FIRMWARE_HEADERS})
|
||||
link_libraries(firmware -lstdc++)
|
||||
add_dependencies(firmware ${RADIO_DEPENDENCIES} ${FIRMWARE_DEPENDENCIES})
|
||||
add_dependencies(firmware ${RADIO_DEPENDENCIES})
|
||||
set_target_properties(firmware PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
|
||||
if(ACCESS_DENIED)
|
||||
|
||||
Reference in New Issue
Block a user