diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c392614 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + push: + pull_request: + +jobs: + build: + name: Build and test + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release + + - name: Build + run: cmake --build build --config Release + + - name: Test + run: ctest --test-dir build --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9f31b97 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.20) + +project(box3cpp + VERSION 0.1.0 + DESCRIPTION "Small C++20 RAII wrapper for Box3D" + LANGUAGES CXX +) + +add_library(box3cpp INTERFACE) +add_library(box3cpp::box3cpp ALIAS box3cpp) + +target_compile_features(box3cpp INTERFACE cxx_std_20) + +target_include_directories(box3cpp + INTERFACE + $ + $ +) + +option(BOX3CPP_BUILD_EXAMPLES "Build box3cpp examples" ON) + +if(BOX3CPP_BUILD_EXAMPLES) + add_executable(box3cpp_hello examples/hello_box3cpp.cpp) + target_link_libraries(box3cpp_hello PRIVATE box3cpp::box3cpp) +endif() + +option(BOX3CPP_BUILD_TESTS "Build box3cpp tests" ON) + +if(BOX3CPP_BUILD_TESTS) + enable_testing() + + add_executable(box3cpp_smoke_test tests/smoke_test.cpp) + target_link_libraries(box3cpp_smoke_test PRIVATE box3cpp::box3cpp) + + add_test(NAME box3cpp_smoke_test COMMAND box3cpp_smoke_test) +endif() diff --git a/examples/hello_box3cpp.cpp b/examples/hello_box3cpp.cpp new file mode 100644 index 0000000..e07c3e0 --- /dev/null +++ b/examples/hello_box3cpp.cpp @@ -0,0 +1,8 @@ +#include + +#include + +int main() { + std::cout << "box3cpp " << box3cpp::version_string << '\n'; + return 0; +} diff --git a/include/box3cpp/box3cpp.hpp b/include/box3cpp/box3cpp.hpp new file mode 100644 index 0000000..31c2679 --- /dev/null +++ b/include/box3cpp/box3cpp.hpp @@ -0,0 +1,3 @@ +#pragma once + +#include diff --git a/include/box3cpp/version.hpp b/include/box3cpp/version.hpp new file mode 100644 index 0000000..b635281 --- /dev/null +++ b/include/box3cpp/version.hpp @@ -0,0 +1,11 @@ +#pragma once + +namespace box3cpp { + +inline constexpr int version_major = 0; +inline constexpr int version_minor = 1; +inline constexpr int version_patch = 0; + +inline constexpr const char* version_string = "0.1.0"; + +} // namespace box3cpp diff --git a/tests/smoke_test.cpp b/tests/smoke_test.cpp new file mode 100644 index 0000000..2bd48c1 --- /dev/null +++ b/tests/smoke_test.cpp @@ -0,0 +1,9 @@ +#include + +int main() { + static_assert(box3cpp::version_major == 0); + static_assert(box3cpp::version_minor == 1); + static_assert(box3cpp::version_patch == 0); + + return 0; +}