diff --git a/cmake/FindEIGEN.cmake b/cmake/FindEIGEN.cmake deleted file mode 100644 index b69e4d53e039da1d201719409bb402cd90c75ca9..0000000000000000000000000000000000000000 --- a/cmake/FindEIGEN.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) 2021 Skyward Experimental Rocketry -# Author: Damiano Amatruda -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -find_path(EIGEN_INCLUDE_DIR - NAMES signature_of_eigen3_matrix_library - PATHS ${SBS_BASE}/libs/eigen -) -set(EIGEN_CFLAGS EIGEN_MAX_ALIGN_BYTES=0) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(EIGEN - FOUND_VAR EIGEN_FOUND - REQUIRED_VARS EIGEN_INCLUDE_DIR -) - -if(EIGEN_FOUND) - set(EIGEN_INCLUDE_DIRS ${EIGEN_INCLUDE_DIR}) - set(EIGEN_DEFINITIONS ${EIGEN_CFLAGS}) -endif() - -mark_as_advanced(EIGEN_INCLUDE_DIR) diff --git a/cmake/FindFMT.cmake b/cmake/FindFMT.cmake deleted file mode 100644 index baebb9c8fd79b9b1c4b266dc22a3ecdc564ec2e7..0000000000000000000000000000000000000000 --- a/cmake/FindFMT.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2021 Skyward Experimental Rocketry -# Author: Damiano Amatruda -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -find_path(FMT_INCLUDE_DIR - NAMES fmt/format.h - PATHS ${SBS_BASE}/libs/fmt/include -) -find_library(FMT_LIBRARY - NAMES fmt - PATHS ${SBS_BASE}/libs/fmt -) -set(FMT_CFLAGS FMT_STATIC_THOUSANDS_SEPARATOR _GLIBCXX_USE_WCHAR_T) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FMT - FOUND_VAR FMT_FOUND - REQUIRED_VARS FMT_INCLUDE_DIR FMT_LIBRARY -) - -if(FMT_FOUND) - set(FMT_INCLUDE_DIRS ${FMT_INCLUDE_DIR}) - set(FMT_LIBRARIES ${FMT_LIBRARY}) - set(FMT_DEFINITIONS ${FMT_CFLAGS}) -endif() - -mark_as_advanced(FMT_INCLUDE_DIR FMT_LIBRARY) diff --git a/cmake/FindMXGUI.cmake b/cmake/FindMXGUI.cmake deleted file mode 100644 index 01d3b488e0e59344eaa745153cd6207e4fb24964..0000000000000000000000000000000000000000 --- a/cmake/FindMXGUI.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2021 Skyward Experimental Rocketry -# Author: Damiano Amatruda -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -find_path(MXGUI_INCLUDE_DIR1 - NAMES mxgui/display.h - PATHS ${SBS_BASE}/libs -) - -find_path(MXGUI_INCLUDE_DIR2 - NAMES config/mxgui_settings.h - PATHS ${SBS_BASE}/libs/mxgui -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(MXGUI - FOUND_VAR MXGUI_FOUND - REQUIRED_VARS MXGUI_INCLUDE_DIR1 MXGUI_INCLUDE_DIR2 -) - -if(MXGUI_FOUND) - set(MXGUI_INCLUDE_DIRS ${MXGUI_INCLUDE_DIR1} ${MXGUI_INCLUDE_DIR2}) -endif() - -mark_as_advanced(MXGUI_INCLUDE_DIR1 MXGUI_INCLUDE_DIR2) diff --git a/cmake/FindTSCPP.cmake b/cmake/FindTSCPP.cmake deleted file mode 100644 index 0683dd65b825902202a86fb8cc19b0b9c0443221..0000000000000000000000000000000000000000 --- a/cmake/FindTSCPP.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2021 Skyward Experimental Rocketry -# Author: Damiano Amatruda -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -find_path(TSCPP_INCLUDE_DIR - NAMES tscpp/buffer.h - PATHS ${SBS_BASE}/libs -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(TSCPP - FOUND_VAR TSCPP_FOUND - REQUIRED_VARS TSCPP_INCLUDE_DIR -) - -if(TSCPP_FOUND) - set(TSCPP_INCLUDE_DIRS ${TSCPP_INCLUDE_DIR}) -endif() - -mark_as_advanced(TSCPP_INCLUDE_DIR) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 324a4bc71ecec9e21e0e6ccad6cf6e00f1dbfc2f..6d111d28cec1455fa302535369414daa67cf262b 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -19,10 +19,20 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -find_package(EIGEN) -find_package(FMT) -find_package(MXGUI) -find_package(TSCPP) +add_subdirectory(${KPATH} EXCLUDE_FROM_ALL) + +add_subdirectory(${SBS_BASE}/libs/mxgui EXCLUDE_FROM_ALL) + +set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) +set(BUILD_TESTING OFF CACHE BOOL "Enable creation of Eigen tests.") +set(EIGEN_TEST_NOQT ON CACHE BOOL "Disable Qt support in unit tests") +set(CMAKE_Fortran_COMPILER NOTFOUND) +add_subdirectory(${SBS_BASE}/libs/eigen EXCLUDE_FROM_ALL) +target_compile_definitions(eigen INTERFACE EIGEN_MAX_ALIGN_BYTES=0) + +add_subdirectory(${SBS_BASE}/libs/fmt EXCLUDE_FROM_ALL) +target_compile_definitions(fmt-header-only INTERFACE _GLIBCXX_USE_WCHAR_T FMT_UNICODE=0 FMT_STATIC_THOUSANDS_SEPARATOR=0) +target_compile_options(fmt-header-only INTERFACE -fno-math-errno) set(SHARED_SOURCES ${SBS_BASE}/src/shared/scheduler/TaskScheduler.cpp diff --git a/cmake/sbs.cmake b/cmake/sbs.cmake index ba29b7b61dc2689bb8777e3caa3770aba08fd163..f2a25c08630851e6c01ab1050f1bc4ccc0b8430a 100644 --- a/cmake/sbs.cmake +++ b/cmake/sbs.cmake @@ -37,7 +37,16 @@ endif() include(dependencies) -function(sbs_get_board TARGET) +function(sbs_mxgui TARGET) + get_target_property(OPT_BOARD ${TARGET} OPT_BOARD) + if(NOT OPT_BOARD) + message(FATAL_ERROR "No board selected") + endif() + + target_link_libraries(${TARGET} mxgui::mxgui-${OPT_BOARD}) +endfunction() + +function(sbs_target TARGET) get_target_property(OPT_BOARD ${TARGET} OPT_BOARD) if(NOT OPT_BOARD) message(FATAL_ERROR "No board selected") @@ -45,7 +54,7 @@ function(sbs_get_board TARGET) set(OPT_BOARD ${OPT_BOARD} PARENT_SCOPE) endfunction() -function(sbs_mxgui TARGET) +function(sbs_link_mxgui TARGET) sbs_get_board(${TARGET}) target_link_libraries(${TARGET} PRIVATE mxgui::mxgui-${OPT_BOARD}) endfunction()