MacOS build fixes (#2622)

Co-authored-by: Alexander Bock <alexander.bock@liu.se>
Co-authored-by: Joakim Kilby <jockekilby@gmail.com>
This commit is contained in:
Micah Acinapura
2023-05-12 03:35:59 -04:00
committed by GitHub
parent 006aefdff0
commit 4731e8e0a8
14 changed files with 48 additions and 19 deletions

View File

@@ -12,7 +12,7 @@
<TileLevel>13</TileLevel>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>GEOGCS[&quot;Mars 2000&quot;, DATUM[&quot;D_Mars_2000&quot;, SPHEROID[&quot;MARS_2000_IAU_IAG&quot;,3396190.0,169.894447222361179]],PRIMEM[&quot;Greenwich&quot;0],UNIT[&quot;Decimal_Degree&quot;,0.0174532925199433]]</Projection>
<Projection>GEOGCS["Mars2000",DATUM["D_Mars_2000",SPHEROID["MARS_2000_IAU_IAG",3396190,169.8944472236118]],PRIMEM["Greenwich",0],UNIT["Decimal_Degree",0.0174532925199433]]</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>2</BandsCount>

View File

@@ -12,7 +12,7 @@
<TileLevel>13</TileLevel>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>GEOGCS["Mars 2000", DATUM["D_Mars_2000", SPHEROID["MARS_2000_IAU_IAG",3396190.0,169.894447222361179]],PRIMEM["Greenwich"0], UNIT["Decimal_Degree",0.0174532925199433]]</Projection>
<Projection>GEOGCS["Mars2000",DATUM["D_Mars_2000",SPHEROID["MARS_2000_IAU_IAG",3396190,169.8944472236118]],PRIMEM["Greenwich",0],UNIT["Decimal_Degree",0.0174532925199433]]</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>2</BandsCount>

View File

@@ -12,7 +12,7 @@
<TileLevel>13</TileLevel>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>GEOGCS[&quot;Mars 2000&quot;, DATUM[&quot;D_Mars_2000&quot;, SPHEROID[&quot;MARS_2000_IAU_IAG&quot;,3396190.0,169.894447222361179]],PRIMEM[&quot;Greenwich&quot;0],UNIT[&quot;Decimal_Degree&quot;,0.0174532925199433]]</Projection>
<Projection>GEOGCS["Mars2000",DATUM["D_Mars_2000",SPHEROID["MARS_2000_IAU_IAG",3396190,169.8944472236118]],PRIMEM["Greenwich",0],UNIT["Decimal_Degree",0.0174532925199433]]</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>2</BandsCount>

View File

@@ -242,10 +242,10 @@ void RenderableTrail::initializeGL() {
#ifdef __APPLE__
_programObject = BaseModule::ProgramObjectManager.request(
ProgramName,
"EphemerisProgram",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"EphemerisProgram",
absPath("${MODULE_BASE}/shaders/renderabletrail_apple_vs.glsl"),
absPath("${MODULE_BASE}/shaders/renderabletrail_apple_fs.glsl")
);

View File

@@ -59,6 +59,9 @@ if (MSVC)
target_compile_options(CCfits PRIVATE "/W0")
target_compile_definitions(CCfits PRIVATE "_SCL_SECURE_NO_WARNINGS")
else ()
if (APPLE)
target_compile_options(cfitsio PRIVATE "-Wno-implicit-function-declaration")
endif ()
target_compile_options(cfitsio PRIVATE "-w")
target_compile_options(CCfits PRIVATE "-w")
endif ()

View File

@@ -671,7 +671,11 @@ void GeoJsonComponent::addMetaPropertiesToFeature(SubFeatureProps& feature, int
const geos::geom::Geometry* geometry)
{
std::unique_ptr<geos::geom::Point> centroid = geometry->getCentroid();
geos::geom::CoordinateXY centroidCoord = *centroid->getCoordinate();
// Using `auto` here as on MacOS `getCoordinate` returns:
// geos::geom::Coordinate
// but on Windows it returns
// geos::geom::CoordinateXY
auto centroidCoord = *centroid->getCoordinate();
glm::vec2 centroidLatLong = glm::vec2(centroidCoord.y, centroidCoord.x);
feature.centroidLatLong = centroidLatLong;

View File

@@ -295,8 +295,16 @@ subdivideTriangle(const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2,
using namespace geos::geom;
GeometryFactory::Ptr geometryFactory = GeometryFactory::create();
std::unique_ptr<MultiPoint> points = geometryFactory->createMultiPoint(pointCoords);
// @TODO (emmbr, 2023-04-18): This is a bit of a temporary workaround to make the
// createMultiPoint call compile on Mac. It should work with just passing in the
// pointCoords variable directly, but for some reason it didn't. We should come up
// with a solution that does not iterate over the (quite big) std::vector an extra time
std::vector<std::unique_ptr<Point>> geosPoints;
geosPoints.reserve(pointCoords.size());
for (const Coordinate& c : pointCoords) {
geosPoints.emplace_back(geometryFactory->createPoint(c));
}
std::unique_ptr<MultiPoint> points = geometryFactory->createMultiPoint(std::move(geosPoints));
// Create triangulation of points
geos::triangulate::DelaunayTriangulationBuilder builder;
builder.setSites(*points->getCoordinates());

View File

@@ -152,17 +152,17 @@ Dataset loadFile(std::filesystem::path path, SkipAllZeroLines skipAllZeroLines)
while (std::getline(file, line)) {
currentLineNumber++;
// Ignore empty line or commented-out lines
if (line.empty() || line[0] == '#') {
continue;
}
// Guard against wrong line endings (copying files from Windows to Mac) causes
// lines to have a final \r
if (line.back() == '\r') {
line = line.substr(0, line.length() - 1);
}
// Ignore empty line or commented-out lines
if (line.empty() || line[0] == '#') {
continue;
}
strip(line);
// If the first character is a digit, we have left the preamble and are in the

View File

@@ -54,7 +54,6 @@ set(CEF_VERSION "102.0.10+gf249b2e+chromium-102.0.5005.115")
if (WIN32 OR UNIX)
option(USE_SANDBOX OFF)
endif ()
# Add this project's cmake/ directory to the module path.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(cef_support)
@@ -163,7 +162,11 @@ set(WEBBROWSER_RESOURCES_SRCS
# Place Helper in separate executable
# The naming style "<ApplicationName> Helper" is required by Chromium.
set(CEF_HELPER_TARGET "OpenSpace_Helper" CACHE INTERNAL "CEF_HELPER_TARGET")
if (OS_MACOSX)
set(CEF_HELPER_TARGET "OpenSpace Helper" CACHE INTERNAL "CEF_HELPER_TARGET")
else ()
set(CEF_HELPER_TARGET "OpenSpace_Helper" CACHE INTERNAL "CEF_HELPER_TARGET")
endif ()
set(CEF_HELPER_TARGET_GPU "OpenSpace Helper (GPU)" CACHE INTERNAL "CEF_HELPER_TARGET_GPU")
set(CEF_HELPER_TARGET_RENDERER "OpenSpace Helper (Renderer)" CACHE INTERNAL "CEF_HELPER_TARGET_RENDERER")

View File

@@ -160,7 +160,9 @@ function(run_cef_linux_config CEF_TARGET CEF_ROOT)
endfunction ()
function(set_modules_dependency_on_cef_libraries LIB_DEPENDENT)
target_link_libraries(${LIB_DEPENDENT} INTERFACE libcef_lib)
if (WIN32 OR OS_LINUX)
target_link_libraries(${LIB_DEPENDENT} INTERFACE libcef_lib)
endif ()
target_link_libraries(${LIB_DEPENDENT} INTERFACE libcef_dll_wrapper)
endfunction ()

View File

@@ -49,6 +49,10 @@ void WebBrowserApp::OnBeforeCommandLineProcessing(const CefString&,
commandLine->AppendSwitch("use-mock-keychain");
commandLine->AppendSwitch("enable-begin-frame-scheduling");
commandLine->AppendSwitchWithValue("autoplay-policy", "no-user-gesture-required");
#ifdef __APPLE__
commandLine->AppendSwitch("--disable-gpu-sandbox");
commandLine->AppendSwitch("--no-sandbox");
#endif
}
} // namespace openspace

View File

@@ -46,7 +46,7 @@ namespace {
constexpr std::string_view SubprocessPath = "OpenSpace_Helper.exe";
#elif defined(__APPLE__)
constexpr std::string_view SubprocessPath =
"../Frameworks/OpenSpace Helper.app/Contents/MacOS/OpenSpace_Helper";
"../Frameworks/OpenSpace Helper.app/Contents/MacOS/OpenSpace Helper";
#else
constexpr std::string_view SubprocessPath = "OpenSpace_Helper";
#endif

View File

@@ -862,7 +862,12 @@ std::string makeIdentifier(std::string s) {
// marks. Hence, we first convert '_' to whitespaces to avoid them being replaced
// in the puncutation check
std::replace(s.begin(), s.end(), '_', ' ');
std::replace_if(s.begin(), s.end(), std::ptr_fun<int, int>(&std::ispunct), '-');
std::replace_if(
s.begin(),
s.end(),
[](char c) { return std::ispunct(c) == 0; },
'-'
);
std::replace(s.begin(), s.end(), ' ', '_');
return s;
}