build(GridFire): building on gcc and clang

resolved some issues preventing GridFire from building on both gcc and clang. Also resolved all warnings on both compilers.
This commit is contained in:
2025-07-24 10:20:44 -04:00
parent c3bc75a7f4
commit cc3708fda5
11 changed files with 32 additions and 22 deletions

View File

@@ -2,4 +2,4 @@ eigen_dep = dependency(
'eigen3',
version : '>=3.3',
fallback : ['eigen', 'eigen_dep']
)
).as_system()

View File

@@ -22,8 +22,20 @@ project('GridFire', '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')
# We disable these because of CppAD
add_project_arguments('-Wno-bitwise-instead-of-logical', language: 'cpp')
message('Found CXX compiler: ' + meson.get_compiler('cpp').get_id())
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')
endif
# For Eigen
add_project_arguments('-Wno-deprecated-declarations', language: 'cpp')

View File

@@ -4,7 +4,7 @@
namespace gridfire::reaclib {
static bool s_initialized = false;
[[maybe_unused]] static bool s_initialized = false;
/**
* @brief Provides global access to the fully initialized REACLIB reaction set.

View File

@@ -536,7 +536,7 @@ namespace gridfire::reaction {
///
friend std::ostream& operator<<(std::ostream& os, const TemplatedReactionSet<ReactionT>& r) {
os << "(ReactionSet: [";
int counter = 0;
size_t counter = 0;
for (const auto& reaction : r.m_reactions) {
os << reaction;
if (counter < r.m_reactions.size() - 2) {

View File

@@ -860,7 +860,7 @@ namespace gridfire {
// Dynamic cast to REACLIBReaction to access specific properties
csvFile << reaction.id() << ";";
// Reactants
int count = 0;
size_t count = 0;
for (const auto& reactant : reaction.reactants()) {
csvFile << reactant.name();
if (++count < reaction.reactants().size()) {

View File

@@ -339,7 +339,7 @@ namespace gridfire {
}
size_t AdaptiveEngineView::mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const {
if (culledSpeciesIndex < 0 || culledSpeciesIndex >= static_cast<int>(m_speciesIndexMap.size())) {
if (culledSpeciesIndex < 0 || culledSpeciesIndex >= m_speciesIndexMap.size()) {
LOG_ERROR(m_logger, "Culled index {} is out of bounds for species index map of size {}.", culledSpeciesIndex, m_speciesIndexMap.size());
m_logger->flush_log();
throw std::out_of_range("Culled index " + std::to_string(culledSpeciesIndex) + " is out of bounds for species index map of size " + std::to_string(m_speciesIndexMap.size()) + ".");
@@ -348,7 +348,7 @@ namespace gridfire {
}
size_t AdaptiveEngineView::mapCulledToFullReactionIndex(size_t culledReactionIndex) const {
if (culledReactionIndex < 0 || culledReactionIndex >= static_cast<int>(m_reactionIndexMap.size())) {
if (culledReactionIndex < 0 || culledReactionIndex >= m_reactionIndexMap.size()) {
LOG_ERROR(m_logger, "Culled index {} is out of bounds for reaction index map of size {}.", culledReactionIndex, m_reactionIndexMap.size());
m_logger->flush_log();
throw std::out_of_range("Culled index " + std::to_string(culledReactionIndex) + " is out of bounds for reaction index map of size " + std::to_string(m_reactionIndexMap.size()) + ".");

View File

@@ -293,7 +293,7 @@ namespace gridfire {
}
size_t DefinedEngineView::mapViewToFullSpeciesIndex(size_t culledSpeciesIndex) const {
if (culledSpeciesIndex < 0 || culledSpeciesIndex >= static_cast<int>(m_speciesIndexMap.size())) {
if (culledSpeciesIndex < 0 || culledSpeciesIndex >= m_speciesIndexMap.size()) {
LOG_ERROR(m_logger, "Defined index {} is out of bounds for species index map of size {}.", culledSpeciesIndex, m_speciesIndexMap.size());
m_logger->flush_log();
throw std::out_of_range("Defined index " + std::to_string(culledSpeciesIndex) + " is out of bounds for species index map of size " + std::to_string(m_speciesIndexMap.size()) + ".");
@@ -302,7 +302,7 @@ namespace gridfire {
}
size_t DefinedEngineView::mapViewToFullReactionIndex(size_t culledReactionIndex) const {
if (culledReactionIndex < 0 || culledReactionIndex >= static_cast<int>(m_reactionIndexMap.size())) {
if (culledReactionIndex < 0 || culledReactionIndex >= m_reactionIndexMap.size()) {
LOG_ERROR(m_logger, "Defined index {} is out of bounds for reaction index map of size {}.", culledReactionIndex, m_reactionIndexMap.size());
m_logger->flush_log();
throw std::out_of_range("Defined index " + std::to_string(culledReactionIndex) + " is out of bounds for reaction index map of size " + std::to_string(m_reactionIndexMap.size()) + ".");

View File

@@ -1,15 +1,13 @@
#include "gridfire/engine/views/engine_multiscale.h"
#include "gridfire/exceptions/error_engine.h"
#include <numeric>
#include "fourdst/logging/logging.h"
#include <stdexcept>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <ranges>
#include <algorithm>
@@ -531,7 +529,7 @@ namespace gridfire {
m_algebraic_species.size(),
[&]() -> std::string {
std::stringstream ss;
int count = 0;
size_t count = 0;
for (const auto& species : m_algebraic_species) {
ss << species.name();
if (m_algebraic_species.size() > 1 && count < m_algebraic_species.size() - 1) {
@@ -1256,7 +1254,7 @@ namespace gridfire {
} else {
msg << "nuclei ";
// TODO: Refactor nice list printing into utility function somewhere
int counter = 0;
size_t counter = 0;
for (const auto& seed_idx : seed_indices) {
msg << m_baseEngine.getNetworkSpecies()[seed_idx].name();
if (counter < seed_indices.size() - 2) {
@@ -1309,7 +1307,7 @@ namespace gridfire {
size_t slowest_pool_index = 0; // Default to the first pool if no valid pool is found
double slowest_mean_timescale = std::numeric_limits<double>::min();
int count = 0;
size_t count = 0;
for (const auto& pool : pools) {
double mean_timescale = 0.0;
for (const auto& species_idx : pool) {
@@ -1321,7 +1319,7 @@ namespace gridfire {
LOG_CRITICAL(m_logger, "Encountered infinite mean timescale for pool {} with species: {}",
count, [&]() -> std::string {
std::stringstream ss;
int iCount = 0;
size_t iCount = 0;
for (const auto& idx : pool) {
ss << all_species[idx].name() << ": " << all_timescales.at(all_species[idx]);
if (iCount < pool.size() - 1) {

View File

@@ -76,7 +76,7 @@ namespace gridfire::partition {
std::string CompositePartitionFunction::type() const {
std::stringstream ss;
ss << "CompositePartitionFunction(";
int count = 0;
size_t count = 0;
for (const auto& partitionFunction : m_partitionFunctions) {
ss << partitionFunction->type();
if (count < m_partitionFunctions.size() - 1) {

View File

@@ -221,8 +221,8 @@ namespace gridfire::solver {
size_t numSpecies = m_engine.getNetworkSpecies().size();
J.resize(numSpecies+1, numSpecies+1);
J.clear();
for (int i = 0; i < numSpecies; ++i) {
for (int j = 0; j < numSpecies; ++j) {
for (size_t i = 0; i < numSpecies; ++i) {
for (size_t j = 0; j < numSpecies; ++j) {
J(i, j) = m_engine.getJacobianMatrixEntry(i, j);
}
}

View File

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