Compare commits
No commits in common. "feat/universal_pch" and "main" have entirely different histories.
feat/unive
...
main
28 changed files with 167 additions and 229 deletions
115
.drone.yml
115
.drone.yml
|
@ -2,12 +2,121 @@ kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: linux_amd64
|
name: linux_amd64
|
||||||
|
|
||||||
|
environment:
|
||||||
|
CONAN_REVISIONS_ENABLED: "1"
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
os: linux
|
os: linux
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
- name: py
|
||||||
|
temp: {}
|
||||||
|
|
||||||
|
- name: conan
|
||||||
|
host:
|
||||||
|
path: /root/.conan2/
|
||||||
|
|
||||||
|
|
||||||
|
services:
|
||||||
|
- name: docker
|
||||||
|
image: docker:dind
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run/
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: clang format
|
- name: build image
|
||||||
image: alpine_amd64__clang_format
|
image: docker:latest
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
commands:
|
||||||
|
- until docker info; do echo "Waiting for Docker daemon..."; sleep 1; done
|
||||||
|
- docker build -t ubuntu_amd64 -f ./tools/docker/linux_amd64 .
|
||||||
|
- docker images
|
||||||
|
|
||||||
|
- name: environment info
|
||||||
|
image: ubuntu_amd64:latest
|
||||||
pull: if-not-exists
|
pull: if-not-exists
|
||||||
commands: $(git rev-parse --show-toplevel)/tools/ci/alpine_amd64/script.sh
|
volumes:
|
||||||
|
- name: py
|
||||||
|
path: /opt/venv/
|
||||||
|
|
||||||
|
commands:
|
||||||
|
- . /opt/venv/bin/activate
|
||||||
|
- whoami
|
||||||
|
- uname -a
|
||||||
|
- pip --version
|
||||||
|
- python3 --version
|
||||||
|
- conan --version
|
||||||
|
- cmake --version
|
||||||
|
- gcc --version
|
||||||
|
- g++ --version
|
||||||
|
- clang --version
|
||||||
|
- clang++ --version
|
||||||
|
- clang-tidy --version
|
||||||
|
|
||||||
|
- name: build gcc
|
||||||
|
image: ubuntu_amd64:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
volumes:
|
||||||
|
- name: py
|
||||||
|
path: /opt/venv/
|
||||||
|
- name: conan
|
||||||
|
path: /root/.conan2
|
||||||
|
|
||||||
|
commands:
|
||||||
|
- . /opt/venv/bin/activate
|
||||||
|
- rm -rvf ./build
|
||||||
|
- export CC=$(which gcc)
|
||||||
|
- export CXX=$(which g++)
|
||||||
|
|
||||||
|
- conan install . --build=missing --profile:build="$(pwd)/tools/conan/profiles/linux_gcc_amd64" --profile:host="$(pwd)/tools/conan/profiles/linux_gcc_amd64"
|
||||||
|
- conan build . --profile:build="$(pwd)/tools/conan/profiles/linux_gcc_amd64" --profile:host="$(pwd)/tools/conan/profiles/linux_gcc_amd64"
|
||||||
|
|
||||||
|
- ./build/Release/modules/light/light
|
||||||
|
|
||||||
|
- name: build clang
|
||||||
|
image: ubuntu_amd64:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
volumes:
|
||||||
|
- name: py
|
||||||
|
path: /opt/venv/
|
||||||
|
- name: conan
|
||||||
|
path: /root/.conan2
|
||||||
|
|
||||||
|
commands:
|
||||||
|
- . /opt/venv/bin/activate
|
||||||
|
- rm -rvf ./build
|
||||||
|
- export CC=$(which clang)
|
||||||
|
- export CXX=$(which clang++)
|
||||||
|
|
||||||
|
- conan install . --build=missing --profile:build="$(pwd)/tools/conan/profiles/linux_clang_amd64" --profile:host="$(pwd)/tools/conan/profiles/linux_clang_amd64"
|
||||||
|
- conan build . --profile:build="$(pwd)/tools/conan/profiles/linux_clang_amd64" --profile:host="$(pwd)/tools/conan/profiles/linux_clang_amd64"
|
||||||
|
|
||||||
|
- ./build/Release/modules/light/light
|
||||||
|
|
||||||
|
- name: static analysis
|
||||||
|
image: ubuntu_amd64:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
- echo "[TODO] Implement static analysis"
|
||||||
|
|
||||||
|
- name: run tests
|
||||||
|
image: ubuntu_amd64:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
- echo "[TODO] Implement tests"
|
||||||
|
- ./build/Release/modules/light/light
|
||||||
|
|
||||||
|
- name: report coverage
|
||||||
|
image: ubuntu_amd64:latest
|
||||||
|
pull: if-not-exists
|
||||||
|
commands:
|
||||||
|
- echo "[TODO] Implement coverage report"
|
||||||
|
|
|
@ -2,9 +2,8 @@ cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
|
||||||
project("light" LANGUAGES CXX)
|
project("light" LANGUAGES CXX)
|
||||||
|
|
||||||
include(tools/cmake/preliminary.cmake)
|
include(tools/cmake/preliminary.cmake)
|
||||||
include(tools/cmake/module_macros.cmake)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 26)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
add_option(ENABLE_SANITIZERS "Enables fsan sanitizers")
|
add_option(ENABLE_SANITIZERS "Enables fsan sanitizers")
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
{
|
|
||||||
"version": 4,
|
|
||||||
"vendor": {
|
|
||||||
"conan": {}
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"build/Debug/generators/CMakePresets.json"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,4 +1,3 @@
|
||||||
.. toctree::
|
.. toctree::
|
||||||
./architecture.rst
|
./architecture.rst
|
||||||
./philosophy.rst
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
Philosophy
|
|
||||||
=========================
|
|
||||||
|
|
||||||
|
|
||||||
Code is documentation
|
|
||||||
------------------------
|
|
|
@ -1,3 +1,2 @@
|
||||||
add_subdirectory(pch)
|
add_subdirectory(utilities/preliminary)
|
||||||
|
add_subdirectory(light)
|
||||||
add_subdirectory(engine)
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace lt::ecs {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
add_executable(engine ${CMAKE_CURRENT_SOURCE_DIR}/private/entrypoint.cpp)
|
|
||||||
target_link_libraries(engine PRIVATE pch)
|
|
|
@ -1,17 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
3
modules/light/CMakeLists.txt
Normal file
3
modules/light/CMakeLists.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
add_executable(light ${CMAKE_CURRENT_SOURCE_DIR}/src/entrypoint.cpp)
|
||||||
|
|
||||||
|
target_link_libraries(light PRIVATE preliminary)
|
6
modules/light/src/entrypoint.cpp
Normal file
6
modules/light/src/entrypoint.cpp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
auto main() -> lt::i32
|
||||||
|
{
|
||||||
|
std::cout << "Light built and ran fine...";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,2 +0,0 @@
|
||||||
add_library_module(universal_pch)
|
|
||||||
target_precompile_headers(universal_pch INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/public/pch/pch.hpp)
|
|
|
@ -1,55 +0,0 @@
|
||||||
#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
|
|
|
@ -1,32 +0,0 @@
|
||||||
#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
|
|
|
@ -1,15 +0,0 @@
|
||||||
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
|
|
|
@ -1,7 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <pch/std_headers.hpp>
|
|
||||||
|
|
||||||
/* error_handling */
|
|
||||||
#include <pch/error_handling/checks.hpp>
|
|
||||||
#include <pch/error_handling/types.hpp>
|
|
|
@ -1,7 +0,0 @@
|
||||||
namespace lt::render::vk {
|
|
||||||
|
|
||||||
struct Context
|
|
||||||
{
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace lt::render::vk
|
|
3
modules/utilities/preliminary/CMakeLists.txt
Normal file
3
modules/utilities/preliminary/CMakeLists.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
add_library(preliminary INTERFACE)
|
||||||
|
target_precompile_headers(preliminary INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.hpp)
|
||||||
|
target_include_directories(preliminary INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
|
21
modules/utilities/preliminary/include/preliminary/types.hpp
Normal file
21
modules/utilities/preliminary/include/preliminary/types.hpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace lt {
|
||||||
|
|
||||||
|
using i8 = int8_t;
|
||||||
|
using i16 = int16_t;
|
||||||
|
using i32 = int32_t;
|
||||||
|
using i64 = int64_t;
|
||||||
|
|
||||||
|
using u8 = uint8_t;
|
||||||
|
using u16 = uint16_t;
|
||||||
|
using u32 = uint32_t;
|
||||||
|
using u64 = uint64_t;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
using vec = std::vector<T>;
|
||||||
|
|
||||||
|
} // namespace lt
|
|
@ -1,4 +1,6 @@
|
||||||
// NOLINTBEGIN
|
#pragma once
|
||||||
|
|
||||||
|
#include <preliminary/types.hpp>
|
||||||
|
|
||||||
/* utilities */
|
/* utilities */
|
||||||
#include <any>
|
#include <any>
|
||||||
|
@ -8,8 +10,6 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <expected>
|
|
||||||
#include <format>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -64,5 +64,3 @@
|
||||||
|
|
||||||
/* filesystem */
|
/* filesystem */
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
// NOLINTEND
|
|
|
@ -1,4 +0,0 @@
|
||||||
FROM alpine:latest
|
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
clang-extra-tools
|
|
|
@ -1,13 +0,0 @@
|
||||||
set -e
|
|
||||||
cd $(git rev-parse --show-toplevel)
|
|
||||||
|
|
||||||
find ./modules -name '*.?pp' | while read -r file; do
|
|
||||||
echo "Checking format for $file"
|
|
||||||
if ! clang-format --dry-run --Werror "$file"; then
|
|
||||||
echo "❌ Formatting issue detected in $file"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "✅ All files are properly formatted"
|
|
||||||
exit 0
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
ALPINE_AMD64=$(git rev-parse --show-toplevel)/tools/ci/alpine_amd64/
|
|
||||||
|
|
||||||
cd ${ALPINE_AMD64}/clang_format/
|
|
||||||
docker build -t alpine_amd64__clang_format
|
|
|
@ -1,34 +0,0 @@
|
||||||
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 ()
|
|
16
tools/docker/linux_amd64
Normal file
16
tools/docker/linux_amd64
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
RUN apt update
|
||||||
|
RUN apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
clang \
|
||||||
|
clang-tidy \
|
||||||
|
gcc \
|
||||||
|
g++ \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
python3.12-venv
|
||||||
|
|
||||||
|
RUN python3 -m venv /opt/venv
|
||||||
|
RUN . /opt/venv/bin/activate && pip install conan==2.5.0
|
Loading…
Add table
Reference in a new issue