From 39cecd2a72d260d1af7ec0325088e973e4abcfae Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 23 Mar 2009 16:01:02 +0000 Subject: [PATCH] From Philip Lowman, "Here's the promised cleanup of the OSG's CMakeLists.txt files for the src/ folder. I'll submit the others separately. Also, there was also a small bug in osgDB's CMakeLists.txt that was causing an error when I tested with CMake 2.4.4. IF(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime") was changed to IF(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX STREQUAL "quicktime") " --- src/CMakeLists.txt | 10 +- src/OpenThreads/CMakeLists.txt | 30 ++--- src/OpenThreads/pthreads/CMakeLists.txt | 28 ++--- src/OpenThreads/sproc/CMakeLists.txt | 2 +- src/OpenThreads/win32/CMakeLists.txt | 4 +- src/osg/CMakeLists.txt | 8 +- src/osgAnimation/CMakeLists.txt | 6 +- src/osgDB/CMakeLists.txt | 30 +++-- src/osgFX/CMakeLists.txt | 6 +- src/osgGA/CMakeLists.txt | 6 +- src/osgIntrospection/CMakeLists.txt | 6 +- src/osgManipulator/CMakeLists.txt | 6 +- src/osgParticle/CMakeLists.txt | 6 +- src/osgPlugins/CMakeLists.txt | 88 ++++++------- src/osgShadow/CMakeLists.txt | 6 +- src/osgSim/CMakeLists.txt | 6 +- src/osgTerrain/CMakeLists.txt | 6 +- src/osgText/CMakeLists.txt | 6 +- src/osgUtil/CMakeLists.txt | 6 +- src/osgViewer/CMakeLists.txt | 161 +++++++++++------------- src/osgVolume/CMakeLists.txt | 6 +- src/osgWidget/CMakeLists.txt | 6 +- src/osgWrappers/CMakeLists.txt | 98 ++++++++------- 23 files changed, 256 insertions(+), 281 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a528ffa2..302847644 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,18 +19,18 @@ FOREACH( mylibfolder osgPlugins ) - ADD_SUBDIRECTORY(${mylibfolder}) + ADD_SUBDIRECTORY(${mylibfolder}) -ENDFOREACH( mylibfolder ) +ENDFOREACH() OPTION(BUILD_OSG_WRAPPERS "Enable to build Introspection and Wrappers" OFF) -IF (BUILD_OSG_WRAPPERS) +IF(BUILD_OSG_WRAPPERS) ADD_SUBDIRECTORY(osgIntrospection) ADD_SUBDIRECTORY(osgWrappers) -ENDIF(BUILD_OSG_WRAPPERS) +ENDIF() IF(MSVC80) OPTION(OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS "Generate or not manifests files under VS8 for dynamically loaded dlls" ON) -ENDIF(MSVC80) +ENDIF() diff --git a/src/OpenThreads/CMakeLists.txt b/src/OpenThreads/CMakeLists.txt index cc28097d7..f7a9ef60f 100644 --- a/src/OpenThreads/CMakeLists.txt +++ b/src/OpenThreads/CMakeLists.txt @@ -13,12 +13,12 @@ INCLUDE(CheckAtomicOps) # User Options OPTION(DYNAMIC_OPENTHREADS "Set to ON to build OpenThreads for dynamic linking. Use OFF for static." ON) -IF (DYNAMIC_OPENTHREADS) +IF(DYNAMIC_OPENTHREADS) SET(OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED") -ELSE (DYNAMIC_OPENTHREADS) +ELSE() SET(OPENTHREADS_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC") SET(OT_LIBRARY_STATIC 1) -ENDIF (DYNAMIC_OPENTHREADS) +ENDIF() ################################################################################ # Set Config file @@ -35,7 +35,7 @@ IF(MSVC) SET(OPENTHREADS_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenThreadsVersionInfo.rc") CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenThreadsVersionInfo.rc.in" "${OPENTHREADS_VERSIONINFO_RC}") -ENDIF(MSVC) +ENDIF() # INSTALL_FILES(/include/OpenThreads/ FILES "${OPENTHREADS_CONFIG_HEADER}") @@ -66,11 +66,11 @@ IF(CMAKE_SYSTEM MATCHES IRIX) IF(CMAKE_USE_SPROC_INIT) # In this case, only Sproc exists, so no option. SET(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS 1) - ELSE(CMAKE_USE_SPROC_INIT) + ELSE() IF(CMAKE_HAVE_SPROC_H) OPTION(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS "Set to ON to build OpenThreads against sproc instead of pthreads" OFF) - ENDIF(CMAKE_HAVE_SPROC_H) - ENDIF(CMAKE_USE_SPROC_INIT) + ENDIF() + ENDIF() ENDIF(CMAKE_SYSTEM MATCHES IRIX) # Maybe we should be using the FindThreads.cmake module? @@ -78,22 +78,22 @@ IF(WIN32) # So I think Cygwin wants to use pthreads IF(CYGWIN) SUBDIRS(pthreads) - ELSE(CYGWIN) + ELSE() # Everybody else including Msys should probably go here SUBDIRS(win32) # examples) - ENDIF(CYGWIN) -ELSE(WIN32) + ENDIF() +ELSE() IF(UNIX) IF(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS) SUBDIRS(sproc) - ELSE(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS) + ELSE() SUBDIRS(pthreads) - ENDIF(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS) - ELSE(UNIX) + ENDIF() + ELSE() MESSAGE("Sorry, OpenThreads may not support your platform") - ENDIF(UNIX) -ENDIF(WIN32) + ENDIF() +ENDIF() # Make sure everyone can find Config INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include) diff --git a/src/OpenThreads/pthreads/CMakeLists.txt b/src/OpenThreads/pthreads/CMakeLists.txt index fdbd8ca91..b20006be4 100644 --- a/src/OpenThreads/pthreads/CMakeLists.txt +++ b/src/OpenThreads/pthreads/CMakeLists.txt @@ -25,7 +25,7 @@ ADD_LIBRARY(${LIB_NAME} IF(OPENTHREADS_SONAMES) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION}) -ENDIF(OPENTHREADS_SONAMES) +ENDIF() SET(CMAKE_REQUIRED_LIBRARIES_SAFE "${CMAKE_REQUIRED_LIBRARIES}") SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) @@ -33,40 +33,40 @@ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INI CHECK_FUNCTION_EXISTS(pthread_yield HAVE_PTHREAD_YIELD) IF(HAVE_PTHREAD_YIELD) ADD_DEFINITIONS(-DHAVE_PTHREAD_YIELD) -ELSE(HAVE_PTHREAD_YIELD) +ELSE() # sched_yield appears not in libc, pthreads or whatever on some systems CHECK_FUNCTION_EXISTS(sched_yield HAVE_SCHED_YIELD) IF(NOT HAVE_SCHED_YIELD) CHECK_LIBRARY_EXISTS(rt sched_yield "" HAVE_SCHED_YIELD) IF(HAVE_SCHED_YIELD) SET(CMAKE_THREAD_LIBS_INIT "${CMAKE_THREAD_LIBS_INIT} -lrt") - ENDIF(HAVE_SCHED_YIELD) - ENDIF(NOT HAVE_SCHED_YIELD) + ENDIF() + ENDIF() IF(HAVE_SCHED_YIELD) ADD_DEFINITIONS(-DHAVE_SCHED_YIELD) - ENDIF(HAVE_SCHED_YIELD) -ENDIF(HAVE_PTHREAD_YIELD) + ENDIF() +ENDIF() IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") # need to have that for pthread_setaffinity_np on linux ADD_DEFINITIONS(-D_GNU_SOURCE) SET(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE") -ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +ENDIF() CHECK_FUNCTION_EXISTS(pthread_setconcurrency HAVE_PTHREAD_SETCONCURRENCY) IF(HAVE_PTHREAD_SETCONCURRENCY) ADD_DEFINITIONS(-DHAVE_PTHREAD_SETCONCURRENCY) -ENDIF(HAVE_PTHREAD_SETCONCURRENCY) +ENDIF() CHECK_FUNCTION_EXISTS(pthread_getconcurrency HAVE_PTHREAD_GETCONCURRENCY) IF(HAVE_PTHREAD_GETCONCURRENCY) ADD_DEFINITIONS(-DHAVE_PTHREAD_GETCONCURRENCY) -ENDIF(HAVE_PTHREAD_GETCONCURRENCY) +ENDIF() CHECK_FUNCTION_EXISTS(pthread_setaffinity_np HAVE_PTHREAD_SETAFFINITY_NP) IF(HAVE_PTHREAD_SETAFFINITY_NP) ADD_DEFINITIONS(-DHAVE_PTHREAD_SETAFFINITY_NP) -ELSE(HAVE_PTHREAD_SETAFFINITY_NP) +ELSE() CHECK_CXX_SOURCE_COMPILES(" #include int main() { @@ -76,7 +76,7 @@ int main() { }" HAVE_THREE_PARAM_SCHED_SETAFFINITY) IF(HAVE_THREE_PARAM_SCHED_SETAFFINITY) ADD_DEFINITIONS(-DHAVE_THREE_PARAM_SCHED_SETAFFINITY) - ELSE(HAVE_THREE_PARAM_SCHED_SETAFFINITY) + ELSE() CHECK_CXX_SOURCE_COMPILES(" #include int main() { @@ -86,9 +86,9 @@ int main() { }" HAVE_TWO_PARAM_SCHED_SETAFFINITY) IF(HAVE_TWO_PARAM_SCHED_SETAFFINITY) ADD_DEFINITIONS(-DHAVE_TWO_PARAM_SCHED_SETAFFINITY) - ENDIF(HAVE_TWO_PARAM_SCHED_SETAFFINITY) - ENDIF(HAVE_THREE_PARAM_SCHED_SETAFFINITY) -ENDIF(HAVE_PTHREAD_SETAFFINITY_NP) + ENDIF() + ENDIF() +ENDIF() SET(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES_SAFE}") diff --git a/src/OpenThreads/sproc/CMakeLists.txt b/src/OpenThreads/sproc/CMakeLists.txt index 8e5612d93..e67c7b79c 100644 --- a/src/OpenThreads/sproc/CMakeLists.txt +++ b/src/OpenThreads/sproc/CMakeLists.txt @@ -23,7 +23,7 @@ ADD_LIBRARY(${LIB_NAME} IF(OPENTHREADS_SONAMES) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION}) -ENDIF(OPENTHREADS_SONAMES) +ENDIF() # Do we need to link against anything for Sproc? #TARGET_LINK_LIBRARIES(${LIB_NAME} diff --git a/src/OpenThreads/win32/CMakeLists.txt b/src/OpenThreads/win32/CMakeLists.txt index 1a1a27c55..5863a53e4 100644 --- a/src/OpenThreads/win32/CMakeLists.txt +++ b/src/OpenThreads/win32/CMakeLists.txt @@ -27,7 +27,7 @@ ADD_LIBRARY(${LIB_NAME} IF(OPENTHREADS_SONAMES) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES VERSION ${OPENTHREADS_VERSION} SOVERSION ${OPENTHREADS_SOVERSION}) -ENDIF(OPENTHREADS_SONAMES) +ENDIF() # Since we're building different platforms binaries in # their respective directories, we need to set the @@ -38,7 +38,7 @@ LINK_DIRECTORIES( IF(MSVC AND OSG_MSVC_VERSIONED_DLL) HANDLE_MSVC_DLL(ot ${OPENTHREADS_SOVERSION}) -ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL) +ENDIF() INSTALL( TARGETS OpenThreads diff --git a/src/osg/CMakeLists.txt b/src/osg/CMakeLists.txt index 1a16f4a65..59e58f13e 100644 --- a/src/osg/CMakeLists.txt +++ b/src/osg/CMakeLists.txt @@ -1,10 +1,10 @@ # FIXME: For OS X, need flag for Framework or dylib -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSG_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osg) @@ -15,7 +15,7 @@ SET(LIB_NAME osg) OPTION(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL "Set to ON to build OcclussionQueryNode with a workaround for multi-threaded OpenGL driver occlussion query crash. " OFF) IF(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL) ADD_DEFINITIONS(-DFORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL) -ENDIF(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL) +ENDIF() SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgAnimation/CMakeLists.txt b/src/osgAnimation/CMakeLists.txt index 381d5ef6b..65d496b33 100644 --- a/src/osgAnimation/CMakeLists.txt +++ b/src/osgAnimation/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGANIMATION_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgAnimation) diff --git a/src/osgDB/CMakeLists.txt b/src/osgDB/CMakeLists.txt index 94cf5e3e3..ae7107d7b 100644 --- a/src/osgDB/CMakeLists.txt +++ b/src/osgDB/CMakeLists.txt @@ -1,12 +1,12 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGDB_LIBRARY) # Add a default plugin search path component ADD_DEFINITIONS(-DOSG_DEFAULT_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}/${OSG_PLUGINS}) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() @@ -79,30 +79,28 @@ IF(APPLE) SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "standard image plugin for os x, options are quicktime, imageio") - - IF(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime") + IF(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX STREQUAL "quicktime") ADD_DEFINITIONS(-DDARWIN_QUICKTIME) - ELSE(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime") + ELSE() ADD_DEFINITIONS(-DDARWIN_IMAGEIO) - ENDIF(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime") - -ENDIF(APPLE) + ENDIF() +ENDIF() IF(QUICKTIME_FOUND) ADD_DEFINITIONS(-DUSE_QUICKTIME) -ENDIF(QUICKTIME_FOUND) +ENDIF() IF(XINE_FOUND) - ADD_DEFINITIONS(-DUSE_XINE) -ENDIF(XINE_FOUND) + ADD_DEFINITIONS(-DUSE_XINE) +ENDIF() IF(INVENTOR_FOUND) - ADD_DEFINITIONS(-DUSE_INVENTOR) -ENDIF(INVENTOR_FOUND) + ADD_DEFINITIONS(-DUSE_INVENTOR) +ENDIF() IF(OPENVRML_FOUND) - ADD_DEFINITIONS(-DUSE_VRML) -ENDIF(OPENVRML_FOUND) + ADD_DEFINITIONS(-DUSE_VRML) +ENDIF() ADD_DEFINITIONS(-DOSG_PLUGIN_EXTENSION=${CMAKE_SHARED_MODULE_SUFFIX}) diff --git a/src/osgFX/CMakeLists.txt b/src/osgFX/CMakeLists.txt index f2d22af2e..5eb533344 100644 --- a/src/osgFX/CMakeLists.txt +++ b/src/osgFX/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGFX_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgFX) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgGA/CMakeLists.txt b/src/osgGA/CMakeLists.txt index e882edccd..b5d35686a 100644 --- a/src/osgGA/CMakeLists.txt +++ b/src/osgGA/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGGA_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgGA) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgIntrospection/CMakeLists.txt b/src/osgIntrospection/CMakeLists.txt index c3303b0f1..5b10c83d3 100644 --- a/src/osgIntrospection/CMakeLists.txt +++ b/src/osgIntrospection/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGINTROSPECTION_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgIntrospection) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgManipulator/CMakeLists.txt b/src/osgManipulator/CMakeLists.txt index 6028a1d35..0af855726 100644 --- a/src/osgManipulator/CMakeLists.txt +++ b/src/osgManipulator/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGMANIPULATOR_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgManipulator) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgParticle/CMakeLists.txt b/src/osgParticle/CMakeLists.txt index f2cd421ac..39c460807 100644 --- a/src/osgParticle/CMakeLists.txt +++ b/src/osgParticle/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGPARTICLE_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgParticle) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgPlugins/CMakeLists.txt b/src/osgPlugins/CMakeLists.txt index 367ffd79b..78e3bb49d 100644 --- a/src/osgPlugins/CMakeLists.txt +++ b/src/osgPlugins/CMakeLists.txt @@ -6,22 +6,22 @@ PROJECT(OSG_PLUGINS_MASTER) -IF (NOT DYNAMIC_OPENSCENEGRAPH) +IF(NOT DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(NOT DYNAMIC_OPENSCENEGRAPH) +ENDIF() IF(NOT MSVC) SET(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/${OSG_PLUGINS}") SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${OSG_PLUGINS}") -ENDIF(NOT MSVC) +ENDIF() SET(CMAKE_SHARED_MODULE_PREFIX ${OSG_PLUGIN_PREFIX}) IF(MSVC80) - IF(NOT OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS) - SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO") - ENDIF(NOT OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS) -ENDIF(MSVC80) + IF(NOT OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS) + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO") + ENDIF() +ENDIF() SET(TARGET_DEFAULT_PREFIX "osgdb_") SET(TARGET_DEFAULT_LABEL_PREFIX "Plugins") @@ -86,32 +86,32 @@ ADD_SUBDIRECTORY(vtf) IF(JPEG_FOUND) ADD_SUBDIRECTORY(jpeg) -ENDIF(JPEG_FOUND) +ENDIF() IF(JASPER_FOUND) ADD_SUBDIRECTORY(jp2) -ENDIF(JASPER_FOUND) +ENDIF() IF(OPENEXR_FOUND) ADD_SUBDIRECTORY(exr) -ENDIF(OPENEXR_FOUND) +ENDIF() IF(GIFLIB_FOUND) ADD_SUBDIRECTORY(gif) -ENDIF(GIFLIB_FOUND) +ENDIF() IF(PNG_FOUND) ADD_SUBDIRECTORY(png) -ENDIF(PNG_FOUND) +ENDIF() IF(TIFF_FOUND) ADD_SUBDIRECTORY(tiff) -ENDIF(TIFF_FOUND) +ENDIF() IF(GDAL_FOUND) ADD_SUBDIRECTORY(gdal) ADD_SUBDIRECTORY(ogr) -ENDIF(GDAL_FOUND) +ENDIF() IF(XUL_FOUND) - IF (WIN32 OR APPLE OR GTK_FOUND) + IF(WIN32 OR APPLE OR GTK_FOUND) ADD_SUBDIRECTORY(gecko) - ENDIF(WIN32 OR APPLE OR GTK_FOUND) -ENDIF(XUL_FOUND) + ENDIF() +ENDIF() @@ -119,18 +119,13 @@ ENDIF(XUL_FOUND) # # 3D Image plugins # -IF (DCMTK_FOUND AND ZLIB_FOUND) - +IF(DCMTK_FOUND AND ZLIB_FOUND) ADD_SUBDIRECTORY(dicom) - -ELSE (DCMTK_FOUND AND ZLIB_FOUND) - - IF (ITK_FOUND) +ELSE() + IF(ITK_FOUND) ADD_SUBDIRECTORY(dicom) - ENDIF(ITK_FOUND) - -ENDIF(DCMTK_FOUND AND ZLIB_FOUND) - + ENDIF() +ENDIF() ############################################################ # @@ -141,24 +136,23 @@ ADD_SUBDIRECTORY(3dc) IF(CURL_FOUND) ADD_SUBDIRECTORY(curl) -ENDIF(CURL_FOUND) +ENDIF() IF(ZLIB_FOUND) ADD_SUBDIRECTORY(gz) -ENDIF(ZLIB_FOUND) - +ENDIF() IF(INVENTOR_FOUND) ADD_SUBDIRECTORY(Inventor) -ENDIF(INVENTOR_FOUND) +ENDIF() IF(OPENVRML_FOUND) ADD_SUBDIRECTORY(vrml) -ENDIF(OPENVRML_FOUND) +ENDIF() IF(COLLADA_FOUND) ADD_SUBDIRECTORY(dae) -ENDIF(COLLADA_FOUND) +ENDIF() ADD_SUBDIRECTORY(lwo) ADD_SUBDIRECTORY(bvh) @@ -172,7 +166,7 @@ ADD_SUBDIRECTORY(obj) IF(PERFORMER_FOUND) ADD_SUBDIRECTORY(pfb) -ENDIF(PERFORMER_FOUND) +ENDIF() ADD_SUBDIRECTORY(pic) ADD_SUBDIRECTORY(stl) @@ -194,43 +188,43 @@ ADD_SUBDIRECTORY(mdl) IF(XINE_FOUND) ADD_SUBDIRECTORY(xine) -ENDIF(XINE_FOUND) +ENDIF() IF(FFMPEG_FOUND) ADD_SUBDIRECTORY(ffmpeg) -ENDIF(FFMPEG_FOUND) +ENDIF() # IF(OPENAL_FOUND) # ADD_SUBDIRECTORY(OpenAL) -# ENDIF(OPENAL_FOUND) +# ENDIF() IF(APPLE) ADD_SUBDIRECTORY(imageio) -ENDIF(APPLE) +ENDIF() IF(QUICKTIME_FOUND) ADD_SUBDIRECTORY(quicktime) -ENDIF(QUICKTIME_FOUND) +ENDIF() IF(FREETYPE_FOUND) ADD_SUBDIRECTORY(freetype) -ENDIF(FREETYPE_FOUND) +ENDIF() + IF(ZLIB_FOUND) ADD_SUBDIRECTORY(zip) -ENDIF(ZLIB_FOUND) +ENDIF() IF(RSVG_FOUND AND CAIRO_FOUND) ADD_SUBDIRECTORY(svg) -ENDIF(RSVG_FOUND AND CAIRO_FOUND) +ENDIF() -IF (POPPLER_FOUND AND CAIRO_FOUND) +IF(POPPLER_FOUND AND CAIRO_FOUND) ADD_SUBDIRECTORY(pdf) -ENDIF(POPPLER_FOUND AND CAIRO_FOUND) +ENDIF() -IF (LIBVNCSERVER_FOUND) +IF(LIBVNCSERVER_FOUND) ADD_SUBDIRECTORY(vnc) -ENDIF(LIBVNCSERVER_FOUND) - +ENDIF() ##########to get all the variables of Cmake #GET_CMAKE_PROPERTY(MYVARS VARIABLES) diff --git a/src/osgShadow/CMakeLists.txt b/src/osgShadow/CMakeLists.txt index bb95f648b..762eac1dc 100644 --- a/src/osgShadow/CMakeLists.txt +++ b/src/osgShadow/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGSHADOW_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgShadow) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgSim/CMakeLists.txt b/src/osgSim/CMakeLists.txt index 7769c36d9..fe960b6e8 100644 --- a/src/osgSim/CMakeLists.txt +++ b/src/osgSim/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGSIM_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgSim) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgTerrain/CMakeLists.txt b/src/osgTerrain/CMakeLists.txt index f838639a8..5ea0b5e5a 100644 --- a/src/osgTerrain/CMakeLists.txt +++ b/src/osgTerrain/CMakeLists.txt @@ -1,8 +1,8 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGTERRAIN_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgTerrain) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgText/CMakeLists.txt b/src/osgText/CMakeLists.txt index 4409aa4e1..db1f041f9 100644 --- a/src/osgText/CMakeLists.txt +++ b/src/osgText/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGTEXT_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgText) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgUtil/CMakeLists.txt b/src/osgUtil/CMakeLists.txt index bfa074bc3..c1d1aecd9 100644 --- a/src/osgUtil/CMakeLists.txt +++ b/src/osgUtil/CMakeLists.txt @@ -1,10 +1,10 @@ # FIXME: For OS X, need flag for Framework or dylib -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGUTIL_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgUtil) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgViewer/CMakeLists.txt b/src/osgViewer/CMakeLists.txt index dad073daf..073e94b24 100644 --- a/src/osgViewer/CMakeLists.txt +++ b/src/osgViewer/CMakeLists.txt @@ -1,10 +1,10 @@ # FIXME: For OS X, need flag for Framework or dylib -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGVIEWER_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgViewer) @@ -40,7 +40,6 @@ SET(LIB_COMMON_FILES SET(LIB_EXTRA_LIBS) IF(WIN32) - # # Enable workaround for OpenGL driver issues when used in multithreaded/multiscreen with NVidia drivers on Windows XP # For example: osgviewer dumptruck.osg was showing total garbage (screen looked like shattered, splashed hedgehog) @@ -51,7 +50,7 @@ IF(WIN32) MARK_AS_ADVANCED(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) IF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) ADD_DEFINITIONS(-DOSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) - ENDIF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND) + ENDIF() SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} ${HEADER_PATH}/api/Win32/GraphicsWindowWin32 @@ -62,17 +61,15 @@ IF(WIN32) GraphicsWindowWin32.cpp PixelBufferWin32.cpp ) - -ELSE(WIN32) - +ELSE() IF(APPLE) SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.") - ELSE(APPLE) + ELSE() SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation. options only X11") - ENDIF(APPLE) + ENDIF() IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa") - ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION) + ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION) SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa @@ -83,88 +80,72 @@ ELSE(WIN32) DarwinUtils.mm PixelBufferCocoa.mm ) - - SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS}) - - ELSE(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa") - IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon") - ADD_DEFINITIONS(-DUSE_DARWIN_CARBON_IMPLEMENTATION) - SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} - ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon - ${HEADER_PATH}/api/Carbon/PixelBufferCarbon - ) - SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} - GraphicsWindowCarbon.cpp - DarwinUtils.h - DarwinUtils.mm - PixelBufferCarbon.cpp - ) - SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS}) - - ELSE(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon") - - # X11 for everybody else - - - INCLUDE(FindPkgConfig OPTIONAL) - IF (PKG_CONFIG_FOUND) - - PKG_CHECK_MODULES(XRANDR xrandr) - - IF (XRANDR_FOUND) - OPTION(OSGVIEWER_USE_XRANDR "Set to ON to enable Xrandr support for GraphicsWindowX11." ON) - ELSE(XRANDR_FOUND) - SET(OSGVIEWER_USE_XRANDR OFF) - ENDIF (XRANDR_FOUND) - ELSE(PKG_CONFIG_FOUND) + SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS}) + ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon") + ADD_DEFINITIONS(-DUSE_DARWIN_CARBON_IMPLEMENTATION) + SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} + ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon + ${HEADER_PATH}/api/Carbon/PixelBufferCarbon + ) + SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} + GraphicsWindowCarbon.cpp + DarwinUtils.h + DarwinUtils.mm + PixelBufferCarbon.cpp + ) + SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS}) + ELSE() + # X11 for everybody else + INCLUDE(FindPkgConfig OPTIONAL) + IF(PKG_CONFIG_FOUND) + PKG_CHECK_MODULES(XRANDR xrandr) + IF(XRANDR_FOUND) + OPTION(OSGVIEWER_USE_XRANDR "Set to ON to enable Xrandr support for GraphicsWindowX11." ON) + ELSE() SET(OSGVIEWER_USE_XRANDR OFF) - ENDIF(PKG_CONFIG_FOUND) + ENDIF() + ELSE() + SET(OSGVIEWER_USE_XRANDR OFF) + ENDIF() + SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} + ${HEADER_PATH}/api/X11/GraphicsWindowX11 + ${HEADER_PATH}/api/X11/PixelBufferX11 + ) - SET(LIB_PUBLIC_HEADERS ${LIB_PUBLIC_HEADERS} - ${HEADER_PATH}/api/X11/GraphicsWindowX11 - ${HEADER_PATH}/api/X11/PixelBufferX11 - ) + SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} + GraphicsWindowX11.cpp + PixelBufferX11.cpp + ) + + IF(OSGVIEWER_USE_XRANDR) + ADD_DEFINITIONS(-DOSGVIEWER_USE_XRANDR) + SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XRANDR_INCLUDE_DIRS} ) + IF(X11_Xrandr_LIB) + SET(LIB_EXTRA_LIBS ${X11_Xrandr_LIB} ${LIB_EXTRA_LIBS}) + ELSE() + SET(LIB_EXTRA_LIBS ${XRANDR_LIBRARIES} ${LIB_EXTRA_LIBS}) + ENDIF() + ENDIF() - SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} - GraphicsWindowX11.cpp - PixelBufferX11.cpp - ) - - IF(OSGVIEWER_USE_XRANDR) - - ADD_DEFINITIONS(-DOSGVIEWER_USE_XRANDR) - SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XRANDR_INCLUDE_DIRS} ) + # X11 on Apple requires X11 library plus OpenGL linking hack on Leopard + IF(APPLE) + # Find GL/glx.h + IF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11/include/GL/glx.h) + SET(OPENGL_INCLUDE_DIR /usr/X11/include) + SET(OPENGL_LIBRARIES /usr/X11/lib/libGL.dylib) + ELSEIF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11R6/include/GL/glx.h) + SET(OPENGL_INCLUDE_DIR /usr/X11R6/include) + SET(OPENGL_LIBRARIES /usr/X11R6/lib/libGL.dylib) + ENDIF() + INCLUDE_DIRECTORIES(BEFORE SYSTEM ${OPENGL_INCLUDE_DIR}) - IF (X11_Xrandr_LIB) - SET(LIB_EXTRA_LIBS ${X11_Xrandr_LIB} ${LIB_EXTRA_LIBS}) - ELSE(X11_Xrandr_LIB) - SET(LIB_EXTRA_LIBS ${XRANDR_LIBRARIES} ${LIB_EXTRA_LIBS}) - ENDIF(X11_Xrandr_LIB) - - ENDIF(OSGVIEWER_USE_XRANDR) - - # X11 on Apple requires X11 library plus OpenGL linking hack on Leopard - IF(APPLE) - # Find GL/glx.h - IF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11/include/GL/glx.h) - SET(OPENGL_INCLUDE_DIR /usr/X11/include) - SET(OPENGL_LIBRARIES /usr/X11/lib/libGL.dylib) - ELSEIF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11R6/include/GL/glx.h) - SET(OPENGL_INCLUDE_DIR /usr/X11R6/include) - SET(OPENGL_LIBRARIES /usr/X11R6/lib/libGL.dylib) - ENDIF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11/include/GL/glx.h) - INCLUDE_DIRECTORIES(BEFORE SYSTEM ${OPENGL_INCLUDE_DIR}) - - SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${OPENGL_LIBRARIES} ${LIB_EXTRA_LIBS}) - SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib") - ENDIF(APPLE) - - - ENDIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon") - ENDIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa") -ENDIF(WIN32) + SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${OPENGL_LIBRARIES} ${LIB_EXTRA_LIBS}) + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib") + ENDIF(APPLE) + ENDIF() +ENDIF() ADD_LIBRARY(${LIB_NAME} @@ -189,11 +170,11 @@ LINK_CORELIB_DEFAULT(${LIB_NAME}) IF(MINGW OR CYGWIN) LINK_EXTERNAL(${LIB_NAME} gdi32 ) -ENDIF(MINGW OR CYGWIN) +ENDIF() INCLUDE(ModuleInstall OPTIONAL) -FOREACH( INCLUDEFILE ${LIB_PUBLIC_HEADERS} ) +FOREACH(INCLUDEFILE ${LIB_PUBLIC_HEADERS} ) FILE(RELATIVE_PATH REL_INCLUDEFILE ${HEADER_PATH} ${INCLUDEFILE}) GET_FILENAME_COMPONENT(REL_INCLUDE_PATH ${REL_INCLUDEFILE} PATH) INSTALL( @@ -201,4 +182,4 @@ FOREACH( INCLUDEFILE ${LIB_PUBLIC_HEADERS} ) DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}/${REL_INCLUDE_PATH} COMPONENT libopenscenegraph-dev ) -ENDFOREACH( INCLUDEFILE) +ENDFOREACH() diff --git a/src/osgVolume/CMakeLists.txt b/src/osgVolume/CMakeLists.txt index 3cd11a35d..ef98496d9 100644 --- a/src/osgVolume/CMakeLists.txt +++ b/src/osgVolume/CMakeLists.txt @@ -1,9 +1,9 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGVOLUME_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgVolume) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgWidget/CMakeLists.txt b/src/osgWidget/CMakeLists.txt index b722b2beb..d1c501bee 100644 --- a/src/osgWidget/CMakeLists.txt +++ b/src/osgWidget/CMakeLists.txt @@ -1,8 +1,8 @@ -IF (DYNAMIC_OPENSCENEGRAPH) +IF(DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSGWIDGET_LIBRARY) -ELSE (DYNAMIC_OPENSCENEGRAPH) +ELSE() ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIB_NAME osgWidget) SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME}) diff --git a/src/osgWrappers/CMakeLists.txt b/src/osgWrappers/CMakeLists.txt index 6e4aa971c..5102b1071 100644 --- a/src/osgWrappers/CMakeLists.txt +++ b/src/osgWrappers/CMakeLists.txt @@ -1,18 +1,18 @@ PROJECT(OSG_WRAPPERS) -IF (NOT DYNAMIC_OPENSCENEGRAPH) +IF(NOT DYNAMIC_OPENSCENEGRAPH) ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC) -ENDIF(NOT DYNAMIC_OPENSCENEGRAPH) +ENDIF() SET(LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH}/${OSG_PLUGINS}") SET(CMAKE_SHARED_MODULE_PREFIX ${OSG_PLUGIN_PREFIX}) IF(MSVC80) - IF(NOT OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS) - SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO") - ENDIF(NOT OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS) -ENDIF(MSVC80) + IF(NOT OSG_MSVC_GENERATE_PLUGINS_AND_WRAPPERS_MANIFESTS) + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO") + ENDIF() +ENDIF() MACRO(ADD_WRAPPER_LIB SUBDIR EXPORTDEF) SET(TARGET_NAME "osgwrapper_${SUBDIR}") @@ -41,12 +41,10 @@ MACRO(ADD_WRAPPER_LIB SUBDIR EXPORTDEF) # MESSAGE(STATUS "STORED LIST [${LISTNAME}] = (${CURRLIST})") SET(LISTNAME ${ARG}) REMOVE(CURRLIST ${CURRLIST} ) - - ELSE(${EXPRESSION}) + ELSE() SET(CURRLIST ${CURRLIST} ${ARG}) - - ENDIF(${EXPRESSION}) - ENDFOREACH(ARG) + ENDIF() + ENDFOREACH() SET(${LISTNAME} ${CURRLIST}) #MESSAGE(STATUS "STORED LIST [${LISTNAME}] = (${CURRLIST})") REMOVE(CURRLIST ${CURRLIST} ) @@ -54,49 +52,45 @@ MACRO(ADD_WRAPPER_LIB SUBDIR EXPORTDEF) #MESSAGE(STATUS "AFTER: EXC (${EXCLUDE}) DEF (${DEFINE}) LINK (${LINK})") FOREACH(EXF ${EXCLUDE}) REMOVE(SRC_FILES ${OPENSCENEGRAPH_DIR}/src/${SUBDIR}/${EXF}) - ENDFOREACH(EXF) + ENDFOREACH() FOREACH(DEF ${DEFINE}) SET(DEFSTR "${DEFSTR} /D \"${DEF}\"") #MESSAGE(STATUS "add symbol : " ${DEF}) - ENDFOREACH(DEF) + ENDFOREACH() IF(NOT DEFSTR STREQUAL "") SET_SOURCE_FILES_PROPERTIES(${SRC_FILES} PROPERTIES COMPILE_FLAGS ${DEFSTR}) #MESSAGE(STATUS "********* ADD COMPILE FLAGS ${DEFSTR} **********") - ENDIF(NOT DEFSTR STREQUAL "") + ENDIF() #ADD_LIBRARY(${TARGET_NAME} SHARED ${SRC_FILES} ) - ADD_LIBRARY(${TARGET_NAME} MODULE ${SRC_FILES} ) + ADD_LIBRARY(${TARGET_NAME} MODULE ${SRC_FILES} ) #not sure if needed, but for plugins only msvc need the d suffix IF(NOT MSVC) SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "") - ELSE(NOT MSVC) + ELSE() IF(OSG_MSVC_VERSIONED_DLL) - - #this is a hack... the build place is set to lib/ by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR - #the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property - #because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there, - #it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented - #changing bin to something else breaks this hack - #the dll are placed in bin/${OSG_PLUGINS} - - IF(NOT MSVC_IDE) - SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "../bin/${OSG_PLUGINS}/") - ELSE(NOT MSVC_IDE) - SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../") - ENDIF(NOT MSVC_IDE) - - - ELSE(OSG_MSVC_VERSIONED_DLL) + #this is a hack... the build place is set to lib/ by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR + #the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property + #because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there, + #it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented + #changing bin to something else breaks this hack + #the dll are placed in bin/${OSG_PLUGINS} + IF(NOT MSVC_IDE) + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "../bin/${OSG_PLUGINS}/") + ELSE() + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../") + ENDIF() + + ELSE() #in standard mode (unversioned) the .lib and .dll are placed in lib//${OSG_PLUGINS}. #here the PREFIX property has been used, the same result would be accomplidhe by prepending ${OSG_PLUGINS}/ to OUTPUT_NAME target property - SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES PREFIX "${OSG_PLUGINS}/") - ENDIF(OSG_MSVC_VERSIONED_DLL) - ENDIF(NOT MSVC) + ENDIF() + ENDIF() SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES DEFINE_SYMBOL "${EXPORTDEF}" PROJECT_LABEL "Wrapper ${SUBDIR}") IF(MSVC AND OSG_MSVC_VERSIONED_DLL) @@ -104,25 +98,31 @@ MACRO(ADD_WRAPPER_LIB SUBDIR EXPORTDEF) #when using full path name to specify linkage, it seems that already linked libs must be specified LINK_EXTERNAL(${TARGET_NAME} ${OPENGL_LIBRARIES}) - ELSE(MSVC AND OSG_MSVC_VERSIONED_DLL) + ELSE() TARGET_LINK_LIBRARIES(${TARGET_NAME} ${LINK}) - ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL) + ENDIF() #MESSAGE(STATUS "--TARGET_LINK_LIBRARIES-->${TARGET_NAME}<->${LINK}<-") + #FIXME: Deprecated REMOVE(DEFINE ${DEFINE}) REMOVE(LINK ${LINK}) REMOVE(EXCLUDE ${EXCLUDE}) IF(WIN32) - INSTALL(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib/${OSG_PLUGINS} LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT libopenscenegraph-wrappers) - ELSE(WIN32) - INSTALL(TARGETS ${TARGET_NAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-wrappers) - ENDIF(WIN32) - + INSTALL(TARGETS ${TARGET_NAME} + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib/${OSG_PLUGINS} + LIBRARY DESTINATION bin/${OSG_PLUGINS} + COMPONENT libopenscenegraph-wrappers) + ELSE() + INSTALL(TARGETS ${TARGET_NAME} + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} + LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} + COMPONENT libopenscenegraph-wrappers) + ENDIF() ENDMACRO(ADD_WRAPPER_LIB) - - SET(OSGWRAPPER_LIB_LIST OpenThreads osg @@ -144,9 +144,11 @@ SET(OSGWRAPPER_LIB_LIST SET(OSGWRAPPER_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + IF(MSVC) SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR}) -ENDIF(MSVC) -FOREACH(LIB ${OSGWRAPPER_LIB_LIST} ) - ADD_WRAPPER_LIB(${LIB} OSGWRAPPERS_LIBRARY LINK OpenThreads osg osgGA ${LIB} osgIntrospection) -ENDFOREACH(LIB ${OSGWRAPPER_LIB_LIST} ) +ENDIF() + +FOREACH(LIB ${OSGWRAPPER_LIB_LIST}) + ADD_WRAPPER_LIB(${LIB} OSGWRAPPERS_LIBRARY LINK OpenThreads osg osgGA ${LIB} osgIntrospection) +ENDFOREACH()