Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix when Compiling with non-standard CMake Configurations #8378

Merged
merged 25 commits into from
Nov 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6125dd0
fix ep_nocache_psychrometrics
mitchute Nov 12, 2020
cbd59a6
Merge branch 'develop' into fix_nocache_psychrometrics
mitchute Nov 13, 2020
06c6420
add CMake to expose EP_nocache_Psychrometrics, add github actions bui…
mitchute Nov 13, 2020
cc00686
fix spelling, minor cleanups
mitchute Nov 13, 2020
7ae4b99
fix CMake for USE_PSYCHROMETRICS_CACHING
mitchute Nov 16, 2020
535426b
move from 'extern T const' to 'constexpr T' in Psychrometrics
mitchute Nov 16, 2020
54dea14
Merge branch 'fix_nocache_psychrometrics' of github.com:NREL/EnergyPl…
mitchute Nov 16, 2020
6bf662e
Merge branch 'develop' into fix_nocache_psychrometrics
mitchute Nov 16, 2020
0d717cd
fix link_with_python=OFF
mitchute Nov 17, 2020
9cdf1b6
test inline-ing cached_Tsat
mitchute Nov 17, 2020
5d7c8a7
move to inline
mitchute Nov 17, 2020
dcc84f7
unify undef's
mitchute Nov 17, 2020
c4eecff
build energyplus_tests on GitHub
mitchute Nov 18, 2020
db33906
build energyplus_tests on GitHub
mitchute Nov 18, 2020
abff040
set BUILD_TESTING=ON
mitchute Nov 18, 2020
9924a3f
Merge branch 'develop' into fix_nocache_psychrometrics
mitchute Nov 19, 2020
3456a4d
turn off build_testing on github, move CMake option up
mitchute Nov 19, 2020
04a4e32
Merge branch 'fix_nocache_psychrometrics' of github.com:NREL/EnergyPl…
mitchute Nov 19, 2020
398c23f
add USE_GLYCOL_CACHE CMake option and build with GH actions
mitchute Nov 20, 2020
bebdc79
Merge branch 'develop' into fix_nocache_psychrometrics
mitchute Nov 23, 2020
ad5a9bc
OPENGL_REQUIRED=OFF to GH actions builds
mitchute Nov 23, 2020
5571721
add USE_PSYCH_CACHE CMake option, fix build, add to GH actions builds
mitchute Nov 23, 2020
3f8f345
move EP_psych_errors to CMake options, add GH actions build, minor fo…
mitchute Nov 23, 2020
955c837
fix Mac unittests build
mitchute Nov 23, 2020
0be9c78
add USE_PSYCH_ERRORS CMake to unittest builds
mitchute Nov 23, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
172 changes: 172 additions & 0 deletions .github/workflows/mac_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: Mac Build

on: [push]

jobs:
python_no_psychcach:
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2
#
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Create Build Directory
run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/EnergyPlus/build
run: cmake -DCMAKE_BUILD_TYPE=Release -DLINK_WITH_PYTHON=ON -DUSE_PSYCHROMETRICS_CACHING=OFF ..

- name: Build EnergyPlus
working-directory: ${{runner.workspace}}/EnergyPlus/build
shell: bash
run: cmake --build . --target energyplus -j 2

no_python_psychcach:
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2
#
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Create Build Directory
run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/EnergyPlus/build
run: cmake -DCMAKE_BUILD_TYPE=Release -DLINK_WITH_PYTHON=OFF -DUSE_PSYCHROMETRICS_CACHING=ON ..

- name: Build EnergyPlus
working-directory: ${{runner.workspace}}/EnergyPlus/build
shell: bash
run: cmake --build . --target energyplus -j 2

no_python_no_psychcach:
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2
#
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Create Build Directory
run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/EnergyPlus/build
run: cmake -DCMAKE_BUILD_TYPE=Release -DLINK_WITH_PYTHON=OFF -DUSE_PSYCHROMETRICS_CACHING=OFF ..

- name: Build EnergyPlus
working-directory: ${{runner.workspace}}/EnergyPlus/build
shell: bash
run: cmake --build . --target energyplus -j 2

no_glcol_cache:
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2
#
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Create Build Directory
run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/EnergyPlus/build
run: cmake -DCMAKE_BUILD_TYPE=Release -DUSE_GLYCOL_CACHING=OFF ..

- name: Build EnergyPlus
working-directory: ${{runner.workspace}}/EnergyPlus/build
shell: bash
run: cmake --build . --target energyplus -j 2

no_opengl:
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2
#
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Create Build Directory
run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/EnergyPlus/build
run: cmake -DCMAKE_BUILD_TYPE=Release -OPENGL_REQUIRED=OFF ..

- name: Build EnergyPlus
working-directory: ${{runner.workspace}}/EnergyPlus/build
shell: bash
run: cmake --build . --target energyplus -j 2

use_psych_stats:
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2
#
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Create Build Directory
run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/EnergyPlus/build
run: cmake -DCMAKE_BUILD_TYPE=Release -USE_PSYCH_STATS=ON ..

- name: Build EnergyPlus
working-directory: ${{runner.workspace}}/EnergyPlus/build
shell: bash
run: cmake --build . --target energyplus -j 2

no_use_psych_errors:
runs-on: macos-10.15

