Compare commits
No commits in common. "cc97efe919679a0a94351d299af3dbdcd65577e0" and "b01213c9ea72e26b437be76867c0f40852af47b7" have entirely different histories.
cc97efe919
...
b01213c9ea
24 changed files with 391 additions and 146 deletions
62
.gitignore
vendored
62
.gitignore
vendored
|
@ -1,5 +1,65 @@
|
||||||
build/
|
build/
|
||||||
.cache/
|
.cache/
|
||||||
|
|
||||||
compile_commands.json
|
# ---> C++
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# ---> Rust
|
||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
debug/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||||
|
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||||
|
Cargo.lock
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# ---> CMake
|
||||||
|
CMakeLists.txt.user
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
CMakeScripts
|
||||||
|
Testing
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
compile_commands.json
|
||||||
|
CTestTestfile.cmake
|
||||||
|
_deps
|
||||||
|
|
|
@ -1,9 +1,21 @@
|
||||||
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||||
project("light" LANGUAGES CXX)
|
project("light" LANGUAGES CXX)
|
||||||
|
|
||||||
|
include(tools/cmake/preliminary.cmake)
|
||||||
|
include(tools/cmake/module_macros.cmake)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 26)
|
set(CMAKE_CXX_STANDARD 26)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
||||||
|
add_option(ENABLE_SANITIZERS "Enables fsan sanitizers")
|
||||||
|
add_option(ENABLE_STATIC_ANALYSIS "Enables clang-tidy static analysis")
|
||||||
|
|
||||||
|
find_package(benchmark REQUIRED)
|
||||||
|
find_package(GTest REQUIRED)
|
||||||
|
|
||||||
|
if(ENABLE_STATIC_ANALYSIS)
|
||||||
|
find_program(CLANG_TIDY_EXE NAMES "clang-tidy" REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(docs)
|
add_subdirectory(docs)
|
||||||
add_subdirectory(modules)
|
add_subdirectory(modules)
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
# light
|
# light
|
||||||
|
|
||||||
Dependency-free game engine for the developer to figure out how EVERYTHING works!
|
Monorepo for a cross-platform, cross-graphics-api, high-performance, modular, and modern game-engine.
|
||||||
|
|
||||||
May not be the best, but makes me lock in and learn so much ^^
|
|
||||||
|
|
58
conanfile.py
Normal file
58
conanfile.py
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
from conan import ConanFile
|
||||||
|
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
|
||||||
|
import shutil
|
||||||
|
import os
|
||||||
|
|
||||||
|
class LightRecipe(ConanFile):
|
||||||
|
name = "light"
|
||||||
|
|
||||||
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
|
generators = "CMakeDeps"
|
||||||
|
|
||||||
|
requires = [
|
||||||
|
"benchmark/1.8.4",
|
||||||
|
"gtest/1.14.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
tool_requires = [
|
||||||
|
"cmake/3.30.0"
|
||||||
|
]
|
||||||
|
|
||||||
|
options = {
|
||||||
|
"enable_static_analysis": [True, False],
|
||||||
|
"enable_sanitizers": [True, False],
|
||||||
|
}
|
||||||
|
|
||||||
|
default_options = {
|
||||||
|
"enable_static_analysis": True,
|
||||||
|
"enable_sanitizers": False,
|
||||||
|
}
|
||||||
|
|
||||||
|
def layout(self):
|
||||||
|
cmake_layout(self)
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
tc = CMakeToolchain(self)
|
||||||
|
|
||||||
|
tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
|
||||||
|
tc.cache_variables["ENABLE_SANITIZERS"] = self.options.enable_sanitizers
|
||||||
|
tc.cache_variables["ENABLE_STATIC_ANALYSIS"] = self.options.enable_static_analysis
|
||||||
|
|
||||||
|
tc.generate()
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
cmake = CMake(self)
|
||||||
|
cmake.configure()
|
||||||
|
cmake.build()
|
||||||
|
self.copy_compile_commands()
|
||||||
|
|
||||||
|
def copy_compile_commands(self):
|
||||||
|
build_folder = self.build_folder
|
||||||
|
source_file = os.path.join(build_folder, "compile_commands.json")
|
||||||
|
destination_file = os.path.join(self.source_folder, "compile_commands.json")
|
||||||
|
|
||||||
|
if os.path.isfile(source_file):
|
||||||
|
shutil.copy(source_file, destination_file)
|
||||||
|
self.output.info(f"Copied compile_commands.json to {destination_file}")
|
||||||
|
else:
|
||||||
|
self.output.warn("compile_commands.json not found!")
|
|
@ -1 +1,3 @@
|
||||||
add_subdirectory(lsd)
|
add_subdirectory(pch)
|
||||||
|
|
||||||
|
add_subdirectory(engine)
|
||||||
|
|
6
modules/ecs/private/sparse_set.hpp
Normal file
6
modules/ecs/private/sparse_set.hpp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace lt::ecs {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
2
modules/engine/CMakeLists.txt
Normal file
2
modules/engine/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
add_executable(engine ${CMAKE_CURRENT_SOURCE_DIR}/private/entrypoint.cpp)
|
||||||
|
target_link_libraries(engine PRIVATE pch)
|
17
modules/engine/private/entrypoint.cpp
Normal file
17
modules/engine/private/entrypoint.cpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
auto main() -> int32_t
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::cout << "Light built and ran fine...";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
catch (const std::exception &exp)
|
||||||
|
{
|
||||||
|
std::cout << "\n\nUnhandled std exception: " << exp.what() << std::endl; // NOLINT
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cout << "\n\nUnhandled exception" << std::endl; // NOLINT
|
||||||
|
return -1;
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
add_library(
|
|
||||||
lsd
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/private/test.cpp
|
|
||||||
)
|
|
||||||
target_include_directories(lsd PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/public)
|
|
|
@ -1,4 +0,0 @@
|
||||||
#include <lsd/float_types.hpp>
|
|
||||||
#include <lsd/int_types.hpp>
|
|
||||||
#include <lsd/numeric_limits.hpp>
|
|
||||||
#include <lsd/source_location.hpp>
|
|
|
@ -1,11 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace lsd {
|
|
||||||
|
|
||||||
using float32_t = float;
|
|
||||||
static_assert(sizeof(float32_t) == 4);
|
|
||||||
|
|
||||||
using float64_t = double;
|
|
||||||
static_assert(sizeof(float64_t) == 8);
|
|
||||||
|
|
||||||
} // namespace lsd
|
|
|
@ -1,28 +0,0 @@
|
||||||
namespace lsd {
|
|
||||||
|
|
||||||
using uint8_t = unsigned char;
|
|
||||||
static_assert(sizeof(uint8_t) == 1);
|
|
||||||
|
|
||||||
using uint16_t = unsigned short;
|
|
||||||
static_assert(sizeof(uint16_t) == 2);
|
|
||||||
|
|
||||||
using uint32_t = unsigned int;
|
|
||||||
static_assert(sizeof(uint32_t) == 4);
|
|
||||||
|
|
||||||
using uint64_t = unsigned long long;
|
|
||||||
static_assert(sizeof(uint64_t) == 8);
|
|
||||||
|
|
||||||
|
|
||||||
using int8_t = signed char;
|
|
||||||
static_assert(sizeof(int8_t) == 1);
|
|
||||||
|
|
||||||
using int16_t = signed short;
|
|
||||||
static_assert(sizeof(int16_t) == 2);
|
|
||||||
|
|
||||||
using int32_t = signed int;
|
|
||||||
static_assert(sizeof(int32_t) == 4);
|
|
||||||
|
|
||||||
using int64_t = signed long long;
|
|
||||||
static_assert(sizeof(int64_t) == 8);
|
|
||||||
|
|
||||||
} // namespace lsd
|
|
|
@ -1,36 +0,0 @@
|
||||||
#include <lsd/int_types.hpp>
|
|
||||||
|
|
||||||
namespace lsd {
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct numeric_limits
|
|
||||||
{
|
|
||||||
static_assert(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct numeric_limits<int32_t>
|
|
||||||
{
|
|
||||||
static constexpr auto is_signed = true;
|
|
||||||
|
|
||||||
static constexpr auto is_integer = true;
|
|
||||||
|
|
||||||
static constexpr auto digits = 31;
|
|
||||||
|
|
||||||
/** -2147483648 */
|
|
||||||
static consteval auto min() noexcept -> int32_t
|
|
||||||
{
|
|
||||||
return (-1) << 31; // NOLINT
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 2147483647 */
|
|
||||||
static consteval auto max() noexcept -> int32_t
|
|
||||||
{
|
|
||||||
return ~(1 << 31); // NOLINT
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static_assert(numeric_limits<int32_t>::min() == -2147483648);
|
|
||||||
static_assert(numeric_limits<int32_t>::max() == 2147483647);
|
|
||||||
|
|
||||||
} // namespace lsd
|
|
|
@ -1,56 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace lsd {
|
|
||||||
|
|
||||||
class source_location
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
constexpr source_location(
|
|
||||||
const char *file = "NA",
|
|
||||||
const char *function = "NA",
|
|
||||||
unsigned line = 0
|
|
||||||
)
|
|
||||||
: m_file(file)
|
|
||||||
, m_function(function)
|
|
||||||
, m_line(line)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr auto current(
|
|
||||||
const char *file = __builtin_FILE(),
|
|
||||||
const char *function = __builtin_FUNCTION(),
|
|
||||||
unsigned line = __builtin_LINE()
|
|
||||||
|
|
||||||
) noexcept -> source_location
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
file,
|
|
||||||
function,
|
|
||||||
line,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr auto file() const -> const char *
|
|
||||||
{
|
|
||||||
return m_file;
|
|
||||||
};
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr auto function() const -> const char *
|
|
||||||
{
|
|
||||||
return m_function;
|
|
||||||
};
|
|
||||||
|
|
||||||
[[nodiscard]] constexpr auto line() const -> unsigned
|
|
||||||
{
|
|
||||||
return m_line;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
const char *m_file {};
|
|
||||||
|
|
||||||
const char *m_function {};
|
|
||||||
|
|
||||||
unsigned m_line {};
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace lsd
|
|
2
modules/pch/CMakeLists.txt
Normal file
2
modules/pch/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
add_library_module(universal_pch)
|
||||||
|
target_precompile_headers(universal_pch INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/public/pch/pch.hpp)
|
55
modules/pch/public/pch/error_handling/checks.hpp
Normal file
55
modules/pch/public/pch/error_handling/checks.hpp
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <pch/error_handling/types.hpp>
|
||||||
|
#include <pch/module_configs.hpp>
|
||||||
|
|
||||||
|
namespace lt {
|
||||||
|
|
||||||
|
namespace details {
|
||||||
|
|
||||||
|
inline void throw_if_false(bool condition, std::source_location location)
|
||||||
|
{
|
||||||
|
if (!condition)
|
||||||
|
{
|
||||||
|
throw Error { "Failed runtime assertion", location };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace details
|
||||||
|
|
||||||
|
/** Throws lt::Error if \a condition is false, otherwise returns without side-effects.
|
||||||
|
*
|
||||||
|
* @throws lt::Error
|
||||||
|
*
|
||||||
|
* @note Only runs when LIGHT_ENABLE_CHECK is enabled, which is enabled by default on debug builds.
|
||||||
|
*
|
||||||
|
* @warn The successful execution of the contract of the using code should NOT depend on the
|
||||||
|
* execution of this function as it may or may NOT be executed--based on project configuration.
|
||||||
|
*/
|
||||||
|
inline void check(bool condition, std::source_location location = std::source_location::current())
|
||||||
|
{
|
||||||
|
if constexpr (light_enabled_check)
|
||||||
|
{
|
||||||
|
details::throw_if_false(condition, location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Throws lt::Error if \a condition is false, otherwise returns without side-effects.
|
||||||
|
*
|
||||||
|
* @throws lt::Error
|
||||||
|
*
|
||||||
|
* @note Only runs when LIGHT_ENABLE_ENSURE is enabled, which is enabled by default on debug and
|
||||||
|
* release builds.
|
||||||
|
*
|
||||||
|
* @warn The successful execution of the contract of the using code should NOT depend on the
|
||||||
|
* execution of this function as it may or may NOT be executed--based on project configuration.
|
||||||
|
*/
|
||||||
|
inline void ensure(bool condition, std::source_location location = std::source_location::current())
|
||||||
|
{
|
||||||
|
if constexpr (light_enabled_ensure)
|
||||||
|
{
|
||||||
|
details::throw_if_false(condition, location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace lt
|
32
modules/pch/public/pch/error_handling/types.hpp
Normal file
32
modules/pch/public/pch/error_handling/types.hpp
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace lt {
|
||||||
|
|
||||||
|
class Error: public std::exception
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Error(std::string_view reason, std::source_location location): m_reason(reason)
|
||||||
|
{
|
||||||
|
std::ignore = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
Error(const Error &prev, std::string_view reason, std::source_location location)
|
||||||
|
: m_reason(reason)
|
||||||
|
{
|
||||||
|
std::ignore = location;
|
||||||
|
std::ignore = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto what() const noexcept -> const char * override
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string m_reason;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using Expected = std::expected<T, Error>;
|
||||||
|
|
||||||
|
} // namespace lt
|
15
modules/pch/public/pch/module_configs.hpp
Normal file
15
modules/pch/public/pch/module_configs.hpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
namespace lt {
|
||||||
|
|
||||||
|
#ifdef LIGHT_ENABLE_CHECK
|
||||||
|
constexpr bool light_enabled_check = true;
|
||||||
|
#else
|
||||||
|
constexpr bool light_enabled_check = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LIGHT_ENABLE_ENSURE
|
||||||
|
constexpr bool light_enabled_ensure = true;
|
||||||
|
#else
|
||||||
|
constexpr bool light_enabled_ensure = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace lt
|
7
modules/pch/public/pch/pch.hpp
Normal file
7
modules/pch/public/pch/pch.hpp
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <pch/std_headers.hpp>
|
||||||
|
|
||||||
|
/* error_handling */
|
||||||
|
#include <pch/error_handling/checks.hpp>
|
||||||
|
#include <pch/error_handling/types.hpp>
|
68
modules/pch/public/pch/std_headers.hpp
Normal file
68
modules/pch/public/pch/std_headers.hpp
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
// NOLINTBEGIN
|
||||||
|
|
||||||
|
/* utilities */
|
||||||
|
#include <any>
|
||||||
|
#include <chrono>
|
||||||
|
#include <cinttypes>
|
||||||
|
#include <csignal>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <ctime>
|
||||||
|
#include <exception>
|
||||||
|
#include <expected>
|
||||||
|
#include <format>
|
||||||
|
#include <functional>
|
||||||
|
#include <limits>
|
||||||
|
#include <memory>
|
||||||
|
#include <numbers>
|
||||||
|
#include <optional>
|
||||||
|
#include <source_location>
|
||||||
|
#include <tuple>
|
||||||
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
#include <variant>
|
||||||
|
|
||||||
|
/* numerics */
|
||||||
|
#include <bit>
|
||||||
|
#include <cmath>
|
||||||
|
#include <random>
|
||||||
|
#include <ratio>
|
||||||
|
|
||||||
|
/* containers */
|
||||||
|
#include <array>
|
||||||
|
#include <bitset>
|
||||||
|
#include <list>
|
||||||
|
#include <map>
|
||||||
|
#include <queue>
|
||||||
|
#include <set>
|
||||||
|
#include <span>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <unordered_set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
/* algorithms */
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
/* input/output */
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
/* regular expression */
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
|
/* thread support */
|
||||||
|
#include <atomic>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include <execution>
|
||||||
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
/* string */
|
||||||
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
|
/* filesystem */
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
// NOLINTEND
|
0
modules/renderer/CMakeLists.txt
Normal file
0
modules/renderer/CMakeLists.txt
Normal file
7
modules/renderer/private/impls/vulkan/context.hpp
Normal file
7
modules/renderer/private/impls/vulkan/context.hpp
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
namespace lt::render::vk {
|
||||||
|
|
||||||
|
struct Context
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace lt::render::vk
|
34
tools/cmake/module_macros.cmake
Normal file
34
tools/cmake/module_macros.cmake
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
macro (add_library_module libname)
|
||||||
|
if ("${ARGN}" STREQUAL "") # Header only library
|
||||||
|
message("Adding INTERFACE library ${libname}")
|
||||||
|
add_library(${libname} INTERFACE)
|
||||||
|
target_include_directories(${libname} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/public)
|
||||||
|
|
||||||
|
# Do not link universal_pch against universal_pch :D
|
||||||
|
if (NOT ${libname} STREQUAL "universal_pch")
|
||||||
|
target_link_libraries(${libname} INTERFACE universal_pch)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
else () # Compiled library
|
||||||
|
set(source_files)
|
||||||
|
set(source_directory "${CMAKE_CURRENT_SOURCE_DIR}/private")
|
||||||
|
foreach (source_file ${ARGN})
|
||||||
|
list(APPEND source_files "${source_directory}/${source_file}")
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
message("Adding library ${libname} with source files: ${source_files}")
|
||||||
|
add_library(${libname} ${source_files})
|
||||||
|
target_include_directories(${libname} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/public)
|
||||||
|
target_include_directories(${libname} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/private)
|
||||||
|
target_compile_options(${libname} PRIVATE ${WARNING_FLAGS})
|
||||||
|
|
||||||
|
# Do not link universal_pch against universal_pch :D
|
||||||
|
if (NOT ${libname} STREQUAL "universal_pch")
|
||||||
|
target_link_libraries(${libname} PUBLIC universal_pch)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (ENABLE_STATIC_ANALYSIS)
|
||||||
|
set_target_properties(${libname} PROPERTIES CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}")
|
||||||
|
endif ()
|
||||||
|
endmacro ()
|
10
tools/cmake/preliminary.cmake
Normal file
10
tools/cmake/preliminary.cmake
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
macro(add_option option help)
|
||||||
|
option(${option} ${help})
|
||||||
|
|
||||||
|
if(${option})
|
||||||
|
message(STATUS "${option}: ON")
|
||||||
|
add_compile_definitions(${option}=1)
|
||||||
|
else()
|
||||||
|
message(STATUS "${option}: OFF")
|
||||||
|
endif()
|
||||||
|
endmacro()
|
Loading…
Add table
Reference in a new issue