Skip to content
Closed
9 changes: 7 additions & 2 deletions ports/osgearth/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Source: osgearth
Version: 3.1
Homepage: https://github.com/gwaldron/osgearth
Port-Version: 1
Homepage: https://github.com/gwaldron/osgearth
Description: osgEarth - Dynamic map generation toolkit for OpenSceneGraph Copyright 2015 Pelican Mapping.
Build-Depends: osg[plugins]
Build-Depends: osg[plugins]

Feature: draco
Description: Build with Draco
Build-Depends: draco
38 changes: 38 additions & 0 deletions ports/osgearth/find-draco.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 049e37e..93bd89f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -134,7 +134,6 @@ find_package(GDAL REQUIRED)
# optional
find_package(GEOS)
find_package(Sqlite3)
-find_package(Draco)
find_package(BASISU)
find_package(GLEW)
find_package(Protobuf)
Comment on lines +7 to +12
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like these should also be listed as dependencies of the port?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ports are optional dependencies of the port. So I didn't add them to the dependency lists.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

@BillyONeal BillyONeal Dec 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're optional, but it makes this port behave totally differently depending on what other ports are selected. That is, it makes

vcpkg install osgearth
vcpkg install sqlite

and

vcpkg install sqlite
vcpkg install osgearth

produce completely different results. Generally we need to either provide all such optional components or patch them to always be off.

I think your fix here addresses the Draco dependency, but the other dependencies here are just as likely to create the same problems.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it would be better to add options for every optional dependency. We can add these ports to the dependency lists or make patches to fix them now. We can consider to ask for help from upstream to make optional dependencies more flexible for users.

@@ -162,9 +161,25 @@ IF(SQLITE3_FOUND)
ENDIF(SQLITE3_FOUND)

# DRACO enables geometry compression sometimes used in glTF:
+if(BUILD_WITH_DRACO)
+ include(FindPackageHandleStandardArgs)
+ include(SelectLibraryConfigurations)
+
+ find_path(DRACO_INCLUDE_DIR draco/core/draco_version.h)
+ find_library(DRACO_LIBRARY_DEBUG NAMES draco dracodec dracoenc libdraco libdracodec libdracoenc NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" NO_DEFAULT_PATH REQUIRED)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't the draco port exposing the right bits here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't make sense. Could you please help describe more details?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, there should probably be a share/draco/dracoConfig.cmake or similar which does this find_library stuff for all consumers instead of only osgearth.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understand now. Thanks for your clarification.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried just making it REQUIRED and that seems to have passed over in #15777 ?

+ find_library(DRACO_LIBRARY_RELEASE NAMES draco dracodec dracoenc libdraco libdracodec libdracoenc NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH REQUIRED)
+
+ select_library_configurations(DRACO)
+
+ set(draco_INCLUDE_DIRS ${DRACO_INCLUDE_DIR})
+ set(draco_LIBRARIES ${DRACO_LIBRARY})
+ if(DRACO_LIBRARY)
+ set(draco_FOUND 1)
+ endif()
IF(draco_FOUND)
ADD_DEFINITIONS(-DOSGEARTH_HAVE_DRACO)
ENDIF(draco_FOUND)
+endif()

# GDAL is the underlying geospatial processing SDK
IF(GDAL_FOUND)
10 changes: 8 additions & 2 deletions ports/osgearth/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ vcpkg_from_github(
REF 342fcadf4c8892ba84841cb5b4162bdc51519e3c #version 3.1
SHA512 03378a918306846d2144e545785c783b01e33fa2dd5c77d16d390a275217b6ce7a3a743c35ae99a497b272a7516b055442c0a891bd312cce727a5538b40364f5
HEAD_REF master
PATCHES
find-draco.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
draco BUILD_WITH_DRACO
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
OPTIONS ${FEATURE_OPTIONS}
-DOSGEARTH_BUILD_EXAMPLES=OFF
-DOSGEARTH_BUILD_TESTS=OFF
-DOSGEARTH_BUILD_DOCS=OFF
Expand Down Expand Up @@ -64,4 +70,4 @@ file(REMOVE_RECURSE ${OSGEARTH_DEBUG_TOOLS})
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/${OSG_PLUGINS_SUBDIR})

# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)