Skip to content

Commit

Permalink
CMAKE WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed May 6, 2024
1 parent 568bdd4 commit 9dd6e8e
Show file tree
Hide file tree
Showing 30 changed files with 39 additions and 62 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ project(
OSGEARTH
DESCRIPTION "osgEarth 3D Geospatial SDK"
HOMEPAGE_URL "https://github.com/gwaldron/osgearth"
LANGUAGES CXX)
LANGUAGES CXX C)

# SDK version number
set(OSGEARTH_MAJOR_VERSION 3)
Expand Down
19 changes: 8 additions & 11 deletions cmake/osgearth-macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ macro(detect_osg_version)
if(OSG_DIR AND NOT OSG_INCLUDE_DIR AND EXISTS "${OSG_DIR}/include/osg/Version")
set(OSG_INCLUDE_DIR "${OSG_DIR}/include")
endif()

OPTION(APPEND_OPENSCENEGRAPH_VERSION "Append the OSG version number to the osgPlugins directory" ON)
option(APPEND_OPENSCENEGRAPH_VERSION "Append the OSG version number to the osgPlugins directory" ON)

# Try to ascertain the version...
# (Taken from CMake's FindOpenSceneGraph.cmake)
Expand Down Expand Up @@ -61,18 +60,16 @@ macro(detect_osg_version)
"Detected version ${OPENSCENEGRAPH_VERSION}")
endif()
endif()

MARK_AS_ADVANCED(OPENSCENEGRAPH_VERSION)
mark_as_advanced(OPENSCENEGRAPH_VERSION)


IF (APPEND_OPENSCENEGRAPH_VERSION AND OPENSCENEGRAPH_VERSION)
if(APPEND_OPENSCENEGRAPH_VERSION AND OPENSCENEGRAPH_VERSION)
SET(OSG_PLUGINS "osgPlugins-${OPENSCENEGRAPH_VERSION}" CACHE STRING "" FORCE)
#MESSAGE(STATUS "Plugins will be installed under osgPlugins-${OPENSCENEGRAPH_VERSION} directory.")
else (APPEND_OPENSCENEGRAPH_VERSION AND OPENSCENEGRAPH_VERSION)
else()
SET(OSG_PLUGINS CACHE STRING "" FORCE)
ENDIF(APPEND_OPENSCENEGRAPH_VERSION AND OPENSCENEGRAPH_VERSION)

MARK_AS_ADVANCED(OSG_PLUGINS)
endif()
mark_as_advanced(OSG_PLUGINS)

endmacro(detect_osg_version)

Expand All @@ -85,7 +82,7 @@ endmacro(detect_osg_version)
#
# example usage:
#
# add_osgearth_library_as_plugin(
# add_osgearth_plugin(
# TARGET [name of plugin with osgdb_ or osgdb_osgearth_ prefix]
# HEADERS [list of header files to include in the project]
# PUBLIC_HEADERS [list of header files to install]
Expand All @@ -97,7 +94,7 @@ endmacro(detect_osg_version)
#
# Note: osgEarth and OpenScenegraph libraries will automatically link to all plugins.
#
macro(add_osgearth_library_as_plugin)
macro(add_osgearth_plugin)

set(options "")
set(oneValueArgs TARGET)
Expand Down
8 changes: 3 additions & 5 deletions src/osgEarthDrivers/basis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

#find_package(BASISU)

if(BASISU_FOUND)

