Skip to content

Commit

Permalink
revert ifdef changes; fix adding compile defs for sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
program-- committed May 17, 2023
1 parent 229a0c9 commit 650969e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ find_package(Boost 1.72.0 REQUIRED)

find_package(SQLite3)
if(SQLITE3_LIBRARY AND SQLITE3_INCLUDE)
set(NGEN_WITH_SQLITE3 ON)
set(NGEN_WITH_SQLITE3 ON)
add_compile_definitions(NGEN_WITH_SQLITE3)
else()
set(NGEN_WITH_SQLITE3 OFF)
endif()
add_compile_definitions(NGEN_WITH_SQLITE3)
message(INFO " SQLite3 support is ${NGEN_WITH_SQLITE3}")

# UDUNITS
Expand Down
10 changes: 5 additions & 5 deletions src/NGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <Catchment_Formulation.hpp>
#include <HY_Features.hpp>

#if NGEN_WITH_SQLITE3
#ifdef NGEN_WITH_SQLITE3
#include <GeoPackage.hpp>
#endif

Expand Down Expand Up @@ -265,10 +265,10 @@ int main(int argc, char *argv[]) {
// TODO: Instead of iterating through a collection of FeatureBase objects mapping to nexi, we instead want to iterate through HY_HydroLocation objects
geojson::GeoJSON nexus_collection;
if (boost::algorithm::ends_with(nexusDataFile, "gpkg")) {
#if NGEN_WITH_SQLITE3
#ifdef NGEN_WITH_SQLITE3
nexus_collection = geopackage::read(nexusDataFile, "nexus", nexus_subset_ids);
#else
throw std::runtime_error("SQLite3 support required to read GeoPackage files.")
throw std::runtime_error("SQLite3 support required to read GeoPackage files.");
#endif
} else {
nexus_collection = geojson::read(nexusDataFile, nexus_subset_ids);
Expand All @@ -278,10 +278,10 @@ int main(int argc, char *argv[]) {
// TODO: Instead of iterating through a collection of FeatureBase objects mapping to catchments, we instead want to iterate through HY_Catchment objects
geojson::GeoJSON catchment_collection;
if (boost::algorithm::ends_with(catchmentDataFile, "gpkg")) {
#if NGEN_WITH_SQLITE3
#ifdef NGEN_WITH_SQLITE3
catchment_collection = geopackage::read(catchmentDataFile, "divides", catchment_subset_ids);
#else
throw std::runtime_error("SQLite3 support required to read GeoPackage files.")
throw std::runtime_error("SQLite3 support required to read GeoPackage files.");
#endif
} else {
catchment_collection = geojson::read(catchmentDataFile, catchment_subset_ids);
Expand Down

0 comments on commit 650969e

Please sign in to comment.