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
)
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
#
ADD_SUBDIRECTORY(osga)
ADD_SUBDIRECTORY(rot)
ADD_SUBDIRECTORY(scale)
ADD_SUBDIRECTORY(trans)
ADD_SUBDIRECTORY(normals)
ADD_SUBDIRECTORY(revisions)
ADD_SUBDIRECTORY(view)
ADD_SUBDIRECTORY(shadow)
ADD_SUBDIRECTORY(terrain)
ADD_PLUGIN_DIRECTORY(osga)
ADD_PLUGIN_DIRECTORY(rot)
ADD_PLUGIN_DIRECTORY(scale)
ADD_PLUGIN_DIRECTORY(trans)
ADD_PLUGIN_DIRECTORY(normals)
ADD_PLUGIN_DIRECTORY(revisions)
ADD_PLUGIN_DIRECTORY(view)
ADD_PLUGIN_DIRECTORY(shadow)
ADD_PLUGIN_DIRECTORY(terrain)
############################################################
#
# Main native plugins
#
ADD_SUBDIRECTORY(osg)
ADD_SUBDIRECTORY(ive)
ADD_PLUGIN_DIRECTORY(osg)
ADD_PLUGIN_DIRECTORY(ive)
############################################################
#
# Viewer plugins
#
ADD_SUBDIRECTORY(cfg)
ADD_PLUGIN_DIRECTORY(cfg)
############################################################
#
# Shader plugins
#
ADD_SUBDIRECTORY(glsl)
ADD_PLUGIN_DIRECTORY(glsl)
############################################################
#
# Image plugins
#
ADD_SUBDIRECTORY(rgb)
ADD_SUBDIRECTORY(bmp)
ADD_SUBDIRECTORY(pnm)
ADD_SUBDIRECTORY(dds)
ADD_SUBDIRECTORY(tga)
ADD_SUBDIRECTORY(hdr)
ADD_SUBDIRECTORY(dot)
ADD_SUBDIRECTORY(vtf)
ADD_SUBDIRECTORY(ktx)
ADD_PLUGIN_DIRECTORY(rgb)
ADD_PLUGIN_DIRECTORY(bmp)
ADD_PLUGIN_DIRECTORY(pnm)
ADD_PLUGIN_DIRECTORY(dds)
ADD_PLUGIN_DIRECTORY(tga)
ADD_PLUGIN_DIRECTORY(hdr)
ADD_PLUGIN_DIRECTORY(dot)
ADD_PLUGIN_DIRECTORY(vtf)
ADD_PLUGIN_DIRECTORY(ktx)
IF(JPEG_FOUND)
ADD_SUBDIRECTORY(jpeg)
ADD_PLUGIN_DIRECTORY(jpeg)
ENDIF()
IF(JASPER_FOUND)
ADD_SUBDIRECTORY(jp2)
ADD_PLUGIN_DIRECTORY(jp2)
ENDIF()
IF(OPENEXR_FOUND AND ZLIB_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(exr)
ADD_PLUGIN_DIRECTORY(exr)
ENDIF()
IF(GIFLIB_FOUND)
ADD_SUBDIRECTORY(gif)
ADD_PLUGIN_DIRECTORY(gif)
ENDIF()
IF(PNG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(png)
ADD_PLUGIN_DIRECTORY(png)
ENDIF()
IF(TIFF_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(tiff)
ADD_PLUGIN_DIRECTORY(tiff)
ENDIF()
IF(GDAL_FOUND)
ADD_SUBDIRECTORY(gdal)
ADD_SUBDIRECTORY(ogr)
ADD_PLUGIN_DIRECTORY(gdal)
ADD_PLUGIN_DIRECTORY(ogr)
ENDIF()
IF(GTA_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(gta)
ADD_PLUGIN_DIRECTORY(gta)
ENDIF()
@ -111,10 +131,10 @@ ENDIF()
# 3D Image plugins
#
IF(DCMTK_FOUND AND ZLIB_FOUND)
ADD_SUBDIRECTORY(dicom)
ADD_PLUGIN_DIRECTORY(dicom)
ELSE()
IF(ITK_FOUND)
ADD_SUBDIRECTORY(dicom)
ADD_PLUGIN_DIRECTORY(dicom)
ENDIF()
ENDIF()
@ -123,90 +143,90 @@ ENDIF()
# 3rd party 3d plugins
#
ADD_SUBDIRECTORY(3dc)
ADD_PLUGIN_DIRECTORY(3dc)
ADD_SUBDIRECTORY(p3d)
ADD_PLUGIN_DIRECTORY(p3d)
IF(CURL_FOUND)
ADD_SUBDIRECTORY(curl)
ADD_PLUGIN_DIRECTORY(curl)
ENDIF()
IF(ZLIB_FOUND)
ADD_SUBDIRECTORY(gz)
ADD_PLUGIN_DIRECTORY(gz)
ENDIF()
IF(NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE)
IF(INVENTOR_FOUND)
ADD_SUBDIRECTORY(Inventor)
ADD_PLUGIN_DIRECTORY(Inventor)
ENDIF()
ENDIF()
IF(OPENVRML_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(vrml)
ADD_PLUGIN_DIRECTORY(vrml)
ENDIF()
IF(COLLADA_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(dae)
ADD_PLUGIN_DIRECTORY(dae)
ENDIF()
IF(FBX_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(fbx)
ADD_PLUGIN_DIRECTORY(fbx)
ENDIF()
IF(OPENCASCADE_FOUND)
ADD_SUBDIRECTORY(OpenCASCADE)
ADD_PLUGIN_DIRECTORY(OpenCASCADE)
ENDIF()
ADD_SUBDIRECTORY(bvh)
ADD_SUBDIRECTORY(x)
ADD_SUBDIRECTORY(dxf)
ADD_SUBDIRECTORY(OpenFlight)
ADD_PLUGIN_DIRECTORY(bvh)
ADD_PLUGIN_DIRECTORY(x)
ADD_PLUGIN_DIRECTORY(dxf)
ADD_PLUGIN_DIRECTORY(OpenFlight)
ADD_SUBDIRECTORY(obj)
ADD_PLUGIN_DIRECTORY(obj)
ADD_SUBDIRECTORY(pic)
ADD_SUBDIRECTORY(stl)
ADD_PLUGIN_DIRECTORY(pic)
ADD_PLUGIN_DIRECTORY(stl)
IF(NOT ANDROID)
ADD_SUBDIRECTORY(3ds)
ADD_PLUGIN_DIRECTORY(3ds)
ENDIF()
ADD_SUBDIRECTORY(ac)
ADD_SUBDIRECTORY(pov)
ADD_PLUGIN_DIRECTORY(ac)
ADD_PLUGIN_DIRECTORY(pov)
ADD_SUBDIRECTORY(logo)
ADD_SUBDIRECTORY(lws)
ADD_SUBDIRECTORY(md2)
ADD_SUBDIRECTORY(osgtgz)
ADD_SUBDIRECTORY(tgz)
ADD_PLUGIN_DIRECTORY(logo)
ADD_PLUGIN_DIRECTORY(lws)
ADD_PLUGIN_DIRECTORY(md2)
ADD_PLUGIN_DIRECTORY(osgtgz)
ADD_PLUGIN_DIRECTORY(tgz)
ADD_SUBDIRECTORY(shp)
ADD_SUBDIRECTORY(txf)
ADD_PLUGIN_DIRECTORY(shp)
ADD_PLUGIN_DIRECTORY(txf)
ADD_SUBDIRECTORY(bsp)
ADD_SUBDIRECTORY(mdl)
ADD_PLUGIN_DIRECTORY(bsp)
ADD_PLUGIN_DIRECTORY(mdl)
ADD_SUBDIRECTORY(gles)
ADD_SUBDIRECTORY(osgjs)
ADD_PLUGIN_DIRECTORY(gles)
ADD_PLUGIN_DIRECTORY(osgjs)
IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(lwo)
ADD_SUBDIRECTORY(ply)
ADD_SUBDIRECTORY(txp)
ADD_PLUGIN_DIRECTORY(lwo)
ADD_PLUGIN_DIRECTORY(ply)
ADD_PLUGIN_DIRECTORY(txp)
ENDIF()
IF(XINE_FOUND)
ADD_SUBDIRECTORY(xine)
ADD_PLUGIN_DIRECTORY(xine)
ENDIF()
IF(FFMPEG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(ffmpeg)
ADD_PLUGIN_DIRECTORY(ffmpeg)
ENDIF()
IF(GSTREAMER_FOUND AND GLIB_FOUND)
ADD_SUBDIRECTORY(gstreamer)
ADD_PLUGIN_DIRECTORY(gstreamer)
ENDIF()
IF(DIRECTSHOW_FOUND)
ADD_SUBDIRECTORY(directshow)
ADD_PLUGIN_DIRECTORY(directshow)
ENDIF()
# IF(OPENAL_FOUND)
@ -214,54 +234,54 @@ ENDIF()
# ENDIF()
IF(APPLE AND NOT ANDROID)
ADD_SUBDIRECTORY(imageio)
ADD_PLUGIN_DIRECTORY(imageio)
ENDIF()
IF(AV_FOUNDATION_FOUND)
ADD_SUBDIRECTORY(avfoundation)
ADD_PLUGIN_DIRECTORY(avfoundation)
ENDIF()
IF(QUICKTIME_FOUND)
ADD_SUBDIRECTORY(quicktime)
ADD_PLUGIN_DIRECTORY(quicktime)
ENDIF()
IF(QTKIT_FOUND)
ADD_SUBDIRECTORY(QTKit)
ADD_PLUGIN_DIRECTORY(QTKit)
ENDIF()
IF(NVTT_FOUND)
ADD_SUBDIRECTORY(nvtt)
ADD_PLUGIN_DIRECTORY(nvtt)
ENDIF()
IF(FREETYPE_FOUND)
ADD_SUBDIRECTORY(freetype)
ADD_PLUGIN_DIRECTORY(freetype)
ENDIF()
IF(ZLIB_FOUND)
ADD_SUBDIRECTORY(zip)
ADD_PLUGIN_DIRECTORY(zip)
ENDIF()
IF(RSVG_FOUND)
ADD_SUBDIRECTORY(svg)
ADD_PLUGIN_DIRECTORY(svg)
ENDIF()
IF(POPPLER_FOUND)
ADD_SUBDIRECTORY(pdf)
ADD_PLUGIN_DIRECTORY(pdf)
ENDIF()
IF(LIBVNCSERVER_FOUND)
ADD_SUBDIRECTORY(vnc)
ADD_PLUGIN_DIRECTORY(vnc)
ENDIF()
ADD_SUBDIRECTORY(pvr)
ADD_PLUGIN_DIRECTORY(pvr)
ADD_SUBDIRECTORY(osc)
ADD_SUBDIRECTORY(trk)
ADD_SUBDIRECTORY(tf)
ADD_PLUGIN_DIRECTORY(osc)
ADD_PLUGIN_DIRECTORY(trk)
ADD_PLUGIN_DIRECTORY(tf)
IF(LIBLAS_FOUND)
ADD_SUBDIRECTORY(las)
ADD_PLUGIN_DIRECTORY(las)
ENDIF()
@ -270,17 +290,17 @@ ENDIF()
# ScriptEngines
#
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()
# V8 and Python plugins are tests for linking against these libraries but aren't functionality beyond this.
# IF (V8_FOUND)
# ADD_SUBDIRECTORY(V8)
# ADD_PLUGIN_DIRECTORY(V8)
# ENDIF()
#
# IF (PYTHONLIBS_FOUND)
# ADD_SUBDIRECTORY(python)
# ADD_PLUGIN_DIRECTORY(python)
# ENDIF()
####################################################
@ -288,16 +308,16 @@ ENDIF()
# Device integration plugins
#
IF (SDL_FOUND)
ADD_SUBDIRECTORY(sdl)
ADD_PLUGIN_DIRECTORY(sdl)
ENDIF(SDL_FOUND)
IF(ASIO_FOUND)
ADD_SUBDIRECTORY(RestHttpDevice)
ADD_PLUGIN_DIRECTORY(RestHttpDevice)
ENDIF(ASIO_FOUND)
IF(ZEROCONF_FOUND)
ADD_SUBDIRECTORY(ZeroConfDevice)
ADD_PLUGIN_DIRECTORY(ZeroConfDevice)
ENDIF()
##########to get all the variables of Cmake