Compare commits
1 commit
ae236efe2b
...
59d8c3cbde
Author | SHA1 | Date | |
---|---|---|---|
59d8c3cbde |
10 changed files with 36 additions and 99 deletions
46
.drone.yml
46
.drone.yml
|
@ -32,43 +32,8 @@ 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
|
||||||
|
@ -86,12 +51,5 @@ steps:
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
privileged: true
|
privileged: true
|
||||||
commands:
|
commands:
|
||||||
- |
|
- git submodule update --init --recursive
|
||||||
git submodule update --init --recursive
|
- conan build . -s build_type=Release -o enable_static_analysis=True --build=missing
|
||||||
|
|
||||||
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,15 +2,29 @@ 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/functions.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/macros.cmake)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/definitions.cmake)
|
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/dependencies.cmake)
|
add_option(ENABLE_STATIC_ANALYSIS "Enables clang-tidy static analysis")
|
||||||
|
|
||||||
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 ()
|
||||||
|
|
||||||
add_option(ENABLE_TESTS "Enables the building of the test modules")
|
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_subdirectory(./modules)
|
add_subdirectory(./modules)
|
||||||
add_subdirectory(./external)
|
add_subdirectory(./external)
|
||||||
|
|
|
@ -11,13 +11,11 @@ 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,
|
||||||
}
|
}
|
||||||
|
@ -45,7 +43,6 @@ 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
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
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,2 +1,4 @@
|
||||||
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,3 +1,6 @@
|
||||||
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)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
if(WIN32)
|
|
||||||
add_compile_definitions(LIGHT_PLATFORM_WINDOWS)
|
|
||||||
elseif(UNIX)
|
|
||||||
add_compile_definitions(LIGHT_PLATFORM_LINUX)
|
|
||||||
endif()
|
|
|
@ -1,9 +0,0 @@
|
||||||
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 @@
|
||||||
function (add_library_module libname)
|
macro (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 @@ function (add_library_module libname)
|
||||||
target_link_libraries(${libname} PUBLIC base)
|
target_link_libraries(${libname} PUBLIC base)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
endfunction ()
|
endmacro ()
|
||||||
|
|
||||||
function (add_executable_module exename)
|
macro (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,28 +36,11 @@ function (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} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
target_include_directories(${exename} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||||
target_link_libraries(${exename} PRIVATE base)
|
target_link_libraries(${exename} PUBLIC base)
|
||||||
endfunction ()
|
endmacro ()
|
||||||
|
|
||||||
function (add_test_module exename)
|
macro (add_option option help)
|
||||||
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})
|
||||||
|
@ -66,4 +49,4 @@ function (add_option option help)
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "${option}: OFF")
|
message(STATUS "${option}: OFF")
|
||||||
endif ()
|
endif ()
|
||||||
endfunction ()
|
endmacro ()
|
Loading…
Add table
Reference in a new issue