add_osgearth_library_as_plugin(TARGET osgdb_basis
INCLUDE_DIRECTORIES ${BASISU_INCLUDE_DIR}
add_osgearth_plugin(
TARGET osgdb_basis
SOURCES ReaderWriterBasis.cpp
INCLUDE_DIRECTORIES ${BASISU_INCLUDE_DIR}
LIBRARIES ${BASISU_TRANSCODER_LIBRARY})

endif()
19 changes: 1 addition & 18 deletions src/osgEarthDrivers/bumpmap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,7 @@ configure_shaders(
${SHADERS_CPP}
${TARGET_GLSL} )

# set(TARGET_SRC
# BumpMapExtension.cpp
# BumpMapTerrainEffect.cpp
# ${SHADERS_CPP} )

# set(TARGET_H_PUBLIC
# BumpMapExtension
# BumpMapOptions
# BumpMapTerrainEffect)

# set(TARGET_H
# ${TARGET_H_PUBLIC}
# BumpMapShaders )

# add_osgearth_library_as_plugin(osgdb_osgearth_bumpmap)

add_osgearth_library_as_plugin(TARGET osgdb_osgearth_bumpmap
add_osgearth_plugin(TARGET osgdb_osgearth_bumpmap
PUBLIC_HEADERS
BumpMapExtension
BumpMapOptions
Expand All @@ -47,4 +31,3 @@ add_osgearth_library_as_plugin(TARGET osgdb_osgearth_bumpmap
SHADERS
${TARGET_GLSL} )


3 changes: 1 addition & 2 deletions src/osgEarthDrivers/cache_filesystem/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_cache_filesystem
SOURCES
FileSystemCache.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/cache_rocksdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(RocksDB_FOUND)

#add_library_as_osgdb_plugin(osgdb_osgearth_cache_rocksdb)

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET
osgdb_osgearth_cache_rocksdb
PUBLIC_HEADERS
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/colorramp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_colorramp
PUBLIC_HEADERS ColorRampOptions
SOURCES ColorRampTileSource.cpp)
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/detail/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ configure_shaders(
${SHADERS_CPP}
${TARGET_GLSL} )

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_detail
SOURCES
DetailPlugin.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/draco/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
find_package(draco)

if(draco_FOUND)
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_draco
SOURCES ReaderWriterDraco.cpp
LIBRARIES draco::draco)
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/earth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_earth
SOURCES
ReaderWriterOsgEarth.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/engine_rex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ SET(TARGET_H
SelectionInfo
)

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_engine_rex
HEADERS ${TARGET_H}
SOURCES ${TARGET_SRC}
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/fastdxt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
option(OSGEARTH_ENABLE_FASTDXT "Set to ON to build optional FastDXT image compressor." ON)
if(OSGEARTH_ENABLE_FASTDXT)

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_fastdxt
HEADERS
dxt.h
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/featurefilter_intersect/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_featurefilter_intersect
PUBLIC_HEADERS
IntersectFeatureFilterOptions
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/featurefilter_join/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_featurefilter_join
PUBLIC_HEADERS
JoinFeatureFilterOptions
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/gltf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SET(TARGET_SRC
ReaderWriterGLTF.cpp
)

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_gltf
HEADERS ${TARGET_H}
SOURCES ${TARGET_SRC} )
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/kml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ SET(TARGET_SRC
KMZArchive.cpp
)

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_kml
HEADERS ${TARGET_H}
PUBLIC_HEADERS KML KMLOptions
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/lerc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include_directories(BEFORE ../../third_party/lerc/include )

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_lerc
SOURCES
ReaderWriterLERC.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/script_engine_duktape/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(TARGET_SRC
DuktapeEngine.cpp
duktape.c )

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_scriptengine_javascript
HEADERS ${TARGET_H}
SOURCES ${TARGET_SRC} )
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/sky_gl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_sky_gl
HEADERS
GLSkyNode
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/sky_silverlining/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if(SILVERLINING_FOUND)
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_sky_silverlining
SOURCES
SilverLiningDriver.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/sky_simple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ set(INCLUDED_SRC_FILES
eb_compute_shaders.cpp
eb_osgearth_shaders.cpp)

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_sky_simple
SOURCES ${TARGET_SRC}
HEADERS ${TARET_H}
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/template/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_template
HEADERS NLTemplate.h
SOURCES ReaderWriterTemplate.cpp NLTemplate.cpp )
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/terrainshader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_terrainshader
PUBLIC_HEADERS
TerrainShaderExtension
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/tileindex/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_tileindex
PUBLIC_HEADERS
TileIndexOptions
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/vdatum_egm2008/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_vdatum_egm2008
HEADERS EGM2008Grid.h
SOURCES EGM2008.cpp )
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/vdatum_egm84/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_vdatum_egm84
HEADERS EGM84Grid.h
SOURCES EGM84.cpp )
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/vdatum_egm96/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_vdatum_egm96
HEADERS EGM96Grid.h
SOURCES EGM96.cpp )
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/viewpoints/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_osgearth_viewpoints
PUBLIC_HEADERS
ViewpointsExtension
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/webp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
if(WEBP_FOUND)
include_directories( ${WEBP_INCLUDE_DIR} )
add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_webp
SOURCES ReaderWriterWebP.cpp )
endif(WEBP_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthDrivers/zip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(LIBZIP_FOUND AND OSGEARTH_BUILD_ZIP_PLUGIN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough")
endif()

add_osgearth_library_as_plugin(
add_osgearth_plugin(
TARGET osgdb_zip
HEADERS
ZipArchive.h
Expand Down

0 comments on commit 9dd6e8e

Please sign in to comment.