Skip to content

Commit

Permalink
Add protobuf forced-config-mode compatibility, which was needed on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed Jun 10, 2024
1 parent 21fb655 commit dd21d8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
7 changes: 5 additions & 2 deletions cmake/oe_osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
IF(APPLE AND NOT ANDROID)
IF(APPLE)

# These are just defaults/recommendations, but how we want to build
# out of the box. But the user needs to be able to change these options.
Expand Down Expand Up @@ -34,5 +34,8 @@ IF(APPLE AND NOT ANDROID)
OPTION(OSGEARTH_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
OPTION(OSGEARTH_BUILD_FRAMEWORKS "Compile frameworks instead of dylibs" OFF)
SET(OSGEARTH_BUILD_FRAMEWORKS_INSTALL_NAME_DIR "@executable_path/../Frameworks" CACHE STRING "Install name dir for compiled frameworks")

# MacOS required this in order to find the protobuf_generate_cpp function:
set(OSGEARTH_PROTOBUF_FORCE_CONFIG_MODE ON)

ENDIF(APPLE AND NOT ANDROID)
ENDIF()
15 changes: 11 additions & 4 deletions src/osgEarth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ find_package(SQLite3 REQUIRED)

# optional
find_package(geos QUIET)
find_package(Protobuf QUIET)
find_package(blend2d QUIET)
find_package(blosc QUIET)
find_package(spdlog QUIET)
Expand All @@ -25,6 +24,14 @@ if(OSGEARTH_BUILD_ZIP_PLUGIN)
find_package(LibZip QUIET)
endif()

if(OSGEARTH_PROTOBUF_FORCE_CONFIG_MODE)
# https://stackoverflow.com/a/56896032/4218920
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")
find_package(Protobuf CONFIG QUIET)
else()
find_package(Protobuf QUIET)
endif()


# Other options ...................................................

Expand Down Expand Up @@ -819,9 +826,9 @@ endif()


# generate the google protocol buffers headers and sources
if(Protobuf_FOUND AND Protobuf_PROTOC_EXECUTABLE)
PROTOBUF_GENERATE_CPP(PROTO_VECTOR_TILE_CPP PROTO_VECTOR_TILE_H vector_tile.proto)
PROTOBUF_GENERATE_CPP(PROTO_GLYPHS_CPP PROTO_GLYPHS_H glyphs.proto)
if(Protobuf_FOUND AND Protobuf_PROTOC_EXECUTABLE)
protobuf_generate_cpp(PROTO_VECTOR_TILE_CPP PROTO_VECTOR_TILE_H vector_tile.proto)
protobuf_generate_cpp(PROTO_GLYPHS_CPP PROTO_GLYPHS_H glyphs.proto)
list(APPEND TARGET_H ${PROTO_VECTOR_TILE_H} ${PROTO_GLYPHS_H})
list(APPEND TARGET_SRC ${PROTO_VECTOR_TILE_CPP} ${PROTO_GLYPHS_CPP})

Expand Down

0 comments on commit dd21d8d

Please sign in to comment.