-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add osgearth/3.2 #7535
Merged
Merged
add osgearth/3.2 #7535
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c3ab92c
add osgearth/3.2
maspri 9b5ceef
set cpp standard in test_package
maspri 41cd0f0
fix not linking against gdal/protobuf in windows build
maspri af1f202
disallow apple-clang if cppstd is not set
maspri e865699
remove default ninja again
maspri bd5652f
delete fPIC on windows
maspri 87476d7
fix osg include
maspri 1a1b76e
fix getting compiler version
maspri 501222b
Update recipes/osgearth/all/conanfile.py
SSE4 5c76617
Update recipes/osgearth/all/conanfile.py
SSE4 248d269
incorporate suggestions
maspri c78d765
Apply suggested changes
maspri 8a00af8
add version to draco requirement
maspri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
if(WIN32) | ||
add_compile_definitions(NOGDI) | ||
endif() | ||
|
||
# osgearth ships with custom cmake find modules. Unfortunately these set | ||
# different variables than the ones generated by conan (most notably *_LIBRARY | ||
# instead of *_LIBRARIES, but also different names). In the following | ||
# these different variables are set using the variables set by conan's | ||
# find modules. | ||
|
||
# OSG | ||
find_package(OpenSceneGraph REQUIRED) | ||
|
||
set(OSG_PLUGINS "osgPlugins-${OPENSCENEGRAPH_VERSION}" CACHE STRING "" FORCE) | ||
set(OSG_LIBRARY ${OPENSCENEGRAPH_LIBRARIES}) | ||
set(OSG_FOUND ${OPENSCENEGRAPH_FOUND}) | ||
set(OSG_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIRS}) | ||
set(OSG_INCLUDE_DIR "${OPENSCENEGRAPH_INCLUDE_DIRS}") | ||
set(OSG_GEN_INCLUDE_DIR "${OPENSCENEGRAPH_INCLUDE_DIRS}") | ||
|
||
# gdal | ||
find_package(GDAL REQUIRED) | ||
set(GDAL_LIBRARY ${GDAL_LIBRARIES}) | ||
|
||
# curl | ||
find_package(CURL REQUIRED) | ||
set(CURL_LIBRARY ${CURL_LIBRARIES}) | ||
|
||
# protobuf | ||
find_package(Protobuf) | ||
set(Protobuf_INCLUDE_DIR ${protobuf_INCLUDE_DIR}) | ||
set(Protobuf_LIBRARIES ${protobuf_LIBRARIES}) | ||
|
||
# GEOS | ||
if (OSGEARTH_WITH_GEOS) | ||
find_package(geos) | ||
endif () | ||
set(GEOS_LIBRARY ${GEOS_LIBS}) | ||
set(GEOS_FOUND ${GEOS_LIBRARY}) | ||
|
||
# SQLite3 | ||
if (OSGEARTH_WITH_SQLITE3) | ||
find_package(SQLite3) | ||
endif () | ||
set(SQLITE3_FOUND ${SQLite3_FOUND}) | ||
set(SQLITE3_LIBRARY ${SQLite_LIBRARIES}) | ||
set(SQLITE3_INCLUDE_DIR ${SQLite_INCLUDE_DIR}) | ||
|
||
# WebP | ||
if (OSGEARTH_WITH_WEBP) | ||
find_package(WebP) | ||
endif () | ||
set(WEBP_FOUND ${WebP_FOUND}) | ||
set(WEBP_LIBRARY ${WebP_LIBRARIES}) | ||
set(WEBP_INCLUDE_DIR ${WebP_INCLUDE_DIR}) | ||
|
||
# libzip | ||
if (OSGEARTH_BUILD_ZIP_PLUGIN) | ||
find_package(LIBZIP) | ||
endif () | ||
set(LIBZIP_FOUND ${libzip_FOUND}) | ||
set(LIBZIP_LIBRARY ${libzip_LIBRARIES}) | ||
set(LIBZIP_INCLUDE_DIR ${libzip_INCLUDE_DIR}) | ||
|
||
# leveldb | ||
find_package(leveldb) | ||
set(LEVELDB_FOUND ${leveldb_FOUND}) | ||
set(LEVELDB_LIBRARY ${leveldb_LIBRARIES}) | ||
set(LEVELDB_INCLUDE_DIR ${leveldb_INCLUDE_DIR}) | ||
|
||
add_subdirectory(source_subfolder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
sources: | ||
'3.2': | ||
sha256: 7e1dd643b1f3b8d1ba9561b899c18176af988342b86c42d89a70be924cb747f6 | ||
url: https://github.com/gwaldron/osgearth/archive/refs/tags/osgearth-3.2.tar.gz | ||
patches: | ||
'3.2': | ||
- patch_file: patches/3.2-osgearth.patch | ||
base_path: source_subfolder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,299 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan.tools.files import rename | ||
from conans.errors import ConanInvalidConfiguration | ||
from conans.tools import os_info | ||
import os | ||
|
||
|
||
class OsgearthConan(ConanFile): | ||
name = "osgearth" | ||
license = "LGPL-3.0" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
description = "osgEarth is a C++ geospatial SDK and terrain engine. \ | ||
Just create a simple XML file, point it at your map data, \ | ||
and go! osgEarth supports all kinds of data and comes with \ | ||
lots of examples to help you get up and running quickly \ | ||
and easily." | ||
topics = "openscenegraph", "graphics" | ||
settings = "os", "compiler", "build_type", "arch" | ||
homepage = "http://osgearth.org/" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"build_procedural_nodekit": [True, False], | ||
# "build_triton_nodekit": [True, False], | ||
# "build_silverlining_nodekit": [True, False], | ||
"build_leveldb_cache": [True, False], | ||
"build_rocksdb_cache": [True, False], | ||
"build_zip_plugin": [True, False], | ||
"enable_geocoder": [True, False], | ||
"with_geos": [True, False], | ||
"with_sqlite3": [True, False], | ||
"with_draco": [True, False], | ||
# "with_basisu": [True, False], | ||
# "with_glew": [True, False], | ||
"with_protobuf": [True, False], | ||
"with_webp": [True, False], | ||
"install_shaders": [True, False], | ||
"enable_nvtt_cpu_mipmaps": [True, False], | ||
"enable_wininet_for_http": [True, False], | ||
} | ||
|
||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"build_procedural_nodekit": True, | ||
# "build_triton_nodekit": False, | ||
# "build_silverlining_nodekit": False, | ||
"build_leveldb_cache": False, | ||
"build_rocksdb_cache": False, | ||
"build_zip_plugin": True, | ||
"enable_geocoder": False, | ||
"with_geos": True, | ||
"with_sqlite3": True, | ||
"with_draco": False, | ||
# "with_basisu": False, | ||
# "with_glew": True, | ||
"with_protobuf": True, | ||
"with_webp": True, | ||
"install_shaders": True, | ||
"enable_nvtt_cpu_mipmaps": False, | ||
"enable_wininet_for_http": False, | ||
} | ||
|
||
short_paths = True | ||
exports_sources = "CMakeLists.txt", "patches/*.patch" | ||
generators = "cmake", "cmake_find_package" | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
tools.check_min_cppstd(self, 11) | ||
elif self.settings.compiler == "apple-clang": | ||
raise ConanInvalidConfiguration("With apple-clang cppstd needs to be set, since default is not at least c++11.") | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
|
||
def config_options(self): | ||
if self.settings.os != "Windows": | ||
self.options.enable_wininet_for_http = False | ||
|
||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
if self.settings.compiler == "Visual Studio": | ||
self.options.build_procedural_nodekit = False | ||
|
||
if self.settings.compiler == "gcc" and self.settings.compiler.version == "11": | ||
# need draco >= 1.4.0 for gcc11 | ||
# https://github.com/google/draco/issues/635 | ||
self.options.with_draco = False | ||
|
||
def requirements(self): | ||
|
||
self.requires("opengl/system") | ||
self.requires("gdal/3.3.1") | ||
self.requires("openscenegraph/3.6.5") | ||
self.requires("libcurl/7.79.1") | ||
|
||
self.requires("libtiff/4.3.0", override=True) | ||
self.requires("openssl/1.1.1l", override=True) | ||
|
||
# if self.options.build_triton_nodekit: | ||
# self.requires("triton_nodekit") | ||
# if self.options.build_silverlining_nodekit: | ||
# self.requires("silverlining_nodekit") | ||
if self.options.build_leveldb_cache: | ||
self.requires("leveldb/1.22") | ||
if self.options.build_rocksdb_cache: | ||
self.requires("rocksdb/6.20.3") | ||
if self.options.build_zip_plugin: | ||
self.requires("libzip/1.7.3") | ||
self.requires("zstd/1.4.9") # override | ||
if self.options.with_geos: | ||
self.requires("geos/3.9.1") | ||
if self.options.with_sqlite3: | ||
self.requires("sqlite3/3.36.0") | ||
if self.options.with_draco: | ||
self.requires("draco") | ||
maspri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# if self.options.with_basisu: | ||
# self.requires("basisu") | ||
# if self.options.with_glew: | ||
# self.requires("glew/2.2.0") | ||
if self.options.with_protobuf: | ||
self.requires("protobuf/3.17.1") | ||
if self.options.with_webp: | ||
self.requires("libwebp/1.2.0") | ||
|
||
def _patch_sources(self): | ||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
tools.patch(**patch) | ||
|
||
for package in ("Draco", "GEOS", "LevelDB", "OSG", "RocksDB", "Sqlite3", "WEBP"): | ||
# Prefer conan's find package scripts over osgEarth's | ||
os.unlink(os.path.join(self._source_subfolder, "CMakeModules", "Find{}.cmake".format(package))) | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], | ||
destination=self._source_subfolder, strip_root=True) | ||
|
||
self._patch_sources() | ||
|
||
def _configured_cmake(self): | ||
if hasattr(self, "_cmake"): | ||
return self._cmake | ||
|
||
self._cmake = cmake = CMake(self) | ||
cmake.definitions["OSGEARTH_BUILD_SHARED_LIBS"] = self.options.shared | ||
cmake.definitions["OSGEARTH_BUILD_TOOLS"] = False | ||
cmake.definitions["OSGEARTH_BUILD_EXAMPLES"] = False | ||
cmake.definitions["OSGEARTH_BUILD_TESTS"] = False | ||
|
||
cmake.definitions["OSGEARTH_BUILD_PROCEDURAL_NODEKIT"] = self.options.build_procedural_nodekit | ||
# cmake.definitions["OSGEARTH_BUILD_TRITON_NODEKIT"] = self.options.build_triton_nodekit | ||
# cmake.definitions["OSGEARTH_BUILD_SILVERLINING_NODEKIT"] = self.options.build_silverlining_nodekit | ||
cmake.definitions["OSGEARTH_BUILD_LEVELDB_CACHE"] = self.options.build_leveldb_cache | ||
cmake.definitions["OSGEARTH_BUILD_ROCKSDB_CACHE"] = self.options.build_rocksdb_cache | ||
cmake.definitions["OSGEARTH_BUILD_ZIP_PLUGIN"] = self.options.build_zip_plugin | ||
cmake.definitions["OSGEARTH_ENABLE_GEOCODER"] = self.options.enable_geocoder | ||
|
||
cmake.definitions["WITH_EXTERNAL_DUKTAPE"] = False | ||
cmake.definitions["WITH_EXTERNAL_TINYXML"] = False | ||
cmake.definitions["CURL_IS_STATIC"] = not self.options["libcurl"].shared | ||
cmake.definitions["CURL_INCLUDE_DIR"] = self.deps_cpp_info["libcurl"].include_paths[0] | ||
cmake.definitions["OSGEARTH_INSTALL_SHADERS"] = self.options.install_shaders | ||
cmake.definitions["OSGEARTH_ENABLE_NVTT_CPU_MIPMAPS"] = self.options.enable_nvtt_cpu_mipmaps | ||
cmake.definitions["OSGEARTH_ENABLE_WININET_FOR_HTTP"] = self.options.enable_wininet_for_http | ||
|
||
# our own defines for using in our top-level CMakeLists.txt | ||
cmake.definitions["OSGEARTH_WITH_GEOS"] = self.options.with_geos | ||
cmake.definitions["OSGEARTH_WITH_SQLITE3"] = self.options.with_sqlite3 | ||
cmake.definitions["OSGEARTH_WITH_WEBP"] = self.options.with_webp | ||
|
||
cmake.configure() | ||
|
||
return cmake | ||
|
||
def build(self): | ||
self._configured_cmake().build() | ||
|
||
def package(self): | ||
self._configured_cmake().install() | ||
self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) | ||
|
||
if self.options.install_shaders: | ||
rename(self, os.path.join(self.package_folder, "resources"), os.path.join(self.package_folder, "res")) | ||
|
||
if os_info.is_linux: | ||
danimtb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
rename(self, os.path.join(self.package_folder, "lib64"), os.path.join(self.package_folder, "lib")) | ||
|
||
def package_info(self): | ||
if self.settings.build_type == "Debug": | ||
postfix = "d" | ||
elif self.settings.build_type == "RelWithDebInfo": | ||
postfix = "rd" | ||
elif self.settings.build_type == "MinSizeRel": | ||
postfix = "s" | ||
else: | ||
postfix = "" | ||
|
||
def setup_lib(library, required_components): | ||
lib = self.cpp_info.components[library] | ||
lib.libs = [library + postfix] | ||
|
||
for source_lib, components in required_components.items(): | ||
lib.requires += [source_lib + "::" + comp for comp in components] | ||
|
||
return lib | ||
|
||
# osgEarth the main lib | ||
required_libs = {"openscenegraph": ["osg", "osgUtil", "osgSim", "osgViewer", "osgText", "osgGA", "osgShadow", | ||
"OpenThreads", "osgManipulator"], | ||
"libcurl": ["libcurl"], | ||
"gdal": ["gdal"], | ||
"opengl": ["opengl"], | ||
} | ||
|
||
osgearth = setup_lib("osgEarth", required_libs) | ||
|
||
if not self.options.shared and self.settings.compiler == "Visual Studio": | ||
osgearth.defines += ["OSGEARTH_LIBRARY_STATIC"] | ||
if self.options.build_zip_plugin: | ||
osgearth.requires += ["libzip::libzip"] | ||
osgearth.requires += ["zstd::zstd"] | ||
if self.options.with_geos: | ||
osgearth.requires += ["geos::geos"] | ||
if self.options.with_sqlite3: | ||
osgearth.requires += ["sqlite3::sqlite3"] | ||
if self.options.with_protobuf: | ||
osgearth.requires += ["protobuf::protobuf"] | ||
if self.options.with_webp: | ||
osgearth.requires += ["libwebp::libwebp"] | ||
|
||
# osgEarthProcedural | ||
if self.options.build_procedural_nodekit: | ||
setup_lib("osgEarthProcedural", {}).requires.append("osgEarth") | ||
|
||
# plugins | ||
def setup_plugin(plugin): | ||
libname = "osgdb_" + plugin | ||
plugin_library = self.cpp_info.components[libname] | ||
plugin_library.libs = [] if self.options.shared else [libname + postfix] | ||
plugin_library.requires = ["osgEarth"] | ||
if not self.options.shared: | ||
plugin_library.libdirs = [os.path.join("lib", "osgPlugins-{}" | ||
.format(self.deps_cpp_info["openscenegraph"].version))] | ||
return plugin_library | ||
|
||
setup_plugin("osgearth_bumpmap") | ||
setup_plugin("osgearth_cache_filesystem") | ||
|
||
if self.options.build_leveldb_cache: | ||
setup_plugin("osgearth_cache_leveldb").requires.append("leveldb::leveldb") | ||
|
||
if self.options.build_rocksdb_cache: | ||
setup_plugin("osgearth_cache_rocksdb").requires.append("rocksdb::rocksdb") | ||
|
||
setup_plugin("osgearth_bumpmap") | ||
setup_plugin("osgearth_cache_filesystem") | ||
setup_plugin("osgearth_colorramp") | ||
setup_plugin("osgearth_detail") | ||
setup_plugin("earth") | ||
setup_plugin("osgearth_engine_rex") | ||
setup_plugin("osgearth_featurefilter_intersect") | ||
setup_plugin("osgearth_featurefilter_join") | ||
setup_plugin("gltf") | ||
setup_plugin("kml") | ||
setup_plugin("osgearth_mapinspector") | ||
setup_plugin("osgearth_monitor") | ||
setup_plugin("osgearth_scriptengine_javascript") | ||
setup_plugin("osgearth_sky_gl") | ||
setup_plugin("osgearth_sky_simple") | ||
setup_plugin("template") | ||
setup_plugin("osgearth_terrainshader") | ||
|
||
if self.options.with_webp: | ||
setup_plugin("webp").requires.append("libwebp::libwebp") | ||
|
||
setup_plugin("lerc") | ||
setup_plugin("osgearth_vdatum_egm2008") | ||
setup_plugin("osgearth_vdatum_egm84") | ||
setup_plugin("osgearth_vdatum_egm96") | ||
setup_plugin("osgearth_viewpoints") | ||
setup_plugin("fastdxt") | ||
|
||
if self.settings.os == "Windows": | ||
self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) | ||
self.env_info.PATH.append(os.path.join(self.package_folder, "bin/osgPlugins-{}" | ||
.format(self.deps_cpp_info["openscenegraph"].version))) | ||
elif self.settings.os == "Linux": | ||
self.env_info.LD_LIBRARY_PATH.append(os.path.join(self.package_folder, "lib")) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little surprised to see this here.
https://github.com/gwaldron/osgearth/blob/master/CMakeLists.txt
Has this already. I am not familiar with the project but some of this logic seems a tad extra.
Is everything required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
osgearth has custom cmake find modules which unfortunately set different variables than the ones generated by conan (most notably *_LIBRARY instead of *_LIBRARIES, but also different names). These are then used in multiple places throughout, so I opted for setting these non-standard variables in the wrapper.
I agree though, that since I do a patch anyway, the wrapper could probably eliminated. Do you think it is necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wrapper is needed and I suspect Conan V2 will have an impact...
Let's improve the comments!