Compare commits
No commits in common. "b1e0e6a9e00c5869612619e4c6d1a48af28eef42" and "4ef2bca643cf9848c7908806991452ed08f9b780" have entirely different histories.
b1e0e6a9e0
...
4ef2bca643
4 changed files with 97 additions and 42 deletions
14
.drone.yml
14
.drone.yml
|
|
@ -25,13 +25,13 @@ trigger:
|
|||
|
||||
steps:
|
||||
- name: unit tests
|
||||
image: ci:latest
|
||||
image: amd64_gcc_unit_tests:latest
|
||||
pull: if-not-exists
|
||||
commands:
|
||||
- ./tools/ci/amd64/gcc/unit_tests.sh
|
||||
|
||||
- name: valgrind
|
||||
image: ci:latest
|
||||
image: amd64_gcc_valgrind:latest
|
||||
pull: if-not-exists
|
||||
commands:
|
||||
- ./tools/ci/amd64/gcc/valgrind.sh
|
||||
|
|
@ -46,7 +46,7 @@ trigger:
|
|||
|
||||
steps:
|
||||
- name: code coverage
|
||||
image: ci:latest
|
||||
image: amd64_clang_coverage:latest
|
||||
pull: if-not-exists
|
||||
environment:
|
||||
CODECOV_TOKEN:
|
||||
|
|
@ -55,13 +55,13 @@ steps:
|
|||
- ./tools/ci/amd64/clang/coverage.sh
|
||||
|
||||
- name: leak sanitizer
|
||||
image: ci:latest
|
||||
image: amd64_clang_lsan:latest
|
||||
pull: if-not-exists
|
||||
commands:
|
||||
- ./tools/ci/amd64/clang/lsan.sh
|
||||
|
||||
- name: memory sanitizer
|
||||
image: ci:latest
|
||||
image: amd64_clang_msan:latest
|
||||
pull: if-not-exists
|
||||
commands:
|
||||
- ./tools/ci/amd64/clang/msan.sh
|
||||
|
|
@ -76,14 +76,14 @@ trigger:
|
|||
|
||||
steps:
|
||||
- name: clang tidy
|
||||
image: ci:latest
|
||||
image: clang_tidy:latest
|
||||
pull: if-not-exists
|
||||
privileged: true
|
||||
commands:
|
||||
- ./tools/ci/static_analysis/clang_tidy.sh
|
||||
|
||||
- name: clang format
|
||||
image: ci:latest
|
||||
image: clang_format:latest
|
||||
pull: if-not-exists
|
||||
commands:
|
||||
- ./tools/ci/static_analysis/clang_format.sh
|
||||
|
|
|
|||
|
|
@ -1,8 +1,41 @@
|
|||
cmake_minimum_required(VERSION 3.14)
|
||||
project(Light)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake)
|
||||
|
||||
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/options.cmake)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(${CMAKE_DIR}/functions.cmake)
|
||||
include(${CMAKE_DIR}/definitions.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)
|
||||
|
|
|
|||
54
conanfile.py
Normal file
54
conanfile.py
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
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()
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
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