mirror of
https://github.com/boostorg/qvm.git
synced 2026-01-19 04:22:16 +00:00
Generating qvm.hpp and qvm_lite.hpp on GitHub Actions
This commit is contained in:
28
.github/workflows/ci.yml
vendored
28
.github/workflows/ci.yml
vendored
@@ -9,7 +9,6 @@ on:
|
||||
- feature/**
|
||||
|
||||
env:
|
||||
LIBRARY: qvm
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
|
||||
jobs:
|
||||
@@ -125,9 +124,9 @@ jobs:
|
||||
cd ..
|
||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||
cp -r $GITHUB_WORKSPACE/* libs/qvm
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" qvm
|
||||
./bootstrap.sh
|
||||
./b2 -d0 headers
|
||||
|
||||
@@ -136,10 +135,16 @@ jobs:
|
||||
run: |
|
||||
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cd ../boost-root/libs/qvm
|
||||
python gen/generate_single_header.py -i include/boost/qvm/all.hpp -p include -o test/qvm.hpp boost/qvm
|
||||
python gen/generate_single_header.py -i include/boost/qvm/lite.hpp -p include -o test/qvm_lite.hpp boost/qvm
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd ../boost-root
|
||||
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release
|
||||
./b2 -j3 libs/qvm/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release,debug_qvm_hpp,release_qvm_hpp,debug_qvm_lite_hpp,release_qvm_lite_hpp
|
||||
|
||||
windows:
|
||||
strategy:
|
||||
@@ -173,15 +178,20 @@ jobs:
|
||||
cd ..
|
||||
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||
xcopy /s /e /q %GITHUB_WORKSPACE% libs\qvm\
|
||||
git submodule update --init tools/boostdep
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" qvm
|
||||
cmd /c bootstrap
|
||||
b2 -d0 headers
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cd ..\boost-root\libs\qvm
|
||||
python gen/generate_single_header.py -i include/boost/qvm/all.hpp -p include -o test/qvm.hpp boost/qvm
|
||||
python gen/generate_single_header.py -i include/boost/qvm/lite.hpp -p include -o test/qvm_lite.hpp boost/qvm
|
||||
|
||||
- name: Run tests
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root
|
||||
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release
|
||||
|
||||
cd ..\boost-root
|
||||
b2 -j3 libs/qvm/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release,debug_qvm_hpp,release_qvm_hpp,debug_qvm_lite_hpp,release_qvm_lite_hpp
|
||||
|
||||
6
.github/workflows/gh-pages.yml
vendored
6
.github/workflows/gh-pages.yml
vendored
@@ -35,6 +35,12 @@ jobs:
|
||||
cd ../boost-root/libs/qvm/doc
|
||||
../../../b2
|
||||
|
||||
- name: Generate headers
|
||||
run: |
|
||||
cd ../boost-root/libs/qvm
|
||||
python gen/generate_single_header.py -i include/boost/qvm/all.hpp -p include -o doc/html/qvm.hpp boost/qvm
|
||||
python gen/generate_single_header.py -i include/boost/qvm/lite.hpp -p include -o doc/html/qvm_lite.hpp boost/qvm
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: JamesIves/github-pages-deploy-action@3.7.1
|
||||
with:
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -11,5 +11,5 @@ vcxproj.exe
|
||||
/doc/html/**
|
||||
/.vscode/c_cpp_properties.json
|
||||
/bld/*
|
||||
/include/boost/qvm.hpp
|
||||
/include/boost/qvm_lite.hpp
|
||||
/test/qvm.hpp
|
||||
/test/qvm_lite.hpp
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2018 Emil Dotchevski
|
||||
# Copyright 2018-2021 Emil Dotchevski
|
||||
# Copyright 2016 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
5
.vscode/tasks.json
vendored
5
.vscode/tasks.json
vendored
@@ -18,7 +18,7 @@
|
||||
{
|
||||
"label": "Generate headers",
|
||||
"type": "shell",
|
||||
"command": "cd ${workspaceRoot} && python3 gen/generate_single_header.py -guard BOOST_QVM_HPP_INCLUDED -i include/boost/qvm/all.hpp -p ${workspaceRoot}/include -o ${workspaceRoot}/include/boost/qvm.hpp boost/qvm && python3 gen/generate_single_header.py -guard BOOST_QVM_LIGHT_HPP_INCLUDED -i include/boost/qvm/detail/all_light.hpp -p ${workspaceRoot}/include -o ${workspaceRoot}/include/boost/qvm_lite.hpp boost/qvm",
|
||||
"command": "cd ${workspaceRoot} && python gen/generate_single_header.py -i include/boost/qvm/all.hpp -p ${workspaceRoot}/include -o ${workspaceRoot}/test/qvm.hpp boost/qvm && python gen/generate_single_header.py -i include/boost/qvm/lite.hpp -p ${workspaceRoot}/include -o ${workspaceRoot}/test/qvm_lite.hpp boost/qvm",
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
@@ -99,9 +99,6 @@
|
||||
"relative",
|
||||
"${workspaceRoot}/bld/debug"
|
||||
]
|
||||
},
|
||||
"windows": {
|
||||
"command": "${workspaceRoot}/.vscode/msvc.bat && cd ${workspaceRoot}/bld/debug && meson test access_m_test"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
35
README.md
35
README.md
@@ -1,12 +1,33 @@
|
||||
QVM: Generic C++ library for working with Quaternions, Vectors and Matrices
|
||||
# QVM
|
||||
|
||||
Official documentation: https://boostorg.github.io/qvm/
|
||||
> A generic C++ library for working with `Q`uaternions, `V`ectors and `M`atrices.
|
||||
|
||||
## Documentation
|
||||
|
||||
https://boostorg.github.io/qvm/
|
||||
|
||||
## Features
|
||||
|
||||
* Emphasis on 2, 3 and 4-dimensional operations needed in graphics, video games and simulation applications.
|
||||
* Free function templates operate on any compatible user-defined quaternion, vector or matrix type.
|
||||
* Quaternion, vector and matrix types from different libraries or subsystems can be safely mixed in the same expression.
|
||||
* Type-safe mapping between compatible lvalue types with no temporary objects; e.g. transpose remaps the elements, rather than transforming the matrix.
|
||||
* Free function templates operate on any compatible user-defined Quaternion, Vector or Matrix type.
|
||||
* Enables Quaternion, Vector and Matrix types from different libraries to be safely mixed in the same expression.
|
||||
* Type-safe mapping between compatible lvalue types with no temporary objects; f.ex. transpose remaps the access to the elements, rather than transforming the matrix.
|
||||
* Requires only {CPP}03.
|
||||
* Zero dependencies.
|
||||
|
||||
Copyright (c) 2018 Emil Dotchevski. Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
||||
## Support
|
||||
|
||||
Please post questions and feedback on the Boost Developers Mailing List.
|
||||
* [cpplang on Slack](https://Cpplang.slack.com) (use the `#boost` channel)
|
||||
* [Boost Users Mailing List](https://lists.boost.org/mailman/listinfo.cgi/boost-users)
|
||||
* [Boost Developers Mailing List](https://lists.boost.org/mailman/listinfo.cgi/boost)
|
||||
|
||||
## Distribution
|
||||
|
||||
Besides GitHub, there are two other distribution channels:
|
||||
|
||||
* QVM is included in official https://www.boost.org/[Boost] releases.
|
||||
* For maximum portability, the library is also available in single-header format, in two variants (direct download links):
|
||||
* [qvm.hpp](https://boostorg.github.io/qvm/qvm.hpp): single header containing the complete QVM source, including the complete set of swizzling overloads.
|
||||
* [qvm_lite.hpp](https://boostorg.github.io/qvm/qvm_lite.hpp): single header containing everything except for the swizzling overloads.
|
||||
|
||||
Copyright (C) 2008-2021 Emil Dotchevski. Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt).
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright 2016, 2017 Peter Dimov
|
||||
# Copyright 2018 Emil Dotchevski
|
||||
# Copyright 2018-2021 Emil Dotchevski
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
51
doc/qvm.adoc
51
doc/qvm.adoc
@@ -5,8 +5,13 @@
|
||||
:stylesheet: zajo-dark.css
|
||||
:source-highlighter: rouge
|
||||
|
||||
ifdef::backend-pdf[]
|
||||
= QVM
|
||||
Quaternion / Vector / Matrix Library for {CPP}03 | Emil Dotchevski
|
||||
endif::[]
|
||||
ifndef::backend-pdf[]
|
||||
= QVM pass:[<div style="z-index: 3; bottom:-16px; right:4px; position:fixed"><input width="32" height="32" type="image" alt="Skin" src="./skin.png" onclick="this.blur();switch_style();return false;"/></div>]
|
||||
endif::[]
|
||||
Quaternion / Vector / Matrix Library written in {CPP}03 | Emil Dotchevski
|
||||
ifndef::backend-pdf[]
|
||||
:toc: left
|
||||
:toclevels: 3
|
||||
@@ -34,6 +39,32 @@ ifndef::backend-pdf[]
|
||||
<<tutorial>> | <<reference>> | <<rationale>>
|
||||
endif::[]
|
||||
|
||||
[[support]]
|
||||
== Support
|
||||
|
||||
* https://Cpplang.slack.com[cpplang on Slack] (use the `#boost` channel)
|
||||
* https://lists.boost.org/mailman/listinfo.cgi/boost-users[Boost Users Mailing List]
|
||||
* https://lists.boost.org/mailman/listinfo.cgi/boost[Boost Developers Mailing List]
|
||||
* https://github.com/boostorg/qvm/issues[Report an issue] on GitHub
|
||||
|
||||
== Portability
|
||||
|
||||
QVM requires only {CPP}03 but is tested on many compiler versions and {CPP} standards.
|
||||
|
||||
== Distribution
|
||||
|
||||
Copyright (C) 2008-2021 Emil Dotchevski. Distributed under the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0].
|
||||
|
||||
There are three distribution channels:
|
||||
|
||||
* QVM is included in official https://www.boost.org/[Boost] releases.
|
||||
* The source code is hosted on https://github.com/boostorg/qvm[GitHub].
|
||||
* For maximum portability, the library is also available in single-header format, in two variants (direct download links):
|
||||
** link:qvm.hpp[qvm.hpp]: single header containing the complete QVM source, including the complete set of <<swizzling,swizzling>> overloads.
|
||||
** link:qvm_lite.hpp[qvm_lite.hpp]: single header containing everything except for the swizzling overloads.
|
||||
|
||||
NOTE: QVM does not depend on Boost or other libraries.
|
||||
|
||||
[[tutorial]]
|
||||
== Tutorial
|
||||
|
||||
@@ -350,6 +381,8 @@ The tables below list commonly used components and the headers they're found in.
|
||||
|
||||
The header `boost/qvm/all.hpp` is provided for convenience. It includes all other QVM headers.
|
||||
|
||||
In addition, Boost QVM is available in single-header format for maximum portability. See <<Distribution>>.
|
||||
|
||||
.Quaternion header files
|
||||
[cols="1,2l"]
|
||||
|====
|
||||
@@ -5126,22 +5159,6 @@ QVM itself defines specializations of the math function templates only for `floa
|
||||
|
||||
Because of this, a call to e.g. `<<rot_mat,rot_mat>>(axis,1)` will compile successfully but fail to link, since it calls e.g. `boost::qvm::sin<int>`, which is undefined. Because rotations by integer number of radians are rarely needed, in QVM there is no protection against such errors. In such cases the solution is to use `rot_mat(axis,1.0f)` instead.
|
||||
|
||||
== Distribution
|
||||
|
||||
QVM is part of https://www.boost.org/[Boost] and is distributed under the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0].
|
||||
|
||||
The source code is available in https://github.com/boostorg/qvm[QVM GitHub repository].
|
||||
|
||||
(C) 2008-2018 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
== Portability
|
||||
|
||||
See the link:https://travis-ci.org/boostorg/qvm[QVM Travis CI Builds].
|
||||
|
||||
== Feedback / Support
|
||||
|
||||
Please use the link:https://lists.boost.org/mailman/listinfo.cgi/boost[Boost Developers mailing list].
|
||||
|
||||
== Q&A
|
||||
|
||||
[qanda]
|
||||
|
||||
@@ -12,12 +12,7 @@
|
||||
|
||||
python3 generate_single_header.py --help
|
||||
|
||||
e.g. python3 generate_single_header.py -i include/boost/qvm/all.hpp -p include -o include/boost/qvm.hpp boost/qvm -guard BOOST_QVM_HPP_INCLUDED
|
||||
|
||||
Note:
|
||||
|
||||
If unit tests are build by meson, you can enable the 'leaf_hpp' option (see meson_options.txt),
|
||||
in which case each time the tests are built, first boost/qvm.hpp will be rebuilt.
|
||||
e.g. python3 generate_single_header.py -i include/boost/qvm/all.hpp -p include -o test/qvm.hpp boost/qvm
|
||||
|
||||
"""
|
||||
|
||||
@@ -38,7 +33,7 @@ def append(input_file_name, input_file, output_file, regex_includes, include_fol
|
||||
next_input_file_name = result.group("include")
|
||||
if next_input_file_name not in included:
|
||||
included.append(next_input_file_name)
|
||||
print("%s" % next_input_file_name, flush=True)
|
||||
print("%s" % next_input_file_name)
|
||||
with open(os.path.join(include_folder, next_input_file_name), "r") as next_input_file:
|
||||
output_file.write('// >>> %s#line 1 "%s"\n' % (line, next_input_file_name))
|
||||
append(next_input_file_name, next_input_file, output_file, regex_includes, include_folder)
|
||||
@@ -63,28 +58,20 @@ def _main():
|
||||
help="Include path")
|
||||
parser.add_argument("prefix", action="store", type=str,
|
||||
help="Non-empty include file prefix (e.g. a/b)")
|
||||
parser.add_argument("-guard", action="store", type=str,
|
||||
help="The include guard to use")
|
||||
args = parser.parse_args()
|
||||
|
||||
regex_includes = re.compile(r"""^\s*#[\t\s]*include[\t\s]*("|\<)(?P<include>%s.*)("|\>)""" % args.prefix)
|
||||
print("Rebuilding %s:" % args.input)
|
||||
with open(args.output, 'w') as output_file, open(args.input, 'r') as input_file:
|
||||
output_file.write(
|
||||
'#ifndef ' + args.guard + '\n'
|
||||
'#define ' + args.guard + '\n'
|
||||
'\n'
|
||||
'// Copyright (c) 2008-2021 Emil Dotchevski and Reverge Studios, Inc.\n'
|
||||
'// Copyright (c) 2018-2019 agate-pris\n'
|
||||
'\n'
|
||||
'// Distributed under the Boost Software License, Version 1.0. (See accompanying\n'
|
||||
'// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n'
|
||||
'\n'
|
||||
'// This file was generated by a program. Do not edit manually.\n' )
|
||||
'// This file was generated by a program. Do not edit manually.\n\n' )
|
||||
append(args.input, input_file, output_file, regex_includes, args.path)
|
||||
output_file.write(
|
||||
'\n'
|
||||
'#endif\n' )
|
||||
|
||||
if __name__ == "__main__":
|
||||
_main()
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#ifndef BOOST_QVM_ALL_HPP_INCLUDED
|
||||
#define BOOST_QVM_ALL_HPP_INCLUDED
|
||||
|
||||
/// Copyright (c) 2008-2021 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
/// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
/// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/qvm/detail/all_light.hpp>
|
||||
#include <boost/qvm/lite.hpp>
|
||||
#include <boost/qvm/swizzle.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef BOOST_QVM_LITE_HPP_INCLUDED
|
||||
#define BOOST_QVM_LITE_HPP_INCLUDED
|
||||
|
||||
/// Copyright (c) 2008-2021 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
/// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
@@ -25,3 +28,5 @@
|
||||
#include <boost/qvm/vec_register.hpp>
|
||||
#include <boost/qvm/map.hpp>
|
||||
#include <boost/qvm/to_string.hpp>
|
||||
|
||||
#endif
|
||||
@@ -151,9 +151,9 @@ if option_enable_unit_tests
|
||||
|
||||
dep_header_inclusion_mode = []
|
||||
if option_qvm_header_mode == 'single'
|
||||
dep_header_inclusion_mode = declare_dependency(compile_args: ['-DBOOST_QVM_TEST_SINGLE_HEADER=<boost/qvm.hpp>'])
|
||||
dep_header_inclusion_mode = declare_dependency(compile_args: ['-DBOOST_QVM_TEST_SINGLE_HEADER="qvm.hpp"'])
|
||||
elif option_qvm_header_mode == 'single_lite'
|
||||
dep_header_inclusion_mode = declare_dependency(compile_args: ['-DBOOST_QVM_TEST_SINGLE_HEADER=<boost/qvm_lite.hpp>', '-DBOOST_QVM_TEST_SINGLE_HEADER_SWIZZLE=<boost/qvm/swizzle.hpp>'])
|
||||
dep_header_inclusion_mode = declare_dependency(compile_args: ['-DBOOST_QVM_TEST_SINGLE_HEADER="qvm_lite.hpp"', '-DBOOST_QVM_TEST_SINGLE_HEADER_SWIZZLE=<boost/qvm/swizzle.hpp>'])
|
||||
elif option_qvm_header_mode != 'multi'
|
||||
error('Bad qvm_header_mode='+option_qvm_header_mode+', valid values are multi, single, single_lite')
|
||||
endif
|
||||
|
||||
@@ -8,10 +8,10 @@ project
|
||||
<include>../include
|
||||
;
|
||||
|
||||
variant debug_qvm_hpp : debug : <define>BOOST_QVM_TEST_SINGLE_HEADER=\"<boost/qvm.hpp>\" ;
|
||||
variant release_qvm_hpp : release : <define>BOOST_QVM_TEST_SINGLE_HEADER=\"<boost/qvm.hpp>\" ;
|
||||
variant debug_qvm_lite_hpp : debug : <define>BOOST_QVM_TEST_SINGLE_HEADER=\"<boost/qvm_lite.hpp>\" <define>BOOST_QVM_TEST_SINGLE_HEADER_SWIZZLE=\"<boost/qvm/swizzle.hpp>\" ;
|
||||
variant release_qvm_lite_hpp : release : <define>BOOST_QVM_TEST_SINGLE_HEADER=\"<boost/qvm_lite.hpp>\" <define>BOOST_QVM_TEST_SINGLE_HEADER_SWIZZLE=\"<boost/qvm/swizzle.hpp>\" ;
|
||||
variant debug_qvm_hpp : debug : <define>BOOST_QVM_TEST_SINGLE_HEADER="\\\"qvm.hpp\\\"" ;
|
||||
variant release_qvm_hpp : release : <define>BOOST_QVM_TEST_SINGLE_HEADER="\\\"qvm.hpp\\\"" ;
|
||||
variant debug_qvm_lite_hpp : debug : <define>BOOST_QVM_TEST_SINGLE_HEADER="\\\"qvm_lite.hpp\\\"" <define>BOOST_QVM_TEST_SINGLE_HEADER_SWIZZLE=\"<boost/qvm/swizzle.hpp>\" ;
|
||||
variant release_qvm_lite_hpp : release : <define>BOOST_QVM_TEST_SINGLE_HEADER="\\\"qvm_lite.hpp\\\"" <define>BOOST_QVM_TEST_SINGLE_HEADER_SWIZZLE=\"<boost/qvm/swizzle.hpp>\" ;
|
||||
|
||||
import testing ;
|
||||
import path ;
|
||||
|
||||
Reference in New Issue
Block a user