fix(unity): GridFire supports unity builds

GridFire can now support unity builds. This is useful for python
bindings. The main limitation is that openssl (a dependency of
libplugin) does not support unity builds. Therefore when building in a
unity build libplugin must be disabled. This is done with the
-Dunity-safe=ture flag at setup time
This commit is contained in:
2025-11-28 11:56:41 -05:00
parent bb558811c6
commit 75a88b9720
8 changed files with 26 additions and 9 deletions

View File

@@ -48,7 +48,7 @@ PROJECT_NAME = GridFire
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = v0.7.3_rc2
PROJECT_NUMBER = v0.7.4_rc2
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewers a

View File

@@ -1,9 +1,17 @@
# bring in all of the fourdst utility repositories
fourdst_build_lib_all = true
if get_option('unity-safe')
fourdst_build_lib_all=false
endif
fourdst_sp = subproject('fourdst',
default_options:
['build-tests=' + get_option('build-tests').to_string(),
'build-python=' + get_option('build-python').to_string()
'build-python=' + get_option('build-python').to_string(),
'build-lib-all=' + fourdst_build_lib_all.to_string(),
'pkg-config=' + get_option('pkg-config').to_string(),
'build-lib-log=true'
]
)
@@ -11,10 +19,15 @@ composition_dep = fourdst_sp.get_variable('composition_dep')
log_dep = fourdst_sp.get_variable('log_dep')
const_dep = fourdst_sp.get_variable('const_dep')
config_dep = fourdst_sp.get_variable('config_dep')
plugin_dep = fourdst_sp.get_variable('plugin_dep')
if not get_option('unity-safe')
plugin_dep = fourdst_sp.get_variable('plugin_dep')
endif
libcomposition = fourdst_sp.get_variable('libcomposition')
libconst = fourdst_sp.get_variable('libconst')
libconfig = fourdst_sp.get_variable('libconfig')
liblogging = fourdst_sp.get_variable('liblogging')
libplugin = fourdst_sp.get_variable('libplugin')
if not get_option('unity-safe')
libplugin = fourdst_sp.get_variable('libplugin')
endif

View File

@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# *********************************************************************** #
project('GridFire', ['c', 'cpp', 'fortran'], version: 'v0.7.3_rc2', default_options: ['cpp_std=c++23'], meson_version: '>=1.5.0')
project('GridFire', ['c', 'cpp', 'fortran'], version: 'v0.7.4_rc2', 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')

View File

@@ -4,3 +4,4 @@ option('build-python', type: 'boolean', value: false, description: 'build the py
option('build-tests', type: 'boolean', value: true, description: 'build the test suite')
option('build-fortran', type: 'boolean', value: false, description: 'build fortran module support')
option('unsafe-fortran', type: 'boolean', value: false, description: 'Allow untested fortran compilers (compilers other than gfortran)')
option('unity-safe', type: 'boolean', value: false, description: 'Enable safe unity builds for better compatibility across different compilers and platforms')

View File

@@ -8,7 +8,7 @@ build-backend = "mesonpy"
[project]
name = "gridfire" # Choose your Python package name
version = "0.7.3_rc2" # Your project's version
version = "0.7.4_rc2" # Your project's version
description = "Python interface to the GridFire nuclear network code"
readme = "README.md"
license = { file = "LICENSE.txt" } # Reference your license file [cite: 2]

View File

@@ -38,11 +38,14 @@ gridfire_build_dependencies = [
log_dep,
xxhash_dep,
eigen_dep,
plugin_dep,
sundials_dep,
json_dep,
]
if not get_option('unity-safe')
gridfire_build_dependencies += [plugin_dep]
endif
# Define the libnetwork library so it can be linked against by other parts of the build system
libgridfire = library('gridfire',
gridfire_sources,

View File

@@ -16,5 +16,5 @@ sys.modules['gridfire.io'] = io
__all__ = ['type', 'utils', 'engine', 'solver', 'exceptions', 'partition', 'reaction', 'screening', 'io', 'policy']
__version__ = "v0.7.3_rc2"
__version__ = "v0.7.4_rc2"

View File

@@ -1,4 +1,4 @@
[wrap-git]
url = https://github.com/4D-STAR/fourdst
revision = v0.9.10
revision = v0.9.11
depth = 1