Compare commits

...

10 Commits

Author SHA1 Message Date
51d927b28d build(meson): more robust python build 2026-06-11 10:58:32 -04:00
86f10d1521 build(header_install_dir): added header_install_dir option
this option is useful for wheel builds
2026-06-11 09:39:15 -04:00
caf48f4590 build(lib_install_dir): added lib_install_dir option
this option is useful for wheel builds
2026-06-11 09:07:04 -04:00
5753e2cc74 fix(rpath): fixed rpath inclusion for dynamic loading 2026-06-10 15:10:12 -04:00
de026e4634 docs(version): v1.1.1 -> v1.1.2
this version updates the install path
2026-06-05 10:28:35 +02:00
d4cb187704 Merge branch 'main' of github.com:tboudreaux/libconstants 2026-06-05 10:27:20 +02:00
bc219f48cb build(constants): changes install path to fourdst/constants
previously install path was at includedir/fourdst/fourdst/constants, this changes the install path to includedir/fourdst

BREAKING CHANGE: This change may break builds which did not previously use -I/usr/local/fourdst/ (i.e. if previous code included #include "fourdst/fourdst/constants/const.h" it will no longer function). Rather, code should use -I/usr/local/include (or whatever include dir was set by the user at build time) and then #include "fourdst/constants/const.h")
2026-06-05 10:12:30 +02:00
cdebdb9762 docs(meson): version bump v1.1.0 -> v1.1.1
This version is able to compile to a wasm target
2025-12-03 08:22:18 -05:00
793e6528d5 build(wasm): libconstants can now compile to wasm and run as a wasm module 2025-12-03 08:21:40 -05:00
efba74d9fe build(meson.build): added option to turn off pkg-config file generation 2025-07-22 13:20:16 -04:00
9 changed files with 104 additions and 16 deletions

1
.gitignore vendored
View File

@@ -86,3 +86,4 @@ output/
.idea/
scratch/
subprojects/.wraplock

19
cross/macos_arm64.ini Normal file
View File

@@ -0,0 +1,19 @@
[binaries]
c = 'arm64-apple-darwin25-clang'
cpp = 'arm64-apple-darwin25-clang++'
ar = 'arm64-apple-darwin25-ar'
strip = 'arm64-apple-darwin25-strip'
pkg-config = 'pkg-config'
ranlib = '/usr/bin/true'
[host_machine]
system = 'darwin'
cpu_family = 'aarch64'
cpu = 'arm64'
endian = 'little'
[built-in options]
c_args = ['-mmacosx-version-min=15.0']
cpp_args = ['-mmacos-version-min=15.0']
c_link_args = ['-mmacosx-version-min=15.0']
cpp_link_args = ['-mmacos-version-min=15.0']

19
cross/wasm.ini Normal file
View File

@@ -0,0 +1,19 @@
[binaries]
cpp = 'em++'
ar = 'emar'
strip = 'emstrip'
exec_wrapper = 'node'
[built-in options]
cpp_args = ['-Dpkg_config=false', '-Dbuild_tests=false', '-Dbuild_examples=true', '-fwasm-exceptions', '-s', 'MEMORY64=1']
cpp_link_args = ['-s', 'WASM=1', '-s', 'ALLOW_MEMORY_GROWTH=1', '-s', 'MEMORY64=1', '-fwasm-exceptions']
[host_machine]
system = 'emscripten'
cpu_family = 'wasm64'
cpu = 'wasm64'
endian = 'little'
[properties]
cmake_toolchain_file = '/home/tboudreaux/Programming/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake'

1
examples/meson.build Normal file
View File

@@ -0,0 +1 @@
executable('simple_constant_usage', 'simple.cpp', dependencies: [const_dep])

13
examples/simple.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include "fourdst/constants/const.h"
#include <iostream>
int main() {
fourdst::constant::Constants& C = fourdst::constant::Constants::getInstance();
std::cout << "Speed of light is " << C.get("c") << std::endl;
std::cout << "All avalible constants are: ";
for (const auto& key : C.keys()) {
std::cout << "\t " << key << ": " << C[key];
}
}

View File

@@ -18,26 +18,56 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# *********************************************************************** #
project('libconstants', 'cpp', version: 'v1.0.6', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0')
project('libconstants', 'cpp', version: 'v1.1.6', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0')
# Add default visibility for all C++ targets
add_project_arguments('-fvisibility=default', language: 'cpp')
if get_option('build_python')
local_py_install = import('python').find_installation('python3', pure: false)
fourdst_pkg = local_py_install.get_install_dir() / 'fourdst'
constants_libdir = fourdst_pkg / 'lib'
constants_header_install_dir = fourdst_pkg / 'include' / 'fourdst' / 'constants'
vendor_lib_dir = fourdst_pkg / 'lib' / 'vendor'
vendor_header_dir = fourdst_pkg / 'include' / 'fourdst' / 'vendor'
message('Installing libconfig in python mode. Install locations are...')
else
constants_libdir = get_option('libdir')
constants_header_install_dir = get_option('includedir') / 'fourdst' / 'constants'
message('Installing libconfig in non python (normal) mode. Install locations are...')
endif
message(' Libraries: ' + constants_libdir)
message(' Headers: ' + constants_header_install_dir)
cpp = meson.get_compiler('cpp')
subdir('assets/static')
subdir('src')
subdir('tests')
pkg = import('pkgconfig')
pkg.generate(
name: 'libconstants',
description: 'Physical Constants for SERiF and related projects',
version: meson.project_version(),
libraries: [libconst],
subdirs: ['fourdst'],
filebase: 'fourdst_constants',
install_dir: join_paths(get_option('libdir'), 'pkgconfig')
)
if get_option('build_tests')
subdir('tests')
endif
if get_option('build_examples')
subdir('examples')
endif
if get_option('pkg_config')
message('Generating pkg-config file for libconstants...')
pkg = import('pkgconfig')
pkg.generate(
name: 'libconstants',
description: 'Physical Constants for SERiF and related projects',
version: meson.project_version(),
libraries: [libconst, '-Wl,-rpath,${libdir}'],
filebase: 'fourdst_constants',
install_dir: join_paths(get_option('libdir'), 'pkgconfig')
)
endif

4
meson_options.txt Normal file
View File

@@ -0,0 +1,4 @@
option('pkg_config', type: 'boolean', value: true, description: 'generate pkg-config file for libconstants (fourdst_constants.pc)')
option('build_tests', type: 'boolean', value: true, description: 'control if tests are built or not')
option('build_examples', type: 'boolean', value: true, description: 'control if examples is built or not')
option('build_python', type: 'boolean', value: false, description: 'Build in python mode. Note that this does not generate a wheel; rather, this is the appropriate option to turn on when packaging this component inside of a wheel.')

View File

@@ -20,11 +20,10 @@
// *********************************************************************** */
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <set>
#include <exception>
#include "fourdst/constants/const.h"

View File

@@ -10,7 +10,8 @@ libconst = library('const',
include_directories: include_directories('include'),
cpp_args: ['-fvisibility=default'],
dependencies: [const_data_dep],
install : true)
install : true,
install_dir: constants_libdir)
const_dep = declare_dependency(
include_directories: include_directories('include'),
@@ -21,4 +22,5 @@ const_dep = declare_dependency(
const_headers = files(
'include/fourdst/constants/const.h'
)
install_headers(const_headers, subdir : 'fourdst/fourdst/constants')
install_headers(const_headers, install_dir: constants_header_install_dir)