Compare commits
3 commits
4ef2bca643
...
b1e0e6a9e0
| Author | SHA1 | Date | |
|---|---|---|---|
| b1e0e6a9e0 | |||
| fa8a1c53b4 | |||
| e3a20e2c33 |
4 changed files with 42 additions and 97 deletions
14
.drone.yml
14
.drone.yml
|
|
@ -25,13 +25,13 @@ trigger:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: unit tests
|
- name: unit tests
|
||||||
image: amd64_gcc_unit_tests:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/amd64/gcc/unit_tests.sh
|
- ./tools/ci/amd64/gcc/unit_tests.sh
|
||||||
|
|
||||||
- name: valgrind
|
- name: valgrind
|
||||||
image: amd64_gcc_valgrind:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/amd64/gcc/valgrind.sh
|
- ./tools/ci/amd64/gcc/valgrind.sh
|
||||||
|
|
@ -46,7 +46,7 @@ trigger:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: code coverage
|
- name: code coverage
|
||||||
image: amd64_clang_coverage:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
environment:
|
environment:
|
||||||
CODECOV_TOKEN:
|
CODECOV_TOKEN:
|
||||||
|
|
@ -55,13 +55,13 @@ steps:
|
||||||
- ./tools/ci/amd64/clang/coverage.sh
|
- ./tools/ci/amd64/clang/coverage.sh
|
||||||
|
|
||||||
- name: leak sanitizer
|
- name: leak sanitizer
|
||||||
image: amd64_clang_lsan:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/amd64/clang/lsan.sh
|
- ./tools/ci/amd64/clang/lsan.sh
|
||||||
|
|
||||||
- name: memory sanitizer
|
- name: memory sanitizer
|
||||||
image: amd64_clang_msan:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/amd64/clang/msan.sh
|
- ./tools/ci/amd64/clang/msan.sh
|
||||||
|
|
@ -76,14 +76,14 @@ trigger:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: clang tidy
|
- name: clang tidy
|
||||||
image: clang_tidy:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
privileged: true
|
privileged: true
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/static_analysis/clang_tidy.sh
|
- ./tools/ci/static_analysis/clang_tidy.sh
|
||||||
|
|
||||||
- name: clang format
|
- name: clang format
|
||||||
image: clang_format:latest
|
image: ci:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands:
|
commands:
|
||||||
- ./tools/ci/static_analysis/clang_format.sh
|
- ./tools/ci/static_analysis/clang_format.sh
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,8 @@
|
||||||
cmake_minimum_required(VERSION 3.14)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
project(Light)
|
project(Light)
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
|
||||||
set(CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake)
|
|
||||||
|
|
||||||
include(CheckCXXSourceCompiles)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/functions.cmake)
|
||||||
include(${CMAKE_DIR}/functions.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/definitions.cmake)
|
||||||
include(${CMAKE_DIR}/definitions.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake/options.cmake)
|
||||||
|
|
||||||
add_option(ENABLE_UNIT_TESTS "Enables the building of the unit test modules")
|
|
||||||
add_option(ENABLE_FUZZ_TESTS "Enables the building of the fuzz test modules")
|
|
||||||
|
|
||||||
add_option(ENABLE_STATIC_ANALYSIS "Makes clang-tidy checks mandatory for compilation")
|
|
||||||
if (ENABLE_STATIC_ANALYSIS)
|
|
||||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--warnings-as-errors=*;--allow-no-checks")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_option(ENABLE_LLVM_COVERAGE "Enables the code coverage instrumentation for clang")
|
|
||||||
if(ENABLE_LLVM_COVERAGE)
|
|
||||||
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
||||||
message(FATAL_ERROR "ENABLE_LLVM_COVERAGE only supports the clang compiler")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Check for libc++
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#include <string>
|
|
||||||
#ifdef _LIBCPP_VERSION
|
|
||||||
int main() { return 0; }
|
|
||||||
#else
|
|
||||||
#error Not using libc++
|
|
||||||
#endif
|
|
||||||
" USING_LIBCXX)
|
|
||||||
if(NOT USING_LIBCXX)
|
|
||||||
message(FATAL_ERROR "ENABLE_LLVM_COVERAGE requires libc++, please compile with -stdlib=libc++")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
|
|
||||||
add_link_options(-fprofile-instr-generate -fcoverage-mapping)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/modules)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/modules)
|
||||||
|
|
|
||||||
54
conanfile.py
54
conanfile.py
|
|
@ -1,54 +0,0 @@
|
||||||
from conan import ConanFile
|
|
||||||
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
|
|
||||||
import git
|
|
||||||
|
|
||||||
class LightRecipe(ConanFile):
|
|
||||||
name = "Light Engine"
|
|
||||||
|
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
|
||||||
generators = "CMakeDeps"
|
|
||||||
|
|
||||||
options = {
|
|
||||||
"enable_unit_tests": [True, False],
|
|
||||||
"enable_fuzz_tests": [True, False],
|
|
||||||
"enable_llvm_coverage": [True, False],
|
|
||||||
"enable_static_analysis": [True, False],
|
|
||||||
"use_mold": [True, False],
|
|
||||||
"export_compile_commands": [True, False],
|
|
||||||
}
|
|
||||||
|
|
||||||
default_options = {
|
|
||||||
"enable_unit_tests": True,
|
|
||||||
"enable_fuzz_tests": False,
|
|
||||||
"enable_llvm_coverage": False,
|
|
||||||
"enable_static_analysis": False,
|
|
||||||
"use_mold": False,
|
|
||||||
"export_compile_commands": True,
|
|
||||||
}
|
|
||||||
|
|
||||||
def layout(self):
|
|
||||||
cmake_layout(self)
|
|
||||||
|
|
||||||
def generate(self):
|
|
||||||
tc = CMakeToolchain(self)
|
|
||||||
|
|
||||||
tc.variables["CMAKE_BUILD_TYPE"] = self.settings.build_type
|
|
||||||
|
|
||||||
if self.options.use_mold:
|
|
||||||
tc.cache_variables["CMAKE_LINKER_TYPE"] = "MOLD"
|
|
||||||
|
|
||||||
tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = self.options.export_compile_commands
|
|
||||||
tc.cache_variables["ENABLE_UNIT_TESTS"] = self.options.enable_unit_tests
|
|
||||||
tc.cache_variables["ENABLE_FUZZ_TESTS"] = self.options.enable_fuzz_tests
|
|
||||||
tc.cache_variables["ENABLE_LLVM_COVERAGE"] = self.options.enable_llvm_coverage
|
|
||||||
tc.cache_variables["ENABLE_STATIC_ANALYSIS"] = self.options.enable_static_analysis
|
|
||||||
|
|
||||||
repo = git.Repo(search_parent_directories=True)
|
|
||||||
tc.cache_variables["GIT_HASH"] = repo.head.object.hexsha
|
|
||||||
|
|
||||||
tc.generate()
|
|
||||||
|
|
||||||
def build(self):
|
|
||||||
cmake = CMake(self)
|
|
||||||
cmake.configure()
|
|
||||||
cmake.build()
|
|
||||||
32
tools/cmake/options.cmake
Normal file
32
tools/cmake/options.cmake
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
add_option(ENABLE_UNIT_TESTS "Enables the building of the unit test modules")
|
||||||
|
add_option(ENABLE_FUZZ_TESTS "Enables the building of the fuzz test modules")
|
||||||
|
add_option(ENABLE_STATIC_ANALYSIS "Makes the clang-tidy checks mandatory for compilation")
|
||||||
|
add_option(ENABLE_LLVM_COVERAGE "Enables the code coverage instrumentation for clang")
|
||||||
|
|
||||||
|
if (ENABLE_STATIC_ANALYSIS)
|
||||||
|
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;--warnings-as-errors=*;--allow-no-checks")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if(ENABLE_LLVM_COVERAGE)
|
||||||
|
include(CheckCXXSourceCompiles)
|
||||||
|
|
||||||
|
if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
|
message(FATAL_ERROR "ENABLE_LLVM_COVERAGE only supports the clang compiler")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Check for libc++
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#include <string>
|
||||||
|
#ifdef _LIBCPP_VERSION
|
||||||
|
int main() { return 0; }
|
||||||
|
#else
|
||||||
|
#error Not using libc++
|
||||||
|
#endif
|
||||||
|
" USING_LIBCXX)
|
||||||
|
if(NOT USING_LIBCXX)
|
||||||
|
message(FATAL_ERROR "ENABLE_LLVM_COVERAGE requires libc++, please compile with -stdlib=libc++")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
|
||||||
|
add_link_options(-fprofile-instr-generate -fcoverage-mapping)
|
||||||
|
endif ()
|
||||||
Loading…
Add table
Reference in a new issue