PROJECT(OSGEARTH_APPLICATIONS)

SET(OSGCORE_BUNDLED TRUE)

IF(NOT OSGCORE_BUNDLED)
	FIND_PACKAGE(OSGCORE)
	IF(OSGCORE_FOUND)
		INCLUDE(${OSGCORE_USE_FILE})
	ELSE(OSGCORE_FOUND)
		MESSAGE(ERROR "OSGCORE needed but NOT FOUND")
	ENDIF(OSGCORE_FOUND)
	SET(CMAKE_MODULE_PATH  ${PROJECT_SOURCE_DIR}/../../Macros)
ENDIF(NOT OSGCORE_BUNDLED)
SET(OPENSCENEGRAPH_APPLICATION_DIR ${PROJECT_SOURCE_DIR})


#OpenThreads, osg, osgDB and osgUtil are included elsewhere.
SET(TARGET_COMMON_LIBRARIES
    osgEarth
    osgEarthFeatures
    osgEarthUtil
    osgEarthSymbology
    osgEarthAnnotation
)

SET(TARGET_DEFAULT_PREFIX "application_")
SET(TARGET_DEFAULT_APPLICATION_FOLDER "Applications")

SET(TARGET_DEFAULT_LABEL_PREFIX "Tool")
SET(TARGET_DEFAULT_APPLICATION_FOLDER "Tools")

IF(NOT OSGEARTH_BUILD_PLATFORM_IPHONE)

ADD_SUBDIRECTORY(osgearth_viewer)
ADD_SUBDIRECTORY(osgearth_toc)
ADD_SUBDIRECTORY(osgearth_seed)
ADD_SUBDIRECTORY(osgearth_package)
ADD_SUBDIRECTORY(osgearth_tfs)
ADD_SUBDIRECTORY(osgearth_boundarygen)
ADD_SUBDIRECTORY(osgearth_overlayviewer)
ADD_SUBDIRECTORY(osgearth_version)
ADD_SUBDIRECTORY(osgearth_tileindex)
ADD_SUBDIRECTORY(osgearth_atlas)
ADD_SUBDIRECTORY(osgearth_conv)
ADD_SUBDIRECTORY(osgearth_3pv)
ADD_SUBDIRECTORY(osgearth_featureinfo)
#ADD_SUBDIRECTORY(osgearth_featuretiler)

IF(BUILD_OSGEARTH_EXAMPLES)
    SET(TARGET_DEFAULT_LABEL_PREFIX "Sample")
    SET(TARGET_DEFAULT_APPLICATION_FOLDER "Samples")
    ADD_SUBDIRECTORY(osgearth_manip)
    ADD_SUBDIRECTORY(osgearth_cluster)
    ADD_SUBDIRECTORY(osgearth_elevation)
    ADD_SUBDIRECTORY(osgearth_features)
    ADD_SUBDIRECTORY(osgearth_featurefilter)
    ADD_SUBDIRECTORY(osgearth_geodetic_graticule)
    ADD_SUBDIRECTORY(osgearth_los)
    ADD_SUBDIRECTORY(osgearth_terrainprofile)
    ADD_SUBDIRECTORY(osgearth_map)
    ADD_SUBDIRECTORY(osgearth_annotation)
    ADD_SUBDIRECTORY(osgearth_tracks)
    ADD_SUBDIRECTORY(osgearth_transform)
    ADD_SUBDIRECTORY(osgearth_horizon)
    ADD_SUBDIRECTORY(osgearth_http)
    ADD_SUBDIRECTORY(osgearth_measure)
    ADD_SUBDIRECTORY(osgearth_controls)
    ADD_SUBDIRECTORY(osgearth_shadercomp)
    ADD_SUBDIRECTORY(osgearth_tilesource)
    ADD_SUBDIRECTORY(osgearth_imageoverlay)
    ADD_SUBDIRECTORY(osgearth_city)
    ADD_SUBDIRECTORY(osgearth_graticule)
    ADD_SUBDIRECTORY(osgearth_featurequery)
    ADD_SUBDIRECTORY(osgearth_occlusionculling)
    ADD_SUBDIRECTORY(osgearth_colorfilter)
    ADD_SUBDIRECTORY(osgearth_sequencecontrol)
    ADD_SUBDIRECTORY(osgearth_minimap)
    ADD_SUBDIRECTORY(osgearth_mrt)
    ADD_SUBDIRECTORY(osgearth_shadergen)
    ADD_SUBDIRECTORY(osgearth_pick)
    ADD_SUBDIRECTORY(osgearth_wfs)
    ADD_SUBDIRECTORY(osgearth_datetime)
    ADD_SUBDIRECTORY(osgearth_ephemeris)
    ADD_SUBDIRECTORY(osgearth_computerangecallback)
    ADD_SUBDIRECTORY(osgearth_skyview)
    ADD_SUBDIRECTORY(osgearth_server)
    ADD_SUBDIRECTORY(osgearth_srstest)
    ADD_SUBDIRECTORY(osgearth_lights)
    ADD_SUBDIRECTORY(osgearth_noisegen)
    ADD_SUBDIRECTORY(osgearth_infinitescroll)
    ADD_SUBDIRECTORY(osgearth_video)
    ADD_SUBDIRECTORY(osgearth_splat)
    ADD_SUBDIRECTORY(osgearth_htm)
    ADD_SUBDIRECTORY(osgearth_scenegraphcallbacks)
    ADD_SUBDIRECTORY(osgearth_drawables)
    ADD_SUBDIRECTORY(osgearth_magnify)
    ADD_SUBDIRECTORY(osgearth_eci)
    ADD_SUBDIRECTORY(osgearth_windows)
    #ADD_SUBDIRECTORY(osgearth_3dtiles)

    IF(SILVERLINING_FOUND)
        ADD_SUBDIRECTORY(osgearth_silverlining)
    ENDIF(SILVERLINING_FOUND)

    IF(TRITON_FOUND)
        ADD_SUBDIRECTORY(osgearth_triton)
    ENDIF(TRITON_FOUND)

ENDIF(BUILD_OSGEARTH_EXAMPLES)

ELSE()

    IF(BUILD_OSGEARTH_EXAMPLES)
        SET(TARGET_DEFAULT_LABEL_PREFIX "Sample")
        SET(TARGET_DEFAULT_APPLICATION_FOLDER "Samples")
        ADD_SUBDIRECTORY(osgearth_viewerIOS)
    ENDIF()

ENDIF()