2025-06-21 05:35:40 -04:00
# ***********************************************************************
#
# Copyright (C) 2025 -- The 4D-STAR Collaboration
# File Author: Emily Boudreaux
# Last Modified: June 21, 2025
#
# GridFire is free software; you can use it and/or modify
# it under the terms and restrictions the GNU General Library Public
# License version 3 (GPLv3) as published by the Free Software Foundation.
#
# GridFire is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this software; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# *********************************************************************** #
2025-11-28 09:53:54 -05:00
project ( 'GridFire' , [ 'c' , 'cpp' , 'fortran' ] , version : 'v0.7.2_rc2' , default_options : [ 'cpp_std=c++23' ] , meson_version : '>=1.5.0' )
2025-06-21 05:35:40 -04:00
# Add default visibility for all C++ targets
add_project_arguments ( '-fvisibility=default' , language : 'cpp' )
2025-07-24 10:20:44 -04:00
message ( 'Found CXX compiler: ' + meson . get_compiler ( 'cpp' ) . get_id ( ) )
2025-11-27 11:20:53 -05:00
message ( 'Found FORTRAN compiler: ' + meson . get_compiler ( 'fortran' ) . get_id ( ) )
message ( 'C++ standard set to: ' + get_option ( 'cpp_std' ) )
message ( 'Fortran standard set to: ' + get_option ( 'fortran_std' ) )
2025-07-24 10:20:44 -04:00
if meson . get_compiler ( 'cpp' ) . get_id ( ) == 'clang'
# We disable these because of CppAD
message ( 'disabling bitwise-instead-of-logical warnings for clang' )
add_project_arguments ( '-Wno-bitwise-instead-of-logical' , language : 'cpp' )
endif
if meson . get_compiler ( 'cpp' ) . get_id ( ) == 'gcc'
# We disable these because of boost notes about abi changes from C++10 -> C++17 make the build too noisey
message ( 'disabling psabi warnings for gcc' )
add_project_arguments ( '-Wno-psabi' , language : 'cpp' )
2025-11-28 09:42:54 -05:00
if ( meson . get_compiler ( 'cpp' ) . version ( ) . version_compare ( '<14.0' ) )
error ( 'g++ version must be at least 14.0, found ' + meson . get_compiler ( 'cpp' ) . version ( ) )
endif
endif
build_fortran = get_option ( 'build-fortran' )
if ( build_fortran )
add_languages ( 'fortran' , native : true )
message ( 'Building fortran module (gridfire_mod.mod)' )
fc = meson . get_compiler ( 'fortran' )
if not get_option ( 'unsafe-fortran' )
if fc . get_id ( ) != 'gcc'
error ( 'The only supported fortran compiler for GridFire is gfortran (version >= 14.0), found ' + fc + '. GridFire has not been tested with any other compilers. You can disable this check with the -Dunsafe-fortran=true flag to try other compilers' )
endif
endif
endif
if ( meson . get_compiler ( 'fortran' ) . version ( ) . version_compare ( '<14.0' ) )
error ( 'gfortran version must be at least 14.0, found ' + meson . get_compiler ( 'fortran' ) . version ( ) )
2025-07-24 10:20:44 -04:00
endif
2025-06-29 14:53:09 -04:00
# For Eigen
add_project_arguments ( '-Wno-deprecated-declarations' , language : 'cpp' )
2025-11-28 09:42:54 -05:00
llevel = get_option ( 'log-level' )
2025-06-26 15:13:46 -04:00
logbase = 'QUILL_COMPILE_ACTIVE_LOG_LEVEL_'
if ( llevel == 'traceL3' )
2025-08-15 12:11:32 -04:00
message ( 'Setting log level to TRACE_L3' )
2025-06-26 15:13:46 -04:00
log_argument = logbase + 'TRACE_L3'
elif ( llevel == 'traceL2' )
2025-08-15 12:11:32 -04:00
message ( 'Setting log level to TRACE_L2' )
2025-06-26 15:13:46 -04:00
log_argument = logbase + 'TRACE_L2'
elif ( llevel == 'traceL1' )
2025-08-15 12:11:32 -04:00
message ( 'Setting log level to TRACE_L1' )
2025-06-26 15:13:46 -04:00
log_argument = logbase + 'TRACE_L1'
elif ( llevel == 'debug' )
2025-08-15 12:11:32 -04:00
message ( 'Setting log level to DEBUG' )
2025-06-26 15:13:46 -04:00
log_argument = logbase + 'DEBUG'
elif ( llevel == 'info' )
2025-08-15 12:11:32 -04:00
message ( 'Setting log level to INFO' )
2025-06-26 15:13:46 -04:00
log_argument = logbase + 'INFO'
elif ( llevel == 'warning' )
2025-08-15 12:11:32 -04:00
message ( 'Setting log level to WARNING' )
2025-06-26 15:13:46 -04:00
log_argument = logbase + 'WARNING'
elif ( llevel == 'error' )
2025-08-15 12:11:32 -04:00
message ( 'Setting log level to ERROR' )
2025-06-26 15:13:46 -04:00
log_argument = logbase + 'ERROR'
elif ( llevel == 'critical' )
2025-08-15 12:11:32 -04:00
message ( 'Setting log level to CRITICAL' )
2025-06-26 15:13:46 -04:00
log_argument = logbase + 'CRITICAL'
endif
log_argument = '-DQUILL_COMPILE_ACTIVE_LOG_LEVEL=' + log_argument
add_project_arguments ( log_argument , language : 'cpp' )
2025-06-21 05:35:40 -04:00
cpp = meson . get_compiler ( 'cpp' )
subdir ( 'build-config' )
subdir ( 'src' )
2025-07-23 16:26:30 -04:00
2025-09-19 15:14:46 -04:00
if get_option ( 'build-python' )
message ( 'Configuring Python bindings...' )
2025-09-29 13:35:48 -04:00
subdir ( 'build-python' )
2025-09-19 15:14:46 -04:00
else
message ( 'Skipping Python bindings...' )
endif
2025-07-23 16:26:30 -04:00
2025-09-19 15:14:46 -04:00
if get_option ( 'build-tests' )
message ( 'Setting up tests for GridFire...' )
subdir ( 'tests' )
else
message ( 'Skipping tests for GridFire...' )
endif
2025-06-21 05:35:40 -04:00
2025-07-23 16:26:30 -04:00
if get_option ( 'pkg-config' )
message ( 'Generating pkg-config file for GridFire...' )
pkg = import ( 'pkgconfig' )
pkg . generate (
name : 'gridfire' ,
description : 'GridFire nuclear reaction network solver' ,
version : meson . project_version ( ) ,
libraries : [
libgridfire ,
libcomposition ,
libconfig ,
libconst ,
liblogging
] ,
subdirs : [ 'gridfire' ] ,
filebase : 'gridfire' ,
install_dir : join_paths ( get_option ( 'libdir' ) , 'pkgconfig' )
)
endif
2025-06-21 16:54:23 -04:00
2025-06-21 05:35:40 -04:00