can't link osgearth libraries by ios

classic Classic list List threaded Threaded
3 messages Options
showzh20 showzh20
Reply | Threaded
Open this post in threaded view
|

can't link osgearth libraries by ios

I can build all the libraries but when I run the osgearth_viewerIOS,reminds me I cannot connect to the specified library and I cannot find the relevant methods
If I set
# osgEarth Examples
OPTION(BUILD_OSGEARTH_EXAMPLES "Enable to build osgEarth Examples" ON)

Cmake will report  errors like this
CMake Error at CMakeModules/OsgEarthMacroUtils.cmake:108 (TARGET_LINK_LIBRARIES):
  Target "osgdb_osgearth_vpb" of type MODULE_LIBRARY may not be linked into
  another target.  One may link only to INTERFACE, STATIC or SHARED
  libraries, or to executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
  CMakeModules/OsgEarthMacroUtils.cmake:170 (LINK_INTERNAL)
  CMakeModules/OsgEarthMacroUtils.cmake:387 (SETUP_LINK_LIBRARIES)
  CMakeModules/OsgEarthMacroUtils.cmake:444 (SETUP_EXE)
  src/applications/osgearth_viewerIOS/CMakeLists.txt:123 (SETUP_EXAMPLE)


CMake Error at CMakeModules/OsgEarthMacroUtils.cmake:108 (TARGET_LINK_LIBRARIES):
  Target "osgdb_osgearth_wcs" of type MODULE_LIBRARY may not be linked into
  another target.  One may link only to INTERFACE, STATIC or SHARED
  libraries, or to executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
  CMakeModules/OsgEarthMacroUtils.cmake:170 (LINK_INTERNAL)
  CMakeModules/OsgEarthMacroUtils.cmake:387 (SETUP_LINK_LIBRARIES)
  CMakeModules/OsgEarthMacroUtils.cmake:444 (SETUP_EXE)
  src/applications/osgearth_viewerIOS/CMakeLists.txt:123 (SETUP_EXAMPLE)


CMake Error at CMakeModules/OsgEarthMacroUtils.cmake:108 (TARGET_LINK_LIBRARIES):
  Target "osgdb_osgearth_wms" of type MODULE_LIBRARY may not be linked into
  another target.  One may link only to INTERFACE, STATIC or SHARED
  libraries, or to executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
  CMakeModules/OsgEarthMacroUtils.cmake:170 (LINK_INTERNAL)
  CMakeModules/OsgEarthMacroUtils.cmake:387 (SETUP_LINK_LIBRARIES)
  CMakeModules/OsgEarthMacroUtils.cmake:444 (SETUP_EXE)
  src/applications/osgearth_viewerIOS/CMakeLists.txt:123 (SETUP_EXAMPLE)


CMake Error at CMakeModules/OsgEarthMacroUtils.cmake:108 (TARGET_LINK_LIBRARIES):
  Target "osgdb_osgearth_xyz" of type MODULE_LIBRARY may not be linked into
  another target.  One may link only to INTERFACE, STATIC or SHARED
  libraries, or to executables with the ENABLE_EXPORTS property set.
tomhog tomhog
Reply | Threaded
Open this post in threaded view
|

Re: can't link osgearth libraries by ios

Hi showzh

Here's the cmake command I use to generate an iOS xcode project

