From a425f7820ffeb5192a156fa451ab4e8d4c4dc4e6 Mon Sep 17 00:00:00 2001 From: Charlie Vanaret Date: Sun, 17 Nov 2024 14:18:10 +0100 Subject: [PATCH] Replaced std::optional.value() with * dereferencing + removed specialized CI code for macOS (not needed any more) --- .github/julia/build_tarballs_release.jl | 19 ------------------- .github/julia/build_tarballs_yggdrasil.jl | 17 ----------------- .github/julia/generate_binaries.jl | 9 ++++----- bindings/AMPL/uno_ampl.cpp | 2 +- uno/options/Presets.cpp | 4 ++-- 5 files changed, 7 insertions(+), 44 deletions(-) diff --git a/.github/julia/build_tarballs_release.jl b/.github/julia/build_tarballs_release.jl index d2e40fb5..bb2bfe14 100644 --- a/.github/julia/build_tarballs_release.jl +++ b/.github/julia/build_tarballs_release.jl @@ -87,25 +87,6 @@ cd $WORKSPACE/srcdir/Uno mkdir -p build cd build -if [[ "${target}" == x86_64-apple-darwin* ]]; then - # Work around the issue - # /workspace/srcdir/Uno/uno/options/Presets.cpp:17:48: error: 'value' is unavailable: introduced in macOS 10.14 - # Presets::set(options, optional_preset.value()); - # ^ - # /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root/usr/include/c++/v1/optional:938:33: note: 'value' has been explicitly marked unavailable here - # constexpr value_type const& value() const& - # ^ - export MACOSX_DEPLOYMENT_TARGET=10.15 - # ...and install a newer SDK which supports `std::filesystem` - pushd $WORKSPACE/srcdir/MacOSX10.*.sdk - # CV: replacing rm -rf with mv to fix https://github.com/cvanaret/Uno/issues/94 - # rm -rf /opt/${target}/${target}/sys-root/System - mv /opt/${target}/${target}/sys-root/System /opt/${target}/${target}/sys-root/System_old - cp -ra usr/* "/opt/${target}/${target}/sys-root/usr/." - cp -ra System "/opt/${target}/${target}/sys-root/." - popd -fi - if [[ "${target}" == *mingw* ]]; then LIBHIGHS=${prefix}/lib/libhighs.dll.a else diff --git a/.github/julia/build_tarballs_yggdrasil.jl b/.github/julia/build_tarballs_yggdrasil.jl index fe7ed2de..39db3047 100644 --- a/.github/julia/build_tarballs_yggdrasil.jl +++ b/.github/julia/build_tarballs_yggdrasil.jl @@ -23,23 +23,6 @@ cd $WORKSPACE/srcdir/Uno mkdir -p build cd build -if [[ "${target}" == x86_64-apple-darwin* ]]; then - # Work around the issue - # /workspace/srcdir/Uno/uno/options/Presets.cpp:17:48: error: 'value' is unavailable: introduced in macOS 10.14 - # Presets::set(options, optional_preset.value()); - # ^ - # /opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root/usr/include/c++/v1/optional:938:33: note: 'value' has been explicitly marked unavailable here - # constexpr value_type const& value() const& - # ^ - export MACOSX_DEPLOYMENT_TARGET=10.15 - # ...and install a newer SDK which supports `std::filesystem` - pushd $WORKSPACE/srcdir/MacOSX10.*.sdk - rm -rf /opt/${target}/${target}/sys-root/System - cp -ra usr/* "/opt/${target}/${target}/sys-root/usr/." - cp -ra System "/opt/${target}/${target}/sys-root/." - popd -fi - if [[ "${target}" == *mingw* ]]; then LBT=blastrampoline-5 LIBHIGHS=${prefix}/lib/libhighs.dll.a diff --git a/.github/julia/generate_binaries.jl b/.github/julia/generate_binaries.jl index 559301fb..cb6e276d 100644 --- a/.github/julia/generate_binaries.jl +++ b/.github/julia/generate_binaries.jl @@ -31,11 +31,10 @@ for (platform, libdir, ext) in platforms run(`tar -xzf products/$platform/deps.tar.gz -C products/$platform`) # Copy the license of each dependency - # CV: comment out temporarily - #for folder in readdir("products/$platform/deps/licenses") - # cp("products/$platform/deps/licenses/$folder", "products/$platform/share/licenses/$folder") - #end - #rm("products/$platform/deps/licenses", recursive=true) + for folder in readdir("products/$platform/deps/licenses") + cp("products/$platform/deps/licenses/$folder", "products/$platform/share/licenses/$folder") + end + rm("products/$platform/deps/licenses", recursive=true) # Copy the shared library of each dependency for file in readdir("products/$platform/deps") diff --git a/bindings/AMPL/uno_ampl.cpp b/bindings/AMPL/uno_ampl.cpp index 05237e5d..1b054961 100644 --- a/bindings/AMPL/uno_ampl.cpp +++ b/bindings/AMPL/uno_ampl.cpp @@ -113,7 +113,7 @@ int main(int argc, char* argv[]) { // possibly set options from an option file const auto optional_option_file = command_line_options.get_string_optional("option_file"); if (optional_option_file.has_value()) { - Options file_options = Options::load_option_file(optional_option_file.value()); + Options file_options = Options::load_option_file(*optional_option_file); options.overwrite_with(file_options); } diff --git a/uno/options/Presets.cpp b/uno/options/Presets.cpp index 035102a0..369271a0 100644 --- a/uno/options/Presets.cpp +++ b/uno/options/Presets.cpp @@ -14,7 +14,7 @@ namespace uno { /** optional user preset **/ if (optional_preset.has_value()) { - Presets::set(options, optional_preset.value()); + Presets::set(options, *optional_preset); } else { /** default preset **/ @@ -152,4 +152,4 @@ namespace uno { throw std::runtime_error("The preset " + preset_name + " is not known"); } } -} // namespace \ No newline at end of file +} // namespace