Compare commits
10 Commits
84e8cdf083
...
51d927b28d
| Author | SHA1 | Date | |
|---|---|---|---|
| 51d927b28d | |||
| 86f10d1521 | |||
| caf48f4590 | |||
| 5753e2cc74 | |||
| de026e4634 | |||
| d4cb187704 | |||
| bc219f48cb | |||
| cdebdb9762 | |||
| 793e6528d5 | |||
| efba74d9fe |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -86,3 +86,4 @@ output/
|
||||
.idea/
|
||||
|
||||
scratch/
|
||||
subprojects/.wraplock
|
||||
|
||||
19
cross/macos_arm64.ini
Normal file
19
cross/macos_arm64.ini
Normal 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
19
cross/wasm.ini
Normal 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
1
examples/meson.build
Normal file
@@ -0,0 +1 @@
|
||||
executable('simple_constant_usage', 'simple.cpp', dependencies: [const_dep])
|
||||
13
examples/simple.cpp
Normal file
13
examples/simple.cpp
Normal 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];
|
||||
}
|
||||
}
|
||||
54
meson.build
54
meson.build
@@ -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
4
meson_options.txt
Normal 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.')
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user