export THIRDPARTY_PATH=/Users/thomashogarth/Documents/AlphaPixel/osgEarth-iOS/3rdParty
cmake ./ -G Xcode -DOSGEARTH_BUILD_PLATFORM_IPHONE:BOOL=ON \
-DIPHONE_SDKVER="11.4" \
-DIPHONE_VERSION_MIN="10.0" \
-DBUILD_OSGEARTH_EXAMPLES:BOOL=ON \
-DOSGEARTH_BUILD_APPLICATION_BUNDLES:BOOL=ON \
-DDYNAMIC_OSGEARTH:BOOL=OFF \
-DOSGEARTH_USE_QT:BOOL=OFF \
-DOSG_DIR:PATH="/Users/thomashogarth/Documents/AlphaPixel/osgEarth-iOS/osg-th" \
-DCURL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/curl-ios-device/include" \
-DCURL_LIBRARY:PATH="$THIRDPARTY_PATH/curl-ios-device/lib/libcurl.a" \
-DGDAL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/gdal-ios-device/include" \
-DGDAL_LIBRARY:PATH="$THIRDPARTY_PATH/gdal-ios-device/lib/libgdal.a" \
-DGEOS_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/geos-ios-device/include/source/headers" \
-DGEOS_LIBRARY:PATH="$THIRDPARTY_PATH/geos-ios-device/lib/libGEOS_3.2.a" \
-DPROJ_LIBRARY:PATH="$THIRDPARTY_PATH/proj4-ios-device/lib/libproj.a" \
-DFREETYPE_LIBRARY:PATH="$THIRDPARTY_PATH/freetype-ios-universal/lib/libFreetype2.a"

Give that a try.

Tom
showzh20 showzh20
Reply | Threaded
Open this post in threaded view
|

Re: can't link osgearth libraries by ios

Hi Tom

Tanks your cmake command,it works,but now when I load readymap.earth it seems doesn't work well , the screen have nothing but the red background.

The console print much messages, some like this:
Warning: dynamic library 'osgPlugins-3.6.1/osgdb_zip.so' does not exist (or isn't readable):
dlopen(osgPlugins-3.6.1/osgdb_zip.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.6.1/osgdb_zip.so"
[osgEarth]  Loading href from /private/var/containers/Bundle/Application/D3C1851B-A0A6-4B32-BA83-8FAB3115EE84/osgearth_viewer_ios.app/viewpoints.xml

I used release build configuration to build osg and osgearth  and this is my osgearth documents

the 3rdParty is dowloads from openscenegraph website
by the way this is my osg cmake command:
export THIRDPARTY_PATH=/Users/zhcode/osgearthBuild/3rdParty
    cmake ./ -G Xcode -DOSG_BUILD_PLATFORM_IPHONE:BOOL=ON \
    -DIPHONE_SDKVER="12.1" \
    -DIPHONE_VERSION_MIN="10.0" \
    -DOPENGL_PROFILE:STRING=GLES3 \
    -DBUILD_OSG_APPLICATIONS:BOOL=OFF \
    -DBUILD_OSG_EXAMPLES:BOOL=ON \
    -DOSG_WINDOWING_SYSTEM:STRING=IOS \
    -DOSG_CPP_EXCEPTIONS_AVAILABLE:BOOL=ON \
    -DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX="imageio" \
    -DDYNAMIC_OPENSCENEGRAPH:BOOL=OFF \
    -DDYNAMIC_OPENTHREADS:BOOL=OFF \
    -DCURL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/curl-ios-device/include" \
    -DCURL_LIBRARY:PATH="$THIRDPARTY_PATH/curl-ios-device/lib/libcurl.a" \
    -DFREETYPE_INCLUDE_DIR_freetype2:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include/freetype" \
    -DFREETYPE_INCLUDE_DIR_ft2build:PATH="$THIRDPARTY_PATH/freetype-ios-universal/include" \
    -DFREETYPE_LIBRARY:PATH="$THIRDPARTY_PATH/freetype-ios-universal/lib/libFreeType_iphone_universal.a" \
    -DTIFF_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/tiff-ios-device/include" \
    -DTIFF_LIBRARY:PATH="$THIRDPARTY_PATH/tiff-ios-device/lib/libtiff.a" \
    -DGDAL_INCLUDE_DIR:PATH="$THIRDPARTY_PATH/gdal-ios-device/include" \
    -DGDAL_LIBRARY:PATH="$THIRDPARTY_PATH/gdal-ios-device/lib/libgdal.a"

Did I do something wrong that caused the problem?

Thanks