Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gwaldron/osgearth
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed Apr 3, 2024
2 parents 33fa735 + b07136f commit 22f15e7
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
9 changes: 9 additions & 0 deletions share/ExternalProject/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.20)

project(ExternalExample)

find_package(osgEarth CONFIG REQUIRED)

add_executable(ExternalExample main.cpp)

target_link_libraries(ExternalExample PRIVATE osgEarth)
10 changes: 10 additions & 0 deletions share/ExternalProject/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# External Project Example
This is a simple example to test the `osgEarthConfig.cmake` packaging configuration file for CMake.

These line in your `CMakeLists.txt` will tell CMake to look for `osgEarthConfig.cmake` and use it to resolve osgEarth and its public-facing dependencies:
```
find_package(osgEarth CONFIG REQUIRED)
...
target_link_libraries(my_project PRIVATE osgEarth)
```
You may need to update your `CMAKE_PREFIX_PATH` to include the location of `osgEarthConfig.cmake`.
24 changes: 24 additions & 0 deletions share/ExternalProject/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <osgEarth/MapNode>
#include <osgEarth/TMS>
#include <osgEarth/EarthManipulator>
#include <osgViewer/Viewer>

int main(int argc, char** argv)
{
osg::ArgumentParser args(&argc, argv);
osgViewer::Viewer viewer(args);

osgEarth::initialize();
osgEarth::setNotifyLevel(osg::INFO);

auto layer = new osgEarth::TMSImageLayer();
layer->setURL("https://readymap.org/readymap/tiles/1.0.0/7/");

auto mapNode = new osgEarth::MapNode();
mapNode->getMap()->addLayer(layer);

viewer.setCameraManipulator(new osgEarth::Util::EarthManipulator());

viewer.setSceneData(mapNode);
return viewer.run();
}
5 changes: 3 additions & 2 deletions src/osgEarth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ IF(WIN32)
LIST(APPEND TARGET_EXTERNAL_LIBRARIES psapi)
ENDIF(WIN32)


LIST(APPEND TARGET_EXTERNAL_LIBRARIES meshoptimizer::meshoptimizer)
IF(meshoptimizer_FOUND)
LIST(APPEND TARGET_EXTERNAL_LIBRARIES meshoptimizer::meshoptimizer)
ENDIF()


# Generate the Version header.
Expand Down
1 change: 1 addition & 0 deletions src/osgEarth/weejobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <thread>
#include <type_traits>
#include <vector>
#include <string>

// OPTIONAL: Define WEEJOBS_EXPORT if you want to use this library from multiple modules (DLLs)
#ifndef WEEJOBS_EXPORT
Expand Down

0 comments on commit 22f15e7

Please sign in to comment.