steps:
- uses: actions/checkout@v2
#
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Create Build Directory
run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/EnergyPlus/build
run: cmake -DCMAKE_BUILD_TYPE=Release -USE_PSYCH_ERRORS=OFF ..

- name: Build EnergyPlus
working-directory: ${{runner.workspace}}/EnergyPlus/build
shell: bash
run: cmake --build . --target energyplus -j 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic!

8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ endif()
option( BUILD_PACKAGE "Build package" OFF )
option( BUILD_TESTING "Build testing targets" OFF )
option( BUILD_FORTRAN "Build Fortran stuff" OFF )
option( USE_PSYCHROMETRICS_CACHING "Use psychrometrics cashing routines" ON )
option( USE_GLYCOL_CACHING "Use glycol cashing routines" ON )
option( USE_PSYCH_STATS "Compute psychrometric stats" OFF )
option( USE_PSYCH_ERRORS "Report psychrometric errors " ON )

#######################################################################

Expand Down Expand Up @@ -392,3 +396,7 @@ mark_as_advanced(BUILD_GMOCK)
mark_as_advanced(BUILD_GTEST)
mark_as_advanced(gmock_build_tests)
mark_as_advanced(BUILD_WCE_TESTING)
mark_as_advanced(USE_PSYCHROMETRICS_CACHING)
mark_as_advanced(USE_GLYCOL_CACHING)
mark_as_advanced(USE_PSYCH_STATS)
mark_as_advanced(USE_PSYCH_ERRORS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really great having some new CMake (advanced) variables for turning compiler settings on and off.

18 changes: 18 additions & 0 deletions src/EnergyPlus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ else()
add_definitions("-DLINK_WITH_PYTHON=0")
endif()

if(USE_PSYCHROMETRICS_CACHING)
# Caching defaulted ON
else()
add_definitions("-DEP_nocache_Psychrometrics")
endif()

if(USE_GLYCOL_CACHING)
add_definitions("-DEP_cache_GlycolSpecificHeat")
endif()

if(USE_PSYCH_STATS)
add_definitions("-DEP_psych_stats")
endif()

if(USE_PSYCH_ERRORS)
add_definitions("-DEP_psych_errors")
endif()

SET( SRC
"${PROJECT_SOURCE_DIR}/third_party/milo/dtoa.h"
"${PROJECT_SOURCE_DIR}/third_party/milo/itoa.h"
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/FluidProperties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
#include <EnergyPlus/TempSolveRoot.hh>
#include <EnergyPlus/UtilityRoutines.hh>

#define EP_cache_GlycolSpecificHeat

namespace EnergyPlus {

namespace FluidProperties {
Expand Down
6 changes: 2 additions & 4 deletions src/EnergyPlus/FluidProperties.hh
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/EnergyPlus.hh>

#define EP_cache_GlycolSpecificHeat


namespace EnergyPlus {

// Forward declarations
Expand Down Expand Up @@ -551,7 +548,8 @@ namespace FluidProperties {
return cTsh.sh; // saturation pressure {Pascals}
}
#else
Real64 GetSpecificHeatGlycol(std::string const &Glycol, // carries in substance name
Real64 GetSpecificHeatGlycol(EnergyPlusData &state,
std::string const &Glycol, // carries in substance name
Real64 const Temperature, // actual temperature given as input
int &GlycolIndex, // Index to Glycol Properties
std::string const &CalledFrom // routine this function was called from (error messages)
Expand Down
12 changes: 6 additions & 6 deletions src/EnergyPlus/PluginManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ namespace PluginManagement {
return "Linked to Python Version: \"" + sVersion + "\"";
}
#else
std::string pythonStringForUsage(EnergyPlusData &state)
std::string pythonStringForUsage([[maybe_unused]] EnergyPlusData &state)
{
return "This version of EnergyPlus not linked to Python library.";
}
Expand Down Expand Up @@ -1093,7 +1093,7 @@ namespace PluginManagement {
}
}
#else
void PluginManager::addToPythonPath([[maybe_unused]] EnergyPlusData &state, const std::string &EP_UNUSED(path), bool EP_UNUSED(userDefinedPath))
void PluginManager::addToPythonPath([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const std::string &path, [[maybe_unused]] bool userDefinedPath)
{
}
#endif
Expand Down Expand Up @@ -1135,8 +1135,8 @@ namespace PluginManagement {
}
#else
int PluginManager::getGlobalVariableHandle([[maybe_unused]] EnergyPlusData &state,
const std::string &EP_UNUSED(name),
bool const EP_UNUSED(suppress_warning))
[[maybe_unused]] const std::string &name,
[[maybe_unused]] bool const suppress_warning)
{
return -1;
}
Expand Down Expand Up @@ -1306,7 +1306,7 @@ namespace PluginManagement {
return 0.0;
}
#else
Real64 PluginManager::getGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, int EP_UNUSED(handle))
Real64 PluginManager::getGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] int handle)
{
return 0.0;
}
Expand All @@ -1328,7 +1328,7 @@ namespace PluginManagement {
}
}
#else
void PluginManager::setGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, int EP_UNUSED(handle), Real64 EP_UNUSED(value))
void PluginManager::setGlobalVariableValue([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] int handle, [[maybe_unused]] Real64 value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay for fixed syntax errors!

{
}
#endif
Expand Down
Loading