From be87603fc49c952d8a8aae8896f1bd6db76b9de0 Mon Sep 17 00:00:00 2001 From: BadQuanta Date: Thu, 14 May 2026 01:47:20 +0000 Subject: [PATCH] First commit. --- .gitignore | 1 + CMakeLists.txt | 123 ++++++++++++++++++++++++++++++++++++++++++++++ CMakePresets.json | 76 ++++++++++++++++++++++++++++ INDEX.md | 43 ++++++++++++++++ 4 files changed, 243 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 CMakePresets.json create mode 100644 INDEX.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..83cdc2b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,123 @@ +cmake_minimum_required(VERSION 3.20) +project(hdk + VERSION 0.0.1 + LANGUAGES CXX + DESCRIPTION "holo development kit" +) + +option(HDK_TESTS "Build HDK tests" OFF) +option(HDK_EXAMPLES "Build HDK examples" OFF) +option(HDK_COVERAGE "Enable HDK coverage instrumentation and reporting" OFF) +set(HDK_COVERAGE_FAIL_UNDER 90 CACHE STRING "Minimum line coverage percentage required by strict coverage target") + +if(HDK_TESTS) + include(CTest) + enable_testing() + + include(FetchContent) + FetchContent_Declare( + doctest + GIT_REPOSITORY https://github.com/doctest/doctest.git + GIT_TAG v2.4.12 + ) + FetchContent_MakeAvailable(doctest) +endif() + +if(HDK_COVERAGE) + if(NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + message(WARNING "Coverage requested but compiler '${CMAKE_CXX_COMPILER_ID}' may not support --coverage.") + endif() + + add_library(hdk-coverage-flags INTERFACE) + target_compile_options( + hdk-coverage-flags + INTERFACE + -O0 + -g + --coverage + -fno-inline + -fno-inline-functions + -fno-default-inline + -fkeep-inline-functions + -fkeep-static-functions + ) + target_link_options(hdk-coverage-flags INTERFACE --coverage) +endif() + +add_subdirectory(grid) +add_subdirectory(sdl) +add_subdirectory(is3r) +#add_subdirectory(hogl) + +if(HDK_TESTS AND HDK_COVERAGE) + find_program(HDK_GCOVR_EXECUTABLE gcovr) + if(HDK_GCOVR_EXECUTABLE) + add_custom_target( + coverage + COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage + COMMAND + ${HDK_GCOVR_EXECUTABLE} + --root ${CMAKE_SOURCE_DIR} + --filter ${CMAKE_SOURCE_DIR}/grid/include + --filter ${CMAKE_SOURCE_DIR}/sdl/include + --exclude ${CMAKE_BINARY_DIR}/_deps + --print-summary + --fail-under-function ${HDK_COVERAGE_FAIL_UNDER} + --html-details ${CMAKE_BINARY_DIR}/coverage/index.html + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Run strict tests+coverage and generate report at ${CMAKE_BINARY_DIR}/coverage/index.html" + VERBATIM + ) + else() + message(WARNING "gcovr not found; coverage target will not be available.") + endif() +endif() + +# Option: DOCUMENTATION +option(HDK_DOCS "Build documentation" OFF) +if(HDK_DOCS) + # Doxygen + find_package(Doxygen) + if(DOXYGEN_FOUND) + set(DOXYGEN_GENERATE_HTML YES) + set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs) + set(DOXYGEN_STRIP_FROM_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + set(DOXYGEN_EXTRACT_ALL YES) + set(DOXYGEN_DIRECTORY_GRAPH YES) + set(DOXYGEN_JAVADOC_BANNER YES) + set(DOXYGEN_JAVADOC_AUTOBRIEF YES) + set(DOXYGEN_DOT_IMAGE_FORMAT svg) + set(DOXYGEN_INTERACTIVE_SVG YES) + set(DOXYGEN_INTERNAL_DOCS YES) + set(DOXYGEN_TIMESTAMP YES) + set(DOXYGEN_RECURSIVE YES) + set(DOXYGEN_TAB_SIZE 2) + set(DOXYGEN_BUILTIN_STL_SUPPORT YES) + set(DOXYGEN_HTML_DYNAMIC_SECTIONS YES) + set(DOXYGEN_USE_MDFILE_AS_MAINPAGE INDEX.md) + set(DOXYGEN_GENERATE_TREEVIEW YES) + set(DOXYGEN_FULL_SIDEBAR YES) + set(DOXYGEN_QUIET YES) + set(DOXYGEN_SOURCE_BROWSER YES) # https://www.doxygen.nl/manual/config.html#cfg_source_browser + # https://www.doxygen.nl/manual/config.html#cfg_verbatim_headers + set(DOXYGEN_VERBATIM_HEADERS YES) + set(DOXYGEN_REFERENCED_BY_RELATION YES) + set(DOXYGEN_REFERENCES_RELATION YES) + doxygen_add_docs(docs + ${CMAKE_CURRENT_SOURCE_DIR}/INDEX.md + ${CMAKE_CURRENT_SOURCE_DIR}/grid/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/grid/src/ + ${CMAKE_CURRENT_SOURCE_DIR}/grid/*.md + ${CMAKE_CURRENT_SOURCE_DIR}/sdl/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/sdl/examples/ + ${CMAKE_CURRENT_SOURCE_DIR}/sdl/src/ + ${CMAKE_CURRENT_SOURCE_DIR}/sdl/*.md + + #USE_STAMP_FILE + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generate API") + else() + message(WARNING "Doxygen not found, API documentation will not be generated.") + endif() +endif() diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..de4e347 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,76 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 20, + "patch": 0 + }, + "configurePresets": [ + { + "name": "base", + "hidden": true, + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "dev", + "displayName": "Dev", + "description": "Tests + examples enabled (Make)", + "inherits": "base", + "cacheVariables": { + "HDK_TESTS": "ON", + "HDK_EXAMPLES": "ON" + } + }, + { + "name": "coverage", + "displayName": "Coverage", + "description": "Tests + coverage instrumentation (Make)", + "inherits": "dev", + "cacheVariables": { + "HDK_COVERAGE": "ON" + } + }, + { + "name": "docs", + "displayName": "Docs", + "description": "Documentation only (Make)", + "inherits": "base", + "cacheVariables": { + "HDK_DOCS": "ON" + } + }, + { + "name": "release", + "displayName": "Release", + "description": "Optimised release build with examples (Make)", + "inherits": "base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "HDK_EXAMPLES": "ON" + } + } + ], + "buildPresets": [ + { "name": "dev", "configurePreset": "dev" }, + { "name": "coverage", "configurePreset": "coverage" }, + { "name": "docs", "configurePreset": "docs" }, + { "name": "release", "configurePreset": "release" } + ], + "testPresets": [ + { + "name": "test-dev", + "displayName": "Test (dev)", + "configurePreset": "dev", + "output": { "outputOnFailure": true } + }, + { + "name": "test-coverage", + "displayName": "Test (coverage)", + "configurePreset": "coverage", + "output": { "outputOnFailure": true } + } + ] +} \ No newline at end of file diff --git a/INDEX.md b/INDEX.md new file mode 100644 index 0000000..3b6fb3f --- /dev/null +++ b/INDEX.md @@ -0,0 +1,43 @@ +# H.D.K. -- Hollow Development Kit + +Complete development environment for hollow interactive environment development on compatible grid emitter systems. + +- [Doxygen generated documentation](https://ufp.institute/hdk/docs/) +- [Git repository](https://git.ufp.institute/ufp/hdk) + +## Submodules + +This repository is simply a collection of submodules that rely on each other to build the "hollow development kit". +The submodules are: + +- [grid](./grid/README.md) +- [sdl](./sdl/README.md) +- [dimgui](./dimgui/README.md) +- [dimgui-sdl](./dimgui-sdl/README.md) + +## Building + +The unifying build system for all submodules is CMake and this can be configured to build all submodules at once. + +To build the entire project, simply run the following commands in the root of the repository: + +```bash +mkdir build +cd build +cmake .. +cmake --build . +``` + +This will build all submodules and create the necessary libraries and executables for development. + +### Options + +These control the default state of submodules so enabling them will enable them by default everywhere. + +- `HDK_TESTS` +- `HDK_EXAMPLES` +- `HDK_COVERAGE` + +`HDK_COVERAGE_FAIL_UNDER` is a percentage threshold for code coverage that will cause the build to fail if not met. + +