diff --git a/CMakeLists.txt b/CMakeLists.txt index d8b8c1b..0520205 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,29 +2,15 @@ cmake_minimum_required(VERSION 3.14) project(Light) set(CMAKE_CXX_STANDARD 23) -include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/macros.cmake) - -add_option(ENABLE_STATIC_ANALYSIS "Enables clang-tidy static analysis") +include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/functions.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/definitions.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/dependencies.cmake) +add_option(ENABLE_STATIC_ANALYSIS "Performs static analysis via clang-tidy and fails build on failing checks") if (ENABLE_STATIC_ANALYSIS) set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--warnings-as-errors=*;--allow-no-checks") endif () -if(WIN32) - add_compile_definitions(LIGHT_PLATFORM_WINDOWS) -elseif(UNIX) - add_compile_definitions(LIGHT_PLATFORM_LINUX) -endif() - -find_package(glfw3 REQUIRED) -find_package(glm REQUIRED) -find_package(spdlog REQUIRED) -find_package(stb REQUIRED) -find_package(yaml-cpp REQUIRED) -find_package(EnTT REQUIRED) -find_package(opengl_system REQUIRED) -find_package(nlohmann_json REQUIRED) -find_package(lz4 REQUIRED) - +add_option(ENABLE_TESTS "Enables the building of the test modules") add_subdirectory(./modules) add_subdirectory(./external) diff --git a/conanfile.py b/conanfile.py index c4683e8..c96cb7e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -11,11 +11,13 @@ class LightRecipe(ConanFile): generators = "CMakeDeps" options = { + "enable_tests": [True, False], "enable_static_analysis": [True, False], "export_compile_commands": [True, False], } default_options = { + "enable_tests": True, "export_compile_commands": True, "enable_static_analysis": False, } @@ -43,6 +45,7 @@ class LightRecipe(ConanFile): tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = self.options.export_compile_commands tc.cache_variables["ENABLE_STATIC_ANALYSIS"] = self.options.enable_static_analysis + tc.cache_variables["ENABLE_TESTS"] = self.options.enable_tests repo = git.Repo(search_parent_directories=True) tc.cache_variables["GIT_HASH"] = repo.head.object.hexsha diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..3dea870 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,6 @@ +A bleeding-edge, cross-platform, cross-graphics-api, minimal-dependencies modern game-engine. + +Supported Platforms: Windows, Mac, Linux, FreeBSD +Supported GraphicsAPIs: DirectX12-Ultimate, Vulkan 1.4, Metal, OpenGL 4.6 + +Dependencies: stdlib, meshoptimizer diff --git a/tools/cmake/definitions.cmake b/tools/cmake/definitions.cmake new file mode 100644 index 0000000..5668a69 --- /dev/null +++ b/tools/cmake/definitions.cmake @@ -0,0 +1,5 @@ +if(WIN32) + add_compile_definitions(LIGHT_PLATFORM_WINDOWS) +elseif(UNIX) + add_compile_definitions(LIGHT_PLATFORM_LINUX) +endif() diff --git a/tools/cmake/dependencies.cmake b/tools/cmake/dependencies.cmake new file mode 100644 index 0000000..97676cd --- /dev/null +++ b/tools/cmake/dependencies.cmake @@ -0,0 +1,9 @@ +find_package(glfw3 REQUIRED) +find_package(glm REQUIRED) +find_package(spdlog REQUIRED) +find_package(stb REQUIRED) +find_package(yaml-cpp REQUIRED) +find_package(EnTT REQUIRED) +find_package(opengl_system REQUIRED) +find_package(nlohmann_json REQUIRED) +find_package(lz4 REQUIRED) diff --git a/tools/cmake/macros.cmake b/tools/cmake/functions.cmake similarity index 89% rename from tools/cmake/macros.cmake rename to tools/cmake/functions.cmake index 9f879ab..b62d542 100644 --- a/tools/cmake/macros.cmake +++ b/tools/cmake/functions.cmake @@ -1,4 +1,4 @@ -macro (add_library_module libname) +function (add_library_module libname) if ("${ARGN}" STREQUAL "") # Header only library message("Adding INTERFACE library ${libname}") add_library(${libname} INTERFACE) @@ -25,9 +25,9 @@ macro (add_library_module libname) target_link_libraries(${libname} PUBLIC base) endif () endif () -endmacro () +endfunction () -macro (add_executable_module exename) +function (add_executable_module exename) set(source_files) set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/src") foreach (source_file ${ARGN}) @@ -38,9 +38,13 @@ macro (add_executable_module exename) add_executable(${exename} ${source_files}) target_include_directories(${exename} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_link_libraries(${exename} PRIVATE base) -endmacro () +endfunction () + +function (add_test_module exename) + if (NOT ${ENABLE_TESTS}) + return() + endif () -macro (add_test_module exename) set(source_files) set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/src") foreach (source_file ${ARGN}) @@ -51,9 +55,9 @@ macro (add_test_module exename) add_executable(${exename}_tests ${source_files}) target_include_directories(${exename} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) target_link_libraries(${exename}_tests PRIVATE ${exename} base test) -endmacro () +endfunction () -macro (add_option option help) +function (add_option option help) option(${option} ${help}) if (${option}) @@ -62,4 +66,4 @@ macro (add_option option help) else () message(STATUS "${option}: OFF") endif () -endmacro () +endfunction ()