build(build): updated build system to be compatible with resource manager

The build system now passes compiler directives based on the mode being build. By default data is stored in the source root (and this is encoded into the compiled binary). However, if building in user mode then data is assumed to be at the meson install prefix data directory
This commit is contained in:
2025-03-20 14:29:43 -04:00
parent 18f3f6689d
commit cb5ac274dc
7 changed files with 61 additions and 12 deletions

View File

@@ -2,11 +2,28 @@ project('4DSSE', 'cpp', version: '0.0.1a', default_options: ['cpp_std=c++23'], m
# Add default visibility for all C++ targets
add_project_arguments('-fvisibility=default', language: 'cpp')
# Determine the mode
mode = 1
if get_option('user_mode')
mode = 0
endif
# Define DATA_DIR based on mode
if mode == 1
data_dir = meson.project_source_root() + '/assets/dynamic'
else
data_dir = get_option('prefix') + '/' + get_option('datadir') + '/4DSSE'
endif
# Pass the DATA_DIR definition to the compiler
add_project_arguments('-DDATA_DIR=' + data_dir, language : 'cpp')
# Build external dependencies first so that all the embedded resources are available to the other targets
subdir('build-config')
subdir('subprojects/PicoSHA2')
subdir('assets/static')
# Build the main project
subdir('src')
if get_option('build_tests')

View File

@@ -1 +1,2 @@
option('build_tests', type: 'boolean', value: true, description: 'Build tests')
option('user_mode', type: 'boolean', value: false, description: 'Enable user mode (set mode = 0)')

View File

@@ -1,23 +1,34 @@
# Define the library
eos_sources = files(
'private/helm.cpp',
'private/eosIO.cpp'
)
eos_headers = files(
'public/helm.h'
'public/helm.h',
'public/eosIO.h'
)
dependencies = [
const_dep,
quill_dep,
probe_dep,
config_dep,
mfem_dep,
macros_dep,
]
# Define the libconst library so it can be linked against by other parts of the build system
libeos = static_library('eos',
eos_sources,
include_directories: include_directories('public'),
cpp_args: ['-fvisibility=default'],
dependencies: [const_dep, quill_dep, probe_dep, config_dep, mfem_dep],
dependencies: dependencies,
install : true)
eos_dep = declare_dependency(
include_directories: include_directories('public'),
link_with: libeos,
dependencies: dependencies
)
# Make headers accessible
install_headers(eos_headers, subdir : '4DSSE/eos')

View File

@@ -6,14 +6,22 @@ meshIO_sources = files(
meshIO_headers = files(
'public/meshIO.h'
)
dependencies = [
mfem_dep
]
# Define the libmeshIO library so it can be linked against by other parts of the build system
libmeshIO = static_library('meshIO',
meshIO_sources,
include_directories: include_directories('public'),
cpp_args: ['-fvisibility=default'],
dependencies: [mfem_dep],
dependencies: dependencies,
install : true)
meshio_dep = declare_dependency(
include_directories: include_directories('public'),
link_with: libmeshIO,
dependencies: dependencies
)
# Make headers accessible
install_headers(meshIO_headers, subdir : '4DSSE/meshIO')

View File

@@ -1,11 +1,18 @@
# Build resources first so that all the embedded resources are available to the other targets
subdir('resources')
# Build the main source code in the correct order
# Build the main source code
subdir('dobj')
subdir('const')
subdir('opatIO')
subdir('meshIO')
# Utility Libraries
subdir('misc')
subdir('config')
subdir('probe')
subdir('const')
subdir('dobj')
# Asset Libraries
subdir('eos')
subdir('opatIO')
subdir('meshIO')
# Resouce Manager Libraries
subdir('resource')
# Physics Libraries

View File

@@ -16,5 +16,9 @@ libopatIO = library('opatIO',
install : true,
)
opatio_dep = declare_dependency(
include_directories: include_directories('public'),
link_with: libopatIO,
)
# Make headers accessible
install_headers(opatIO_headers, subdir : '4DSSE/opatIO')

View File

@@ -11,6 +11,7 @@ subdir('meshIO')
subdir('config')
subdir('probe')
subdir('eos')
subdir('resource')
# Subdirectories for sandbox tests
subdir('dobj_sandbox')