Keep the colleague's microbu-esp32c5 tree in this repository
obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
if(NOT AUTOTALKS_CRATON)
|
||||
find_path(
|
||||
AUTOTALKS_ROOT
|
||||
NAMES "include/atlk/v2x_service.h"
|
||||
PATH_SUFFIXES "autotalks_secton_api"
|
||||
PATHS $ENV{HOME}
|
||||
CMAKE_FIND_ROOT_PATH_BOTH # Seems like this is not needed in newer CMake
|
||||
)
|
||||
|
||||
set(AUTOTALKS_INCLUDE_DIRS "${AUTOTALKS_ROOT}/include" "${AUTOTALKS_ROOT}/ref_src/include" "${AUTOTALKS_ROOT}/depend/device/include" "${AUTOTALKS_ROOT}/src/include" "${AUTOTALKS_ROOT}/src/core/include")
|
||||
set(AUTOTALKS_LIBS_DIR ${AUTOTALKS_ROOT}/output.sec/x86/lib)
|
||||
set(AUTOTALKS_OBJ_DIR ${AUTOTALKS_ROOT}/output.sec/x86/obj)
|
||||
|
||||
# Secton does not need ToMcrypt and ToMmath as Craton
|
||||
|
||||
set(AUTOTALKS_OBJECTS target_type/target_type_remote.o platform_type/platform_type_linux_u.o link_layer/linux_u/remote/link_layer_remote.o link_layer/linux_u/ipc/link_layer_ipc.o link_layer/linux_u/tee/link_layer_tee_stub.o link_layer/link_layer_interface.o flash_reader/linux_u/remote/flash_reader_remote.o ref_sys/ref_sys.o ref_sys/ref_sys_logger.o log_reader/log_reader.o secure_hdif_crypto_layer/crypto_layer_ref_sys.o secure_hdif_crypto_layer/crypto_layer_interface.o secure_hdif_crypto_layer/crypto_lib_wrapper.o secure_storage/secure_storage.o time_sync/time_sync.o time_sync/time_sync_poti.o poti_lib/gnss/gnss.o poti_lib/nmea/nmea.o poti_lib/nmea/nmea_io.o poti_lib/nmea/nmea_io_check.o poti_lib/nmea/nmea_nav.o poti_lib/nmea/nmea_parse.o poti_lib/gnss/teseo/teseo.o poti_lib/gnss/teseo/teseo_commands.o poti_lib/coord/coord.o poti_lib/periodic_alarm/periodic_alarm.o poti_lib/api/poti_api.o poti_lib/ubx/serial_driver.o poti_lib/ubx/ubx_driver.o poti_lib/ubx/ubx_nav.o)
|
||||
list(TRANSFORM AUTOTALKS_OBJECTS PREPEND ${AUTOTALKS_OBJ_DIR}/)
|
||||
|
||||
if (NOT TARGET Autotalks::AtlkRemote)
|
||||
add_library(Autotalks::AtlkRemote UNKNOWN IMPORTED)
|
||||
set_target_properties(Autotalks::AtlkRemote PROPERTIES
|
||||
IMPORTED_LOCATION "${AUTOTALKS_LIBS_DIR}/libatlkremote_linux_u.so"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}")
|
||||
set_property(TARGET Autotalks::AtlkRemote APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ${AUTOTALKS_OBJECTS} rt)
|
||||
# target_link_libraries not working properly in CMake v3.5.1 used in Ubuntu 16.04
|
||||
endif()
|
||||
|
||||
else() # Craton device
|
||||
find_path(
|
||||
AUTOTALKS_ROOT
|
||||
NAMES "include/atlk/v2x_service.h"
|
||||
PATHS $ENV{HOME}
|
||||
PATH_SUFFIXES "autotalks_craton_api"
|
||||
CMAKE_FIND_ROOT_PATH_BOTH # Seems like this is not needed in newer CMake
|
||||
)
|
||||
|
||||
set(AUTOTALKS_INCLUDE_DIRS "${AUTOTALKS_ROOT}/include" "${AUTOTALKS_ROOT}/ref_src/include" "${AUTOTALKS_ROOT}/depend/device/include" "${AUTOTALKS_ROOT}/src/include" "${AUTOTALKS_ROOT}/src/core/include")
|
||||
|
||||
set(AUTOTALKS_LIBS_DIR ${AUTOTALKS_ROOT}/output.cr2_lnx/armv7-32/lib)
|
||||
set(AUTOTALKS_OBJ_DIR ${AUTOTALKS_ROOT}/output.cr2_lnx/armv7-32/obj)
|
||||
|
||||
if (NOT TARGET Autotalks::ToMcrypt)
|
||||
add_library(Autotalks::ToMcrypt UNKNOWN IMPORTED)
|
||||
set_target_properties(Autotalks::ToMcrypt PROPERTIES
|
||||
IMPORTED_LOCATION "${AUTOTALKS_LIBS_DIR}/libtomcrypt.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
if (NOT TARGET Autotalks::ToMmath)
|
||||
add_library(Autotalks::ToMmath UNKNOWN IMPORTED)
|
||||
set_target_properties(Autotalks::ToMmath PROPERTIES
|
||||
IMPORTED_LOCATION "${AUTOTALKS_LIBS_DIR}/libtommath.a"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
if (NOT TARGET Autotalks::Optee)
|
||||
add_library(Autotalks::Optee UNKNOWN IMPORTED)
|
||||
set_target_properties(Autotalks::Optee PROPERTIES
|
||||
IMPORTED_LOCATION "${AUTOTALKS_ROOT}/depend/optee/lib/libteec.so"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
set(AUTOTALKS_OBJECTS target_type/target_type_local.o platform_type/platform_type_linux_u.o link_layer/linux_u/local/link_layer_local_shared_memory.o link_layer/linux_u/ipc/link_layer_ipc.o link_layer/linux_u/tee/static_list.o link_layer/linux_u/tee/link_layer_tee.o link_layer/link_layer_interface.o flash_reader/linux_u/local/flash_reader_local.o ref_sys/ref_sys.o ref_sys/ref_sys_logger.o log_reader/log_reader.o secure_hdif_crypto_layer/crypto_layer_stubs.o time_sync/time_sync.o time_sync/time_sync_poti.o poti_lib/gnss/gnss.o poti_lib/nmea/nmea.o poti_lib/nmea/nmea_io.o poti_lib/nmea/nmea_io_check.o poti_lib/nmea/nmea_nav.o poti_lib/nmea/nmea_parse.o poti_lib/gnss/teseo/teseo.o poti_lib/gnss/teseo/teseo_commands.o poti_lib/coord/coord.o poti_lib/periodic_alarm/periodic_alarm.o poti_lib/api/poti_api.o poti_lib/ubx/serial_driver.o poti_lib/ubx/ubx_driver.o poti_lib/ubx/ubx_nav.o)
|
||||
list(TRANSFORM AUTOTALKS_OBJECTS PREPEND ${AUTOTALKS_OBJ_DIR}/)
|
||||
|
||||
if (NOT TARGET Autotalks::AtlkLocal)
|
||||
add_library(Autotalks::AtlkLocal SHARED IMPORTED)
|
||||
set_target_properties(Autotalks::AtlkLocal PROPERTIES
|
||||
IMPORTED_LOCATION "${AUTOTALKS_LIBS_DIR}/libatlklocal_linux_u.so"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${AUTOTALKS_INCLUDE_DIRS}")
|
||||
set_property(TARGET Autotalks::AtlkLocal APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Autotalks::ToMcrypt Autotalks::ToMmath ${AUTOTALKS_OBJECTS} rt Autotalks::Optee)
|
||||
# target_link_libraries not working properly in CMake v3.5.1 used in Ubuntu 16.04
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Autotalks "Autotalks libraries not found" AUTOTALKS_ROOT)
|
||||
@@ -0,0 +1,14 @@
|
||||
# FindCapnProto.cmake – thin wrapper around the upstream CapnProtoConfig.cmake
|
||||
#
|
||||
# The upstream CapnProtoTargets.cmake unconditionally calls add_library(... IMPORTED)
|
||||
# and will therefore fail on repeated find_package() invocations in the same configure run.
|
||||
# This wrapper short-circuits the second call when the targets already exist.
|
||||
|
||||
if(NOT TARGET CapnProto::capnp)
|
||||
# Forward to upstream CapnProtoConfig.cmake.
|
||||
# Always QUIET, find_package_handle_standard_args below controls options and output
|
||||
find_package(CapnProto CONFIG QUIET)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CapnProto CONFIG_MODE)
|
||||
@@ -0,0 +1,20 @@
|
||||
find_path(COHDA_ROOT
|
||||
NAMES "ieee1609/app/lib1609/include/lib1609.h" "cohda/kernel/include/linux/cohda/llc/llc-api.h"
|
||||
PATHS "/home/duser"
|
||||
PATH_SUFFIXES mk5 mk2
|
||||
CMAKE_FIND_ROOT_PATH_BOTH
|
||||
DOC "Cohda SDK")
|
||||
|
||||
set(COHDA_KERNEL_INCLUDE_DIR ${COHDA_ROOT}/ieee1609/kernel/include)
|
||||
set(COHDA_LIB1609_INCLUDE_DIR ${COHDA_ROOT}/ieee1609/app/lib1609/include)
|
||||
set(COHDA_LLC_INCLUDE_DIR ${COHDA_ROOT}/cohda/kernel/include/linux/cohda/llc)
|
||||
set(COHDA_INCLUDE_DIRS ${COHDA_KERNEL_INCLUDE_DIR} ${COHDA_LIB1609_INCLUDE_DIR} ${COHDA_LLC_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Cohda "Cohda SDK not found" COHDA_ROOT)
|
||||
mark_as_advanced(COHDA_ROOT)
|
||||
if(COHDA_FOUND AND NOT TARGET Cohda::headers)
|
||||
add_library(Cohda::headers UNKNOWN IMPORTED)
|
||||
set_target_properties(Cohda::headers PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${COHDA_INCLUDE_DIRS}")
|
||||
endif()
|
||||
@@ -0,0 +1,31 @@
|
||||
find_path(CryptoPP_INCLUDE_DIR NAMES cryptopp/config.h DOC "CryptoPP include directory")
|
||||
find_library(CryptoPP_LIBRARY NAMES cryptopp DOC "CryptoPP library")
|
||||
|
||||
if(CryptoPP_INCLUDE_DIR)
|
||||
# CRYPTOPP_VERSION has been moved to config_ver.h starting with Crypto++ 8.3
|
||||
if(EXISTS ${CryptoPP_INCLUDE_DIR}/cryptopp/config_ver.h)
|
||||
set(CryptoPP_VERSION_HEADER "config_ver.h")
|
||||
else()
|
||||
set(CryptoPP_VERSION_HEADER "config.h")
|
||||
endif()
|
||||
file(STRINGS ${CryptoPP_INCLUDE_DIR}/cryptopp/${CryptoPP_VERSION_HEADER} _config_version REGEX "CRYPTOPP_VERSION")
|
||||
string(REGEX MATCH "([0-9])([0-9])([0-9])" _match_version "${_config_version}")
|
||||
set(CryptoPP_VERSION_STRING "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CryptoPP
|
||||
REQUIRED_VARS CryptoPP_INCLUDE_DIR CryptoPP_LIBRARY
|
||||
FOUND_VAR CryptoPP_FOUND
|
||||
VERSION_VAR CryptoPP_VERSION_STRING)
|
||||
|
||||
if(CryptoPP_FOUND AND NOT TARGET CryptoPP::CryptoPP)
|
||||
add_library(CryptoPP::CryptoPP UNKNOWN IMPORTED)
|
||||
set_target_properties(CryptoPP::CryptoPP PROPERTIES
|
||||
IMPORTED_LOCATION "${CryptoPP_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CryptoPP_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CryptoPP_INCLUDE_DIR CryptoPP_LIBRARY)
|
||||
set(CryptoPP_INCLUDE_DIRS ${CryptoPP_INCLUDE_DIR})
|
||||
set(CryptoPP_LIBRARIES ${CryptoPP_LIBRARY})
|
||||
@@ -0,0 +1,27 @@
|
||||
find_path(GPS_INCLUDE_DIR NAMES gps.h DOC "libgps include directory")
|
||||
find_library(GPS_LIBRARY NAMES gps DOC "libgps library")
|
||||
|
||||
if(GPS_INCLUDE_DIR)
|
||||
file(STRINGS ${GPS_INCLUDE_DIR}/gps.h _version_lines REGEX "GPSD_API_(MAJOR|MINOR)_VERSION")
|
||||
string(REGEX MATCH "MAJOR_VERSION[ \t]+([0-9]+)" _version_major ${_version_lines})
|
||||
set(GPS_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "MINOR_VERSION[ \t]+([0-9]+)" _version_minor ${_version_lines})
|
||||
set(GPS_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||
set(GPS_VERSION_STRING "${GPS_VERSION_MAJOR}.${GPS_VERSION_MINOR}")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GPS
|
||||
REQUIRED_VARS GPS_INCLUDE_DIR GPS_LIBRARY
|
||||
VERSION_VAR GPS_VERSION_STRING)
|
||||
|
||||
if(GPS_FOUND AND NOT TARGET GPS::GPS)
|
||||
add_library(GPS::GPS UNKNOWN IMPORTED)
|
||||
set_target_properties(GPS::GPS PROPERTIES
|
||||
IMPORTED_LOCATION "${GPS_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GPS_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(GPS_INCLUDE_DIR GPS_LIBRARY)
|
||||
set(GPS_INCLUDE_DIRS ${GPS_INCLUDE_DIR})
|
||||
set(GPS_LIBRARIES ${GPS_LIBRARY})
|
||||
@@ -0,0 +1,54 @@
|
||||
option(GeographicLib_PREFER_PACKAGE_CONFIG "Prefer CMake config mode" ON)
|
||||
mark_as_advanced(GeographicLib_PREFER_PACKAGE_CONFIG)
|
||||
|
||||
if(GeographicLib_PREFER_PACKAGE_CONFIG)
|
||||
find_package(GeographicLib ${GeographicLib_FIND_VERSION} QUIET CONFIG)
|
||||
if (GeographicLib_FOUND)
|
||||
message(STATUS "GeographicLib: using found CMake configuration")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "GeographicLib: using lookup code by Vanetza")
|
||||
|
||||
find_path(GeographicLib_INCLUDE_DIR NAMES GeographicLib/Config.h DOC "GeographicLib include directory")
|
||||
find_library(GeographicLib_LIBRARY_RELEASE NAMES Geographic GeographicLib DOC "GeographicLib library (release)")
|
||||
find_library(GeographicLib_LIBRARY_DEBUG NAMES Geographic_d GeographicLib_d DOC "GeographicLib library (debug)")
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(GeographicLib)
|
||||
|
||||
if(GeographicLib_INCLUDE_DIR)
|
||||
file(STRINGS ${GeographicLib_INCLUDE_DIR}/GeographicLib/Config.h _config_version REGEX "GEOGRAPHICLIB_VERSION_STRING")
|
||||
string(REGEX MATCH "\"([0-9.]+)\"$" _match_version ${_config_version})
|
||||
set(GeographicLib_VERSION_STRING ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GeographicLib
|
||||
REQUIRED_VARS GeographicLib_INCLUDE_DIR GeographicLib_LIBRARY
|
||||
FOUND_VAR GeographicLib_FOUND
|
||||
VERSION_VAR GeographicLib_VERSION_STRING)
|
||||
|
||||
if(GeographicLib_FOUND AND NOT TARGET GeographicLib::GeographicLib)
|
||||
add_library(GeographicLib::GeographicLib UNKNOWN IMPORTED)
|
||||
set_target_properties(GeographicLib::GeographicLib PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GeographicLib_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${GeographicLib_LIBRARY}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
|
||||
if(EXISTS "${GeographicLib_LIBRARY_RELEASE}")
|
||||
set_property(TARGET GeographicLib::GeographicLib APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(GeographicLib::GeographicLib PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${GeographicLib_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
if(EXISTS "${GeographicLib_LIBRARY_DEBUG}")
|
||||
set_property(TARGET GeographicLib::GeographicLib APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(GeographicLib::GeographicLib PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${GeographicLib_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(GeographicLib_INCLUDE_DIR GeographicLib_LIBRARY)
|
||||
set(GeographicLib_INCLUDE_DIRS ${GeographicLib_INCLUDE_DIR})
|
||||
# GeographicLib_LIBRARIES is set by SelectLibraryConfigurations
|
||||
@@ -0,0 +1,66 @@
|
||||
set(GTest_VERSION 1.16.0)
|
||||
set(GTest_ARCHIVE_NAME googletest-${GTest_VERSION})
|
||||
set(GTest_ARCHIVE ${GTest_ARCHIVE_NAME}.tar.gz)
|
||||
set(GTest_ARCHIVE_SHA1 517f27ed21b40f9927ab91f2abc147519cedb5a5)
|
||||
set(GTest_URL https://github.com/google/googletest/releases/download/v${GTest_VERSION}/${GTest_ARCHIVE})
|
||||
|
||||
option(GTest_BUILD_DIRECTORY_DOWNLOAD "Download GoogleTest in build directory" OFF)
|
||||
mark_as_advanced(GTest_BUILD_DIRECTORY_DOWNLOAD)
|
||||
if(GTest_BUILD_DIRECTORY_DOWNLOAD)
|
||||
set(GTest_DIR ${PROJECT_BINARY_DIR}/gtest)
|
||||
else()
|
||||
set(GTest_DIR ${PROJECT_SOURCE_DIR}/gtest)
|
||||
endif()
|
||||
set(GTest_ARCHIVE_DIR ${GTest_DIR}/${GTest_ARCHIVE_NAME}/googletest)
|
||||
set(GTest_SOURCE_DIR ${GTest_ARCHIVE_DIR}/src)
|
||||
set(GTest_INCLUDE_DIR ${GTest_ARCHIVE_DIR}/include)
|
||||
|
||||
set(GTest_LIBRARY gtest)
|
||||
set(GTest_LIBRARY_SOURCES ${GTest_SOURCE_DIR}/gtest-all.cc)
|
||||
set(GTest_MAIN_LIBRARY gtest_main)
|
||||
set(GTest_MAIN_LIBRARY_SOURCES ${GTest_SOURCE_DIR}/gtest_main.cc)
|
||||
|
||||
file(DOWNLOAD
|
||||
${GTest_URL}
|
||||
${GTest_DIR}/${GTest_ARCHIVE}
|
||||
EXPECTED_HASH SHA1=${GTest_ARCHIVE_SHA1})
|
||||
add_custom_target(download_gtest DEPENDS ${GTest_DIR}/${GTest_ARCHIVE})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${GTest_LIBRARY_SOURCES} ${GTest_MAIN_LIBRARY_SOURCES}
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xfz ${GTest_DIR}/${GTest_ARCHIVE}
|
||||
DEPENDS download_gtest
|
||||
COMMENT "Extracting ${GTest_ARCHIVE} in ${GTest_DIR}"
|
||||
WORKING_DIRECTORY ${GTest_DIR}
|
||||
VERBATIM)
|
||||
add_custom_target(extract_gtest DEPENDS ${GTest_LIBRARY_SOURCES} ${GTest_MAIN_LIBRARY_SOURCES})
|
||||
|
||||
# GTest library for tests with own main function
|
||||
add_library(${GTest_LIBRARY} ${GTest_LIBRARY_SOURCES})
|
||||
target_include_directories(${GTest_LIBRARY} PRIVATE ${GTest_ARCHIVE_DIR})
|
||||
target_include_directories(${GTest_LIBRARY} SYSTEM PUBLIC ${GTest_INCLUDE_DIR})
|
||||
add_dependencies(${GTest_LIBRARY} extract_gtest)
|
||||
|
||||
# GTest library providing main function for tests
|
||||
add_library(${GTest_MAIN_LIBRARY} ${GTest_MAIN_LIBRARY_SOURCES})
|
||||
target_link_libraries(${GTest_MAIN_LIBRARY} PUBLIC ${GTest_LIBRARY})
|
||||
add_dependencies(${GTest_MAIN_LIBRARY} extract_gtest)
|
||||
|
||||
# Look for threading library and configure GTest accordingly
|
||||
if(NOT DEFINED CMAKE_USE_PTHREADS_INIT)
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads MODULE)
|
||||
endif()
|
||||
|
||||
if(CMAKE_USE_PTHREADS_INIT)
|
||||
message(STATUS "Build GTest with pthread support")
|
||||
target_compile_definitions(${GTest_LIBRARY} PUBLIC "GTEST_HAS_PTHREAD=1")
|
||||
target_link_libraries(${GTest_LIBRARY} PUBLIC Threads::Threads)
|
||||
else()
|
||||
message(STATUS "Build GTest without threading")
|
||||
target_compile_definitions(${GTest_LIBRARY} PUBLIC "GTEST_HAS_PTHREAD=0")
|
||||
endif()
|
||||
|
||||
set_target_properties(download_gtest extract_gtest ${GTest_LIBRARY} ${GTest_MAIN_LIBRARY}
|
||||
PROPERTIES FOLDER "GTest")
|
||||
@@ -0,0 +1,8 @@
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
|
||||
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
|
||||
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
@@ -0,0 +1,16 @@
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "arm")
|
||||
set(POKY_CRATON2 "/opt/poky-craton2/4.0.1")
|
||||
set(CMAKE_C_COMPILER "${POKY_CRATON2}/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc")
|
||||
set(CMAKE_CXX_COMPILER "${POKY_CRATON2}/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++")
|
||||
set(CMAKE_C_FLAGS "--sysroot=${POKY_CRATON2}/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7" CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_FLAGS "--sysroot=${POKY_CRATON2}/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi -I${POKY_CRATON2}/sysroots/cortexa7t2hf-neon-poky-linux-gnueabi/usr/include -march=armv7ve -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7" CACHE STRING "" FORCE)
|
||||
set(THREADS_PTHREAD_ARG "2" CACHE STRING "Forced by Autotalks toolchain" FORCE)
|
||||
# Cache string needed in cmake v3.5.1, in v3.16.3 not anymore
|
||||
# THREADS_PTHREAD_ARG needed for a bug that is also not present in v3.16.3 anymore
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
set(AUTOTALKS_CRATON true)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "arm")
|
||||
set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
|
||||
set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
|
||||
set(THREADS_PTHREAD_ARG "2" CACHE STRING "Forced by Cohda toolchain" FORCE)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# configure_gtest_directory(
|
||||
# [SOURCES <srcs...>]
|
||||
# [LINK_LIBRARIES <libs...>]
|
||||
# [INCLUDE_DIRECTORIES <dirs...>]
|
||||
# [COMPILE_DEFINITIONS <defs...>])
|
||||
#
|
||||
# Set GTest properties common for all unit test executables in current directory.
|
||||
#
|
||||
function(configure_gtest_directory)
|
||||
cmake_parse_arguments(args "" "" "SOURCES;LINK_LIBRARIES;INCLUDE_DIRECTORIES;COMPILE_DEFINITIONS" ${ARGN})
|
||||
if(args_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "unknown arguments given to configure_gtest_directory: ${args_UNPARSED_ARGUMENTS}")
|
||||
endif()
|
||||
|
||||
set_property(DIRECTORY PROPERTY GTEST_SOURCES ${args_SOURCES})
|
||||
set_property(DIRECTORY PROPERTY GTEST_LINK_LIBRARIES ${args_LINK_LIBRARIES})
|
||||
set_property(DIRECTORY PROPERTY GTEST_INCLUDE_DIRECTORIES ${args_INCLUDE_DIRECTORIES})
|
||||
set_property(DIRECTORY PROPERTY GTEST_COMPILE_DEFINITIONS ${args_COMPILE_DEFINITIONS})
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# add_gtest(<name>
|
||||
# [SOURCES] <srcs...>
|
||||
# [LINK_LIBRARIES <libs...>]
|
||||
# [INCLUDE_DIRECTORIES <dirs...>]
|
||||
# [COMPILE_DEFINITIONS <defs...>])
|
||||
#
|
||||
# Add a CTest unit test executable using Google Test.
|
||||
# The executable will be built as specified by given arguments and directory properties.
|
||||
#
|
||||
function(add_gtest name)
|
||||
set(target GTest_${name})
|
||||
cmake_parse_arguments(args "" "" "SOURCES;LINK_LIBRARIES;INCLUDE_DIRECTORIES;COMPILE_DEFINITIONS" ${ARGN})
|
||||
|
||||
get_directory_property(sources GTEST_SOURCES)
|
||||
list(APPEND sources "${args_SOURCES}" "${args_UNPARSED_ARGUMENTS}")
|
||||
get_directory_property(link_libraries GTEST_LINK_LIBRARIES)
|
||||
list(APPEND link_libraries "${args_LINK_LIBRARIES}" ${GTest_MAIN_LIBRARY})
|
||||
get_directory_property(include_directories GTEST_INCLUDE_DIRECTORIES)
|
||||
list(APPEND include_directories "${args_INCLUDE_DIRECTORIES}" ${GTest_INCLUDE_DIR})
|
||||
get_directory_property(compile_definitions GTEST_COMPILE_DEFINITIONS)
|
||||
list(APPEND compile_definitions "${args_COMPILE_DEFINITIONS}")
|
||||
|
||||
if(NOT sources)
|
||||
message(FATAL_ERROR "no sources given to add_gtest")
|
||||
endif()
|
||||
|
||||
add_executable(${target} ${sources})
|
||||
set_target_properties(${target} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/tests
|
||||
FOLDER "GTest"
|
||||
LINK_LIBRARIES "${link_libraries}"
|
||||
INCLUDE_DIRECTORIES "${include_directories}"
|
||||
COMPILE_DEFINITIONS "${compile_definitions}")
|
||||
add_test(NAME ${name}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMAND ${target})
|
||||
endfunction()
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# vanetza_optional_dependency(<package> [<version>] <option> <description>)
|
||||
#
|
||||
# Probe for <package> quietly, create a CMake option defaulting to whether it
|
||||
# was found, and require it if the option is enabled.
|
||||
#
|
||||
macro(vanetza_optional_dependency package)
|
||||
if(${ARGC} EQUAL 4)
|
||||
set(_vanetza_dep_version ${ARGV1})
|
||||
set(_vanetza_dep_option ${ARGV2})
|
||||
set(_vanetza_dep_description "${ARGV3}")
|
||||
else()
|
||||
set(_vanetza_dep_version)
|
||||
set(_vanetza_dep_option ${ARGV1})
|
||||
set(_vanetza_dep_description "${ARGV2}")
|
||||
endif()
|
||||
find_package(${package} ${_vanetza_dep_version} QUIET)
|
||||
option(${_vanetza_dep_option} "${_vanetza_dep_description}" ${${package}_FOUND})
|
||||
if(${_vanetza_dep_option})
|
||||
find_package(${package} ${_vanetza_dep_version} REQUIRED)
|
||||
endif()
|
||||
unset(_vanetza_dep_version)
|
||||
unset(_vanetza_dep_option)
|
||||
unset(_vanetza_dep_description)
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# add_vanetza_component(<name> <sources...>)
|
||||
#
|
||||
function(add_vanetza_component name)
|
||||
set(sources ${ARGN})
|
||||
|
||||
add_library(${name} ${sources})
|
||||
add_library(Vanetza::${name} ALIAS ${name})
|
||||
target_include_directories(${name} PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
set_target_properties(${name} PROPERTIES
|
||||
OUTPUT_NAME vanetza_${name}
|
||||
SOVERSION ${VANETZA_SOVERSION}
|
||||
INSTALL_RPATH $ORIGIN)
|
||||
target_compile_features(${name} PUBLIC cxx_std_14)
|
||||
install(TARGETS ${name} EXPORT ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
set_property(GLOBAL APPEND PROPERTY VANETZA_COMPONENTS ${name})
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# add_test_subdirectory(<directory>)
|
||||
#
|
||||
# Add subdirectory only when tests are enabled via BUILD_TESTS
|
||||
#
|
||||
function(add_test_subdirectory directory)
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(${directory})
|
||||
endif()
|
||||
endfunction(add_test_subdirectory)
|
||||
@@ -0,0 +1,38 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
# Temporarily extend module path for bundled find package scripts
|
||||
set(_vanetza_save_cmake_module_path ${CMAKE_MODULE_PATH})
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Boost @Boost_VERSION_STRING@ CONFIG COMPONENTS date_time)
|
||||
|
||||
if(@VANETZA_WITH_GEOGRAPHICLIB@)
|
||||
find_dependency(GeographicLib @GeographicLib_VERSION_STRING@)
|
||||
endif()
|
||||
|
||||
if(@VANETZA_WITH_RPC@)
|
||||
find_dependency(CapnProto @CapnProto_VERSION@)
|
||||
endif()
|
||||
|
||||
if(@VANETZA_WITH_CRYPTOPP@)
|
||||
find_dependency(CryptoPP @CryptoPP_VERSION_STRING@)
|
||||
endif()
|
||||
|
||||
if(@VANETZA_WITH_OPENSSL@)
|
||||
# remove patch letter found with OpenSSL 1.x
|
||||
string(REGEX REPLACE "[a-z]+$" "" OpenSSL_VERSION_WITHOUT_PATCH "@OpenSSL_VERSION@")
|
||||
find_dependency(OpenSSL ${OpenSSL_VERSION_WITHOUT_PATCH})
|
||||
endif()
|
||||
|
||||
if(@VANETZA_WITH_PQC@)
|
||||
find_dependency(liboqs 0.14 CONFIG)
|
||||
endif()
|
||||
|
||||
# Restore previous module path
|
||||
set(CMAKE_MODULE_PATH ${_vanetza_save_cmake_module_path})
|
||||
unset(_vanetza_save_cmake_module_path)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/VanetzaTargets.cmake")
|
||||
|
||||
set_and_check(VANETZA_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
||||
@@ -0,0 +1,34 @@
|
||||
# Temporarily extend module path for bundled find package scripts
|
||||
set(_vanetza_save_cmake_module_path ${CMAKE_MODULE_PATH})
|
||||
list(APPEND CMAKE_MODULE_PATH "@PROJECT_SOURCE_DIR@/cmake")
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Boost @Boost_VERSION_STRING@ CONFIG COMPONENTS date_time)
|
||||
|
||||
if(@VANETZA_WITH_GEOGRAPHICLIB@)
|
||||
find_dependency(GeographicLib @GeographicLib_VERSION_STRING@)
|
||||
endif()
|
||||
|
||||
if(@VANETZA_WITH_RPC@)
|
||||
find_dependency(CapnProto @CapnProto_VERSION@)
|
||||
endif()
|
||||
|
||||
if(@VANETZA_WITH_CRYPTOPP@)
|
||||
find_dependency(CryptoPP @CryptoPP_VERSION_STRING@)
|
||||
endif()
|
||||
|
||||
if(@VANETZA_WITH_OPENSSL@)
|
||||
# remove patch letter found with OpenSSL 1.x
|
||||
string(REGEX REPLACE "[a-z]+$" "" OpenSSL_VERSION_WITHOUT_PATCH "@OpenSSL_VERSION@")
|
||||
find_dependency(OpenSSL ${OpenSSL_VERSION_WITHOUT_PATCH})
|
||||
endif()
|
||||
|
||||
if(@VANETZA_WITH_PQC@)
|
||||
find_dependency(liboqs 0.14 CONFIG)
|
||||
endif()
|
||||
|
||||
# Restore previous module path
|
||||
set(CMAKE_MODULE_PATH ${_vanetza_save_cmake_module_path})
|
||||
unset(_vanetza_save_cmake_module_path)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/VanetzaExports.cmake")
|
||||
Reference in New Issue
Block a user