aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt54
1 files changed, 51 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2343c77..f7c7fe8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,29 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules")
include("ElfTransformations")
include("GenerateBootableIso")
+include("CTest")
+include("EnableCoverage")
+
+#[============================================================================[
+# External Dependencies
+#]============================================================================]
+
+include("FetchContent")
+
+if (BUILD_TESTING)
+ FetchContent_Declare(
+ "Catch2"
+ URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.7.1.tar.gz"
+ URL_HASH "SHA256=c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c"
+ EXCLUDE_FROM_ALL
+ FIND_PACKAGE_ARGS
+ )
+
+ FetchContent_MakeAvailable("Catch2")
+
+ add_compile_definitions("CATCH_CONFIG_NO_COUNTER")
+ set(CATCH_TEST_ARGS "EXTRA_ARGS" "--reporter" "junit::out=junit.xml" "--reporter" "console::out=-::colour-mode=ansi")
+endif()
#[============================================================================[
# Global Build System Options
@@ -23,6 +46,10 @@ option(TEACHOS_GENERATE_DOCS "Generate documentation during build" ON)
# Global Build System Configuration
#]============================================================================]
+if(POLICY CMP0209)
+ cmake_policy(SET CMP0209 NEW)
+endif()
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION YES)
@@ -42,7 +69,12 @@ add_compile_options(
# Global Linting Configuration
#]============================================================================]
-find_program(CLANG_TIDY_EXE "clang-tidy")
+find_program(CLANG_TIDY_EXE NAMES
+ "clang-tidy-23"
+ "clang-tidy-22"
+ "clang-tidy-21"
+ "clang-tidy"
+)
if(CLANG_TIDY_EXE AND TEACHOS_ENABLE_LINTING)
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}")
@@ -64,10 +96,26 @@ if(Doxygen_FOUND AND TEACHOS_GENERATE_DOCS)
endif()
#[============================================================================[
+# Build Host Testing
+#]============================================================================]
+
+if(BUILD_TESTING)
+ if(TARGET "Catch2" AND TARGET "Catch2WithMain")
+ set_target_properties("Catch2" "Catch2WithMain" PROPERTIES
+ C_CLANG_TIDY ""
+ CXX_CLANG_TIDY ""
+ )
+ endif()
+endif()
+
+#[============================================================================[
# Global Targets
#]============================================================================]
-add_subdirectory("arch/${CMAKE_SYSTEM_PROCESSOR}")
+if(CMAKE_CROSSCOMPILING)
+ add_subdirectory("arch/${CMAKE_SYSTEM_PROCESSOR}")
+endif()
+
add_subdirectory("kapi")
+add_subdirectory("kernel")
add_subdirectory("libs")
-add_subdirectory("kernel") \ No newline at end of file