build(root): added initial meson build system implimentation and mk script
we will use meson as the build system for this project. Added a rough outline of this which builds source, libraries, and links them to tests (along with the google test library for testing). meson will be setup and compiled with ./mk.
This commit is contained in:
9
meson.build
Normal file
9
meson.build
Normal file
@@ -0,0 +1,9 @@
|
||||
project('4DSSE', 'cpp', version: '0.0.1a', default_options: ['cpp_std=c++23'])
|
||||
|
||||
# Add default visibility for all C++ targets
|
||||
add_project_arguments('-fvisibility=default', language: 'cpp')
|
||||
add_project_arguments('-Wl,-export_dynamic', language: 'cpp')
|
||||
|
||||
|
||||
subdir('src')
|
||||
subdir('tests')
|
||||
9
mk
Executable file
9
mk
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# if build directory is present, remove it
|
||||
if [ -d "build" ]; then
|
||||
rm -rf build
|
||||
fi
|
||||
|
||||
meson setup build
|
||||
meson compile -C build
|
||||
18
src/meson.build
Normal file
18
src/meson.build
Normal file
@@ -0,0 +1,18 @@
|
||||
# Define the library
|
||||
dobj_sources = files(
|
||||
'dobj/private/Metadata.cpp'
|
||||
)
|
||||
|
||||
dobj_headers = files(
|
||||
'dobj/public/Metadata.h'
|
||||
)
|
||||
|
||||
# Define the libdobj library so it can be linked against by other parts of the build system
|
||||
libdobj = library('dobj',
|
||||
dobj_sources,
|
||||
include_directories: include_directories('dobj/public'),
|
||||
cpp_args: ['-fvisibility=default'],
|
||||
install : true)
|
||||
|
||||
# Make headers accessible
|
||||
install_headers(dobj_headers, subdir : '4DSSE/dobj')
|
||||
22
tests/dobj/meson.build
Normal file
22
tests/dobj/meson.build
Normal file
@@ -0,0 +1,22 @@
|
||||
# Test files for dobj
|
||||
test_sources = [
|
||||
'MetadataTest.cpp'
|
||||
]
|
||||
|
||||
foreach test_file : test_sources
|
||||
exe_name = test_file.split('.')[0]
|
||||
message('Building test: ' + exe_name)
|
||||
|
||||
# Create an executable target for each test
|
||||
test_exe = executable(
|
||||
exe_name,
|
||||
test_file,
|
||||
dependencies: gtest_dep,
|
||||
include_directories: include_directories('../../src/dobj/public'),
|
||||
link_with: libdobj, # Link the dobj library
|
||||
install_rpath: '@loader_path/../../src' # Ensure runtime library path resolves correctly
|
||||
)
|
||||
|
||||
# Add the executable as a test
|
||||
test(exe_name, test_exe)
|
||||
endforeach
|
||||
5
tests/meson.build
Normal file
5
tests/meson.build
Normal file
@@ -0,0 +1,5 @@
|
||||
# Google Test dependency
|
||||
gtest_dep = dependency('gtest', main: true, required : true)
|
||||
|
||||
# Subdirectory for dobj tests
|
||||
subdir('dobj')
|
||||
Reference in New Issue
Block a user