Compare commits
4 commits
59d8c3cbde
...
ae236efe2b
Author | SHA1 | Date | |
---|---|---|---|
ae236efe2b | |||
38cabb6b32 | |||
b25ea41096 | |||
a54885b02e |
10 changed files with 100 additions and 37 deletions
48
.drone.yml
48
.drone.yml
|
@ -32,8 +32,43 @@ steps:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit ${has_fomatting_issues}
|
exit ${has_fomatting_issues}
|
||||||
---
|
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: unit tests
|
||||||
|
clone:
|
||||||
|
recursive: true
|
||||||
|
submodule_update_remote: true
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: unit tests
|
||||||
|
image: unit_tests:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
- |
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
conan build . \
|
||||||
|
-c tools.system.package_manager:mode=install \
|
||||||
|
-s build_type=Release \
|
||||||
|
-o enable_static_analysis=False \
|
||||||
|
-o enable_tests=True \
|
||||||
|
--build=missing
|
||||||
|
|
||||||
|
find ./build \
|
||||||
|
-type f \
|
||||||
|
-name '*_tests' \
|
||||||
|
-executable \
|
||||||
|
-exec sh -c \
|
||||||
|
'{}' \
|
||||||
|
\;
|
||||||
|
|
||||||
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: static analysis
|
name: static analysis
|
||||||
|
@ -51,5 +86,12 @@ steps:
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
privileged: true
|
privileged: true
|
||||||
commands:
|
commands:
|
||||||
- git submodule update --init --recursive
|
- |
|
||||||
- conan build . -s build_type=Release -o enable_static_analysis=True --build=missing
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
conan build . \
|
||||||
|
-c tools.system.package_manager:mode=install \
|
||||||
|
-s build_type=Release \
|
||||||
|
-o enable_static_analysis=True \
|
||||||
|
-o enable_tests=True \
|
||||||
|
--build=missing
|
||||||
|
|
|
@ -2,29 +2,15 @@ cmake_minimum_required(VERSION 3.14)
|
||||||
project(Light)
|
project(Light)
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/macros.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/functions.cmake)
|
||||||
|
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/definitions.cmake)
|
||||||
add_option(ENABLE_STATIC_ANALYSIS "Enables clang-tidy static analysis")
|
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)
|
if (ENABLE_STATIC_ANALYSIS)
|
||||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--warnings-as-errors=*;--allow-no-checks")
|
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--warnings-as-errors=*;--allow-no-checks")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if(WIN32)
|
add_option(ENABLE_TESTS "Enables the building of the test modules")
|
||||||
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_subdirectory(./modules)
|
add_subdirectory(./modules)
|
||||||
add_subdirectory(./external)
|
add_subdirectory(./external)
|
||||||
|
|
|
@ -11,11 +11,13 @@ class LightRecipe(ConanFile):
|
||||||
generators = "CMakeDeps"
|
generators = "CMakeDeps"
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
"enable_tests": [True, False],
|
||||||
"enable_static_analysis": [True, False],
|
"enable_static_analysis": [True, False],
|
||||||
"export_compile_commands": [True, False],
|
"export_compile_commands": [True, False],
|
||||||
}
|
}
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
|
"enable_tests": True,
|
||||||
"export_compile_commands": True,
|
"export_compile_commands": True,
|
||||||
"enable_static_analysis": False,
|
"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["CMAKE_EXPORT_COMPILE_COMMANDS"] = self.options.export_compile_commands
|
||||||
tc.cache_variables["ENABLE_STATIC_ANALYSIS"] = self.options.enable_static_analysis
|
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)
|
repo = git.Repo(search_parent_directories=True)
|
||||||
tc.cache_variables["GIT_HASH"] = repo.head.object.hexsha
|
tc.cache_variables["GIT_HASH"] = repo.head.object.hexsha
|
||||||
|
|
6
docs/index.rst
Normal file
6
docs/index.rst
Normal file
|
@ -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
|
|
@ -1,4 +1,2 @@
|
||||||
add_library_module(test test.cpp entrypoint.cpp)
|
add_library_module(test test.cpp entrypoint.cpp)
|
||||||
|
add_test_module(test test.tests.cpp)
|
||||||
add_executable(test_tests ${CMAKE_CURRENT_SOURCE_DIR}/tests/test.cpp)
|
|
||||||
target_link_libraries(test_tests PRIVATE test)
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
add_library_module(time timer.cpp)
|
add_library_module(time timer.cpp)
|
||||||
|
add_test_module(time timer.tests.cpp)
|
||||||
add_executable(timer_tests ${CMAKE_CURRENT_SOURCE_DIR}/src/timer.tests.cpp)
|
|
||||||
target_include_directories(timer_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
target_link_libraries(timer_tests PRIVATE time test)
|
|
||||||
|
|
||||||
|
|
5
tools/cmake/definitions.cmake
Normal file
5
tools/cmake/definitions.cmake
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
if(WIN32)
|
||||||
|
add_compile_definitions(LIGHT_PLATFORM_WINDOWS)
|
||||||
|
elseif(UNIX)
|
||||||
|
add_compile_definitions(LIGHT_PLATFORM_LINUX)
|
||||||
|
endif()
|
9
tools/cmake/dependencies.cmake
Normal file
9
tools/cmake/dependencies.cmake
Normal file
|
@ -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)
|
|
@ -1,4 +1,4 @@
|
||||||
macro (add_library_module libname)
|
function (add_library_module libname)
|
||||||
if ("${ARGN}" STREQUAL "") # Header only library
|
if ("${ARGN}" STREQUAL "") # Header only library
|
||||||
message("Adding INTERFACE library ${libname}")
|
message("Adding INTERFACE library ${libname}")
|
||||||
add_library(${libname} INTERFACE)
|
add_library(${libname} INTERFACE)
|
||||||
|
@ -25,9 +25,9 @@ macro (add_library_module libname)
|
||||||
target_link_libraries(${libname} PUBLIC base)
|
target_link_libraries(${libname} PUBLIC base)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
endmacro ()
|
endfunction ()
|
||||||
|
|
||||||
macro (add_executable_module exename)
|
function (add_executable_module exename)
|
||||||
set(source_files)
|
set(source_files)
|
||||||
set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||||
foreach (source_file ${ARGN})
|
foreach (source_file ${ARGN})
|
||||||
|
@ -36,11 +36,28 @@ macro (add_executable_module exename)
|
||||||
|
|
||||||
message("Adding executable ${exename} with source files: ${source_files}")
|
message("Adding executable ${exename} with source files: ${source_files}")
|
||||||
add_executable(${exename} ${source_files})
|
add_executable(${exename} ${source_files})
|
||||||
target_include_directories(${exename} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
target_include_directories(${exename} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
target_link_libraries(${exename} PUBLIC base)
|
target_link_libraries(${exename} PRIVATE base)
|
||||||
endmacro ()
|
endfunction ()
|
||||||
|
|
||||||
macro (add_option option help)
|
function (add_test_module exename)
|
||||||
|
if (NOT ${ENABLE_TESTS})
|
||||||
|
return()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(source_files)
|
||||||
|
set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||||
|
foreach (source_file ${ARGN})
|
||||||
|
list(APPEND source_files "${source_directory}/${source_file}")
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
message("Adding test executable ${exename}_tests with source files: ${source_files}")
|
||||||
|
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)
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
|
function (add_option option help)
|
||||||
option(${option} ${help})
|
option(${option} ${help})
|
||||||
|
|
||||||
if (${option})
|
if (${option})
|
||||||
|
@ -49,4 +66,4 @@ macro (add_option option help)
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "${option}: OFF")
|
message(STATUS "${option}: OFF")
|
||||||
endif ()
|
endif ()
|
||||||
endmacro ()
|
endfunction ()
|
Loading…
Add table
Reference in a new issue