Compare commits

..
6 Commits
Author SHA1 Message Date
Slendi c390ef3761 docs: Add DCO
Signed-off-by: Slendi <slendi@socopon.com>
2026-07-02 15:31:10 +03:00
Slendi 4a6f7df498 docs: Add AI guidelines
Signed-off-by: Slendi <slendi@socopon.com>
2026-07-02 15:28:17 +03:00
Slendi 720d3edfe3 Add formatting checks for PRs
Signed-off-by: Slendi <slendi@socopon.com>
2026-07-02 15:22:56 +03:00
Slendi 14873489ed Run clang-format on smath.cppm
Signed-off-by: Slendi <slendi@socopon.com>
2026-07-02 15:22:27 +03:00
Slendi 01a917880f Format all CMake scripts
Signed-off-by: Slendi <slendi@socopon.com>
2026-07-02 15:16:51 +03:00
Slendi aea3be7158 Remove nested exports from module
Signed-off-by: Slendi <slendi@socopon.com>
2026-07-02 14:34:30 +03:00
9 changed files with 223 additions and 110 deletions
+24
View File
@@ -0,0 +1,24 @@
name: Format checks
on:
pull_request:
branches:
- master
jobs:
format:
name: Format
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- name: git checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Check clang-format
run: |
nix develop -c sh -lc 'git ls-files "*.cpp" "*.hpp" "*.cppm" | xargs clang-format --dry-run --Werror'
- name: Check cmake-format
run: |
nix develop -c sh -lc 'cmake-format --check CMakeLists.txt src/modules/CMakeLists.txt cmake/smathConfig.cmake.in'
+11
View File
@@ -0,0 +1,11 @@
# AGENTS.md
Instructions for agents working in this repo.
See the [`CONTRIBUTING.md`](CONTRIBUTING.md) file. Said file **must** be read, examined,
and understood before any change is made by agents.
For agents that understand `@`-inclusion of other markdown files, said inclusion line for
`CONTRIBUTING.md` follows, such that explicit reading of the file is not necessary:
@CONTRIBUTING.md
+7
View File
@@ -0,0 +1,7 @@
# CLAUDE.md
This project's agent guidance lives in [AGENTS.md](AGENTS.md), the single source of truth
shared with other tools. Claude Code does not load `AGENTS.md` automatically, so it is
imported here:
@AGENTS.md
+27 -39
View File
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(SmathExamples LANGUAGES CXX VERSION 1.0.0)
project(
SmathExamples
LANGUAGES CXX
VERSION 1.0.0)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -16,18 +19,16 @@ if(SMATH_BUILD_MODULES)
endif()
add_library(smath INTERFACE)
target_include_directories(smath
target_include_directories(
smath
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<$<BOOL:${SMATH_ENABLE_LEGACY_HEADER}>:$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>>
$<INSTALL_INTERFACE:include>
)
$<INSTALL_INTERFACE:include>)
add_library(smath::smath ALIAS smath)
include(CMakePackageConfigHelpers)
install(TARGETS smath
EXPORT smathTargets
)
install(TARGETS smath EXPORT smathTargets)
install(FILES include/smath/smath.hpp DESTINATION include/smath)
if(SMATH_INSTALL_INTEROP_HEADERS)
@@ -36,47 +37,36 @@ endif()
if(SMATH_ENABLE_LEGACY_HEADER)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/smath_legacy_header.hpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/smath.hpp"
@ONLY
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/smath.hpp" DESTINATION include)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/smath_legacy_header.hpp.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/smath.hpp" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/smath.hpp"
DESTINATION include)
endif()
install(EXPORT smathTargets
install(
EXPORT smathTargets
NAMESPACE smath::
FILE smathTargets.cmake
DESTINATION lib/cmake/smath
)
DESTINATION lib/cmake/smath)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/smathConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
COMPATIBILITY SameMajorVersion)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/smathConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/smathConfig.cmake"
INSTALL_DESTINATION "lib/cmake/smath"
)
INSTALL_DESTINATION "lib/cmake/smath")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/smath.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/smath.pc"
@ONLY
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/smath.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/smath.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/smath.pc"
DESTINATION lib/pkgconfig
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/smath.pc" DESTINATION lib/pkgconfig)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/smathConfig.cmake"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/smathConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/smathConfigVersion.cmake"
DESTINATION lib/cmake/smath
)
DESTINATION lib/cmake/smath)
if(SMATH_BUILD_EXAMPLES)
file(GLOB EXAMPLE_SOURCES "${CMAKE_SOURCE_DIR}/examples/*.cpp")
@@ -96,19 +86,17 @@ if(SMATH_BUILD_TESTS)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip)
set(gtest_force_shared_crt
ON
CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
endif()
file(GLOB TEST_SOURCES "${CMAKE_SOURCE_DIR}/tests/*.cpp")
add_executable(smath_tests ${TEST_SOURCES})
target_link_libraries(smath_tests PRIVATE
smath::smath
GTest::gtest_main
)
target_link_libraries(smath_tests PRIVATE smath::smath GTest::gtest_main)
include(GoogleTest)
gtest_discover_tests(smath_tests)
+48 -1
View File
@@ -2,7 +2,9 @@
Welcome to `smath` contributors!
This document contains a set of guidelines to contribute to the project. If you feel like there's a mistake or something can be improved to this document, feel free to propose changes in a pull request.
This document contains a set of guidelines to contribute to the project. If you
feel like there's a mistake or something can be improved to this document, feel
free to propose changes in a pull request.
## Philosophy
@@ -52,6 +54,51 @@ This project uses `clang-format` to maintain a consistent code style. Before ope
git ls-files '*.hpp' '*.cpp' | xargs clang-format -i
```
## Sign-off (DCO)
Every commit must be signed off by at least one (1) human contributor:
```
git commit -s
```
This adds a `Signed-off-by: Your Name <your@email>` trailer certifying that you
wrote the change (or otherwise have reviewed the commit and have the right to
submit it) and agree to contribute it under the project's license, per the
Developer Certificate of Origin (the DCO file in this repository - also at
https://developercertificate.org).
## AI-assisted contributions
AI-assisted contributions are allowed, subject to the following:
- A human must be in the loop at all times. AI tools may assist, but a human
contributor must drive the work, review and understand every generated
change, and take full responsibility for it. Do not submit code you have not
read and understood.
- The assistance must be disclosed. Any commit produced with material AI help
must carry an `Assisted-by:` trailer using a format similar to the Linux
kernel's AI coding assistant format:
```
Assisted-by: AGENT_NAME:MODEL_VERSION
```
`AGENT_NAME` is the AI tool or framework (e.g. Codex, Claude, ...).
`MODEL_VERSION` is the full model identifier, all lowercase, including any
numeric, snapshot, or version suffix. Do not shorten it to the model family
(e.g. use gpt-5-5, not gpt-5; use claude-opus-4-8, not claude-opus).
- Do not add `Co-authored-by:` trailers for the AI assistant. The
`Assisted-by:` trailer already serves that purpose.
- The human contributor still signs off (see above). `Signed-off-by:` is the
human's certification of, and responsibility for, the change.
`Assisted-by:` only records which tool helped. It does not replace the sign-off or the human review.
Unreviewed, bulk, or fully-automated submissions are not accepted.
## Pull requests
- Keep changes focused and scoped to one topic.
+35
View File
@@ -0,0 +1,35 @@
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
+1
View File
@@ -23,6 +23,7 @@
devShells.default = pkgs.mkShell {
packages = with pkgs; [
cmake
cmake-format
ninja
clang-tools
lldb
-1
View File
@@ -5,4 +5,3 @@ target_sources(smath_modules PUBLIC FILE_SET CXX_MODULES FILES smath.cppm)
target_link_libraries(smath_modules PUBLIC smath::smath)
target_compile_features(smath_modules PUBLIC cxx_std_20)
+38 -37
View File
@@ -4,51 +4,52 @@ module;
export module smath;
export namespace smath {
export using ::smath::Vec;
export using ::smath::VecOrScalar;
export using ::smath::Quaternion;
export using ::smath::Mat;
export namespace smath
{
using ::smath::Mat;
using ::smath::Quaternion;
using ::smath::Vec;
using ::smath::VecOrScalar;
export using ::smath::Vec2;
export using ::smath::Vec3;
export using ::smath::Vec4;
using ::smath::Vec2;
using ::smath::Vec3;
using ::smath::Vec4;
export using ::smath::Vec2d;
export using ::smath::Vec3d;
export using ::smath::Vec4d;
using ::smath::Vec2d;
using ::smath::Vec3d;
using ::smath::Vec4d;
export using ::smath::Mat2;
export using ::smath::Mat3;
export using ::smath::Mat4;
using ::smath::Mat2;
using ::smath::Mat3;
using ::smath::Mat4;
export using ::smath::Mat2d;
export using ::smath::Mat3d;
export using ::smath::Mat4d;
using ::smath::Mat2d;
using ::smath::Mat3d;
using ::smath::Mat4d;
export using ::smath::swizzle;
using ::smath::swizzle;
export using ::smath::deg;
export using ::smath::rad;
export using ::smath::turns;
using ::smath::deg;
using ::smath::rad;
using ::smath::turns;
export using ::smath::pack_unorm4x8;
export using ::smath::pack_snorm4x8;
export using ::smath::unpack_unorm4x8;
export using ::smath::unpack_snorm4x8;
using ::smath::pack_snorm4x8;
using ::smath::pack_unorm4x8;
using ::smath::unpack_snorm4x8;
using ::smath::unpack_unorm4x8;
export using ::smath::operator*;
using ::smath::operator*;
export using ::smath::translate;
export using ::smath::rotate;
export using ::smath::scale;
using ::smath::rotate;
using ::smath::scale;
using ::smath::translate;
export using ::smath::shear_x;
export using ::smath::shear_y;
export using ::smath::shear_z;
using ::smath::shear_x;
using ::smath::shear_y;
using ::smath::shear_z;
export using ::smath::matrix_ortho3d;
export using ::smath::matrix_perspective;
export using ::smath::matrix_infinite_perspective;
export using ::smath::matrix_look_at;
}
using ::smath::matrix_infinite_perspective;
using ::smath::matrix_look_at;
using ::smath::matrix_ortho3d;
using ::smath::matrix_perspective;
} // namespace smath