Add CMake options to control which osgPlugins/ are built

This commit is contained in:
scrawl 2017-02-07 19:30:38 +01:00
parent 94061aa9fb
commit c1dd0eb348

View File

@ -32,77 +32,97 @@ SET(TARGET_COMMON_LIBRARIES
osgUtil osgUtil
) )
OPTION(BUILD_OSG_PLUGINS_BY_DEFAULT "If set, all available plugins are built by default and each plugin can be disabled from the build by setting BUILD_OSG_PLUGIN_<PLUGINNAME> to 0. If not set, no plugins are built by default and each desired plugin must be explicitely enabled by setting BUILD_OSG_PLUGIN_<PLUGINNAME> to 1." ON)
# Macro used for adding plugins below. By default, all plugins are built
# but can be disabled by setting the CMake Variable BUILD_OSG_PLUGIN_<PLUGINNAME> to 0.
macro(ADD_PLUGIN_DIRECTORY DIRECTORY)
STRING(TOUPPER "${DIRECTORY}" DIRECTORY_UPPER)
SET(VARNAME "BUILD_OSG_PLUGIN_${DIRECTORY_UPPER}")
if (NOT DEFINED ${VARNAME})
if (BUILD_OSG_PLUGINS_BY_DEFAULT)
SET(${VARNAME} 1)
else()
SET(${VARNAME} 0)
endif()
endif()
if ("${${VARNAME}}")
ADD_SUBDIRECTORY("${DIRECTORY}")
endif()
endmacro()
############################################################ ############################################################
# #
# NodeKit/Psudo loader plugins # NodeKit/Psudo loader plugins
# #
ADD_SUBDIRECTORY(osga) ADD_PLUGIN_DIRECTORY(osga)
ADD_SUBDIRECTORY(rot) ADD_PLUGIN_DIRECTORY(rot)
ADD_SUBDIRECTORY(scale) ADD_PLUGIN_DIRECTORY(scale)
ADD_SUBDIRECTORY(trans) ADD_PLUGIN_DIRECTORY(trans)
ADD_SUBDIRECTORY(normals) ADD_PLUGIN_DIRECTORY(normals)
ADD_SUBDIRECTORY(revisions) ADD_PLUGIN_DIRECTORY(revisions)
ADD_SUBDIRECTORY(view) ADD_PLUGIN_DIRECTORY(view)
ADD_SUBDIRECTORY(shadow) ADD_PLUGIN_DIRECTORY(shadow)
ADD_SUBDIRECTORY(terrain) ADD_PLUGIN_DIRECTORY(terrain)
############################################################ ############################################################
# #
# Main native plugins # Main native plugins
# #
ADD_SUBDIRECTORY(osg) ADD_PLUGIN_DIRECTORY(osg)
ADD_SUBDIRECTORY(ive) ADD_PLUGIN_DIRECTORY(ive)
############################################################ ############################################################
# #
# Viewer plugins # Viewer plugins
# #
ADD_SUBDIRECTORY(cfg) ADD_PLUGIN_DIRECTORY(cfg)
############################################################ ############################################################
# #
# Shader plugins # Shader plugins
# #
ADD_SUBDIRECTORY(glsl) ADD_PLUGIN_DIRECTORY(glsl)
############################################################ ############################################################
# #
# Image plugins # Image plugins
# #
ADD_SUBDIRECTORY(rgb) ADD_PLUGIN_DIRECTORY(rgb)
ADD_SUBDIRECTORY(bmp) ADD_PLUGIN_DIRECTORY(bmp)
ADD_SUBDIRECTORY(pnm) ADD_PLUGIN_DIRECTORY(pnm)
ADD_SUBDIRECTORY(dds) ADD_PLUGIN_DIRECTORY(dds)
ADD_SUBDIRECTORY(tga) ADD_PLUGIN_DIRECTORY(tga)
ADD_SUBDIRECTORY(hdr) ADD_PLUGIN_DIRECTORY(hdr)
ADD_SUBDIRECTORY(dot) ADD_PLUGIN_DIRECTORY(dot)
ADD_SUBDIRECTORY(vtf) ADD_PLUGIN_DIRECTORY(vtf)
ADD_SUBDIRECTORY(ktx) ADD_PLUGIN_DIRECTORY(ktx)
IF(JPEG_FOUND) IF(JPEG_FOUND)
ADD_SUBDIRECTORY(jpeg) ADD_PLUGIN_DIRECTORY(jpeg)
ENDIF() ENDIF()
IF(JASPER_FOUND) IF(JASPER_FOUND)
ADD_SUBDIRECTORY(jp2) ADD_PLUGIN_DIRECTORY(jp2)
ENDIF() ENDIF()
IF(OPENEXR_FOUND AND ZLIB_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(OPENEXR_FOUND AND ZLIB_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(exr) ADD_PLUGIN_DIRECTORY(exr)
ENDIF() ENDIF()
IF(GIFLIB_FOUND) IF(GIFLIB_FOUND)
ADD_SUBDIRECTORY(gif) ADD_PLUGIN_DIRECTORY(gif)
ENDIF() ENDIF()
IF(PNG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(PNG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(png) ADD_PLUGIN_DIRECTORY(png)
ENDIF() ENDIF()
IF(TIFF_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(TIFF_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(tiff) ADD_PLUGIN_DIRECTORY(tiff)
ENDIF() ENDIF()
IF(GDAL_FOUND) IF(GDAL_FOUND)
ADD_SUBDIRECTORY(gdal) ADD_PLUGIN_DIRECTORY(gdal)
ADD_SUBDIRECTORY(ogr) ADD_PLUGIN_DIRECTORY(ogr)
ENDIF() ENDIF()
IF(GTA_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(GTA_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(gta) ADD_PLUGIN_DIRECTORY(gta)
ENDIF() ENDIF()
@ -111,10 +131,10 @@ ENDIF()
# 3D Image plugins # 3D Image plugins
# #
IF(DCMTK_FOUND AND ZLIB_FOUND) IF(DCMTK_FOUND AND ZLIB_FOUND)
ADD_SUBDIRECTORY(dicom) ADD_PLUGIN_DIRECTORY(dicom)
ELSE() ELSE()
IF(ITK_FOUND) IF(ITK_FOUND)
ADD_SUBDIRECTORY(dicom) ADD_PLUGIN_DIRECTORY(dicom)
ENDIF() ENDIF()
ENDIF() ENDIF()
@ -123,90 +143,90 @@ ENDIF()
# 3rd party 3d plugins # 3rd party 3d plugins
# #
ADD_SUBDIRECTORY(3dc) ADD_PLUGIN_DIRECTORY(3dc)
ADD_SUBDIRECTORY(p3d) ADD_PLUGIN_DIRECTORY(p3d)
IF(CURL_FOUND) IF(CURL_FOUND)
ADD_SUBDIRECTORY(curl) ADD_PLUGIN_DIRECTORY(curl)
ENDIF() ENDIF()
IF(ZLIB_FOUND) IF(ZLIB_FOUND)
ADD_SUBDIRECTORY(gz) ADD_PLUGIN_DIRECTORY(gz)
ENDIF() ENDIF()
IF(NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE) IF(NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE)
IF(INVENTOR_FOUND) IF(INVENTOR_FOUND)
ADD_SUBDIRECTORY(Inventor) ADD_PLUGIN_DIRECTORY(Inventor)
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(OPENVRML_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(OPENVRML_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(vrml) ADD_PLUGIN_DIRECTORY(vrml)
ENDIF() ENDIF()
IF(COLLADA_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(COLLADA_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(dae) ADD_PLUGIN_DIRECTORY(dae)
ENDIF() ENDIF()
IF(FBX_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(FBX_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(fbx) ADD_PLUGIN_DIRECTORY(fbx)
ENDIF() ENDIF()
IF(OPENCASCADE_FOUND) IF(OPENCASCADE_FOUND)
ADD_SUBDIRECTORY(OpenCASCADE) ADD_PLUGIN_DIRECTORY(OpenCASCADE)
ENDIF() ENDIF()
ADD_SUBDIRECTORY(bvh) ADD_PLUGIN_DIRECTORY(bvh)
ADD_SUBDIRECTORY(x) ADD_PLUGIN_DIRECTORY(x)
ADD_SUBDIRECTORY(dxf) ADD_PLUGIN_DIRECTORY(dxf)
ADD_SUBDIRECTORY(OpenFlight) ADD_PLUGIN_DIRECTORY(OpenFlight)
ADD_SUBDIRECTORY(obj) ADD_PLUGIN_DIRECTORY(obj)
ADD_SUBDIRECTORY(pic) ADD_PLUGIN_DIRECTORY(pic)
ADD_SUBDIRECTORY(stl) ADD_PLUGIN_DIRECTORY(stl)
IF(NOT ANDROID) IF(NOT ANDROID)
ADD_SUBDIRECTORY(3ds) ADD_PLUGIN_DIRECTORY(3ds)
ENDIF() ENDIF()
ADD_SUBDIRECTORY(ac) ADD_PLUGIN_DIRECTORY(ac)
ADD_SUBDIRECTORY(pov) ADD_PLUGIN_DIRECTORY(pov)
ADD_SUBDIRECTORY(logo) ADD_PLUGIN_DIRECTORY(logo)
ADD_SUBDIRECTORY(lws) ADD_PLUGIN_DIRECTORY(lws)
ADD_SUBDIRECTORY(md2) ADD_PLUGIN_DIRECTORY(md2)
ADD_SUBDIRECTORY(osgtgz) ADD_PLUGIN_DIRECTORY(osgtgz)
ADD_SUBDIRECTORY(tgz) ADD_PLUGIN_DIRECTORY(tgz)
ADD_SUBDIRECTORY(shp) ADD_PLUGIN_DIRECTORY(shp)
ADD_SUBDIRECTORY(txf) ADD_PLUGIN_DIRECTORY(txf)
ADD_SUBDIRECTORY(bsp) ADD_PLUGIN_DIRECTORY(bsp)
ADD_SUBDIRECTORY(mdl) ADD_PLUGIN_DIRECTORY(mdl)
ADD_SUBDIRECTORY(gles) ADD_PLUGIN_DIRECTORY(gles)
ADD_SUBDIRECTORY(osgjs) ADD_PLUGIN_DIRECTORY(osgjs)
IF(OSG_CPP_EXCEPTIONS_AVAILABLE) IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(lwo) ADD_PLUGIN_DIRECTORY(lwo)
ADD_SUBDIRECTORY(ply) ADD_PLUGIN_DIRECTORY(ply)
ADD_SUBDIRECTORY(txp) ADD_PLUGIN_DIRECTORY(txp)
ENDIF() ENDIF()
IF(XINE_FOUND) IF(XINE_FOUND)
ADD_SUBDIRECTORY(xine) ADD_PLUGIN_DIRECTORY(xine)
ENDIF() ENDIF()
IF(FFMPEG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(FFMPEG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(ffmpeg) ADD_PLUGIN_DIRECTORY(ffmpeg)
ENDIF() ENDIF()
IF(GSTREAMER_FOUND AND GLIB_FOUND) IF(GSTREAMER_FOUND AND GLIB_FOUND)
ADD_SUBDIRECTORY(gstreamer) ADD_PLUGIN_DIRECTORY(gstreamer)
ENDIF() ENDIF()
IF(DIRECTSHOW_FOUND) IF(DIRECTSHOW_FOUND)
ADD_SUBDIRECTORY(directshow) ADD_PLUGIN_DIRECTORY(directshow)
ENDIF() ENDIF()
# IF(OPENAL_FOUND) # IF(OPENAL_FOUND)
@ -214,54 +234,54 @@ ENDIF()
# ENDIF() # ENDIF()
IF(APPLE AND NOT ANDROID) IF(APPLE AND NOT ANDROID)
ADD_SUBDIRECTORY(imageio) ADD_PLUGIN_DIRECTORY(imageio)
ENDIF() ENDIF()
IF(AV_FOUNDATION_FOUND) IF(AV_FOUNDATION_FOUND)
ADD_SUBDIRECTORY(avfoundation) ADD_PLUGIN_DIRECTORY(avfoundation)
ENDIF() ENDIF()
IF(QUICKTIME_FOUND) IF(QUICKTIME_FOUND)
ADD_SUBDIRECTORY(quicktime) ADD_PLUGIN_DIRECTORY(quicktime)
ENDIF() ENDIF()
IF(QTKIT_FOUND) IF(QTKIT_FOUND)
ADD_SUBDIRECTORY(QTKit) ADD_PLUGIN_DIRECTORY(QTKit)
ENDIF() ENDIF()
IF(NVTT_FOUND) IF(NVTT_FOUND)
ADD_SUBDIRECTORY(nvtt) ADD_PLUGIN_DIRECTORY(nvtt)
ENDIF() ENDIF()
IF(FREETYPE_FOUND) IF(FREETYPE_FOUND)
ADD_SUBDIRECTORY(freetype) ADD_PLUGIN_DIRECTORY(freetype)
ENDIF() ENDIF()
IF(ZLIB_FOUND) IF(ZLIB_FOUND)
ADD_SUBDIRECTORY(zip) ADD_PLUGIN_DIRECTORY(zip)
ENDIF() ENDIF()
IF(RSVG_FOUND) IF(RSVG_FOUND)
ADD_SUBDIRECTORY(svg) ADD_PLUGIN_DIRECTORY(svg)
ENDIF() ENDIF()
IF(POPPLER_FOUND) IF(POPPLER_FOUND)
ADD_SUBDIRECTORY(pdf) ADD_PLUGIN_DIRECTORY(pdf)
ENDIF() ENDIF()
IF(LIBVNCSERVER_FOUND) IF(LIBVNCSERVER_FOUND)
ADD_SUBDIRECTORY(vnc) ADD_PLUGIN_DIRECTORY(vnc)
ENDIF() ENDIF()
ADD_SUBDIRECTORY(pvr) ADD_PLUGIN_DIRECTORY(pvr)
ADD_SUBDIRECTORY(osc) ADD_PLUGIN_DIRECTORY(osc)
ADD_SUBDIRECTORY(trk) ADD_PLUGIN_DIRECTORY(trk)
ADD_SUBDIRECTORY(tf) ADD_PLUGIN_DIRECTORY(tf)
IF(LIBLAS_FOUND) IF(LIBLAS_FOUND)
ADD_SUBDIRECTORY(las) ADD_PLUGIN_DIRECTORY(las)
ENDIF() ENDIF()
@ -270,17 +290,17 @@ ENDIF()
# ScriptEngines # ScriptEngines
# #
IF ((LUA_LIBRARIES AND LUA_INCLUDE_DIR) OR (LUA_SOURCE_DIR AND LUA_INCLUDE_DIR) OR (OSG_USE_LOCAL_LUA_SOURCE)) IF ((LUA_LIBRARIES AND LUA_INCLUDE_DIR) OR (LUA_SOURCE_DIR AND LUA_INCLUDE_DIR) OR (OSG_USE_LOCAL_LUA_SOURCE))
ADD_SUBDIRECTORY(lua) ADD_PLUGIN_DIRECTORY(lua)
ENDIF() ENDIF()
# V8 and Python plugins are tests for linking against these libraries but aren't functionality beyond this. # V8 and Python plugins are tests for linking against these libraries but aren't functionality beyond this.
# IF (V8_FOUND) # IF (V8_FOUND)
# ADD_SUBDIRECTORY(V8) # ADD_PLUGIN_DIRECTORY(V8)
# ENDIF() # ENDIF()
# #
# IF (PYTHONLIBS_FOUND) # IF (PYTHONLIBS_FOUND)
# ADD_SUBDIRECTORY(python) # ADD_PLUGIN_DIRECTORY(python)
# ENDIF() # ENDIF()
#################################################### ####################################################
@ -288,16 +308,16 @@ ENDIF()
# Device integration plugins # Device integration plugins
# #
IF (SDL_FOUND) IF (SDL_FOUND)
ADD_SUBDIRECTORY(sdl) ADD_PLUGIN_DIRECTORY(sdl)
ENDIF(SDL_FOUND) ENDIF(SDL_FOUND)
IF(ASIO_FOUND) IF(ASIO_FOUND)
ADD_SUBDIRECTORY(RestHttpDevice) ADD_PLUGIN_DIRECTORY(RestHttpDevice)
ENDIF(ASIO_FOUND) ENDIF(ASIO_FOUND)
IF(ZEROCONF_FOUND) IF(ZEROCONF_FOUND)
ADD_SUBDIRECTORY(ZeroConfDevice) ADD_PLUGIN_DIRECTORY(ZeroConfDevice)
ENDIF() ENDIF()
##########to get all the variables of Cmake ##########to get all the variables of Cmake