Refactor cmake support to be less leaky
This commit is contained in:
parent
69e1538cbb
commit
bb220c9e92
@ -9,7 +9,6 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- mkdir -p build
|
- mkdir -p build
|
||||||
- cd build
|
- cd build
|
||||||
- conan install .. --build=missing
|
|
||||||
- cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON
|
- cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON
|
||||||
- ninja
|
- ninja
|
||||||
- ctest . --output-on-failure
|
- ctest . --output-on-failure
|
||||||
|
|||||||
@ -1,22 +1,19 @@
|
|||||||
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
||||||
|
|
||||||
set(version 0.1.0)
|
set(SKULLC_VERSION 0.1.0)
|
||||||
|
|
||||||
project(skullc
|
project(skullc
|
||||||
VERSION ${version}
|
VERSION ${SKULLC_VERSION}
|
||||||
LANGUAGES
|
LANGUAGES
|
||||||
C
|
C
|
||||||
CXX
|
CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
|
#list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
option(SKULLC_WITH_TESTS "Enable unit testing." OFF)
|
||||||
list(APPEND CMAKE_CXX_FLAGS "-Wall -Wextra")
|
option(SKULLC_WITH_HAL "Enable the compiling and deployment of the HAL dependent sections." OFF)
|
||||||
|
|
||||||
option(WITH_TESTS "Enable unit testing." OFF)
|
|
||||||
option(WITH_HAL "Enable the compiling and deployment of the HAL dependent sections." OFF)
|
|
||||||
|
|
||||||
include(skullc-install)
|
include(skullc-install)
|
||||||
|
|
||||||
@ -24,7 +21,7 @@ add_subdirectory(Peripherals)
|
|||||||
add_subdirectory(Utility)
|
add_subdirectory(Utility)
|
||||||
add_subdirectory(Messaging)
|
add_subdirectory(Messaging)
|
||||||
|
|
||||||
if(WITH_TESTS)
|
if(SKULLC_WITH_TESTS)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(Tests)
|
add_subdirectory(Tests)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@ -7,16 +7,12 @@ pipeline {
|
|||||||
stage("build && test") {
|
stage("build && test") {
|
||||||
steps {
|
steps {
|
||||||
echo "Workspace: ${env.WORKSPACE}"
|
echo "Workspace: ${env.WORKSPACE}"
|
||||||
sh 'ls'
|
|
||||||
sh 'sudo pip3 install --upgrade conan==1.42.1'
|
|
||||||
sh 'conan profile new default --detect'
|
|
||||||
sh 'conan profile update settings.compiler.libcxx=libstdc++11 default'
|
|
||||||
sh 'mkdir -p build'
|
sh 'mkdir -p build'
|
||||||
|
|
||||||
dir("build") {
|
dir("build") {
|
||||||
sh 'ls'
|
sh 'ls'
|
||||||
sh 'conan install .. --build=missing'
|
sh 'conan install .. --build=missing'
|
||||||
sh 'cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DWITH_TESTS=ON'
|
sh 'cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DSKULLC_WITH_TESTS=ON'
|
||||||
sh 'ninja'
|
sh 'ninja'
|
||||||
sh 'ctest . -T test --output-on-failure --no-compress-output'
|
sh 'ctest . -T test --output-on-failure --no-compress-output'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,14 @@ add_library(messaging INTERFACE)
|
|||||||
add_library(skullc::messaging ALIAS messaging)
|
add_library(skullc::messaging ALIAS messaging)
|
||||||
|
|
||||||
target_include_directories(messaging
|
target_include_directories(messaging
|
||||||
INTERFACE
|
INTERFACE
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Inc>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Inc>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
|
|
||||||
skullc_install_packages(skullc messaging ${version})
|
set_target_properties(messaging
|
||||||
|
PROPERTIES
|
||||||
|
CXX_STANDARD 17
|
||||||
|
)
|
||||||
|
|
||||||
|
skullc_install_packages(skullc messaging ${SKULLC_VERSION})
|
||||||
|
|||||||
@ -10,5 +10,10 @@ target_include_directories(peripherals
|
|||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_target_properties(peripherals
|
||||||
|
PROPERTIES
|
||||||
|
CXX_STANDARD 17
|
||||||
|
)
|
||||||
|
|
||||||
## INSTALL
|
## INSTALL
|
||||||
skullc_install_packages(skullc peripherals ${version})
|
skullc_install_packages(skullc peripherals ${SKULLC_VERSION})
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
||||||
|
|
||||||
option(TESTS_WITH_SANITIZERS "Enable sanitizers for tests." ON)
|
option(SKULLC_TESTS_WITH_SANITIZERS "Enable sanitizers for tests." ON)
|
||||||
|
|
||||||
find_package(Catch2 REQUIRED)
|
include(FetchContent)
|
||||||
|
|
||||||
if(TESTS_WITH_SANITIZERS)
|
FetchContent_Declare(Catch2
|
||||||
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
|
GIT_TAG v2.13.8
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(Catch2)
|
||||||
|
|
||||||
|
if(SKULLC_TESTS_WITH_SANITIZERS)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
|
||||||
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
|
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fno-sanitize-recover")
|
||||||
endif()
|
endif()
|
||||||
@ -28,6 +34,12 @@ target_link_libraries(tests
|
|||||||
Catch2::Catch2
|
Catch2::Catch2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set_target_properties(tests
|
||||||
|
PROPERTIES
|
||||||
|
CXX_STANDARD 17
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(Catch)
|
include(Catch)
|
||||||
catch_discover_tests(tests)
|
catch_discover_tests(tests)
|
||||||
@ -1,10 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
||||||
|
|
||||||
#if(WITH_HAL)
|
|
||||||
# set(additional_sources
|
|
||||||
# )
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
add_library(utility STATIC
|
add_library(utility STATIC
|
||||||
Src/utility_logging.cpp
|
Src/utility_logging.cpp
|
||||||
Src/utility_rand.cpp
|
Src/utility_rand.cpp
|
||||||
@ -18,5 +13,9 @@ target_include_directories(utility
|
|||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Inc>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Inc>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
)
|
)
|
||||||
|
set_target_properties(utility
|
||||||
|
PROPERTIES
|
||||||
|
CXX_STANDARD 17
|
||||||
|
)
|
||||||
|
|
||||||
skullc_install_packages(skullc utility ${version})
|
skullc_install_packages(skullc utility ${SKULLC_VERSION})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user