Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

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()
8 changes: 8 additions & 0 deletions examples/hello_box3cpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <box3cpp/box3cpp.hpp>

#include <iostream>

int main() {
std::cout << "box3cpp " << box3cpp::version_string << '\n';
return 0;
}
3 changes: 3 additions & 0 deletions include/box3cpp/box3cpp.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

#include <box3cpp/version.hpp>
11 changes: 11 additions & 0 deletions include/box3cpp/version.hpp
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions tests/smoke_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <box3cpp/box3cpp.hpp>

int main() {
static_assert(box3cpp::version_major == 0);
static_assert(box3cpp::version_minor == 1);
static_assert(box3cpp::version_patch == 0);

return 0;
}
Loading