aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/coolprop
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/coolprop')
-rw-r--r--vcpkg/ports/coolprop/cmake-project-include.cmake3
-rw-r--r--vcpkg/ports/coolprop/fix-builderror.patch25
-rw-r--r--vcpkg/ports/coolprop/fix-dependency.patch22
-rw-r--r--vcpkg/ports/coolprop/fix-install.patch45
-rw-r--r--vcpkg/ports/coolprop/fmt-fix.patch156
-rw-r--r--vcpkg/ports/coolprop/portfile.cmake59
-rw-r--r--vcpkg/ports/coolprop/vcpkg.json20
7 files changed, 330 insertions, 0 deletions
diff --git a/vcpkg/ports/coolprop/cmake-project-include.cmake b/vcpkg/ports/coolprop/cmake-project-include.cmake
new file mode 100644
index 0000000..4002296
--- /dev/null
+++ b/vcpkg/ports/coolprop/cmake-project-include.cmake
@@ -0,0 +1,3 @@
+if(MSVC)
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+endif()
diff --git a/vcpkg/ports/coolprop/fix-builderror.patch b/vcpkg/ports/coolprop/fix-builderror.patch
new file mode 100644
index 0000000..de07acb
--- /dev/null
+++ b/vcpkg/ports/coolprop/fix-builderror.patch
@@ -0,0 +1,25 @@
+diff --git a/include/CPmsgpack.h b/include/CPmsgpack.h
+index e11f6be..948cc65 100644
+--- a/include/CPmsgpack.h
++++ b/include/CPmsgpack.h
+@@ -6,7 +6,6 @@
+
+ // Workaround MSVC endiannes issues
+ #if defined(_MSC_VER) && ( defined(_M_ARM) || defined(_M_ARM64) )
+-# define MSGPACK_ENDIAN_LITTLE_BYTE
+ #endif
+
+ #include "msgpack.hpp"
+diff --git a/src/ODEIntegrators.cpp b/src/ODEIntegrators.cpp
+index 23bd4c4..beab710 100644
+--- a/src/ODEIntegrators.cpp
++++ b/src/ODEIntegrators.cpp
+@@ -4,6 +4,8 @@
+ #include "CPstrings.h"
+ #include "Exceptions.h"
+ #include <algorithm>
++#undef max
++#undef min
+
+ bool ODEIntegrators::AdaptiveRK54(AbstractODEIntegrator& ode, double tstart, double tend, double hmin, double hmax, double eps_allowed,
+ double step_relax) {
diff --git a/vcpkg/ports/coolprop/fix-dependency.patch b/vcpkg/ports/coolprop/fix-dependency.patch
new file mode 100644
index 0000000..e89ccba
--- /dev/null
+++ b/vcpkg/ports/coolprop/fix-dependency.patch
@@ -0,0 +1,22 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7bbf8d6..617ac93 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -247,13 +247,10 @@ list(REMOVE_ITEM APP_SOURCES
+ list(REMOVE_ITEM APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/CoolPropLib.cpp")
+
+ set(APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
+-list(APPEND APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/externals/Eigen")
+-list(APPEND APP_INCLUDE_DIRS
+- "${CMAKE_CURRENT_SOURCE_DIR}/externals/msgpack-c/include")
+-list(APPEND APP_INCLUDE_DIRS
+- "${CMAKE_CURRENT_SOURCE_DIR}/externals/fmtlib/include")
+-list(APPEND APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/externals/fmtlib"
+-)# should be deprecated
++find_package(Eigen3 CONFIG REQUIRED)
++find_package(msgpack-cxx CONFIG REQUIRED)
++find_package(fmt CONFIG REQUIRED)
++link_libraries(Eigen3::Eigen msgpack-cxx fmt::fmt)
+ list(APPEND APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include")
+ list(APPEND APP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
+
diff --git a/vcpkg/ports/coolprop/fix-install.patch b/vcpkg/ports/coolprop/fix-install.patch
new file mode 100644
index 0000000..33bef8f
--- /dev/null
+++ b/vcpkg/ports/coolprop/fix-install.patch
@@ -0,0 +1,45 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 619dfeb..f856613 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -543,21 +543,24 @@ if(COOLPROP_OBJECT_LIBRARY
+ endif(MSVC)
+ install(
+ TARGETS ${LIB_NAME}
+- DESTINATION
+- static_library/${CMAKE_SYSTEM_NAME}/${BITNESS}bit_${CMAKE_CXX_COMPILER_ID}_${CMAKE_CXX_COMPILER_VERSION}
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib
+ )
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COOLPROP_LIBRARY_HEADER}
+- DESTINATION static_library)
++ DESTINATION include)
+ elseif(COOLPROP_SHARED_LIBRARY)
+ list(APPEND APP_SOURCES
+ "${CMAKE_CURRENT_SOURCE_DIR}/${COOLPROP_LIBRARY_SOURCE}")
+ add_library(${LIB_NAME} SHARED ${APP_SOURCES} ${COOLPROP_LIBRARY_EXPORTS})
+ install(
+ TARGETS ${LIB_NAME}
+- DESTINATION shared_library/${CMAKE_SYSTEM_NAME}/${BITNESS}bit${CONVENTION}
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib
+ )
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COOLPROP_LIBRARY_HEADER}
+- DESTINATION shared_library)
++ DESTINATION include)
+ set_property(
+ TARGET ${LIB_NAME}
+ APPEND_STRING
+@@ -889,7 +892,9 @@ if(COOLPROP_EES_MODULE)
+ VERBATIM)
+ # install the generated library and the other files
+ install(TARGETS COOLPROP_EES
+- DESTINATION "${CMAKE_INSTALL_PREFIX}/EES/${CMAKE_SYSTEM_NAME}")
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib)
+ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/wrappers/EES/CoolProp.htm"
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/EES/${CMAKE_SYSTEM_NAME}")
+ install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/wrappers/EES/CoolProp.LIB"
diff --git a/vcpkg/ports/coolprop/fmt-fix.patch b/vcpkg/ports/coolprop/fmt-fix.patch
new file mode 100644
index 0000000..8054377
--- /dev/null
+++ b/vcpkg/ports/coolprop/fmt-fix.patch
@@ -0,0 +1,156 @@
+diff --git a/include/CPstrings.h b/include/CPstrings.h
+index 711981cd..fda2f055 100644
+--- a/include/CPstrings.h
++++ b/include/CPstrings.h
+@@ -6,6 +6,8 @@
+ #include <algorithm>
+ #include <functional>
+ #include <cctype>
++#include <vector>
++#include <string>
+
+ #if !defined(NO_FMTLIB)
+ # ifndef FMT_HEADER_ONLY
+@@ -74,17 +76,16 @@ inline bool endswith(const std::string& s1, const std::string& s2) {
+ #if defined(NO_FMTLIB)
+ // Missing string formatting function, this old guy is needed for ancient gcc compilers on PowerPC for VxWorks
+ inline std::string format(const char* fmt, ...);
++#elif FMT_VERSION >= 50000
++template <typename... Args>
++inline std::string format(const char* format_str, const Args&... args) {
++ return fmt::sprintf(format_str, args...);
++}
+ #else
+-// Missing std::string formatting function - provided by the fmtlib library
+ inline std::string format(const char* format, fmt::ArgList args) {
+ return fmt::sprintf(format, args);
+ }
+ FMT_VARIADIC(std::string, format, const char*)
+-// For latest FMTLIB
+-/*template <typename... Args>
+- inline std::string format(const char *format_str, const Args & ... args) {
+- return fmt::sprintf(format_str, args);
+- }*/
+ #endif
+
+ // Missing string split - like in Python
+diff --git a/include/CoolPropFluid.h b/include/CoolPropFluid.h
+index 80fb9ff3..093bd294 100644
+--- a/include/CoolPropFluid.h
++++ b/include/CoolPropFluid.h
+@@ -562,5 +562,19 @@ class CoolPropFluid
+ };
+ };
+
++#if !defined(NO_FMTLIB) && FMT_VERSION >= 90000
++static int format_as(ViscosityDiluteVariables::ViscosityDiluteType type) {
++ return fmt::underlying(type);
++}
++
++static int format_as(TransportPropertyData::ViscosityHardcodedEnum viscosity) {
++ return fmt::underlying(viscosity);
++}
++
++static int format_as(TransportPropertyData::ConductivityHardcodedEnum conductivity) {
++ return fmt::underlying(conductivity);
++}
++#endif
++
+ } /* namespace CoolProp */
+ #endif /* COOLPROPFLUID_H_ */
+diff --git a/include/DataStructures.h b/include/DataStructures.h
+index 0aebc0b4..5265ac82 100644
+--- a/include/DataStructures.h
++++ b/include/DataStructures.h
+@@ -473,5 +473,40 @@ void extract_backend_families(std::string backend_string, backend_families& f1,
+ void extract_backend_families_string(std::string backend_string, backend_families& f1, std::string& f2);
+ std::string get_backend_string(backends backend);
+
++#if !defined(NO_FMTLIB) && FMT_VERSION >= 90000
++/// Allows enums to be formatted
++static int format_as(parameters parameter) {
++ return fmt::underlying(parameter);
++}
++
++static int format_as(phases phase) {
++ return fmt::underlying(phase);
++}
++
++static int format_as(schemes scheme) {
++ return fmt::underlying(scheme);
++}
++
++static int format_as(composition_types type) {
++ return fmt::underlying(type);
++}
++
++static int format_as(fluid_types type) {
++ return fmt::underlying(type);
++}
++
++static int format_as(input_pairs pair) {
++ return fmt::underlying(pair);
++}
++
++static int format_as(backend_families family) {
++ return fmt::underlying(family);
++}
++
++static int format_as(backends backend) {
++ return fmt::underlying(backend);
++}
++#endif
++
+ } /* namespace CoolProp */
+ #endif /* DATASTRUCTURES_H_ */
+diff --git a/include/IncompressibleFluid.h b/include/IncompressibleFluid.h
+index 1ea41775..b641d2e0 100644
+--- a/include/IncompressibleFluid.h
++++ b/include/IncompressibleFluid.h
+@@ -44,6 +44,12 @@ struct IncompressibleData
+ };
+ };
+
++#if !defined(NO_FMTLIB) && FMT_VERSION >= 90000
++static int format_as(IncompressibleData::IncompressibleTypeEnum type) {
++ return fmt::underlying(type);
++}
++#endif
++
+ /// A property provider for incompressible solutions and pure fluids
+ /**
+ This fluid instance is populated using an entry from a JSON file
+diff --git a/src/Backends/Helmholtz/VLERoutines.h b/src/Backends/Helmholtz/VLERoutines.h
+index e13c0295..c63d0cbc 100644
+--- a/src/Backends/Helmholtz/VLERoutines.h
++++ b/src/Backends/Helmholtz/VLERoutines.h
+@@ -97,6 +97,12 @@ struct saturation_PHSU_pure_options
+ }
+ };
+
++#if !defined(NO_FMTLIB) && FMT_VERSION >= 90000
++static int format_as(saturation_PHSU_pure_options::specified_variable_options option) {
++ return fmt::underlying(option);
++}
++#endif
++
+ void saturation_PHSU_pure(HelmholtzEOSMixtureBackend& HEOS, CoolPropDbl specified_value, saturation_PHSU_pure_options& options);
+
+ /* \brief This is a backup saturation_p solver for the case where the Newton solver cannot approach closely enough the solution
+diff --git a/src/HumidAirProp.cpp b/src/HumidAirProp.cpp
+index 640bd843..eb586a63 100644
+--- a/src/HumidAirProp.cpp
++++ b/src/HumidAirProp.cpp
+@@ -76,6 +76,12 @@ enum givens
+ GIVEN_ISENTROPIC_EXPONENT
+ };
+
++#if !defined(NO_FMTLIB) && FMT_VERSION >= 90000
++int format_as(givens given) {
++ return fmt::underlying(given);
++}
++#endif
++
+ void _HAPropsSI_inputs(double p, const std::vector<givens>& input_keys, const std::vector<double>& input_vals, double& T, double& psi_w);
+ double _HAPropsSI_outputs(givens OuputType, double p, double T, double psi_w);
+ double MoleFractionWater(double, double, int, double);
diff --git a/vcpkg/ports/coolprop/portfile.cmake b/vcpkg/ports/coolprop/portfile.cmake
new file mode 100644
index 0000000..146e1db
--- /dev/null
+++ b/vcpkg/ports/coolprop/portfile.cmake
@@ -0,0 +1,59 @@
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO CoolProp/CoolProp
+ REF "v${VERSION}"
+ SHA512 ccd868cb297d86f054318acec4c3bf9f8ec07b54c320d5e887853c4190adefbd3b2d188e7453896656b5ad0e81b32d133fd0ce67bf58e647d58c96918bc993eb
+ HEAD_REF master
+ PATCHES
+ fmt-fix.patch
+ fix-builderror.patch
+ fix-dependency.patch
+ fix-install.patch
+)
+vcpkg_replace_string("${SOURCE_PATH}/CMakeLists.txt" "CACHE LIST" "CACHE STRING")
+
+file(REMOVE_RECURSE "${SOURCE_PATH}/externals")
+file(COPY "${CURRENT_INSTALLED_DIR}/include/IF97.h" DESTINATION "${SOURCE_PATH}/externals/IF97")
+file(COPY "${CURRENT_INSTALLED_DIR}/include/REFPROP_lib.h" DESTINATION "${SOURCE_PATH}/externals/REFPROP-headers/")
+file(COPY "${CURRENT_INSTALLED_DIR}/include/rapidjson" DESTINATION "${SOURCE_PATH}/externals/rapidjson/include")
+# Fix GCC warning when thread_local is substitude as __thread
+vcpkg_replace_string("${SOURCE_PATH}/externals/rapidjson/include/rapidjson/document.h" "thread_local static " "static thread_local ")
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" COOLPROP_SHARED_LIBRARY)
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" COOLPROP_STATIC_LIBRARY)
+
+string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" COOLPROP_MSVC_DYNAMIC)
+string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" COOLPROP_MSVC_STATIC)
+
+vcpkg_find_acquire_program(PYTHON3)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ DISABLE_PARALLEL_CONFIGURE
+ OPTIONS
+ "-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
+ -DCOOLPROP_SHARED_LIBRARY=${COOLPROP_SHARED_LIBRARY}
+ -DCOOLPROP_STATIC_LIBRARY=${COOLPROP_STATIC_LIBRARY}
+ -DCOOLPROP_MSVC_DYNAMIC=${COOLPROP_MSVC_DYNAMIC}
+ -DCOOLPROP_MSVC_STATIC=${COOLPROP_MSVC_STATIC}
+ "-DPYTHON_EXECUTABLE=${PYTHON3}"
+ OPTIONS_RELEASE
+ "-DCOOLPROP_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}"
+ OPTIONS_DEBUG
+ "-DCOOLPROP_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug"
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+
+if (VCPKG_TARGET_IS_WINDOWS AND COOLPROP_SHARED_LIBRARY)
+ vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/CoolPropLib.h
+ "#if defined(COOLPROP_LIB)" "#if 1"
+ )
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+# Handle copyright
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/coolprop/vcpkg.json b/vcpkg/ports/coolprop/vcpkg.json
new file mode 100644
index 0000000..bf69e28
--- /dev/null
+++ b/vcpkg/ports/coolprop/vcpkg.json
@@ -0,0 +1,20 @@
+{
+ "name": "coolprop",
+ "version-semver": "6.4.3",
+ "port-version": 3,
+ "description": "Thermophysical properties for the masses",
+ "homepage": "https://github.com/CoolProp/CoolProp",
+ "license": "MIT",
+ "dependencies": [
+ "eigen3",
+ "fmt",
+ "if97",
+ "msgpack",
+ "rapidjson",
+ "refprop-headers",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}