Skip to content

Commit

Permalink
Get model disabled builds compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
lefticus committed Jul 17, 2023
1 parent 1c38c5a commit a98f5f4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ void modelica_command(CLI::App &app, nlohmann::json &user_input)

create_fmu_command->callback(
[&user_input]() { std::cout << "create-fmu callback input: " << user_input << std::endl; });
#else
// get rid of the unused variable warning without breaking the check for the
// other ifdef'd block
[[maybe_unused]] const auto &app_ref = app;
[[maybe_unused]] const auto &user_input_ref = user_input;
#endif
}

Expand Down
7 changes: 6 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ add_executable(
)

add_dependencies(tests example_fmu_lib)
target_link_libraries(tests PRIVATE CONAN_PKG::catch2 spawn_mbl spawn_utils fmu libspawn compile_options)
target_link_libraries(tests PRIVATE CONAN_PKG::catch2 spawn_utils fmu libspawn compile_options)

if(ENABLE_BUILDINGS_LIBRARY)
target_link_libraries(tests PRIVATE spawn_mbl)
endif()


if (ENABLE_COMPILER OR ENABLE_MODELICA_COMPILER)
add_executable(test_compiler test_compiler.cpp)
Expand Down
14 changes: 13 additions & 1 deletion test/create_epfmu.cpp
Original file line number Diff line number Diff line change
@@ -1,30 +1,42 @@
#include "create_epfmu.hpp"
#include "../mbl/config.hpp"
#include "../submodules/EnergyPlus/third_party/nlohmann/json.hpp"
#include "../util/config.hpp"
#include "paths.hpp"
#include <fmt/format.h>
#include <fstream>
#include "../mbl/config.hpp"

using json = nlohmann::json;

spawn_fs::path single_family_house_idf_path()
{
#if defined ENABLE_MODELICA_COMPILER
return spawn::project_binary_dir() / "mbl/MBL-prefix/src/MBL/Buildings/Resources/Data/ThermalZones" /
spawn::mbl_energyplus_version_string() / "Examples" /
"SingleFamilyHouse_TwoSpeed_ZoneAirBalance/SingleFamilyHouse_TwoSpeed_ZoneAirBalance.idf";
#else
return {};
#endif
}

spawn_fs::path two_zones_idf_path()
{
#if defined ENABLE_MODELICA_COMPILER
return spawn::project_binary_dir() / "mbl/MBL-prefix/src/MBL/Buildings/Resources/Data/ThermalZones" /
spawn::mbl_energyplus_version_string() / "Validation/TwoIdenticalZones/TwoIdenticalZones.idf";
#else
return {};
#endif
}

spawn_fs::path chicago_epw_path()
{
#if defined ENABLE_MODELICA_COMPILER
return spawn::project_binary_dir() /
"mbl/MBL-prefix/src/MBL/Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw";
#else
return {};
#endif
}

spawn_fs::path create_epfmu()
Expand Down
4 changes: 4 additions & 0 deletions test/test_spawn_cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@

using json = nlohmann::json;

#if defined ENABLE_MODELICA_COMPILER
const std::string one_zone_one_year =
"Buildings.ThermalZones." + spawn::mbl_energyplus_version_string() + ".Validation.ThermalZone.OneZoneOneYear";
#else
const std::string one_zone_one_year = "";
#endif

TEST_CASE("Spawn shows help")
{
Expand Down

0 comments on commit a98f5f4

Please sign in to comment.