MacOS: Add workaround for std::variant

pull/474/head
Jonathan G Rennison 1 year ago
parent 24b744f7c8
commit 5e76e6fb07

@ -193,4 +193,9 @@ macro(compile_flags)
# rdynamic is used to get useful stack traces from crash reports.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# workaround for MacOS 10.13 and below which does not support std::variant, etc
add_definitions(-D_LIBCPP_DISABLE_AVAILABILITY)
endif()
endmacro()

@ -4,6 +4,7 @@ add_files(
font_osx.h
macos.h
macos.mm
misc_osx.cpp
osx_stdafx.h
string_osx.cpp
string_osx.h

@ -0,0 +1,19 @@
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file misc_osx.cpp OS X misc functionality */
#include "../../stdafx.h"
#include "../../safeguards.h"
#include <variant>
/* See: https://stackoverflow.com/questions/52310835/xcode-10-call-to-unavailable-function-stdvisit/53868971#53868971 */
const char* std::bad_variant_access::what() const noexcept {
return "bad_variant_access";
}
Loading…
Cancel
Save