aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt151
1 files changed, 32 insertions, 119 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0e45f8..2343c77 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,18 @@ project("kernel"
LANGUAGES ASM C CXX
)
+set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules")
+
+include("ElfTransformations")
+include("GenerateBootableIso")
+
+#[============================================================================[
+# Global Build System Options
+#]============================================================================]
+
+option(TEACHOS_ENABLE_LINTING "Enable linting during build" ON)
+option(TEACHOS_GENERATE_DOCS "Generate documentation during build" ON)
+
#[============================================================================[
# Global Build System Configuration
#]============================================================================]
@@ -15,61 +27,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION YES)
-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules")
-
-set(CMAKE_CXX_STANDARD "20")
+set(CMAKE_CXX_STANDARD "23")
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
-#[============================================================================[
-# Documentation
-#]============================================================================]
-
-find_package("Doxygen")
-
-set(DOXYGEN_GENERATE_HTML YES)
-set(DOXYGEN_GENERATE_XML YES)
-set(DOXYGEN_EXCLUDE_PATTERNS "*.cpp")
-set(DOXYGEN_OUTPUT_DIRECTORY "doxygen")
-set(DOXYGEN_QUIET YES)
-
-file(GLOB_RECURSE DOXYGEN_SOURCES CONFIGURE_DEPENDS "*.hpp")
-
-message(STATUS "${SPHINX_SOURCES}")
-
-doxygen_add_docs("docs_xml"
- ${DOXYGEN_SOURCES}
- ALL
- USE_STAMP_FILE
- COMMENT "Generating developer documentation sources"
-)
-
-set_target_properties("docs_xml" PROPERTIES
- ADDITIONAL_CLEAN_FILES
- "${PROJECT_BINARY_DIR}/doxygen"
-)
-
-file(GLOB_RECURSE SPHINX_SOURCES CONFIGURE_DEPENDS "../docs/**.rst")
-
-add_custom_target("docs" ALL
- COMMAND "${SPHINX_BUILD_EXE}"
- "../docs"
- "docs"
- "-q"
- DEPENDS "docs_xml"
- SOURCES ${SPHINX_SOURCES}
- COMMENT "Generating developer documentation html"
-)
-
-set_target_properties("docs" PROPERTIES
- ADDITIONAL_CLEAN_FILES
- "${PROJECT_BINARY_DIR}/docs"
-)
-
-#[============================================================================[
-# Global Compiler Configuration
-#]============================================================================]
-
add_compile_options(
"$<$<CXX_COMPILER_ID:GNU>:-Wall>"
"$<$<CXX_COMPILER_ID:GNU>:-Wextra>"
@@ -78,83 +39,35 @@ add_compile_options(
)
#[============================================================================[
-# Global Directories
-#]============================================================================]
-
-include_directories(
- "include"
- "arch/${CMAKE_SYSTEM_PROCESSOR}/include"
-)
-
-#[============================================================================[
-# The Bootstrap Library
-#]============================================================================]
-
-add_library("_boot" OBJECT)
-add_library("teachos::boot" ALIAS "_boot")
-
-#[============================================================================[
-# The Video Library
+# Global Linting Configuration
#]============================================================================]
-add_library("_video" OBJECT)
-add_library("teachos::video" ALIAS "_video")
+find_program(CLANG_TIDY_EXE "clang-tidy")
-#[============================================================================[
-# THE Memory Library
-#]============================================================================]
-
-add_library("_memory" OBJECT)
-add_library("teachos::memory" ALIAS "_memory")
+if(CLANG_TIDY_EXE AND TEACHOS_ENABLE_LINTING)
+ set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXE}")
+ set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
+endif()
#[============================================================================[
-# The Exception handling Library
+# Global Documentation Configuration
#]============================================================================]
-add_library("_exception" OBJECT)
-add_library("teachos::exception" ALIAS "_exception")
+find_package(Doxygen "1.10")
-#[============================================================================[
-# The Context switching Library
-#]============================================================================]
-
-add_library("_context" OBJECT)
-add_library("teachos::context_switching" ALIAS "_context")
-
-add_library("_interrupt_handling" OBJECT)
-add_library("teachos::interrupt_handling" ALIAS "_interrupt_handling")
-# https://forum.osdev.org/viewtopic.php?f=1&t=36712
-# https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#index-interrupt-function-attribute_002c-x86
-target_compile_options("_interrupt_handling" PRIVATE "-mgeneral-regs-only")
-
-#[============================================================================[
-# The Stub Standard Library
-#]============================================================================]
-
-add_library("_stl" OBJECT)
-add_library("teachos::stl" ALIAS "_stl")
-
-#[============================================================================[
-# The Kernel
-#]============================================================================]
-
-add_executable("_kernel"
- "src/kernel/main.cpp"
-)
-add_executable("teachos::kernel" ALIAS "_kernel")
-
-target_link_libraries("_kernel" PRIVATE
- "teachos::boot"
- "teachos::video"
- "teachos::memory"
- "teachos::exception"
- "teachos::stl"
- "teachos::context_switching"
- "teachos::interrupt_handling"
-)
+if(Doxygen_FOUND AND TEACHOS_GENERATE_DOCS)
+ doxygen_add_docs("docs"
+ ALL
+ COMMENT "Generating documentation"
+ CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile"
+ )
+endif()
#[============================================================================[
-# Platform Specific Components
+# Global Targets
#]============================================================================]
add_subdirectory("arch/${CMAKE_SYSTEM_PROCESSOR}")
+add_subdirectory("kapi")
+add_subdirectory("libs")
+add_subdirectory("kernel") \ No newline at end of file