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:
@@ -3,8 +3,6 @@
|
||||
if(GTEST_INCDIR AND GTEST_SRCDIR AND Qt5Widgets_FOUND)
|
||||
add_library(gtests-radio-lib STATIC EXCLUDE_FROM_ALL ${GTEST_SRCDIR}/src/gtest-all.cc )
|
||||
target_include_directories(gtests-radio-lib PUBLIC ${GTEST_INCDIR} ${GTEST_INCDIR}/gtest ${GTEST_SRCDIR})
|
||||
add_definitions(-DSIMU -DGTESTS)
|
||||
remove_definitions(-DCLI)
|
||||
set(TESTS_PATH ${RADIO_SRC_DIR}/tests)
|
||||
set(TESTS_BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
||||
configure_file(${RADIO_SRC_DIR}/tests/location.h.in ${CMAKE_CURRENT_BINARY_DIR}/location.h @ONLY)
|
||||
@@ -41,11 +39,12 @@ if(GTEST_INCDIR AND GTEST_SRCDIR AND Qt5Widgets_FOUND)
|
||||
target_link_libraries(gtests-radio-lib PRIVATE ${SDL_LIBRARY})
|
||||
endif()
|
||||
|
||||
foreach(FILE ${SRC})
|
||||
set(RADIO_SRC ${RADIO_SRC} ../${FILE})
|
||||
endforeach()
|
||||
|
||||
file(GLOB TEST_SRC_FILES ${RADIO_SRC_DIR}/tests/*.cpp)
|
||||
set(TEST_SRC_FILES ${TEST_SRC_FILES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/location.h
|
||||
${SIMU_SRC}
|
||||
)
|
||||
|
||||
if(MINGW)
|
||||
# struct packing breaks on MinGW w/out -mno-ms-bitfields: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52991 & http://stackoverflow.com/questions/24015852/struct-packing-and-alignment-with-mingw
|
||||
@@ -53,21 +52,11 @@ if(GTEST_INCDIR AND GTEST_SRCDIR AND Qt5Widgets_FOUND)
|
||||
endif()
|
||||
|
||||
add_executable(gtests-radio EXCLUDE_FROM_ALL
|
||||
${GTEST_SRC}
|
||||
${TEST_SRC_FILES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/location.h
|
||||
${RADIO_SRC}
|
||||
../targets/simu/simpgmspace.cpp
|
||||
../targets/simu/simueeprom.cpp
|
||||
../targets/simu/simufatfs.cpp
|
||||
../targets/simu/simulcd.cpp
|
||||
../targets/simu/module_drivers.cpp
|
||||
../targets/simu/led_driver.cpp
|
||||
../targets/simu/backlight_driver.cpp
|
||||
../targets/simu/gyro_driver.cpp
|
||||
../targets/simu/bt_driver.cpp
|
||||
)
|
||||
add_dependencies(gtests-radio ${RADIO_DEPENDENCIES} ${FIRMWARE_DEPENDENCIES} gtests-radio-lib)
|
||||
target_compile_options(gtests-radio PRIVATE ${SIMU_SRC_OPTIONS})
|
||||
|
||||
add_dependencies(gtests-radio gtests-radio-lib)
|
||||
if(PCB STREQUAL X12S OR PCB STREQUAL X10)
|
||||
add_dependencies(gtests-radio ${HORUS_MODEL_FILES})
|
||||
endif()
|
||||
|
||||
@@ -155,10 +155,14 @@ const char * nchar2string(const char * string, int size)
|
||||
return _stringResult;
|
||||
}
|
||||
|
||||
extern bool _eeprom_write_simu_delay;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
simuInit();
|
||||
|
||||
_eeprom_write_simu_delay = false;
|
||||
startEepromThread(nullptr);
|
||||
#if defined(EEPROM_SIZE)
|
||||
eeprom = (uint8_t *)malloc(EEPROM_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user