commit c1d65c7f1f6836d4fe961c0a54ea11ff8fdfc62d Author: Ryan Pavlik Date: Thu Nov 11 10:59:10 2010 -0600 Squashed 'cmake/' content from commit 2d25566 git-subtree-dir: cmake git-subtree-split: 2d25566a1c5162ce3fd6bfc268d5665de182af89 diff --git a/BoostTestTargets.cmake b/BoostTestTargets.cmake new file mode 100644 index 0000000..92607b6 --- /dev/null +++ b/BoostTestTargets.cmake @@ -0,0 +1,273 @@ +# - Add tests using boost::test +# +# Add this line to your test files in place of including a basic boost test header: +# #include +# +# If you cannot do that and must use the included form for a given test, +# include the line +# // OVERRIDE_BOOST_TEST_INCLUDED_WARNING +# in the same file with the boost test include. +# +# include(BoostTestTargets) +# add_boost_test( SOURCES [] +# [FAIL_REGULAR_EXPRESSION ] +# [LAUNCHER ] +# [LIBRARIES [...]] +# [RESOURCES [...]] +# [TESTS [...]]) +# +# If for some reason you need access to the executable target created, +# it can be found in ${${testdriver_name}_TARGET_NAME} as specified when +# you called add_boost_test +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Requires: +# GetForceIncludeDefinitions +# CopyResourcesToBuildTree +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__add_boost_test) + return() +endif() +set(__add_boost_test YES) + +set(BOOST_TEST_TARGET_PREFIX "boosttest") + +if(NOT Boost_FOUND) + find_package(Boost 1.34.0 QUIET) +endif() +if("${Boost_VERSION}0" LESS "1034000") + set(_shared_msg + "NOTE: boost::test-based targets and tests cannot " + "be added: boost >= 1.34.0 required but not found. " + "(found: '${Boost_VERSION}'; want >=103400) ") + if(BUILD_TESTING) + message(FATAL_ERROR + ${_shared_msg} + "You may disable BUILD_TESTING to continue without the " + "tests.") + else() + message(STATUS + ${_shared_msg} + "BUILD_TESTING disabled, so continuing anyway.") + endif() +endif() + +include(GetForceIncludeDefinitions) +include(CopyResourcesToBuildTree) + +if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000") + if(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY) + find_package(Boost 1.34.0 QUIET COMPONENTS unit_test_framework) + endif() + if(Boost_UNIT_TEST_FRAMEWORK_LIBRARY) + set(_boosttesttargets_libs ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if(Boost_USE_STATIC_LIBS) + set(_boostConfig "BoostTestTargetsStatic.h") + else() + set(_boostConfig "BoostTestTargetsDynamic.h") + endif() + else() + set(_boosttesttargets_libs) + set(_boostConfig "BoostTestTargetsIncluded.h") + endif() + get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) + configure_file("${_moddir}/${_boostConfig}" + "${CMAKE_CURRENT_BINARY_DIR}/BoostTestTargetConfig.h" + COPYONLY) + include_directories("${CMAKE_CURRENT_BINARY_DIR}") +endif() + +function(add_boost_test _name) + if(NOT BUILD_TESTING) + return() + endif() + if("${CMAKE_VERSION}" VERSION_LESS "2.8.0") + if(NOT "${_boost_test_cmakever_pestered}x" EQUALS "${CMAKE_VERSION}x") + message(STATUS + "Not adding boost::test targets - CMake 2.8.0 or newer required, using ${CMAKE_VERSION}") + set(_boost_test_cmakever_pestered + "${CMAKE_VERSION}" + CACHE + INTERNAL + "" + FORCE) + endif() + return() + endif() + + # parse arguments + set(_nowhere) + set(_curdest _nowhere) + set(_val_args + SOURCES + FAIL_REGULAR_EXPRESSION + LAUNCHER + LIBRARIES + RESOURCES + TESTS) + set(_bool_args + USE_COMPILED_LIBRARY) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR "Syntax error in use of add_boost_test!") + endif() + + if(NOT SOURCES) + message(FATAL_ERROR + "Syntax error in use of add_boost_test: at least one source file required!") + endif() + + if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000") + + include_directories(${Boost_INCLUDE_DIRS}) + + set(includeType) + foreach(src ${SOURCES}) + file(READ ${src} thefile) + if("${thefile}" MATCHES ".*BoostTestTargetConfig.h.*") + set(includeType CONFIGURED) + set(includeFileLoc ${src}) + break() + elseif("${thefile}" MATCHES ".*boost/test/included/unit_test.hpp.*") + set(includeType INCLUDED) + set(includeFileLoc ${src}) + set(_boosttesttargets_libs) # clear this out - linking would be a bad idea + if(NOT + "${thefile}" + MATCHES + ".*OVERRIDE_BOOST_TEST_INCLUDED_WARNING.*") + message("Please replace the include line in ${src} with this alternate include line instead:") + message(" \#include ") + message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)") + endif() + break() + endif() + endforeach() + + if(NOT _boostTestTargetsNagged${_name} STREQUAL "${includeType}") + if("includeType" STREQUAL "CONFIGURED") + message(STATUS + "Test '${_name}' uses the CMake-configurable form of the boost test framework - congrats! (Including File: ${includeFileLoc})") + elseif("${includeType}" STREQUAL "INCLUDED") + message("In test '${_name}': ${includeFileLoc} uses the 'included' form of the boost unit test framework.") + else() + message("In test '${_name}': Didn't detect the CMake-configurable boost test include.") + message("Please replace your existing boost test include in that test with the following:") + message(" \#include ") + message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)") + endif() + endif() + set(_boostTestTargetsNagged${_name} + "${includeType}" + CACHE + INTERNAL + "" + FORCE) + + + if(RESOURCES) + list(APPEND SOURCES ${RESOURCES}) + endif() + + # Generate a unique target name, using the relative binary dir + # and provided name. (transform all / into _ and remove all other + # non-alphabet characters) + file(RELATIVE_PATH + targetpath + "${CMAKE_BINARY_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}") + string(REGEX REPLACE "[^A-Za-z/_]" "" targetpath "${targetpath}") + string(REPLACE "/" "_" targetpath "${targetpath}") + + set(_target_name ${BOOST_TEST_TARGET_PREFIX}-${targetpath}-${_name}) + set(${_name}_TARGET_NAME "${_target_name}" PARENT_SCOPE) + + # Build the test. + add_executable(${_target_name} ${SOURCES}) + + list(APPEND LIBRARIES ${_boosttesttargets_libs}) + + if(LIBRARIES) + target_link_libraries(${_target_name} ${LIBRARIES}) + endif() + + if(RESOURCES) + set_property(TARGET ${_target_name} PROPERTY RESOURCE ${RESOURCES}) + copy_resources_to_build_tree(${_target_name}) + endif() + + if(NOT Boost_TEST_FLAGS) +# set(Boost_TEST_FLAGS --catch_system_error=yes --output_format=XML) + set(Boost_TEST_FLAGS --catch_system_error=yes) + endif() + + # TODO: Figure out why only recent boost handles individual test running properly + + if(LAUNCHER) + set(_test_command ${LAUNCHER} "\$") + else() + set(_test_command ${_target_name}) + endif() + + if(TESTS AND ( "${Boost_VERSION}" VERSION_GREATER "103799" )) + foreach(_test ${TESTS}) + add_test(NAME + ${_name}-${_test} + COMMAND + ${_test_command} + --run_test=${_test} + ${Boost_TEST_FLAGS}) + if(FAIL_REGULAR_EXPRESSION) + set_tests_properties(${_name}-${_test} + PROPERTIES + FAIL_REGULAR_EXPRESSION + "${FAIL_REGULAR_EXPRESSION}") + endif() + endforeach() + else() + add_test(NAME + ${_name}-boost_test + COMMAND + ${_test_command} + ${Boost_TEST_FLAGS}) + if(FAIL_REGULAR_EXPRESSION) + set_tests_properties(${_name}-${_test} + PROPERTIES + FAIL_REGULAR_EXPRESSION + "${FAIL_REGULAR_EXPRESSION}") + endif() + endif() + + # CppCheck the test if we can. + if(COMMAND add_cppcheck) + add_cppcheck(${_target_name} STYLE UNUSED_FUNCTIONS) + endif() + + endif() +endfunction() diff --git a/BoostTestTargetsDynamic.h b/BoostTestTargetsDynamic.h new file mode 100644 index 0000000..ae1f38e --- /dev/null +++ b/BoostTestTargetsDynamic.h @@ -0,0 +1,9 @@ +// Small header computed by CMake to set up boost test. +// include AFTER #define BOOST_TEST_MODULE whatever +// but before any other boost test includes. + +// Using the Boost UTF dynamic library + +#define BOOST_TEST_DYN_LINK +#include + diff --git a/BoostTestTargetsIncluded.h b/BoostTestTargetsIncluded.h new file mode 100644 index 0000000..253133c --- /dev/null +++ b/BoostTestTargetsIncluded.h @@ -0,0 +1,7 @@ +// Small header computed by CMake to set up boost test. +// include AFTER #define BOOST_TEST_MODULE whatever +// but before any other boost test includes. + +// Using the Boost UTF included framework + +#include diff --git a/BoostTestTargetsStatic.h b/BoostTestTargetsStatic.h new file mode 100644 index 0000000..dd3cdda --- /dev/null +++ b/BoostTestTargetsStatic.h @@ -0,0 +1,7 @@ +// Small header computed by CMake to set up boost test. +// include AFTER #define BOOST_TEST_MODULE whatever +// but before any other boost test includes. + +// Using the Boost UTF static library + +#include diff --git a/BundleOSGPlugins.cmake b/BundleOSGPlugins.cmake new file mode 100644 index 0000000..a86510d --- /dev/null +++ b/BundleOSGPlugins.cmake @@ -0,0 +1,83 @@ +# - Provide access to the OpenSceneGraph runtime files for bundling in +# an installation or package. +# +# Sets these variables: +# - OSGDB_PLUGINS_RELEASE +# - OSGDB_PLUGINS_DEBUG +# - OSGWRAPPER_PLUGINS_RELEASE +# - OSGWRAPPER_PLUGINS_DEBUG +# - OSG_RUNTIME_LIBRARY_DIR +# - OSG_PATH_TO_PLUGINS +# +# Creates this function: +# - install_osg_plugins( {varNameForOutputFilenames} ) +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +function(_osgbundle_split_debug_versions releasevar debugvar) + set(release) + set(debug) + foreach(fn ${ARGN}) + get_filename_component(name "${fn}" NAME_WE) + if(${name} MATCHES "d$") + list(APPEND debug "${fn}") + else() + list(APPEND release "${fn}") + endif() + endforeach() + set(${releasevar} ${release} PARENT_SCOPE) + set(${debugvar} ${debug} PARENT_SCOPE) +endfunction() + +function(_osgbundle_find_plugins varprefix filenameprefix) + file(GLOB + all + "${OSG_RUNTIME_LIBRARY_DIR}/osgPlugins-${OPENSCENEGRAPH_VERSION}/${filenameprefix}*${CMAKE_SHARED_LIBRARY_SUFFIX}") + _osgbundle_split_debug_versions(${varprefix}_PLUGINS_RELEASE + ${varprefix}_PLUGINS_DEBUG + ${all}) + set(${varprefix}_PLUGINS_RELEASE + "${${varprefix}_PLUGINS_RELEASE}" + PARENT_SCOPE) + set(${varprefix}_PLUGINS_DEBUG + "${${varprefix}_PLUGINS_DEBUG}" + PARENT_SCOPE) +endfunction() + +if(OPENSCENEGRAPH_FOUND) + if(WIN32) + get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH) + get_filename_component(_osgroot "${_osglibdir}/.." ABSOLUTE) + set(OSG_RUNTIME_LIBRARY_DIR "${_osgroot}/bin") + set(OSG_PATH_TO_PLUGINS "bin/osgPlugins-${OPENSCENEGRAPH_VERSION}/") + else() + get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH) + set(OSG_RUNTIME_LIBRARY_DIR "${_osglibdir}") + set(OSG_PATH_TO_PLUGINS "lib/osgPlugins-${OPENSCENEGRAPH_VERSION}/") + endif() + # Find the osgDB plugins + _osgbundle_find_plugins(OSGDB osgdb) + _osgbundle_find_plugins(OSGWRAPPER osgwrapper) +endif() + +function(install_osg_plugins var) + set(INSTALLEDPLUGINS) + foreach(plugin ${OSGDB_PLUGINS_RELEASE} ${OSGWRAPPER_PLUGINS_RELEASE}) + install(FILES "${plugin}" DESTINATION "${OSG_PATH_TO_PLUGINS}") + get_filename_component(name "${plugin}" NAME) + list(APPEND INSTALLEDPLUGINS "${OSG_PATH_TO_PLUGINS}/${name}") + endforeach() + set(${var} ${INSTALLEDPLUGINS} PARENT_SCOPE) +endfunction() diff --git a/BundleOSGRuntime.cmake b/BundleOSGRuntime.cmake new file mode 100644 index 0000000..48b2e2e --- /dev/null +++ b/BundleOSGRuntime.cmake @@ -0,0 +1,118 @@ +# - Include the OpenSceneGraph runtime files in an installation or built package. +# +# OSGRUNTIME_BUNDLE - Set to "yes" to enable this behavior +# OSGRUNTIME_zlib1dll - Must be set to the location of zlib1.dll on Windows +# OSGRUNTIME_zlib1ddll - Can be set to the location of zlib1d.dll (debug) on Windows. +# If set, will be installed. +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +function(_osgbundle_split_debug_versions releasevar debugvar) + set(release) + set(debug) + foreach(fn ${ARGN}) + get_filename_component(name "${fn}" NAME_WE) + if(${name} MATCHES "d$") + list(APPEND debug "${fn}") + else() + list(APPEND release "${fn}") + endif() + endforeach() + set(${releasevar} ${release} PARENT_SCOPE) + set(${debugvar} ${debug} PARENT_SCOPE) +endfunction() + +function(_osgbundle_find_plugins varprefix filenameprefix) + file(GLOB + all + "${OSG_RUNTIME_LIBRARY_DIR}/osgPlugins-${OPENSCENEGRAPH_VERSION}/${filenameprefix}*${CMAKE_SHARED_LIBRARY_SUFFIX}") + _osgbundle_split_debug_versions(${varprefix}_PLUGINS_RELEASE + ${varprefix}_PLUGINS_DEBUG + ${all}) +endfunction() + +if(OPENSCENEGRAPH_FOUND) + if(WIN32) + get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH) + get_filename_component(_osgroot "${_osglibdir}/.." ABSOLUTE) + set(OSG_RUNTIME_LIBRARY_DIR "${_osgroot}/bin") + find_file(OSGBUNDLE_zlib1dll + zlib1.dll + PATHS + "${_osgroot}/bin" + "${_osgroot}/lib") + find_file(OSGBUNDLE_zlib1ddll + zlib1d.dll + PATHS + "${_osgroot}/bin" + "${_osgroot}/lib") + mark_as_advanced(OSGBUNDLE_zlib1dll OSGBUNDLE_zlib1ddll) + set(_osgbundle_required OSGBUNDLE_zlib1dll) + set(_osgbundle_platformOK on) + else() + get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH) + set(OSG_RUNTIME_LIBRARY_DIR "${_osglibdir}") + set(_osgbundle_platformOK on) + endif() + + # Find the osgDB plugins + + _osgbundle_find_plugins(OSGDB osgdb) + _osgbundle_find_plugins(OSGWRAPPER osgwrapper) +endif() + + + +if(_osgbundle_platformOK) + set(_osgbundle_caninstall on) + foreach(_var ${_osgbundle_required}) + if(NOT ${_var}) + # If we are missing a single required file, cut out now. + set(_osgbundle_caninstall off) + option(OSGRUNTIME_BUNDLE + "Install a local copy of the OpenSceneGraph runtime files with the project." + off) + endif() + endforeach() + if(_osgbundle_caninstall) + option(OSGRUNTIME_BUNDLE + "Install a local copy of the OpenSceneGraph runtime files with the project." + on) + endif() +endif() + +mark_as_advanced(OSGRUNTIME_BUNDLE) + +if(OSGRUNTIME_BUNDLE AND OPENSCENEGRAPH_FOUND AND _osgbundle_caninstall) + if(WIN32) + set(DESTINATION bin) + install(FILES "${OSGBUNDLE_zlib1dll}" + DESTINATION ${DESTINATION}) + + if(OSGBUNDLE_zlib1ddll) + install(FILES "${OSGBUNDLE_zlib1ddll}" + DESTINATION ${DESTINATION}) + endif() + + else() + set(DESTINATION lib) + endif() + + install(DIRECTORY "${_osgroot}/bin/" "${_osgroot}/lib/" + DESTINATION ${DESTINATION} + FILES_MATCHING + + # Runtime files + PATTERN "*${CMAKE_SHARED_LIBRARY_SUFFIX}") +endif() diff --git a/BundleVRJ22Runtime.cmake b/BundleVRJ22Runtime.cmake new file mode 100644 index 0000000..d5c6b89 --- /dev/null +++ b/BundleVRJ22Runtime.cmake @@ -0,0 +1,99 @@ +# - Include the VR Juggler runtime files in an installation or built package. +# +# VRJUGGLERRUNTIME_BUNDLE +# VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well +# +# Requires these CMake modules: +# FindVRJuggler22 and its dependencies +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(WIN32) + option(VRJUGGLERRUNTIME_BUNDLE + "Install a local copy of the VR Juggler runtime files with the project." + on) + option(VRJUGGLERRUNTIME_BUNDLE_DEBUG + "Install the VR Juggler debug runtime files as well." + off) + mark_as_advanced(VRJUGGLERRUNTIME_BUNDLE_DEBUG) +else() + # TODO - how to handle when not on Windows? + #option(VRJUGGLERRUNTIME_BUNDLE "Install a local copy of the VR Juggler runtime files with the project." off) +endif() + +mark_as_advanced(VRJUGGLERRUNTIME_BUNDLE VRJUGGLERRUNTIME_BUNDLE_DEBUG) + +if(VRJUGGLERRUNTIME_BUNDLE AND VRJUGGLER22_FOUND) + if(WIN32) + get_filename_component(_vrjlibdir "${VRJ22_LIBRARY_RELEASE}" PATH) + get_filename_component(_vrjroot "${_vrjlibdir}/../" ABSOLUTE) + + # TODO - make sure gadgeteer and sonix can find their DSO's at runtime... + + foreach(_dir bin lib) + if(VRJUGGLERRUNTIME_BUNDLE_DEBUG) + install(DIRECTORY "${_vrjroot}/${_dir}/" + DESTINATION bin + PATTERN "*.lib" EXCLUDE # exclude static and link libraries + PATTERN "*.exe" EXCLUDE # exclude unneeded executables + PATTERN "*.py" EXCLUDE # exclude unneeded python executables + PATTERN "*.pyc" EXCLUDE # exclude unneeded python executables + ) + else() + install(DIRECTORY ${_vrjroot}/${_dir}/ + DESTINATION bin + PATTERN "*.lib" EXCLUDE # exclude static and link libraries + PATTERN "*.exe" EXCLUDE # exclude unneeded executables + PATTERN "*.py" EXCLUDE # exclude unneeded python executables + PATTERN "*.pyc" EXCLUDE # exclude unneeded python executables + + PATTERN "*d.dll" EXCLUDE # exclude debug dll's + PATTERN "*-gd-*.dll" EXCLUDE # exclude Boost debug dll's + ) + endif() + + endforeach() + + install(DIRECTORY ${_vrjroot}/share/ + DESTINATION share + FILES_MATCHING + + # Runtime files + PATTERN "*.dll" + PATTERN "*.jar" + + # Data files + PATTERN "*.wav" + PATTERN "*.xml" + PATTERN "*.xsl" + PATTERN "*.xsd" + PATTERN "*.flt" + PATTERN "*.dat" + PATTERN "*.table" + + + # Config files + PATTERN "*.jdef" + PATTERN "*.jconf" + PATTERN "*.cfg" + PATTERN "hosts.allow" + + # Other Files + PATTERN "*.txt" + PATTERN "COPYING*" + PATTERN "ChangeLog" + ) + + endif() + + + +endif() diff --git a/CheckMacHIDAPI.cmake b/CheckMacHIDAPI.cmake new file mode 100644 index 0000000..9a8a302 --- /dev/null +++ b/CheckMacHIDAPI.cmake @@ -0,0 +1,73 @@ +# - Script to check if the signature for a mac HID callback uses UInt32 or uint32_t +# Requires that the associated CPP file be present: CheckMacHIDAPI.cpp. +# +# MACOSX_HID_UINT32T, set according to the results of our test. +# +# Use add_definitions(-DMACOSX_HID_UINT32T=${MACOSX_HID_UINT32T}) in your +# listfile and the following prototype for the function you'd like to +# register using setInterruptReportHandlerCallback: +# void ReaderReportCallback( +# void *target, +# IOReturn result, +# void *refcon, +# void *sender, +# MACOSX_HID_UINT32T size +# ) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +if(APPLE) + if(NOT MACOSX_HID_UINT32T) + get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) + + try_compile(_HID_uint32t + ${CMAKE_BINARY_DIR} + ${_moddir}/CheckMacHIDAPI.cpp + OUTPUT_VARIABLE + _HID_uint32t_OUTPUT + COMPILE_DEFINITIONS + -DMACOSX_HID_UINT32T=uint32_t) + message(STATUS + "Checking uint32_t in HID callback signature... ${_HID_uint32t}") + + try_compile(_HID_UInt32 + ${CMAKE_BINARY_DIR} + ${_moddir}/CheckMacHIDAPI.cpp + OUTPUT_VARIABLE + _HID_UInt32_OUTPUT + COMPILE_DEFINITIONS + -DMACOSX_HID_UINT32T=UInt32) + message(STATUS + "Checking UInt32 in HID callback signature... ${_HID_UInt32}") + + + if(_HID_uint32t) + set(MACOSX_HID_UINT32T + "uint32_t" + CACHE + STRING + "The 32-bit uint type desired in the callback set by setInterruptReportHandlerCallback") + mark_as_advanced(MACOSX_HID_UINT32T) + elseif(_HID_UInt32) + set(MACOSX_HID_UINT32T + "UInt32" + CACHE + STRING + "The 32-bit uint type desired in the callback set by setInterruptReportHandlerCallback") + mark_as_advanced(MACOSX_HID_UINT32T) + else() + message(SEND_ERROR + "ERROR: Could not detect appropriate Mac HID uint32 type!") + endif() + + endif() +endif() diff --git a/CheckMacHIDAPI.cpp b/CheckMacHIDAPI.cpp new file mode 100644 index 0000000..ba5e415 --- /dev/null +++ b/CheckMacHIDAPI.cpp @@ -0,0 +1,47 @@ +/** + * \file CheckMacHIDAPI.cpp + * \brief C++ source file used by CMake module CheckMacHIDAPI.cmake + * + * \author + * Ryan Pavlik, 2009-2010 + * + * http://academic.cleardefinition.com/ + * + * \author + * Based on code extracted from VRPN 07.22 for use as a minimal test case + * + * Attempts to compile a difficult bit of code against the Mac + * HID API, as two different types have been required in the callback + * function (UInt32 and uint32_t) and testing is the best way to know + * which one is correct for a given system. + * + */ + + +#if defined(__APPLE__) + +#include +#include +#include +#include +#include +void ReaderReportCallback( + void *target, IOReturn result, void *refcon, void *sender, MACOSX_HID_UINT32T size + ) + {} +#endif + +int main(int argc, char* argv[]) { +#if defined(__APPLE__) + io_object_t _ioObject; + IOHIDDeviceInterface122 **_interface; + bool _gotdata; + int _gotsize; + unsigned char _buffer[512]; + IOReturn result = (*_interface)->setInterruptReportHandlerCallback(_interface, + _buffer, 512, + ReaderReportCallback, + NULL, 0); +#endif + return 0; +} diff --git a/CheckVersion.cmake b/CheckVersion.cmake new file mode 100644 index 0000000..bbd21f1 --- /dev/null +++ b/CheckVersion.cmake @@ -0,0 +1,47 @@ +# - Utility function for Find modules considering multiple possible versions +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__check_version) + return() +endif() +set(__check_version YES) + +function(check_version var packagename version) + # By default, we say that the version is good enough + set(_result TRUE) + + # Was a version requested? If so, what is our test condition? + if(${packagename}_FIND_VERSION) + if(${packagename}_FIND_VERSION_EXACT) + # Yes, an exact == version was requested - check it. + + if(NOT "${version}" VERSION_EQUAL "${${packagename}_FIND_VERSION}") + # version is not an exact match + set(_result FALSE) + endif() + else() + # Yes, a minimum >= version was requested - check it. + + if("${version}" VERSION_LESS "${${packagename}_FIND_VERSION}") + # version is lower than requested + set(_result FALSE) + endif() + + endif() + endif() + + # Return _result + set(${var} ${_result} PARENT_SCOPE) +endfunction() diff --git a/CleanDirectoryList.cmake b/CleanDirectoryList.cmake new file mode 100644 index 0000000..67adccd --- /dev/null +++ b/CleanDirectoryList.cmake @@ -0,0 +1,48 @@ +# - Removes duplicate entries and non-directories from a provided list +# +# clean_directory_list( [...]) +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__clean_directory_list) + return() +endif() +set(__clean_directory_list YES) + +function(clean_directory_list _var) + # combine variable's current value with additional list items + set(_in ${${_var}} ${ARGN}) + + if(_in) + # Initial list cleaning + list(REMOVE_DUPLICATES _in) + + # Grab the absolute path of each actual directory + set(_out) + foreach(_dir ${_in}) + if(IS_DIRECTORY "${_dir}") + get_filename_component(_dir "${_dir}" ABSOLUTE) + file(TO_CMAKE_PATH "${_dir}" _dir) + list(APPEND _out "${_dir}") + endif() + endforeach() + + if(_out) + # Clean up the output list now + list(REMOVE_DUPLICATES _out) + endif() + + # return _out + set(${_var} "${_out}" PARENT_SCOPE) + endif() +endfunction() diff --git a/CleanLibraryList.cmake b/CleanLibraryList.cmake new file mode 100644 index 0000000..fcff1b4 --- /dev/null +++ b/CleanLibraryList.cmake @@ -0,0 +1,72 @@ +# - A smarter replacement for list(REMOVE_DUPLICATES) for library lists +# +# Note that, in the case of cyclic link dependencies, you _do_ actually need +# a library in a list multiple times. So, only use this function when you know +# that the dependency graph is acyclic. +# +# clean_library_list( [...]) - where +# listvar is the name of a destination variable, and also possibly a source, and +# it is followed by any number (including 0) of additional libraries to append +# to the list before processing. +# +# Removes duplicates from the list, leaving only the last instance, while +# preserving the meaning of the "optimized", "debug", and "general" labeling. +# (Libraries listed as general are listed in the result instead as optimized and +# debug) +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__clean_library_list) + return() +endif() +set(__clean_library_list YES) + +function(clean_library_list _var) + # combine variable's current value with additional list items + set(_work ${${_var}} ${ARGN}) + if(_work) + # Turn each of optimized, debug, and general into flags + # prefixed on their respective library (combining list items) + string(REGEX REPLACE "optimized;" "1CLL%O%" _work "${_work}") + string(REGEX REPLACE "debug;" "1CLL%D%" _work "${_work}") + string(REGEX REPLACE "general;" "1CLL%G%" _work "${_work}") + + # Any library that doesn't have a prefix is general, and a general + # library is both debug and optimized so stdize it + set(_std) + foreach(_lib ${_work}) + if(NOT "${_lib}" MATCHES "^1CLL%.%") + list(APPEND _std "1CLL%D%${_lib}" "1CLL%O%${_lib}") + elseif("${_lib}" MATCHES "^1CLL%G%") + string(REPLACE "1CLL%G%" "" _justlib "${_lib}") + list(APPEND _std "1CLL%D%${_justlib}" "1CLL%O%${_justlib}") + else() + list(APPEND _std "${_lib}") + endif() + endforeach() + + # REMOVE_DUPLICATES leaves the first - so we reverse before and after + # to keep the last, instead + list(REVERSE _std) + list(REMOVE_DUPLICATES _std) + list(REVERSE _std) + + # Split list items back out again: turn prefixes into the + # library type flags. + string(REGEX REPLACE "1CLL%D%" "debug;" _std "${_std}") + string(REGEX REPLACE "1CLL%O%" "optimized;" _std "${_std}") + + # Return _std + set(${_var} ${_std} PARENT_SCOPE) + endif() +endfunction() diff --git a/CopyResourcesToBuildTree.cmake b/CopyResourcesToBuildTree.cmake new file mode 100644 index 0000000..3bb2503 --- /dev/null +++ b/CopyResourcesToBuildTree.cmake @@ -0,0 +1,83 @@ +# - Copy the resources your app needs to the build tree. +# +# copy_resources_to_build_tree() +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__copy_resources_to_build_tree) + return() +endif() +set(__copy_resources_to_build_tree YES) + +function(copy_resources_to_build_tree _target) + get_target_property(_resources ${_target} RESOURCE) + if(NOT _resources) + # Bail if no resources + message(STATUS + "Told to copy resources for target ${_target}, but " + "no resources are set!") + return() + endif() + + get_target_property(_path ${_target} LOCATION) + get_filename_component(_path "${_path}" PATH) + + if(NOT MSVC AND NOT "${CMAKE_GENERATOR}" MATCHES "Makefiles") + foreach(_config ${CMAKE_CONFIGURATION_TYPES}) + get_target_property(_path${_config} ${_target} LOCATION_${_config}) + get_filename_component(_path${_config} "${_path${_config}}" PATH) + add_custom_command(TARGET ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS -E make_directory "${_path${_config}}/" + COMMENT "Creating directory ${_path${_config}}/") + endforeach() + endif() + + foreach(_res ${_resources}) + if(NOT IS_ABSOLUTE "${_res}") + get_filename_component(_res "${_res}" ABSOLUTE) + endif() + get_filename_component(_name "${_res}" NAME) + + if(MSVC) + # Working dir is solution file dir, not exe file dir. + add_custom_command(TARGET ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${_res}" "${CMAKE_BINARY_DIR}/" + COMMENT "Copying ${_name} to ${CMAKE_BINARY_DIR}/ for MSVC") + else() + if("${CMAKE_GENERATOR}" MATCHES "Makefiles") + add_custom_command(TARGET ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${_res}" "${_path}/" + COMMENT "Copying ${_name} to ${_path}/") + else() + foreach(_config ${CMAKE_CONFIGURATION_TYPES}) + add_custom_command(TARGET ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${_res}" "${_path${_config}}" + COMMENT "Copying ${_name} to ${_path${_config}}") + endforeach() + + endif() + endif() + endforeach() +endfunction() diff --git a/CppcheckTargets.cmake b/CppcheckTargets.cmake new file mode 100644 index 0000000..f753105 --- /dev/null +++ b/CppcheckTargets.cmake @@ -0,0 +1,213 @@ +# - Run cppcheck on c++ source files as a custom target and a test +# +# include(CppcheckTargets) +# add_cppcheck( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) - +# Create a target to check a target's sources with cppcheck and the indicated options +# add_cppcheck_sources( [UNUSED_FUNCTIONS] [STYLE] [POSSIBLE_ERROR] [FAIL_ON_WARNINGS]) - +# Create a target to check standalone sources with cppcheck and the indicated options +# +# Requires these CMake modules: +# Findcppcheck +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__add_cppcheck) + return() +endif() +set(__add_cppcheck YES) + +if(NOT CPPCHECK_FOUND) + find_package(cppcheck QUIET) +endif() + +if(CPPCHECK_FOUND) + if(NOT TARGET all_cppcheck) + add_custom_target(all_cppcheck) + set_target_properties(all_cppcheck PROPERTIES EXCLUDE_FROM_ALL TRUE) + endif() +endif() + +function(add_cppcheck_sources _targetname) + if(CPPCHECK_FOUND) + set(_cppcheck_args) + set(_input ${ARGN}) + list(FIND _input UNUSED_FUNCTIONS _unused_func) + if("${_unused_func}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_UNUSEDFUNC_ARG}) + list(REMOVE_AT _input ${_unused_func}) + endif() + + list(FIND _input STYLE _style) + if("${_style}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_STYLE_ARG}) + list(REMOVE_AT _input ${_style}) + endif() + + list(FIND _input POSSIBLE_ERROR _poss_err) + if("${_poss_err}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_POSSIBLEERROR_ARG}) + list(REMOVE_AT _input ${_poss_err}) + endif() + + list(FIND _input FAIL_ON_WARNINGS _fail_on_warn) + if("${_fail_on_warn}" GREATER "-1") + list(APPEND + CPPCHECK_FAIL_REGULAR_EXPRESSION + ${CPPCHECK_WARN_REGULAR_EXPRESSION}) + list(REMOVE_AT _input ${_fail_on_warn}) + endif() + + set(_files) + foreach(_source ${_input}) + get_source_file_property(_cppcheck_loc "${_source}" LOCATION) + if(_cppcheck_loc) + # This file has a source file property, carry on. + get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE) + if("${_cppcheck_lang}" MATCHES "CXX") + list(APPEND _files "${_cppcheck_loc}") + endif() + else() + # This file doesn't have source file properties - figure it out. + get_filename_component(_cppcheck_loc "${_source}" ABSOLUTE) + if(EXISTS "${_cppcheck_loc}") + list(APPEND _files "${_cppcheck_loc}") + else() + message(FATAL_ERROR + "Adding CPPCHECK for file target ${_targetname}: " + "File ${_source} does not exist or needs a corrected path location " + "since we think its absolute path is ${_cppcheck_loc}") + endif() + endif() + endforeach() + + if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") + # Older than CMake 2.8.0 + add_test(${_targetname}_cppcheck_test + "${CPPCHECK_EXECUTABLE}" + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files}) + else() + # CMake 2.8.0 and newer + add_test(NAME + ${_targetname}_cppcheck_test + COMMAND + "${CPPCHECK_EXECUTABLE}" + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files}) + endif() + + set_tests_properties(${_targetname}_cppcheck_test + PROPERTIES + FAIL_REGULAR_EXPRESSION + "${CPPCHECK_FAIL_REGULAR_EXPRESSION}") + + add_custom_command(TARGET + all_cppcheck + PRE_BUILD + COMMAND + ${CPPCHECK_EXECUTABLE} + ${CPPCHECK_QUIET_ARG} + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT + "${_targetname}_cppcheck: Running cppcheck on target ${_targetname}..." + VERBATIM) + endif() +endfunction() + +function(add_cppcheck _name) + if(NOT TARGET ${_name}) + message(FATAL_ERROR + "add_cppcheck given a target name that does not exist: '${_name}' !") + endif() + if(CPPCHECK_FOUND) + set(_cppcheck_args) + + list(FIND ARGN UNUSED_FUNCTIONS _unused_func) + if("${_unused_func}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_UNUSEDFUNC_ARG}) + endif() + + list(FIND ARGN STYLE _style) + if("${_style}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_STYLE_ARG}) + endif() + + list(FIND ARGN POSSIBLE_ERROR _poss_err) + if("${_poss_err}" GREATER "-1") + list(APPEND _cppcheck_args ${CPPCHECK_POSSIBLEERROR_ARG}) + endif() + + list(FIND _input FAIL_ON_WARNINGS _fail_on_warn) + if("${_fail_on_warn}" GREATER "-1") + list(APPEND + CPPCHECK_FAIL_REGULAR_EXPRESSION + ${CPPCHECK_WARN_REGULAR_EXPRESSION}) + list(REMOVE_AT _input ${_unused_func}) + endif() + + get_target_property(_cppcheck_sources "${_name}" SOURCES) + set(_files) + foreach(_source ${_cppcheck_sources}) + get_source_file_property(_cppcheck_lang "${_source}" LANGUAGE) + get_source_file_property(_cppcheck_loc "${_source}" LOCATION) + if("${_cppcheck_lang}" MATCHES "CXX") + list(APPEND _files "${_cppcheck_loc}") + endif() + endforeach() + + if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") + # Older than CMake 2.8.0 + add_test(${_name}_cppcheck_test + "${CPPCHECK_EXECUTABLE}" + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files}) + else() + # CMake 2.8.0 and newer + add_test(NAME + ${_name}_cppcheck_test + COMMAND + "${CPPCHECK_EXECUTABLE}" + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files}) + endif() + + set_tests_properties(${_name}_cppcheck_test + PROPERTIES + FAIL_REGULAR_EXPRESSION + "${CPPCHECK_FAIL_REGULAR_EXPRESSION}") + + add_custom_command(TARGET + all_cppcheck + PRE_BUILD + COMMAND + ${CPPCHECK_EXECUTABLE} + ${CPPCHECK_QUIET_ARG} + ${CPPCHECK_TEMPLATE_ARG} + ${_cppcheck_args} + ${_files} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT + "${_name}_cppcheck: Running cppcheck on target ${_name}..." + VERBATIM) + endif() + +endfunction() diff --git a/CreateDashboardScripts.cmake b/CreateDashboardScripts.cmake new file mode 100644 index 0000000..44abb65 --- /dev/null +++ b/CreateDashboardScripts.cmake @@ -0,0 +1,190 @@ +# - Create ctest -S scripts to use to run dashboard builds +# +# include(CreateDashboardScripts) +# create_dashboard_scripts([]) +# +# If you need additional settings to persist from the "parent" CMake instance +# to the initial cache created by the dashboard script, +# you may pass a filename which will be configured into the initial cache. +# +# In the resulting DASHBOARDSCRIPT_BASE_DIRECTORY, an end-user +# may optionally create a file named +# CustomInitialCache.${DASHBOARDSCRIPT_SCRIPT_NAME} +# (by default, CustomInitialCache.go.cmake) containing set commands that use +# the CACHE option, to set up additional site-local cache variable values. +# +# Requires these CMake modules: +# GetCompilerInfoString +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# Only do any of the prep work if not already in a dashboard script +if(NOT IN_DASHBOARD_SCRIPT) + + # Hide a CTest variable + mark_as_advanced(DART_TESTING_TIMEOUT) + + include(GetCompilerInfoString) + + get_compiler_info_string(_COMPILERID) + + # We must run the following at "include" time, not at function call time, + # to find the path to this module rather than the path to a calling list file + get_filename_component(_dashboardmoddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) + + if(NOT "$ENV{USER}" MATCHES "^$") + set(_user "$ENV{USER}") + elseif(NOT "$ENV{USERNAME}" MATCHES "^$") + set(_user "$ENV{USERNAME}") + endif() + + if(NOT _dashboardscript_machine) + if(NOT SITE) + site_name(SITE) + endif() + set(_dashboardscript_machine "${SITE}" CACHE INTERNAL "") + set(SITE + "${_user}@${_dashboardscript_machine}" + CACHE + STRING + "Human-readable site name" + FORCE) + endif() + + set(DASHBOARDSCRIPT_BASE_DIRECTORY + "${CMAKE_BINARY_DIR}/Dashboards-${_dashboardscript_machine}-${_user}" + CACHE + PATH + "Directory to use as the root of all dashboard work") + mark_as_advanced(DASHBOARDSCRIPT_BASE_DIRECTORY) + + set(DASHBOARDSCRIPT_SOURCE_DIRECTORY "${CMAKE_SOURCE_DIR}") + + set(BUILDNAME + "${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${_COMPILERID}" + CACHE + STRING + "Human-readable build ID info") + + set(DASHBOARDSCRIPT_CMAKE_COMMAND + "${CMAKE_COMMAND}" + CACHE + FILEPATH + "The cmake binary to use when configuring a dashboard build") + mark_as_advanced(DASHBOARDSCRIPT_CMAKE_COMMAND) + + # Try to find CTest, preferably right next to the chosen CMake + if(DASHBOARDSCRIPT_CMAKE_COMMAND) + get_filename_component(_cmake_dir + ${DASHBOARDSCRIPT_CMAKE_COMMAND} + PATH) + else() + get_filename_component(_cmake_dir ${CMAKE_COMMAND} PATH) + endif() + find_program(DASHBOARDSCRIPT_CTEST_EXECUTABLE + NAMES + ctest + HINTS + "${_cmake_dir}" + NO_DEFAULT_PATH) + find_program(DASHBOARDSCRIPT_CTEST_EXECUTABLE + NAMES + ctest + HINTS + "${_cmake_dir}") + + + set(DASHBOARDSCRIPT_CTEST_EXECUTABLE + "${DASHBOARDSCRIPT_CTEST_EXECUTABLE}" + CACHE + FILEPATH + "Path to the CTest executable to use for dashboard builds.") + mark_as_advanced(DASHBOARDSCRIPT_CTEST_EXECUTABLE) + + + # Optionals + + if(NOT "1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") + if(IS_DIRECTORY "${CMAKE_SOURCE_DIRECTORY}/.git") + find_program(DASHBOARDSCRIPT_GIT_EXECUTABLE NAMES git) + if(DASHBOARDSCRIPT_GIT_EXECUTABLE) + + set(UPDATE_TYPE "git") + set(UPDATE_COMMAND "${DASHBOARDSCRIPT_GIT_EXECUTABLE}") + set(UPDATE_OPTIONS "") + mark_as_advanced(DASHBOARDSCRIPT_GIT_EXECUTABLE) + endif() + endif() + endif() + +else() + # IN_DASHBOARD_SCRIPT is YES + message(STATUS + "CreateDashboardScripts detected that we're in a dashboard script already.") +endif() + +function(create_dashboard_scripts) + # Only create the script if we have all the required variables + # and are not already in it, and are at least 2.8.0. + if(DASHBOARDSCRIPT_BASE_DIRECTORY AND + DASHBOARDSCRIPT_SOURCE_DIRECTORY AND + DASHBOARDSCRIPT_BASE_DIRECTORY AND + BUILDNAME AND + DASHBOARDSCRIPT_CMAKE_COMMAND AND + DASHBOARDSCRIPT_CTEST_EXECUTABLE AND + NOT IN_DASHBOARD_SCRIPT AND + NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.0") + + set(_Continuous_cron "15 * * * * ") + set(_Nightly_cron "15 0 * * * ") + set(_Experimental_cron + "\nor run this command for an one-off experimental test build:\n") + set(_Experimental_flags "-VV") + + message(STATUS + "Dashboard scripts have been generated for automatic nightly and continuous builds.") + if(WIN32) + set(_Continuous_cron) + set(_Nightly_cron) + message(STATUS + "You can set up scheduled tasks to run these command lines:") + else() + message(STATUS "You can add these sample lines to your crontab:") + endif() + + set(_msg) + + foreach(DASHBOARDSCRIPT_DASH_TYPE Nightly Continuous Experimental) + # If given a cache template, configure it + if(ARGN) + configure_file(${ARGN} + "${DASHBOARDSCRIPT_BASE_DIRECTORY}/GeneratedInitialCache.run${DASHBOARDSCRIPT_DASH_TYPE}.cmake" + @ONLY) + endif() + + # Actually create the script file + configure_file(${_dashboardmoddir}/DashboardScript.cmake.in + "${DASHBOARDSCRIPT_BASE_DIRECTORY}/run${DASHBOARDSCRIPT_DASH_TYPE}.cmake" + @ONLY) + + set(_msg + "${_msg}\n${_${DASHBOARDSCRIPT_DASH_TYPE}_cron}\"${DASHBOARDSCRIPT_CTEST_EXECUTABLE}\" -S \"${DASHBOARDSCRIPT_BASE_DIRECTORY}/run${DASHBOARDSCRIPT_DASH_TYPE}.cmake\" ${_${DASHBOARDSCRIPT_DASH_TYPE}_flags}") + + endforeach() + message(STATUS "\n${_msg}\n") + message(STATUS "") + + endif() +endfunction() diff --git a/CreateImportedTarget.cmake b/CreateImportedTarget.cmake new file mode 100644 index 0000000..9728ba5 --- /dev/null +++ b/CreateImportedTarget.cmake @@ -0,0 +1,64 @@ +# - A smarter replacement for list(REMOVE_DUPLICATES) for library lists +# +# create_imported_target( [SHARED|STATIC|MODULE] [...]) - where +# ${libname}_LIBRARIES is set to this library's paths. +# +# Removes duplicates from the list then sorts while preserving "optimized", +# "debug", and "general" labeling +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__create_imported_target) + return() +endif() +set(__create_imported_target YES) + +function(create_imported_target _libname) + if(ARGN) + list(FIND ARGN SHARED _target_shared) + list(FIND ARGN STATIC _target_static) + list(FIND ARGN MODULE _target_module) + + if(${_target_shared} GREATER -1) + set(_target_type SHARED) + elseif(${_target_static} GREATER -1) + set(_target_type STATIC) + elseif(${_target_module} GREATER -1) + set(_target_type MODULE) + else() + set(_target_type UNKNOWN) + endif() + + set(_deps ${ARGN}) + list(REMOVE_ITEM _deps SHARED STATIC MODULE UNKNOWN) + else() + set(_target_type UNKNOWN) + set(_deps) + endif() + + if(${_libname}_LIBRARIES AND NOT TARGET ${_libname}_imported) + add_library(${_libname}_imported ${_target_type} IMPORTED) + #message(STATUS "Library ${_libname}: lib ${${_libname}_LIBRARIES}") + #message(STATUS "Deps: ${_deps}") + set_target_properties(${_libname}_imported + PROPERTIES + IMPORTED_LOCATION + "${${_libname}_LIBRARIES}" + IMPORTED_LINK_INTERFACE_LIBRARIES + "${_deps}") + endif() + + if(TARGET ${_libname}_imported) + set(${_libname}_LIBRARIES ${_libname}_imported PARENT_SCOPE) + endif() +endfunction() diff --git a/CreateLaunchers.cmake b/CreateLaunchers.cmake new file mode 100644 index 0000000..8cbb624 --- /dev/null +++ b/CreateLaunchers.cmake @@ -0,0 +1,304 @@ +# - Create launchers to set working directory, env. vars, etc. +# +# include(CreateLaunchers) - to make these available +# guess_runtime_library_dirs( [ ...]) +# create_default_target_launcher( +# [ARGS ] +# [FORWARD_ARGS] +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# +# create_target_launcher( +# [ARGS ] +# [FORWARD_ARGS] +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# +# create_generic_launcher( +# [RUNTIME_LIBRARY_DIRS ] +# [WORKING_DIRECTORY ] +# [ENVIRONMENT [...]]) +# - sets GENERIC_LAUNCHER_COMMAND amd GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION +# +# Requires these CMake modules: +# ListFilter +# ProgramFilesGlob +# CleanDirectoryList +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__create_launchers) + return() +endif() +set(__create_launchers YES) + +include(CleanDirectoryList) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_launchermoddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) +set(_launchermoddir "${_launchermoddir}/launcher-templates") + +macro(_launcher_system_settings) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(BITS 64) + else() + set(BITS 32) + endif() + + if(WIN32) + # Find user and system name + set(SYSTEM_NAME $ENV{USERDOMAIN}) + set(USER_NAME $ENV{USERNAME}) + + if(MSVC100) + set(USERFILE_VC_VERSION 10.00) + elseif(MSVC90) + set(USERFILE_VC_VERSION 9.00) + elseif(MSVC80) + set(USERFILE_VC_VERSION 8.00) + elseif(MSVC71) + set(USERFILE_VC_VERSION 7.10) + endif() + + set(USERFILE_PLATFORM Win${BITS}) + set(_pathdelim ";") + set(_suffix "cmd") + else() + set(_pathdelim ":") + set(USERFILE_PLATFORM ${CMAKE_SYSTEM_NAME}${BITS}) + set(_suffix "sh") + endif() + + if(WIN32 AND NOT USERFILE_REMOTE_MACHINE) + site_name(USERFILE_REMOTE_MACHINE) + mark_as_advanced(USERFILE_REMOTE_MACHINE) + endif() +endmacro() + +macro(_launcher_process_args) + set(_nowhere) + set(_curdest _nowhere) + set(_val_args + ARGS + RUNTIME_LIBRARY_DIRS + WORKING_DIRECTORY + ENVIRONMENT) + set(_bool_args FORWARD_ARGS) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR + "Syntax error in use of a function in CreateLaunchers!") + endif() + + # Turn into a list of native paths + set(_runtime_lib_dirs) + foreach(_dlldir ${RUNTIME_LIBRARY_DIRS}) + file(TO_NATIVE_PATH "${_dlldir}" _path) + set(_runtime_lib_dirs "${_runtime_lib_dirs}${_path}${_pathdelim}") + endforeach() + + if(NOT WORKING_DIRECTORY) + set(WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + endif() + + if(FORWARD_ARGS) + if(WIN32) + set(FWD_ARGS %*) + else() + set(FWD_ARGS $*) + endif() + else() + set(FWD_ARGS) + endif() + + set(USERFILE_WORKING_DIRECTORY "${WORKING_DIRECTORY}") + set(USERFILE_COMMAND_ARGUMENTS "${ARGS}") + set(LAUNCHERSCRIPT_COMMAND_ARGUMENTS "${ARGS} ${FWD_ARGS}") + + if(WIN32) + set(RUNTIME_LIBRARIES_ENVIRONMENT "PATH=${_runtime_lib_dirs};%PATH%") + file(READ + "${_launchermoddir}/launcher.env.cmd.in" + _cmdenv) + else() + if(APPLE) + set(RUNTIME_LIBRARIES_ENVIRONMENT + "DYLD_LIBRARY_PATH=${_runtime_lib_dirs}:$DYLD_LIBRARY_PATH") + else() + set(RUNTIME_LIBRARIES_ENVIRONMENT + "LD_LIBRARY_PATH=${_runtime_lib_dirs}:$LD_LIBRARY_PATH") + endif() + file(READ + "${_launchermoddir}/launcher.env.sh.in" + _cmdenv) + endif() + set(USERFILE_ENVIRONMENT "${RUNTIME_LIBRARIES_ENVIRONMENT}") + + set(USERFILE_ENV_COMMANDS) + foreach(_arg "${RUNTIME_LIBRARIES_ENVIRONMENT}" ${ENVIRONMENT}) + string(CONFIGURE + "@USERFILE_ENVIRONMENT@ @_arg@" + USERFILE_ENVIRONMENT + @ONLY) + string(CONFIGURE + "@USERFILE_ENV_COMMANDS@${_cmdenv}" + USERFILE_ENV_COMMANDS + @ONLY) + endforeach() +endmacro() + +macro(_launcher_produce_vcproj_user) + if(MSVC) + file(READ + "${_launchermoddir}/perconfig.vcproj.user.in" + _perconfig) + set(USERFILE_CONFIGSECTIONS) + foreach(USERFILE_CONFIGNAME ${CMAKE_CONFIGURATION_TYPES}) + get_target_property(USERFILE_${USERFILE_CONFIGNAME}_COMMAND + ${_targetname} + LOCATION_${USERFILE_CONFIGNAME}) + file(TO_NATIVE_PATH + "${USERFILE_${USERFILE_CONFIGNAME}_COMMAND}" + USERFILE_${USERFILE_CONFIGNAME}_COMMAND) + string(CONFIGURE "${_perconfig}" _temp @ONLY ESCAPE_QUOTES) + string(CONFIGURE + "${USERFILE_CONFIGSECTIONS}${_temp}" + USERFILE_CONFIGSECTIONS + ESCAPE_QUOTES) + endforeach() + + + configure_file("${_launchermoddir}/vcproj.user.in" + ${VCPROJNAME}.vcproj.${SYSTEM_NAME}.${USER_NAME}.user + @ONLY) + endif() + +endmacro() + +macro(_launcher_create_target_launcher) + if(CMAKE_CONFIGURATION_TYPES) + # Multi-config generator - multiple launchers + foreach(_config ${CMAKE_CONFIGURATION_TYPES}) + set(USERFILE_COMMAND "${USERFILE_${_config}_COMMAND}") + configure_file("${_launchermoddir}/targetlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/launch-${_targetname}-${_config}.${_suffix}" + @ONLY) + endforeach() + else() + # Single-config generator - single launcher + get_target_property(USERFILE_COMMAND + ${_targetname} + LOCATION) + file(TO_NATIVE_PATH + "${USERFILE_COMMAND}" + USERFILE_COMMAND) + configure_file("${_launchermoddir}/targetlauncher.${_suffix}.in" + "${CMAKE_CURRENT_BINARY_DIR}/launch-${_targetname}.${_suffix}" + @ONLY) + endif() +endmacro() + +function(create_default_target_launcher _targetname) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + set(VCPROJNAME "${CMAKE_BINARY_DIR}/ALL_BUILD") + _launcher_produce_vcproj_user() + + set(VCPROJNAME "${CMAKE_CURRENT_BINARY_DIR}/${_targetname}") + _launcher_produce_vcproj_user() + + _launcher_create_target_launcher() +endfunction() + +function(create_target_launcher _targetname) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + set(VCPROJNAME "${CMAKE_CURRENT_BINARY_DIR}/${_targetname}") + _launcher_produce_vcproj_user() + + _launcher_create_target_launcher() +endfunction() + +function(create_generic_launcher _launchername) + _launcher_system_settings() + _launcher_process_args(${ARGN}) + + if(NOT IS_ABSOLUTE _launchername) + set(_launchername + "${CMAKE_CURRENT_BINARY_DIR}/${_launchername}.${_suffix}") + else() + set(_launchername "${_launchername}.${_suffix}") + endif() + if(WIN32) + set(GENERIC_LAUNCHER_COMMAND "${_launchername}" PARENT_SCOPE) + set(GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION) + else() + set(GENERIC_LAUNCHER_COMMAND sh "${_launchername}" PARENT_SCOPE) + set(GENERIC_LAUNCHER_FAIL_REGULAR_EXPRESSION + "Program terminated with signal") + endif() + + configure_file("${_launchermoddir}/genericlauncher.${_suffix}.in" + "${_launchername}" + @ONLY) +endfunction() + +function(guess_runtime_library_dirs _var) + # Start off with the link directories of the calling listfile's directory + get_directory_property(_libdirs LINK_DIRECTORIES) + + # Add additional libraries passed to the function + foreach(_lib ${ARGN}) + get_filename_component(_libdir "${_lib}" PATH) + list(APPEND _libdirs "${_libdir}") + endforeach() + + # Now, build a list of potential dll directories + set(_dlldirs) + foreach(_libdir ${_libdirs}) + # Add the libdir itself + list(APPEND _dlldirs "${_libdir}") + + # Look also in libdir/../bin since the dll might not be with the lib + get_filename_component(_libdir "${_libdir}/../bin" ABSOLUTE) + list(APPEND _dlldirs "${_libdir}") + endforeach() + + # Only keep the valid, unique directories + clean_directory_list(_dlldirs) + + # Return _dlldirs + set(${_var} "${_dlldirs}" PARENT_SCOPE) +endfunction() diff --git a/DashboardScript.cmake.in b/DashboardScript.cmake.in new file mode 100644 index 0000000..9c51898 --- /dev/null +++ b/DashboardScript.cmake.in @@ -0,0 +1,117 @@ +# - Dashboard driver script for use with ctest. +# +# Generated file processed by CreateDashboardScripts.cmake +# Run it like: +# ctest -S nameofthisfile +# with -V or -V -VV if you want more feedback. +# +# Generally you do not need to edit this file by hand! +# +# If this file isn't named DashboardScript.cmake.in and located +# in the same directory as CreateDashboardScripts.cmake, it has been +# auto-generated and will be overwritten every time CMake configures +# itself. (This may be every build!) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +cmake_minimum_required(VERSION 2.8 FATAL_ERROR) + +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_PROJECT_NAME "@PROJECT_NAME@") + +set(CTEST_DASHBOARD_ROOT "@DASHBOARDSCRIPT_BASE_DIRECTORY@") +set(CTEST_SOURCE_DIRECTORY "@DASHBOARDSCRIPT_SOURCE_DIRECTORY@") +set(DASH_TYPE "@DASHBOARDSCRIPT_DASH_TYPE@") +set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/build-${DASH_TYPE}") + +set(CTEST_NOTES_FILES + "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}" + "${CTEST_DASHBOARD_ROOT}/GeneratedCombinedCache.${CTEST_SCRIPT_NAME}") + +set(CTEST_BUILD_NAME "@BUILDNAME@") +set(CTEST_SITE "@SITE@") + +set(CTEST_USE_LAUNCHERS TRUE) + +set(CTEST_COMMAND "@DASHBOARDSCRIPT_CTEST_EXECUTABLE@") +set(CTEST_CMAKE_COMMAND "@DASHBOARDSCRIPT_CMAKE_COMMAND@") +set(CTEST_UPDATE_TYPE "@UPDATE_TYPE@") +set(CTEST_UPDATE_COMMAND "@UPDATE_COMMAND@") +set(CTEST_UPDATE_OPTIONS "@UPDATE_OPTIONS@") + + +# Avoid non-ascii characters in tool output. +set(ENV{LC_ALL} C) + +if(EXISTS "${CTEST_DASHBOARD_ROOT}/GeneratedInitialCache.${CTEST_SCRIPT_NAME}") + file(READ "${CTEST_DASHBOARD_ROOT}/GeneratedInitialCache.${CTEST_SCRIPT_NAME}" _initcache) +else() + set(_initcache) +endif() + +if(EXISTS "${CTEST_DASHBOARD_ROOT}/CustomInitialCache.cmake") + file(READ "${CTEST_DASHBOARD_ROOT}/CustomInitialCache.cmake" _customcache) + set(_initcache "${_initcache} +${_customcache}") +endif() +set(_initcache "# This file is automatically regenerated every dashboard build - +# Do not edit it directly! +# If you want to add initial cache values, you can create/modify +# the CustomInitialCache.cmake file in this directory. + +# Pretty typical settings to preseve from the generating cache +set(BUILD_TESTING ON CACHE BOOL docstring) +set(IN_DASHBOARD_SCRIPT ON CACHE BOOL docstring) +set(CTEST_USE_LAUNCHERS ON CACHE BOOL docstring) +set(CMAKE_PREFIX_PATH \"@CMAKE_PREFIX_PATH@\" CACHE STRING docstring) +set(CMAKE_BUILD_TYPE \"@CMAKE_BUILD_TYPE@\" CACHE STRING docstring) +set(CTEST_CONFIGURATION_TYPE \"@CMAKE_BUILD_TYPE@\" CACHE STRING docstring) + +# testing tool locations +# Saved here because the tools in the path might be outdated +set(CPPCHECK_EXECUTABLE \"@CPPCHECK_EXECUTABLE@\" CACHE FILEPATH docstring) +set(DOXYGEN_EXECUTABLE \"@DOXYGEN_EXECUTABLE@\" CACHE FILEPATH docstring) + +${_initcache}") + +file(WRITE "${CTEST_DASHBOARD_ROOT}/GeneratedCombinedCache.${CTEST_SCRIPT_NAME}" "${_initcache}") + +ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}") + +ctest_start(${DASH_TYPE}) + +if(CTEST_UPDATE_COMMAND AND NOT DASH_TYPE STREQUAL "Experimental") + ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res) +endif() + +# Only proceed if we updated a file or if we're not a continuous build +set(PROCEED NO) +if(res GREATER 0) + message(STATUS "One or more files were updated, so we will proceed to " + "and build") + set(PROCEED YES) +endif() + +if(NOT DASH_TYPE STREQUAL "Continuous") + message(STATUS "We are not a continuous dashboard, so continuing regardless " + "of whether any files were updated") + set(PROCEED YES) +endif() + +if(PROCEED) + ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res + OPTIONS "-C${CTEST_DASHBOARD_ROOT}/GeneratedCombinedCache.${CTEST_SCRIPT_NAME}") + if(${res} EQUAL 0) + # Only try to build if we could configure + ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) + + # Some tests, like cppcheck tests, don't depend on a successful build + ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) + endif() +endif() + +# Always submit results +ctest_submit(RETURN_VALUE res) diff --git a/DoxygenTargets.cmake b/DoxygenTargets.cmake new file mode 100644 index 0000000..1643083 --- /dev/null +++ b/DoxygenTargets.cmake @@ -0,0 +1,247 @@ +# - Run doxygen on source files as a custom target +# +# include(DoxygenTargets) +# add_doxygen( [OUTPUT_DIRECTORY ] +# [INSTALL_DESTINATION +# [INSTALL_COMPONENT ] +# [INSTALL_PDF_NAME ] ] +# [DOC_TARGET ] +# [PROJECT_NUMBER ] +# [NO_WARNINGS] +# [NO_PDF]) +# +# Requires these CMake modules: +# FindDoxygen +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__add_doxygen) + return() +endif() +set(__add_doxygen YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_doxygenmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +if(APPLE) + list(APPEND CMAKE_PREFIX_PATH "/usr/texbin") +endif() + +if(NOT DOXYGEN_FOUND) + find_package(Doxygen QUIET) +endif() + +set(DOXYGEN_LATEX "NO") +set(DOXYGEN_PDFLATEX "NO") +set(DOXYGEN_DOT "NO") + +if(DOXYGEN_DOT_EXECUTABLE) + set(DOXYGEN_DOT "YES") +endif() + +find_package(LATEX QUIET) +if(LATEX_COMPILER AND MAKEINDEX_COMPILER) + set(DOXYGEN_LATEX "YES") +endif() + +if(PDFLATEX_COMPILER) + set(DOXYGEN_PDFLATEX "YES") +endif() + + + +function(add_doxygen _doxyfile) + # parse arguments + set(WARNINGS YES) + set(_nowhere) + set(_curdest _nowhere) + set(_val_args + OUTPUT_DIRECTORY + DOC_TARGET + INSTALL_DESTINATION + INSTALL_COMPONENT + INSTALL_PDF_NAME + PROJECT_NUMBER) + set(_bool_args + NO_WARNINGS + NO_PDF) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR "Syntax error in use of add_doxygen!") + endif() + + if(NO_WARNINGS) + set(WARNINGS NO) + endif() + + if(NOT DOC_TARGET) + set(DOC_TARGET doc) + endif() + + if(NOT OUTPUT_DIRECTORY) + set(OUTPUT_DIRECTORY "docs-generated") + endif() + + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_DIRECTORY}") + + if(NOT INSTALL_PDF_NAME) + set(INSTALL_PDF_NAME "docs-generated.pdf") + endif() + + if(NOT PROJECT_NUMBER) + set(PROJECT_NUMBER "${CPACK_PACKAGE_VERSION}") + endif() + + if(DOXYGEN_FOUND) + if(NOT TARGET ${DOC_TARGET}) + + if(NOT IN_DASHBOARD_SCRIPT) + add_custom_target(${DOC_TARGET}) + set_target_properties(${DOC_TARGET} + PROPERTIES + EXCLUDE_FROM_ALL + TRUE) + set_target_properties(${DOC_TARGET} + PROPERTIES + EXCLUDE_FROM_DEFAULT_BUILD + TRUE) + else() + add_custom_target(${DOC_TARGET} ALL) + endif() + endif() + + if(NOT IS_ABSOLUTE "${OUTPUT_DIRECTORY}") + get_filename_component(OUTPUT_DIRECTORY + "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_DIRECTORY}" + ABSOLUTE) + endif() + + set_property(DIRECTORY + APPEND + PROPERTY + ADDITIONAL_MAKE_CLEAN_FILES + "${OUTPUT_DIRECTORY}/html" + "${OUTPUT_DIRECTORY}/latex") + + get_filename_component(_doxyfileabs "${_doxyfile}" ABSOLUTE) + get_filename_component(INCLUDE_FILE "${_doxyfileabs}" NAME) + get_filename_component(INCLUDE_PATH "${_doxyfileabs}" PATH) + + # Doesn't currently work on Windows, so don't bother + if(DOXYGEN_LATEX AND NOT NO_PDF AND NOT WIN32) + set(MAKE_PDF YES) + set(GENERATE_LATEX YES) + else() + set(MAKE_PDF NO) + set(GENERATE_LATEX NO) + endif() + + if(DOXYGEN_PDFLATEX AND MAKE_PDF) + set(USE_PDFLATEX YES) + else() + set(USE_PDFLATEX NO) + endif() + + if(DOXYGEN_DOT) + set(HAVE_DOT YES) + set(DOT_PATH ${DOXYGEN_DOT_PATH}) + else() + set(HAVE_DOT NO) + set(DOT_PATH) + endif() + + # See http://www.cmake.org/pipermail/cmake/2006-August/010786.html + # for info on this variable + if("${CMAKE_BUILD_TOOL}" MATCHES "(msdev|devenv)") + set(WARN_FORMAT "\"$file($line) : $text \"") + else() + set(WARN_FORMAT "\"$file:$line: $text \"") + endif() + + configure_file("${_doxygenmoddir}/DoxygenTargets.doxyfile.in" + "${CMAKE_CURRENT_BINARY_DIR}/${_doxyfile}.additional" + @ONLY) + + add_custom_command(TARGET + ${DOC_TARGET} + COMMAND + ${DOXYGEN_EXECUTABLE} + "${CMAKE_CURRENT_BINARY_DIR}/${_doxyfile}.additional" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + #MAIN_DEPENDENCY ${DOC_TARGET} + COMMENT + "Running Doxygen with configuration ${_doxyfile}..." + VERBATIM) + + if(MAKE_PDF) + add_custom_command(TARGET + ${DOC_TARGET} + POST_BUILD + COMMAND + ${CMAKE_MAKE_PROGRAM} + WORKING_DIRECTORY + "${OUTPUT_DIRECTORY}/latex" + COMMENT + "Generating PDF using PDFLaTeX..." + VERBATIM) + endif() + + if(INSTALL_DESTINATION) + if(INSTALL_COMPONENT) + install(DIRECTORY + "${OUTPUT_DIRECTORY}/html" + DESTINATION + "${INSTALL_DESTINATION}" + COMPONENT + "${INSTALL_COMPONENT}" + OPTIONAL) + if(MAKE_PDF) + install(FILES "${OUTPUT_DIRECTORY}/latex/refman.pdf" + DESTINATION "${INSTALL_DESTINATION}" + COMPONENT "${INSTALL_COMPONENT}" + RENAME "${INSTALL_PDF_NAME}" + OPTIONAL) + endif() + + else() + install(DIRECTORY + "${OUTPUT_DIRECTORY}/html" + DESTINATION + "${INSTALL_DESTINATION}") + if(MAKE_PDF) + install(FILES "${OUTPUT_DIRECTORY}/latex/refman.pdf" + DESTINATION "${INSTALL_DESTINATION}" + RENAME "${INSTALL_PDF_NAME}") + endif() + endif() + endif() + + endif() +endfunction() diff --git a/DoxygenTargets.doxyfile.in b/DoxygenTargets.doxyfile.in new file mode 100644 index 0000000..e08f56e --- /dev/null +++ b/DoxygenTargets.doxyfile.in @@ -0,0 +1,18 @@ +@INCLUDE_PATH = "@INCLUDE_PATH@" +@INCLUDE = "@INCLUDE_FILE@" + +OUTPUT_DIRECTORY = "@OUTPUT_DIRECTORY@" +GENERATE_LATEX = "@GENERATE_LATEX@" +USE_PDFLATEX = @USE_PDFLATEX@ +HAVE_DOT = @HAVE_DOT@ +DOT_PATH = "@DOT_PATH@" +LATEX_CMD_NAME = "@LATEX_COMPILER@" +MAKEINDEX_CMD_NAME = "@MAKEINDEX_COMPILER@" + +WARNINGS = @WARNINGS@ +WARN_FORMAT = @WARN_FORMAT@ + +PROJECT_NUMBER = @PROJECT_NUMBER@ + +LATEX_BATCHMODE = YES +QUIET = YES diff --git a/EnableExtraCompilerWarnings.cmake b/EnableExtraCompilerWarnings.cmake new file mode 100644 index 0000000..c670bd9 --- /dev/null +++ b/EnableExtraCompilerWarnings.cmake @@ -0,0 +1,62 @@ +# - Add flags to compile with extra warnings +# +# enable_extra_compiler_warnings() +# globally_enable_extra_compiler_warnings() - to modify CMAKE_CXX_FLAGS, etc +# to change for all targets declared after the command, instead of per-command +# +# +# Original Author: +# 2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__enable_extra_compiler_warnings) + return() +endif() +set(__enable_extra_compiler_warnings YES) + +macro(_enable_extra_compiler_warnings_flags) + set(_flags) + if(MSVC) + option(COMPILER_WARNINGS_EXTREME + "Use compiler warnings that are probably overkill." + off) + mark_as_advanced(COMPILER_WARNINGS_EXTREME) + set(_flags "/W4") + if(COMPILER_WARNINGS_EXTREME) + set(_flags "${_flags} /Wall /wd4619 /wd4668 /wd4820 /wd4571 /wd4710") + endif() + elseif(CMAKE_COMPILER_IS_GNUCXX) + set(_flags "-W -Wall") + endif() +endmacro() + +function(enable_extra_compiler_warnings _target) + _enable_extra_compiler_warnings_flags() + get_target_property(_origflags ${_target} COMPILE_FLAGS) + if(_origflags) + set_property(TARGET + ${_target} + PROPERTY + COMPILE_FLAGS + "${_flags} ${_origflags}") + else() + set_property(TARGET + ${_target} + PROPERTY + COMPILE_FLAGS + "${_flags}") + endif() + +endfunction() + +function(globally_enable_extra_compiler_warnings) + _enable_extra_compiler_warnings_flags() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" PARENT_SCOPE) +endfunction() diff --git a/EnableProfiling.cmake b/EnableProfiling.cmake new file mode 100644 index 0000000..65ac4b2 --- /dev/null +++ b/EnableProfiling.cmake @@ -0,0 +1,56 @@ +# - Add flags to compile with profiling support - currently only for GCC +# +# enable_profiling() +# globally_enable_profiling() - to modify CMAKE_CXX_FLAGS, etc +# to change for all targets declared after the command, instead of per-command +# +# +# Original Author: +# 2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__enable_profiling) + return() +endif() +set(__enable_profiling YES) + +macro(_enable_profiling_flags) + set(_flags) + if(MSVC) + # TODO: what kind of flags are needed to profile on MSVC? + #set(_flags /W4) + elseif(CMAKE_COMPILER_IS_GNUCXX) + set(_flags "-p") + endif() +endmacro() + +function(enable_profiling _target) + _enable_profiling_flags() + get_target_property(_origflags ${_target} COMPILE_FLAGS) + if(_origflags) + set_property(TARGET + ${_target} + PROPERTY + COMPILE_FLAGS + "${_flags} ${_origflags}") + else() + set_property(TARGET + ${_target} + PROPERTY + COMPILE_FLAGS + "${_flags}") + endif() + +endfunction() + +function(globally_enable_profiling) + _enable_profiling_flags() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" PARENT_SCOPE) +endfunction() diff --git a/FindALUT.cmake b/FindALUT.cmake new file mode 100644 index 0000000..ed5d9ae --- /dev/null +++ b/FindALUT.cmake @@ -0,0 +1,136 @@ +# - try to find the OpenAL ALUT library +# +# Users may optionally supply: +# ALUT_ROOT_DIR - a prefix to start searching. +# +# Cache Variables: (probably not for direct use in your scripts) +# ALUT_INCLUDE_DIR +# ALUT_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# ALUT_FOUND +# ALUT_INCLUDE_DIRS +# ALUT_LIBRARIES +# ALUT_WORKAROUND_INCLUDE_DIRS - add these to your include path with +# include_directories(${ALUT_WORKAROUND_INCLUDE_DIRS} ${ALUT_INCLUDE_DIRS}) +# so you can always #include and #include even on +# Mac where the paths might differ. +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(ALUT_ROOT_DIR + "${ALUT_ROOT_DIR}" + CACHE + PATH + "Path to search for ALUT library") + +# Share search paths with OpenAL +if(NOT "$ENV{OPENALDIR}" STREQUAL "") + if(NOT ALUT_ROOT_DIR) + set(ALUT_ROOT_DIR "$ENV{OPENALDIR}") + endif() +else() + if(ALUT_ROOT_DIR) + set(ENV{OPENALDIR} "${ALUT_ROOT_DIR}") + endif() +endif() + + + +### +# Configure ALUT +### +find_path(ALUT_INCLUDE_DIR + NAMES + alut.h + HINTS + "${ALUT_ROOT_DIR}" + PATH_SUFFIXES + AL + alut + OpenAL + include + include/alut + include/freealut + include/AL + include/OpenAL + PATHS + /usr/local + /opt/local + /sw) +mark_as_advanced(ALUT_INCLUDE_DIR) + +find_library(ALUT_LIBRARY + NAMES + alut + HINTS + "${ALUT_ROOT_DIR}" + PATH_SUFFIXES + lib + lib64 + PATHS + /usr/local + /opt/local + /sw) +mark_as_advanced(ALUT_LIBRARY) + +### +# Prereq: OpenAL +### + +# On Mac OS X, the ALUT headers were in the OpenAL framework until 10.4.7 +# If we found ALUT headers elsewhere, it's probably freealut which may +# define the same symbols as the library in the framework (?) +# so we might want to save/restore the CMake variable that controls searching +# in frameworks +find_package(OpenAL QUIET) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ALUT + DEFAULT_MSG + ALUT_LIBRARY + ALUT_INCLUDE_DIR + OPENAL_FOUND) + +if(ALUT_FOUND) + set(ALUT_INCLUDE_DIRS "${OPENAL_INCLUDE_DIR}" "${ALUT_INCLUDE_DIR}") + set(ALUT_LIBRARIES "${OPENAL_LIBRARY}" ${ALUT_LIBRARY}) + if(APPLE) + get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) + if("${OPENAL_INCLUDE_DIR}" MATCHES "\\.framework$") + # OpenAL is in a framework - need a workaround + set(OPENAL_WORKAROUND_INCLUDE_DIR + "${_moddir}/workarounds/mac-openal") + list(APPEND + ALUT_WORKAROUND_INCLUDE_DIRS + "${OPENAL_WORKAROUND_INCLUDE_DIR}") + endif() + if("${ALUT_INCLUDE_DIR}" MATCHES "\\.framework$") + # ALUT is in the OpenAL framework - need a workaround + set(ALUT_WORKAROUND_INCLUDE_DIR + "${_moddir}/workarounds/mac-alut-framework") + list(APPEND + ALUT_WORKAROUND_INCLUDE_DIRS + "${ALUT_WORKAROUND_INCLUDE_DIR}") + endif() + endif() + + if("${ALUT_INCLUDE_DIR}" MATCHES "AL$") + get_filename_component(_parent "${ALUT_INCLUDE_DIR}/.." ABSOLUTE) + list(APPEND ALUT_INCLUDE_DIRS "${_parent}") + endif() + mark_as_advanced(ALUT_ROOT_DIR) +endif() diff --git a/FindCPPDOM.cmake b/FindCPPDOM.cmake new file mode 100644 index 0000000..b262166 --- /dev/null +++ b/FindCPPDOM.cmake @@ -0,0 +1,172 @@ +# - try to find CPPDOM library +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# CPPDOM_LIBRARY_DIR, library search path +# CPPDOM_INCLUDE_DIR, include search path +# CPPDOM_LIBRARY, the library to link against +# CPPDOM_CXX_FLAGS +# CPPDOM_FOUND, If false, do not try to use this library. +# +# Useful configuration variables you might want to add to your cache: +# CPPDOM_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# CPPDOM_ADDITIONAL_VERSIONS - Additional versions (outside of 0.7.8 to 1.0.0) +# to use when constructing search names and paths +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# VR Juggler requires this package, so this Find script takes that into +# account when determining where to search for the desired files. +# The VJ_BASE_DIR environment variable is searched (preferentially) +# when searching for this package, so most sane VR Juggler build environments +# should "just work." Note that you need to manually re-run CMake if you +# change this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(_HUMAN "cppdom") +set(_HEADER cppdom/cppdom.h) +set(_FP_PKG_NAME cppdom) + +set(CPPDOM_VERSIONS + ${CPPDOM_ADDITIONAL_VERSIONS} + 1.1.2 + 1.1.1 + 1.1.0 + 1.0.3 + 1.0.2 + 1.0.1 + 1.0.0 + 0.7.10 + 0.7.9 + 0.7.8) +set(CPPDOM_DIRS) +set(CPPDOM_RELEASE_LIB_NAMES) +set(CPPDOM_DEBUG_LIB_NAMES) +foreach(_version ${CPPDOM_VERSIONS}) + string(REGEX REPLACE "[-\\.]" "_" _versionclean ${_version}) + list(APPEND CPPDOM_DIRS cppdom-${_version}) + list(APPEND CPPDOM_HEADER_DIRS include/cppdom-${_version}) + list(APPEND CPPDOM_RELEASE_LIB_NAMES cppdom-${_versionclean}) + list(APPEND CPPDOM_DEBUG_LIB_NAMES cppdom_d-${_versionclean}) +endforeach() + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(CPPDOM_INCLUDE_DIRS AND CPPDOM_LIBRARIES) + # in cache already + set(CPPDOM_FIND_QUIETLY TRUE) +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_names(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(CPPDOM_ROOT_DIR + "${CPPDOM_ROOT_DIR}" + CACHE + PATH + "Root directory to search for CPPDOM") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(CPPDOM_ROOT_DIR) +endif() +if(NOT CPPDOM_ROOT_DIR) + set(CPPDOM_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${CPPDOM_ROOT_DIR}") + +find_path(CPPDOM_INCLUDE_DIR + ${_HEADER} + HINTS + ${_ROOT_DIR} + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATHS + PATH_SUFFIXES + ${CPPDOM_DIRS} + ${CPPDOM_HEADER_DIRS} + include + DOC + "Path to ${_HUMAN} includes root") + +find_library(CPPDOM_LIBRARY_RELEASE + NAMES + ${CPPDOM_RELEASE_LIB_NAMES} + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_NAMES} + HINTS + ${_ROOT_DIR} + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} library full path") + +find_library(CPPDOM_LIBRARY_DEBUG + NAMES + ${CPPDOM_DEBUG_LIB_NAMES} + HINTS + ${_ROOT_DIR} + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +# Fallback to same library name but in the debug folder +if(NOT CPPDOM_LIBRARY_DEBUG) + find_library(CPPDOM_LIBRARY_DEBUG + NAMES + ${CPPDOM_LIB_NAMES} + HINTS + ${CPPDOM_INCLUDE_DIR}/../ + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES_ONLY} + NO_DEFAULT_PATH + DOC + "${_HUMAN} debug library full path") +endif() + +if(CPPDOM_LIBRARY_RELEASE OR CPPDOM_LIBRARY_DEBUG) + select_library_configurations(CPPDOM) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CPPDOM + DEFAULT_MSG + CPPDOM_LIBRARY + CPPDOM_INCLUDE_DIR) + +if(CPPDOM_FOUND) + set(CPPDOM_INCLUDE_DIRS ${CPPDOM_INCLUDE_DIR}) + if(MSVC) + set(CPPDOM_CXX_FLAGS "/wd4290") + endif() + + mark_as_advanced(CPPDOM_ROOT_DIR) +endif() + +mark_as_advanced(CPPDOM_LIBRARY_RELEASE + CPPDOM_LIBRARY_DEBUG + CPPDOM_INCLUDE_DIR) diff --git a/FindDCubed.cmake b/FindDCubed.cmake new file mode 100644 index 0000000..d50a483 --- /dev/null +++ b/FindDCubed.cmake @@ -0,0 +1,146 @@ +# - try to find DCUBED library +# +# DCUBED_LIBRARY_DIR, library search path +# DCUBED_INCLUDE_DIR, include search path +# DCUBED_{component}_LIBRARY, the library to link against +# DCUBED_ENVIRONMENT +# DCUBED_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# DCUBED_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(NOT BITS) + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(BITS 64) + else() + set(BITS 32) + endif() +endif() + +if(WIN32 AND MSVC) + include(CMakeDetermineVSServicePack) + determinevsservicepack(_sp) + if(MSVC71) + set(VC_VER vc71) + set(VC_VER_LONG vc71) + elseif(MSVC80) + set(VC_VER vc8) + set(VC_VER_LONG vc80) + # FIXME TODO provide more options here + set(D3BUILD nt8) + if("${_sp}" STREQUAL "vc80sp1") + set(_verstring nt8s1) + else() + set(_verstring nt8) + endif() + elseif(MSVC90) + set(VC_VER vc9) + set(VC_VER_LONG vc90) + set(_verstring nt9) + endif() + + if(BITS EQUAL 32) + set(PLATFORM win32) + else() + set(PLATFORM win64) + endif() +endif() + +if(NOT DCUBED_ROOT_DIR) + if(EXISTS "$ENV{DCUBED}" AND IS_DIRECTORY "$ENV{DCUBED}") + set(DCUBED_ROOT_DIR "$ENV{DCUBED}") + endif() +endif() + +file(TO_CMAKE_PATH "${DCUBED_ROOT_DIR}" DCUBED_ROOT_DIR) + +set(DCUBED_ROOT_DIR + "${DCUBED_ROOT_DIR}" + CACHE + PATH + "Root directory to search for DCubed") + +### +# Configure DCubed +### + + +find_path(DCUBED_CORE_INCLUDE_DIR + d3ew_inc/modelgate.hxx + PATHS + "${DCUBED_ROOT_DIR}/inc") + +foreach(lib aem cdmwp d3e_base d3e_cd dcm dcm3 g3) + find_library(DCUBED_${lib}_LIBRARY + ${lib} + PATHS + "${DCUBED_ROOT_DIR}/lib/${_verstring}") + list(APPEND DCUBED_LIBRARIES ${DCUBED_${lib}_LIBRARY}) + list(APPEND DCUBED_CORE_LIBRARIES ${DCUBED_${lib}_LIBRARY}) + mark_as_advanced(DCUBED_${lib}_LIBRARY) +endforeach() + +find_path(DCUBED_WRAPPER_INCLUDE_DIR + d3ew_p/p_utils.hxx + PATHS + "${DCUBED_ROOT_DIR}/source/wrapper_source/") + +foreach(lib d3ew_p d3ew_scene) + find_library(DCUBED_WRAPPER_${lib}_LIBRARY + ${lib}_${D3BUILD} + PATHS + "${DCUBED_ROOT_DIR}/wrappers/cdmwp/${lib}") + list(APPEND DCUBED_LIBRARIES ${DCUBED_WRAPPER_${lib}_LIBRARY}) + list(APPEND DCUBED_WRAPPER_LIBRARIES ${DCUBED_WRAPPER_${lib}_LIBRARY}) + mark_as_advanced(DCUBED_WRAPPER_${lib}_LIBRARY) +endforeach() + +list(APPEND DCUBED_LIBRARIES ${DCUBED_WRAPPER_LIBRARIES}) + +if(NOT DCUBED_ROOT_DIR) + get_filename_component(_path "${DCUBED_dcm_LIBRARY}" PATH) + get_filename_component(_path "${_path}/../.." ABSOLUTE) + set(DCUBED_ROOT_DIR + "${DCUBED_ROOT_DIR}" + CACHE + PATH + "Root directory to search for DCubed" + FORCE) +endif() + +#file(TO_NATIVE_PATH "${DCUBED_ROOT_DIR}" _d3envdir) +set(DCUBED_ENVIRONMENT "DCUBED=${DCUBED_ROOT_DIR}") + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(DCubed + DEFAULT_MSG + DCUBED_ROOT_DIR + DCUBED_LIBRARIES + DCUBED_CORE_LIBRARIES + DCUBED_CORE_INCLUDE_DIR + DCUBED_WRAPPER_INCLUDE_DIR + DCUBED_WRAPPER_LIBRARIES) + +if(DCUBED_FOUND) + set(DCUBED_INCLUDE_DIRS + "${DCUBED_CORE_INCLUDE_DIR}" + "${DCUBED_WRAPPER_INCLUDE_DIR}") + mark_as_advanced(DCUBED_ROOT_DIR) +endif() + +mark_as_advanced(DCUBED_CORE_INCLUDE_DIR DCUBED_WRAPPER_INCLUDE_DIR) diff --git a/FindFlagpoll.cmake b/FindFlagpoll.cmake new file mode 100644 index 0000000..cd83d16 --- /dev/null +++ b/FindFlagpoll.cmake @@ -0,0 +1,151 @@ +# - try to find Flagpoll application, and offer package-finding services +# FLAGPOLL, the executable: if not defined, do not try to use Flagpoll. +# +# Useful configuration variables you might want to add to your cache: +# FLAGPOLL_ROOT_DIR - A directory prefix to search for the app +# (a path that contains bin/ as a subdirectory) +# +# VR Juggler requires this package, so this Find script takes that into +# account when determining where to search for the desired files. +# The VJ_BASE_DIR environment variable is searched (preferentially) +# when searching for this package, so most sane VR Juggler build environments +# should "just work." Note that you need to manually re-run CMake if you +# change this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# You can use Flagpoll to provide directories to use as HINTS for find_* +# These are the provided macros: +# flagpoll_get_include_dirs +# flagpoll_get_library_dirs +# flagpoll_get_library_names +# flagpoll_get_extra_libs +# All take the name of the desired package, optionally NO_DEPS to pass --no-deps +# to Flagpoll, and return yourpkgname_FLAGPOLL_INCLUDE_DIRS(etc. for the other +# macros). +# +# Example usage: +# flagpoll_get_include_dirs(vpr NO_DEPS) +# find_path(VPR20_INCLUDE_DIRS vpr/vpr.h +# HINTS ${vpr_FLAGPOLL_INCLUDE_DIRS}) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +### +# Flagpoll detection +### +set(Flagpoll_FIND_QUIETLY true) +find_program(FLAGPOLL + NAMES + flagpoll + flagpoll.exe + PATHS + "${FLAGPOLL_ROOT_DIR}" + "${VRJUGGLER22_ROOT_DIR}" + PATH_SUFFIXES + bin) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Flagpoll DEFAULT_MSG FLAGPOLL) + +mark_as_advanced(FLAGPOLL) + +### +# Macro for internal use - shared workings between all the public macros below. +### +macro(_flagpoll_get_results _package _arg _flag _output) + if(FLAGPOLL) + + # If the CMakeLists that called the flagpoll macro passed NO_DEPS, + # we won't return the results for dependencies + if("${ARGN}" MATCHES "NO_DEPS") + set(_FLAGPOLL_NODEP "--no-deps") + else() + set(_FLAGPOLL_NODEP "") + endif() + + # Run flagpoll + execute_process(COMMAND + ${FLAGPOLL} + ${_package} + ${_arg} + ${_FLAGPOLL_NODEP} + OUTPUT_VARIABLE + _FLAGPOLL_OUTPUT + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(_FLAGPOLL_OUTPUT) + # Remove -I and /I(or equivalent for other flags + string(REGEX + REPLACE + "[-/]${_flag}" + "" + _FLAGPOLL_OUTPUT + ${_FLAGPOLL_OUTPUT}) + + # Remove extra spaces + string(REGEX REPLACE " +" " " _FLAGPOLL_OUTPUT ${_FLAGPOLL_OUTPUT}) + + # Make a CMake list, standardize paths, and append only what we want to our final list + separate_arguments(_FLAGPOLL_OUTPUT) + foreach(_RESULT ${_FLAGPOLL_OUTPUT}) + string(REGEX MATCH "^-" _BAD ${_RESULT}) + if(_RESULT AND NOT _BAD) + file(TO_CMAKE_PATH "${_RESULT}" _RESULT_CLEAN) + list(APPEND ${_output} ${_RESULT_CLEAN}) + endif() + endforeach() + endif() + + endif() +endmacro() + +### +# "Public" macros - to use flagpoll to give you HINTS directories when finding things +### +macro(flagpoll_get_include_dirs _package) + # Passing ARGN along so if they specified NO_DEPS we actually do it. + _flagpoll_get_results(${_package} + "--cflags-only-I" + I + ${_package}_FLAGPOLL_INCLUDE_DIRS + ${ARGN}) +endmacro() + +macro(flagpoll_get_library_dirs _package) + # Passing ARGN along so if they specified NO_DEPS we actually do it. + _flagpoll_get_results(${_package} + "--libs-only-L" + L + ${_package}_FLAGPOLL_LIBRARY_DIRS + ${ARGN}) +endmacro() + +macro(flagpoll_get_library_names _package) + # Passing ARGN along so if they specified NO_DEPS we actually do it. + _flagpoll_get_results(${_package} + "--libs-only-l" + l + ${_package}_FLAGPOLL_LIBRARY_NAMES + ${ARGN}) +endmacro() + +macro(flagpoll_get_extra_libs _package) + # Passing ARGN along so if they specified NO_DEPS we actually do it. + _flagpoll_get_results(${_package} + "--get-extra-libs" + l + ${_package}_FLAGPOLL_EXTRA_LIBS + ${ARGN}) +endmacro() diff --git a/FindGHOST.cmake b/FindGHOST.cmake new file mode 100644 index 0000000..9e66027 --- /dev/null +++ b/FindGHOST.cmake @@ -0,0 +1,86 @@ +# - try to find Sensable GHOST library and include files +# GHOST_INCLUDE_DIRS, where to find GL/glut.h, etc. +# GHOST_LIBRARIES, the libraries to link against +# GHOST_FOUND, If false, do not try to use GLUT. +# GHOST_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use. +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(GHOST_ROOT_DIR + "${GHOST_ROOT_DIR}" + CACHE + PATH + "Path to search for GHOST") + +set(_dirs) +if(WIN32) + include(ProgramFilesGlob) + program_files_fallback_glob(_dirs "/Sensable/GHOST/v*/") +endif() + +find_path(GHOST_INCLUDE_DIR + gstPHANToM.h + PATHS + ${_dirs} + HINTS + "${GHOST_ROOT_DIR}" + PATH_SUFFIXES + include) + +find_library(GHOST_LIBRARY + GHOST40 + PATHS + ${_dirs} + HINTS + "${GHOST_ROOT_DIR}" + PATH_SUFFIXES + lib) + +if(MSVC_VERSION GREATER 1300) + # .NET and newer: fake the STL headers + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + set(GHOST_STL_INCLUDE_DIR "${_moddir}/ghost-fake-stl") +else() + # 6.0 and earlier - use GHOST-provided STL + find_path(GHOST_STL_INCLUDE_DIR + vector.h + PATHS + ${_dirs} + HINTS + "${GHOST_ROOT_DIR}" + PATH_SUFFIXES + external/stl) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GHOST + DEFAULT_MSG + GHOST_LIBRARY + GHOST_STL_INCLUDE_DIR + GHOST_INCLUDE_DIR) + +if(GHOST_FOUND) + set(GHOST_LIBRARIES "${GHOST_LIBRARY}") + set(GHOST_INCLUDE_DIRS + "${GHOST_STL_INCLUDE_DIR}" + "${GHOST_INCLUDE_DIR}") + + mark_as_advanced(GHOST_ROOT_DIR) +endif() + +mark_as_advanced(GHOST_LIBRARY + GHOST_STL_INCLUDE_DIR + GHOST_INCLUDE_DIR) diff --git a/FindGLUI.cmake b/FindGLUI.cmake new file mode 100644 index 0000000..95a431e --- /dev/null +++ b/FindGLUI.cmake @@ -0,0 +1,136 @@ +# - Try to find GLUI (GL User Interface) +# Requires OpenGL and GLUT - searches for them using find_package +# Once done, this will define +# +# GLUI_INCLUDE_DIR, where to find GL/glui.h (or GLUI/glui.h on mac) +# GLUI_LIBRARY, the libraries to link against +# GLUI_FOUND, If false, do not try to use GLUI. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# GLUI_ROOT_DIR - A directory prefix to search +# (usually a path that contains include/ as a subdirectory) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(GLUI_FIND_QUIETLY) + find_package(OpenGL QUIET) + find_package(GLUT QUIET) +else() + find_package(OpenGL) + find_package(GLUT) +endif() + +if(OPENGL_FOUND AND GLUT_FOUND) + if(WIN32) + find_path(GLUI_INCLUDE_DIR + NAMES + GL/glui.h + PATHS + ${GLUI_ROOT_PATH}/include + DOC + "GLUI include directory") + find_library(GLUI_LIBRARY + NAMES + glui + ${GLUI_ROOT_DIR}/lib + ${GLUI_ROOT_DIR}/Release + HINTS + ${OPENGL_LIBRARY_DIR} + ${OPENGL_INCLUDE_DIR}/../lib + DOC + "GLUI library") + find_library(GLUI_DEBUG_LIBRARY + NAMES + glui32 + ${GLUI_ROOT_DIR}/lib + ${GLUI_ROOT_DIR}/Debug + HINTS + ${OPENGL_LIBRARY_DIR} + ${OPENGL_INCLUDE_DIR}/../lib + DOC + "GLUI debug library") + else() + find_library(GLUI_LIBRARY + NAMES + GLUI + glui + PATHS + ${GLUI_ROOT_DIR}/lib64 + ${GLUI_ROOT_DIR}/lib + ${GLUI_ROOT_DIR} + /usr/openwin/lib + HINTS + ${OPENGL_LIBRARY_DIR} + ${OPENGL_INCLUDE_DIR}/../lib64 + ${OPENGL_INCLUDE_DIR}/../lib + DOC + "GLUI library") + + if(APPLE) + find_path(GLUI_INCLUDE_DIR + GLUI/glui.h + HINTS + ${OPENGL_INCLUDE_DIR} + DOC + "GLUI include directory") + else() + find_path(GLUI_INCLUDE_DIR + GL/glui.h + PATHS + ${GLUI_ROOT_DIR}/include + /usr/include/GL + /usr/openwin/share/include + /usr/openwin/include + /opt/graphics/OpenGL/include + /opt/graphics/OpenGL/contrib/libglui + DOC + "GLUI include directory") + endif() + endif() +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLUI + DEFAULT_MSG + GLUI_INCLUDE_DIR + GLUI_LIBRARY + GLUT_FOUND + OPENGL_FOUND) + +if(GLUI_FOUND) + if(WIN32 AND GLUI_LIBRARY AND GLUI_DEBUG_LIBRARY) + set(GLUI_LIBRARIES + optimized + ${GLUI_LIBRARY} + debug + ${GLUI_DEBUG_LIBRARY} + ${GLUT_LIBRARIES} + ${OPENGL_LIBRARIES}) + else() + set(GLUI_LIBRARIES + ${GLUI_LIBRARY} + ${GLUT_LIBRARIES} + ${OPENGL_LIBRARIES}) + endif() + set(GLUI_INCLUDE_DIRS + ${GLUI_INCLUDE_DIR} + ${GLUT_INCLUDE_DIR} + ${OPENGL_INCLUDE_DIR}) +endif() + +if(GLUI_LIBRARY AND GLUI_INCLUDE_DIR) + mark_as_advanced(GLUI_INCLUDE_DIR GLUI_LIBRARY GLUI_DEBUG_LIBRARY) +endif() diff --git a/FindGLUT.cmake b/FindGLUT.cmake new file mode 100644 index 0000000..79486f0 --- /dev/null +++ b/FindGLUT.cmake @@ -0,0 +1,132 @@ +# - try to find glut library and include files +# GLUT_INCLUDE_DIRS, where to find GL/glut.h, etc. +# GLUT_LIBRARIES, the libraries to link against +# GLUT_FOUND, If false, do not try to use GLUT. +# GLUT_RUNTIME_LIBRARY_DIRS, path to DLL on Windows for runtime use. +# GLUT_RUNTIME_LIBRARY, dll on Windows, for installation purposes +# +# Also defined, but not for general use are: +# GLUT_INCLUDE_DIR, where to find GL/glut.h, etc. +# GLUT_glut_LIBRARY = the full path to the glut library. + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# Copyright 2009-2010 Iowa State University +# (Author: Ryan Pavlik ) +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +if(GLUT_FIND_QUIETLY) + find_package(OpenGL QUIET) +else() + find_package(OpenGL) +endif() + +if(OPENGL_FOUND) + get_filename_component(_ogl_libdir ${OPENGL_gl_LIBRARY} PATH) + find_path(GLUT_INCLUDE_DIR + NAMES + GL/glut.h + GLUT/glut.h + glut.h + PATHS + ${_ogl_libdir}/../include + ${GLUT_ROOT_PATH} + ${GLUT_ROOT_PATH}/include + /usr/include/GL + /usr/openwin/share/include + /usr/openwin/include + /opt/graphics/OpenGL/include + /opt/graphics/OpenGL/contrib/libglut) + + find_library(GLUT_glut_LIBRARY + NAMES + glut + glut32 + GLUT + freeglut + PATHS + ${_ogl_libdir} + ${GLUT_ROOT_PATH} + ${GLUT_ROOT_PATH}/Release + /usr/openwin/lib) + +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLUT + DEFAULT_MSG + GLUT_glut_LIBRARY + GLUT_INCLUDE_DIR + OPENGL_FOUND) + +if(GLUT_FOUND) + set(GLUT_LIBRARIES ${GLUT_glut_LIBRARY} ${OPENGL_LIBRARIES}) + set(GLUT_INCLUDE_DIRS ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}) + + if(WIN32) + get_filename_component(_basename "${GLUT_glut_LIBRARY}" NAME_WE) + get_filename_component(_libpath "${GLUT_glut_LIBRARY}" PATH) + find_path(GLUT_RUNTIME_LIBRARY + NAMES + ${_basename}.dll + glut.dll + glut32.dll + freeglut.dll + HINTS + ${_libpath} + ${_libpath}/../bin) + if(GLUT_RUNTIME_LIBRARY) + get_filename_component(GLUT_RUNTIME_LIBRARY_DIRS + "${GLUT_RUNTIME_LIBRARY}" + PATH) + else() + set(GLUT_RUNTIME_LIBRARY_DIRS) + endif() + endif() + + #The following deprecated settings are for backwards compatibility with CMake1.4 + set(GLUT_LIBRARY ${GLUT_LIBRARIES}) + set(GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR}) +endif() + +mark_as_advanced(GLUT_INCLUDE_DIR + GLUT_glut_LIBRARY + GLUT_RUNTIME_LIBRARY) diff --git a/FindGMTL.cmake b/FindGMTL.cmake new file mode 100644 index 0000000..b02ea8f --- /dev/null +++ b/FindGMTL.cmake @@ -0,0 +1,110 @@ +# - Try to find GMTL +# Optionally uses Flagpoll and FindFlagpoll.cmake +# Once done, this will define +# +# GMTL_FOUND - system has GMTL +# GMTL_INCLUDE_DIR - the GMTL include directory +# +# Useful configuration variables you might want to add to your cache: +# GMTL_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# GMTL_ADDITIONAL_VERSIONS - Additional versions (outside of 0.5.1 to 0.6.2) +# to use when constructing search names and paths +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# VR Juggler requires this package, so this Find script takes that into +# account when determining where to search for the desired files. +# The VJ_BASE_DIR environment variable is searched (preferentially) +# when searching for this package, so most sane VR Juggler build environments +# should "just work." Note that you need to manually re-run CMake if you +# change this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(_HUMAN "GMTL") +set(_HEADER gmtl/gmtl.h) +set(_FP_PKG_NAME gmtl) + +include(CheckVersion) + +set(GMTL_VERSIONS + ${GMTL_ADDITIONAL_VERSIONS} + 0.6.2 + 0.6.1 + 0.6.0 + 0.5.4 + 0.5.3 + 0.5.2 + 0.5.1) +set(GMTL_DIRS) +foreach(_version ${GMTL_VERSIONS}) + check_version(_ver_ok GMTL ${_version}) + if(_ver_ok) + list(APPEND GMTL_DIRS gmtl-${_version}) + list(APPEND GMTL_HEADER_DIRS include/gmtl-${_version}) + endif() +endforeach() + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanDirectoryList) + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME}) +endif() + +set(GMTL_ROOT_DIR + "${GMTL_ROOT_DIR}" + CACHE + PATH + "Root directory to search for GMTL") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(GMTL_ROOT_DIR) +endif() +if(NOT GMTL_ROOT_DIR) + set(GMTL_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${GMTL_ROOT_DIR}") + +# Include dir +find_path(GMTL_INCLUDE_DIR + NAMES + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATHS + PATH_SUFFIXES + ${GMTL_DIRS} + ${GMTL_HEADER_DIRS} + include/ + DOC + "GMTL include path") + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GMTL DEFAULT_MSG GMTL_INCLUDE_DIR) + +if(GMTL_FOUND) + set(GMTL_INCLUDE_DIRS "${GMTL_INCLUDE_DIR}") + mark_as_advanced(GMTL_ROOT_DIR) +endif() + +mark_as_advanced(GMTL_INCLUDE_DIR) diff --git a/FindGPM.cmake b/FindGPM.cmake new file mode 100644 index 0000000..37a2b61 --- /dev/null +++ b/FindGPM.cmake @@ -0,0 +1,43 @@ +# - try to find GPM library +# +# Cache Variables: (probably not for direct use in your scripts) +# GPM_INCLUDE_DIR +# GPM_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# GPM_FOUND +# GPM_INCLUDE_DIRS +# GPM_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +find_library(GPM_LIBRARY + NAMES gpm) + +find_path(GPM_INCLUDE_DIR + NAMES gpm.h) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GPM + DEFAULT_MSG + GPM_LIBRARY + GPM_INCLUDE_DIR) + +if(GPM_FOUND) + set(GPM_LIBRARIES "${GPM_LIBRARY}") + + set(GPM_INCLUDE_DIRS "${GPM_INCLUDE_DIR}") +endif() + +mark_as_advanced(GPM_INCLUDE_DIR GPM_LIBRARY) diff --git a/FindGadgeteer12.cmake b/FindGadgeteer12.cmake new file mode 100644 index 0000000..f6becd4 --- /dev/null +++ b/FindGadgeteer12.cmake @@ -0,0 +1,186 @@ +# - try to find Gadgeteer 1.2 library +# Requires JCCL 1.2 and VPR 2.0 (thus FindJCCL12.cmake and FindVPR20.cmake) +# Requires X11 if not on Mac or Windows. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# GADGETEER12_LIBRARY_DIR, library search path +# GADGETEER12_INCLUDE_DIR, include search path +# GADGETEER12_LIBRARY, the library to link against +# GADGETEER12_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# GADGETEER12_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(_HUMAN "Gadgeteer 1.2") +set(_RELEASE_NAMES gadget-1_2 libgadget-1_2) +set(_DEBUG_NAMES gadget_d-1_2 libgadget_d-1_2) +set(_DIR gadgeteer-1.2) +set(_HEADER gadget/gadgetConfig.h) +set(_FP_PKG_NAME gadgeteer) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(Gadgeteer12_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(GADGETEER12_ROOT_DIR + "${GADGETEER12_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Gadgeteer") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(GADGETEER12_ROOT_DIR) +endif() +if(NOT GADGETEER12_ROOT_DIR) + set(GADGETEER12_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${GADGETEER12_ROOT_DIR}") + +find_path(GADGETEER12_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(GADGETEER12_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(GADGETEER12_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(GADGETEER12) + +# Dependencies +foreach(package JCCL12 VPR20 GMTL) + if(NOT ${PACKAGE}_FOUND) + find_package(${package} ${_FIND_FLAGS}) + endif() +endforeach() + +if(UNIX AND NOT APPLE AND NOT WIN32) + # We need X11 if not on Mac or Windows + if(NOT X11_FOUND) + find_package(X11 ${_FIND_FLAGS}) + endif() + + set(_CHECK_EXTRAS + X11_FOUND + X11_X11_LIB + X11_ICE_LIB + X11_SM_LIB + X11_INCLUDE_DIR) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Gadgeteer12 + DEFAULT_MSG + GADGETEER12_LIBRARY + GADGETEER12_INCLUDE_DIR + JCCL12_FOUND + JCCL12_LIBRARIES + JCCL12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR + GMTL_FOUND + GMTL_INCLUDE_DIR + ${_CHECK_EXTRAS}) + +if(GADGETEER12_FOUND) + set(_DEPS ${JCCL12_LIBRARIES} ${VPR20_LIBRARIES}) + + set(GADGETEER12_INCLUDE_DIRS ${GADGETEER12_INCLUDE_DIR}) + list(APPEND + GADGETEER12_INCLUDE_DIRS + ${JCCL12_INCLUDE_DIRS} + ${VPR20_INCLUDE_DIRS} + ${GMTL_INCLUDE_DIRS}) + + if(UNIX AND NOT APPLE AND NOT WIN32) + # We need X11 if not on Mac or Windows + list(APPEND _DEPS ${X11_X11_LIB} ${X11_ICE_LIB} ${X11_SM_LIB}) + list(APPEND GADGETEER12_INCLUDE_DIRS ${X11_INCLUDE_DIR}) + endif() + + clean_directory_list(GADGETEER12_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(GADGETEER12 ${_DEPS}) + else() + clean_library_list(GADGETEER12_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(GADGETEER12_ROOT_DIR) +endif() + +mark_as_advanced(GADGETEER12_LIBRARY_RELEASE + GADGETEER12_LIBRARY_DEBUG + GADGETEER12_INCLUDE_DIR) diff --git a/FindGlove5DT.cmake b/FindGlove5DT.cmake new file mode 100644 index 0000000..46d79a9 --- /dev/null +++ b/FindGlove5DT.cmake @@ -0,0 +1,200 @@ +# - try to find Glove5DT libraries +# +# Cache Variables: (probably not for direct use in your scripts) +# GLOVE5DT_INCLUDE_DIR +# GLOVE5DT_LIBRARY +# GLOVE5DT_LIBRARY_RELEASE +# GLOVE5DT_LIBRARY_DEBUG +# GLOVE5DT_RUNTIME_LIBRARY_RELEASE +# GLOVE5DT_RUNTIME_LIBRARY_DEBUG +# +# Non-cache variables you might use in your CMakeLists.txt: +# GLOVE5DT_FOUND +# GLOVE5DT_INCLUDE_DIRS +# GLOVE5DT_LIBRARIES +# GLOVE5DT_RUNTIME_LIBRARY_DIRS +# +# Requires these CMake modules: +# CleanDirectoryList +# CleanLibraryList +# ListCombinations +# ProgramFilesGlob +# SelectLibraryConfigurations (included with CMake >=2.8.0) +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(GLOVE5DT_ROOT_DIR + "${GLOVE5DT_ROOT_DIR}" + CACHE + PATH + "Path to search for Glove5DT SDK") + +### +# Configure Glove5DT +### + +include(SelectLibraryConfigurations) +include(ListCombinations) +include(CleanDirectoryList) +include(ProgramFilesGlob) + +if(WIN32) + # Data Glove 5 and 16 use these directories for includes, lib, and runtime + program_files_glob(_dirs516 "/5DT/*/Driver") + set(_dirs516 + "${GLOVE5DT_ROOT_DIR}/Driver" + "${GLOVE5DT_ROOT_DIR}" + ${_dirs516}) + + # Data Glove Ultra uses this directory as the base for a dll, inc, and lib directory + program_files_glob(_dirsultra "/5DT/*/SDK") + + list_combinations(_libsearchultra + PREFIXES + "${GLOVE5DT_ROOT_DIR}" + "${_dirsultra}" + SUFFIXES + "/lib") + list_combinations(_incsearchultra + PREFIXES + "${GLOVE5DT_ROOT_DIR}" + "${_dirsultra}" + SUFFIXES + "/inc") + list_combinations(_dllsearchultra + PREFIXES + "${GLOVE5DT_ROOT_DIR}" + "${_dirsultra}" + SUFFIXES + "/dll") +endif() + + +### +# First search for the Ultra (2.0) SDK +### +find_path(GLOVE5DT_INCLUDE_DIR + NAMES + fglove.h + HINTS + ${_incsearchultra}) + +find_library(GLOVE5DT_LIBRARY_RELEASE + NAMES + fglove + HINTS + ${_libsearchultra}) + +find_library(GLOVE5DT_LIBRARY_DEBUG + NAMES + fgloved + HINTS + ${_libsearchultra}) + + +select_library_configurations(GLOVE5DT) +# As a post condition, either both LIBRARY_RELEASE and LIBRARY_DEBUG are set, or +# neither is. + + +### +# Ultra (2.0) SDK Runtime Libraries +### +if(WIN32) + find_file(GLOVE5DT_RUNTIME_LIBRARY_RELEASE + NAMES + fglove.dll + HINTS + ${_dllsearchultra}) + + find_file(GLOVE5DT_RUNTIME_LIBRARY_DEBUG + NAMES + fgloved.dll + HINTS + ${_dllsearchultra}) +else() + # the library is the runtime library + set(GLOVE5DT_RUNTIME_LIBRARY_RELEASE "${GLOVE5DT_LIBRARY_RELEASE}") + set(GLOVE5DT_RUNTIME_LIBRARY_DEBUG "${GLOVE5DT_LIBRARY_DEBUG}") +endif() + + +select_library_configurations(GLOVE5DT_RUNTIME) + + +### +# Fallback to the 5/16 (1.0) SDK +### +find_path(GLOVE5DT_INCLUDE_DIR + NAMES + fglove.h + HINTS + ${_dirs516}) + +find_library(GLOVE5DT_LIBRARY_RELEASE + NAMES + fglove + HINTS + ${_dirs516}) + +select_library_configurations(GLOVE5DT) + +### +# 5/16 (1.0) SDK Runtime Libraries +### + +if(WIN32) + find_file(GLOVE5DT_RUNTIME_LIBRARY_RELEASE + NAMES + fglove.dll + HINTS + ${_dirs516}) +else() + # the library is the runtime library + set(GLOVE5DT_RUNTIME_LIBRARY_RELEASE "${GLOVE5DT_LIBRARY_RELEASE}") +endif() + +select_library_configurations(GLOVE5DT_RUNTIME) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Glove5DT + DEFAULT_MSG + GLOVE5DT_LIBRARY_RELEASE + GLOVE5DT_RUNTIME_LIBRARY_RELEASE + GLOVE5DT_INCLUDE_DIR) + + +if(GLOVE5DT_FOUND) + set(GLOVE5DT_RUNTIME_LIBRARY_DIRS) + foreach(_lib + GLOVE5DT_RUNTIME_LIBRARY_RELEASE + GLOVE5DT_RUNTIME_LIBRARY_DEBUG) + if(${_lib}) + get_filename_component(_libdir ${${_lib}} PATH) + list(APPEND GLOVE5DT_RUNTIME_LIBRARY_DIRS "${_libdir}") + endif() + endforeach() + + clean_directory_list(GLOVE5DT_RUNTIME_LIBRARY_DIRS) + set(GLOVE5DT_INCLUDE_DIRS "${GLOVE5DT_INCLUDE_DIR}") + set(GLOVE5DT_LIBRARIES ${GLOVE5DT_LIBRARY}) + mark_as_advanced(GLOVE5DT_ROOT_DIR) +endif() + + +mark_as_advanced(GLOVE5DT_INCLUDE_DIR + GLOVE5DT_LIBRARY_RELEASE + GLOVE5DT_LIBRARY_DEBUG + GLOVE5DT_RUNTIME_LIBRARY_RELEASE + GLOVE5DT_RUNTIME_LIBRARY_DEBUG) diff --git a/FindJCCL12.cmake b/FindJCCL12.cmake new file mode 100644 index 0000000..d9e0bec --- /dev/null +++ b/FindJCCL12.cmake @@ -0,0 +1,152 @@ +# - try to find JCCL 1.2 library +# Requires VPR 2.0 (thus FindVPR20.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# JCCL12_LIBRARY_DIR, library search path +# JCCL12_INCLUDE_DIR, include search path +# JCCL12_LIBRARY, the library to link against +# JCCL12_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# JCCL12_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +set(_HUMAN "JCCL 1.2") +set(_RELEASE_NAMES jccl-1_2 libjccl-1_2) +set(_DEBUG_NAMES jccl_d-1_2 libjccl_d-1_2) +set(_DIR jccl-1.2) +set(_HEADER jccl/jcclConfig.h) +set(_FP_PKG_NAME jccl) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(JCCL12_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(JCCL12_ROOT_DIR + "${JCCL12_ROOT_DIR}" + CACHE + PATH + "Root directory to search for JCCL") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(JCCL12_ROOT_DIR) +endif() +if(NOT JCCL12_ROOT_DIR) + set(JCCL12_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR ${JCCL12_ROOT_DIR}) + +find_path(JCCL12_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(JCCL12_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(JCCL12_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(JCCL12) + +# Dependency +if(NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(JCCL12 + DEFAULT_MSG + JCCL12_LIBRARY + JCCL12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR) + +if(JCCL12_FOUND) + set(_DEPS ${VPR20_LIBRARIES}) + + set(JCCL12_INCLUDE_DIRS ${JCCL12_INCLUDE_DIR}) + list(APPEND JCCL12_INCLUDE_DIRS ${VPR20_INCLUDE_DIRS}) + clean_directory_list(JCCL12_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(JCCL12 ${_DEPS}) + else() + clean_library_list(JCCL12_LIBRARIES) + endif() + + mark_as_advanced(JCCL12_ROOT_DIR) +endif() + +mark_as_advanced(JCCL12_LIBRARY_RELEASE + JCCL12_LIBRARY_DEBUG + JCCL12_INCLUDE_DIR) diff --git a/FindJtTk.cmake b/FindJtTk.cmake new file mode 100644 index 0000000..a1661f8 --- /dev/null +++ b/FindJtTk.cmake @@ -0,0 +1,453 @@ +# - try to find JTTK library +# +# JTTK_LIBRARY_DIRS, library search path +# JTTK_INCLUDE_DIRS, include search path +# JTTK_{component}_LIBRARY, the library to link against +# JTTK_ENVIRONMENT, environment variables to set +# JTTK_RUNTIME_LIBRARY_DIRS +# JTTK_FOUND, If false, do not try to use this library. +# +# If you have license issues, you might run this command on each JtTk-using target: +# jttk_stamp_binary() +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# JTTK_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(ListCombinations) +include(CheckVersion) +include(GetDirectoryList) +include(PrefixListGlob) +include(GetCompilerInfoString) +if(WIN32) + include(ProgramFilesGlob) +endif() + +set(JTTK_ROOT_DIR + "${JTTK_ROOT_DIR}" + CACHE + PATH + "Root directory to search for JtTk") + +if(NOT JTTK_CUSTOMER_ID) + set(JTTK_CUSTOMER_ID "$ENV{JTTK_CUSTOMER_ID}") +endif() + +set(JTTK_CUSTOMER_ID + "${JTTK_CUSTOMER_ID}" + CACHE + STRING + "JtTk customer ID, to place in the environment") + + +get_filename_component(_jttk_mod_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + +if(NOT BITS) + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(BITS 64) + else() + set(BITS 32) + endif() +endif() + +set(JTTK_ENVIRONMENT "JTTK_DEV_PLATFORM=${BITS}") +if(JTTK_CUSTOMER_ID) + list(APPEND JTTK_ENVIRONMENT "JTTK_CUSTOMER_ID=${JTTK_CUSTOMER_ID}") +endif() + +if(WIN32 AND MSVC) + if(MSVC90) + set(VC_VER vc9) + set(VC_VER_LONG vc90) + elseif(MSVC80) + set(VC_VER vc8) + set(VC_VER_LONG vc80) + elseif(MSVC71) + set(VC_VER vc71) + set(VC_VER_LONG vc71) + endif() + + if(BITS EQUAL 32) + set(PLATFORM win32) + else() + set(PLATFORM win64) + endif() +endif() + +if(NOT "${3RDPARTYROOT}") + set(3RDPARTYROOT ${CMAKE_SOURCE_DIR}/third-party) +endif() + +set(libsearchdirs) +set(includesearchdirs) +set(_jttklibs) +set(_libsuffixes) +if(WIN32) + program_files_fallback_glob(_dirs "/UGS/JTOpenToolkit/*/dev") + program_files_fallback_glob(_dirs2 "/Siemens/JTOpenToolkit/*/dev") + list(APPEND _dirs ${_dirs2}) + + file(TO_CMAKE_PATH "$ENV{JTTK_DEV_PATH}" _envloc) + list(APPEND _dirs "${_envloc}") + + if(MSVC90) + prefix_list_glob(_vc9_libdirs + "/lib/win_${BITS}vc9/JtTk*.dll" + "${JTTK_ROOT_DIR}" + ${_dirs}) + list(APPEND _jttklibs ${_vc9_libdirs}) + prefix_list_glob(_vc9_libdirs + "/lib/win_${BITS}_vc9/JtTk*.dll" + "${JTTK_ROOT_DIR}" + ${_dirs}) + list(APPEND _jttklibs ${_vc9_libdirs}) + list(APPEND _libsuffixes "/lib/win_${BITS}vc9" "/lib/win_${BITS}_vc9") + endif() + if(MSVC80) + prefix_list_glob(_vc8_libdirs + "/lib/win_${BITS}/JtTk*.dll" + "${JTTK_ROOT_DIR}" + ${_dirs}) + list(APPEND _jttklibs ${_vc8_libdirs}) + list(APPEND _libsuffixes "/lib/win_${BITS}") + endif() + if(MSVC71) + prefix_list_glob(_vc71_libdirs + "/lib/win_${BITS}vs7/JtTk*.dll" + "${dirs}") + list(APPEND _jttklibs "${_vc71_libdirs}") + list(APPEND _libsuffixes "/lib/win_${BITS}vs7") + endif() + +elseif(UNIX) + + get_gcc_version(_gccver) + if("${_gccver}" VERSION_LESS "4.1.0") + set(_compiler "") + else() + set(_compiler "_gcc41") + endif() + + string(TOLOWER "${CMAKE_SYSTEM_NAME}" _sysname) + file(TO_CMAKE_PATH "$ENV{JTTK_DEV_PATH}" _envloc) + prefix_list_glob(_jttklibs + "lib/${_sysname}_${BITS}${_compiler}/libJtTk*" + "/usr/" + "/usr/local/" + "/usr/local/siemens/" + "/usr/local/ugs/") + prefix_list_glob(_jttklibs2 + "dev/lib/${_sysname}_${BITS}${_compiler}/libJtTk*" + "/usr/" + "/usr/local/" + "/usr/local/siemens/" + "/usr/local/ugs/" + "${_envloc}/") + list(APPEND _jttklibs ${_jttklibs2}) + + list(APPEND _libsuffixes "/lib/${_sysname}_${BITS}${_compiler}") +endif() + +foreach(_lib ${_jttklibs}) + string(REGEX MATCH "JtTk[0-9][0-9]" _jttkver "${_lib}") + if(_jttkver) + string(REGEX + REPLACE + "JtTk([0-9])([0-9])" + "\\1.\\2" + _verstd + "${_jttkver}") + string(REGEX + REPLACE + "JtTk([0-9])([0-9])" + "\\1\\2" + _vernodot + "${_jttkver}") + endif() + check_version(_result JtTk "${_verstd}") + if(_result) + get_filename_component(_libpath "${_lib}" PATH) + list(APPEND JTTK_JTTK_VERSIONS ${_vernodot}) + list(APPEND JTTK_DEV_PATHS "${_libpath}") + else() + #message(STATUS "Found JtTk version ${ver}, does not meet requirements") + endif() +endforeach() + +if(JTTK_JTTK_VERSIONS) + list(SORT JTTK_JTTK_VERSIONS) + list(REVERSE JTTK_JTTK_VERSIONS) +endif() + +### +# Configure JtTk +### + +### +# Find the link library +### +list_combinations(names PREFIXES "JtTk" SUFFIXES ${JTTK_JTTK_VERSIONS}) +find_library(JTTK_JtTk_LIBRARY + NAMES + ${names} + HINTS + ${JTTK_DEV_PATHS} + PATH_SUFFIXES + ${_libsuffixes}) +set(JTTK_LIBRARY "${JTTK_JtTk_LIBRARY}") +set(JTTK_LIBRARIES "${JTTK_JtTk_LIBRARY}") + +### +# Prepare for the rest of our search based off of where we found the link library +### +get_filename_component(JTTK_LIBRARY_DIR "${JTTK_LIBRARY}" PATH) +get_filename_component(JTTK_DEV_PATH + "${JTTK_LIBRARY_DIR}/../.." + ABSOLUTE) + +# Grab JtTk version +string(REGEX MATCH "JtTk[0-9]*" _ver "${JTTK_LIBRARY}") +string(REGEX + REPLACE + "JtTk([0-9])([0-9])" + "\\1.\\2" + JTTK_JTTK_VERSION + "${_ver}") +string(REGEX + REPLACE + "JtTk([0-9])([0-9])" + "\\1\\2" + JTTK_JTTK_VERNODOT + "${_ver}") + +# Grab JT version +file(GLOB _jtdll "${JTTK_LIBRARY_DIR}/*JtBrep*") +string(REGEX MATCH "JtBrep[0-9]*" _jtver "${_jtdll}") +string(REGEX + REPLACE + "JtBrep([0-9])([0-9])" + "\\1\\2" + JTTK_JT_VERNODOT + "${_jtver}") + +# Setup dev path +get_filename_component(JTTK_DEV_PATH + "${JTTK_LIBRARY_DIR}/../../" + ABSOLUTE) + +list(APPEND JTTK_ENVIRONMENT "JTTK_DEV_PATH=${JTTK_DEV_PATH}") +set(ENV{JTTK_DEV_PLATFORM} ${BITS}) +set(ENV{JTTK_DEV_PATH} "${JTTK_DEV_PATH}") + +set(_deps_libs) +set(_deps_includes) +set(_deps_check) + +### +# Find the headers +### +find_path(JTTK_INCLUDE_DIR + JtTk/JtkEntity.h + HINTS + ${JTTK_DEV_PATH}/include) + +if(WIN32) + ### + # Find the DLL's + ### + + # Find the versioned DLL's + foreach(dll Jt JtBrep JtLibra JtSimp JtSupt JtXTBrep ParaSupt) + find_file(JTTK_${dll}_DLL + NAMES + "${dll}${JTTK_JT_VERNODOT}.dll" + HINTS + "${JTTK_LIBRARY_DIR}") + list(APPEND JTTK_DLLS ${JTTK_${dll}_DLL}) + mark_as_advanced(JTTK_${dll}_DLL) + endforeach() + + # Find the unversioned DLL's and the matching JtTk dll + foreach(dll psbodyshop pskernel psxttoolkit JtTk${JTTK_JTTK_VERNODOT}) + list_combinations(names PREFIXES "${dll}" SUFFIXES ".dll") + find_file(JTTK_${dll}_DLL + NAMES + ${names} + HINTS + "${JTTK_LIBRARY_DIR}") + list(APPEND JTTK_DLLS ${JTTK_${dll}_DLL}) + mark_as_advanced(JTTK_${dll}_DLL) + endforeach() + + get_directory_list(JTTK_RUNTIME_LIBRARY_DIRS ${JTTK_DLLS}) + +elseif(UNIX) + + foreach(_lib Jt JtBrep JtLibra JtSimp JtSupt JtXTBrep ParaSupt) + find_library(JTTK_${_lib}_LIBRARY + NAMES + "${_lib}${JTTK_JT_VERNODOT}" + HINTS + "${JTTK_LIBRARY_DIR}") + list(APPEND _deps_libs "${JTTK_${_lib}_LIBRARY}") + list(APPEND _deps_check JTTK_${_lib}_LIBRARY) + mark_as_advanced(JTTK_${_lib}_LIBRARY) + endforeach() + + # Find the unversioned libs + foreach(_lib psbodyshop pskernel psxttoolkit eaiunicode) + find_library(JTTK_${_lib}_LIBRARY + NAMES + ${_lib} + HINTS + "${JTTK_LIBRARY_DIR}") + list(APPEND _deps_libs "${JTTK_${_lib}_LIBRARY}") + list(APPEND _deps_check JTTK_${_lib}_LIBRARY) + mark_as_advanced(JTTK_${_lib}_LIBRARY) + endforeach() + + # Find stamper + #list(APPEND _deps_check JTTK_KEYS) + + find_program(JTTK_STAMP_COMMAND + stampkey + HINTS + "${JTTK_DEV_PATH}/../bin") + list(APPEND _deps_check JTTK_STAMP_COMMAND) + + find_program(JTTK_STAMP_PLATFORM_COMMAND + stampkey + HINTS + "${JTTK_DEV_PATH}/../bin/${_sysname}") + list(APPEND _deps_check JTTK_STAMP_PLATFORM_COMMAND) + + + if("${JTTK_KEYS}" STREQUAL "${JTTK_KEYS_AUTO}" OR NOT JTTK_KEYS) + find_file(JTTK_INSTALL_LOG + install.log + HINTS + "${JTTK_DEV_PATH}/.." + NO_DEFAULT_PATH) + #list(APPEND _deps_check JTTK_INSTALL_LOG) + mark_as_advanced(JTTK_INSTALL_LOG) + + if(JTTK_INSTALL_LOG) + file(READ "${JTTK_INSTALL_LOG}" _log) + string(REGEX MATCHALL "..key ([0-9A-Z])+" _keylines "${_log}") + set(JTTK_KEYS) + foreach(_keyline ${_keylines}) + string(REGEX + REPLACE + "..key (([0-9A-Z])+)$" + "\\1" + _key + "${_keyline}") + list(APPEND JTTK_KEYS "${_key}") + message(STATUS "Found JtTk key: ${_key}") + endforeach() + set(JTTK_KEYS + "${JTTK_KEYS}" + CACHE + STRING + "A semi-colon separated list of JtTk keys to stamp on the binaries." + FORCE) + set(JTTK_KEYS_AUTO + "${JTTK_KEYS}" + CACHE + INTERNAL + "The keys we auto-detected" + FORCE) + endif() + else() + foreach(_key ${JTTK_KEYS}) + message(STATUS "Using cached JtTk key: ${_key}") + endforeach() + set(JTTK_KEYS + "${JTTK_KEYS}" + CACHE + STRING + "A semi-colon separated list of JtTk keys to stamp on the binaries.") + endif() + + # Find dependencies + find_library(JTTK_MATH_LIBRARY m) + mark_as_advanced(JTTK_MATH_LIBRARY) + list(APPEND _deps_check JTTK_MATH_LIBRARY) + list(APPEND _deps_libs ${JTTK_MATH_LIBRARY}) + + if(NOT X11_FOUND) + find_package(X11) + endif() + list(APPEND _deps_check X11_FOUND) + list(APPEND _deps_libs ${X11_LIBRARIES}) + list(APPEND _deps_includes ${X11_INCLUDE_DIRS}) + + if(NOT OPENGL_FOUND) + find_package(OpenGL) + endif() + list(APPEND _deps_check OPENGL_FOUND) + list(APPEND _deps_libs ${OPENGL_LIBRARIES}) + list(APPEND _deps_includes ${OPENGL_INCLUDE_DIR}) + + if(NOT THREADS_FOUND) + find_package(Threads) + endif() + list(APPEND _deps_check THREADS_FOUND) + list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT}) + + get_directory_list(JTTK_RUNTIME_LIBRARY_DIRS ${_deps_libs}) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(JtTk + DEFAULT_MSG + JTTK_JtTk_LIBRARY + JTTK_CUSTOMER_ID + JTTK_INCLUDE_DIR + ${_deps_check}) + +if(JTTK_FOUND) + set(JTTK_INCLUDE_DIRS "${JTTK_INCLUDE_DIR}" ${_deps_includes}) + set(JTTK_LIBRARIES "${JTTK_LIBRARY}" ${_deps_libs}) + mark_as_advanced(JTTK_CUSTOMER_ID JTTK_ROOT_DIR) +endif() + +function(jttk_stamp_binary _target) + if(UNIX) + get_target_property(_binary "${_target}" LOCATION) + configure_file("${_jttk_mod_dir}/FindJtTk.stampkey.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/${_target}.stampkey.cmake" + @ONLY) + add_custom_command(TARGET + "${_target}" + POST_BUILD + COMMAND + "${CMAKE_COMMAND}" + -P + "${CMAKE_CURRENT_BINARY_DIR}/${_target}.stampkey.cmake" + COMMENT + "Stamping executable ${_binary} with JtTk keys..." + VERBATIM) + endif() +endfunction() + +mark_as_advanced(JTTK_JtTk_LIBRARY + JTTK_INCLUDE_DIR + JTTK_KEYS + JTTK_STAMP_COMMAND + JTTK_STAMP_PLATFORM_COMMAND) diff --git a/FindJtTk.stampkey.cmake.in b/FindJtTk.stampkey.cmake.in new file mode 100644 index 0000000..53985d2 --- /dev/null +++ b/FindJtTk.stampkey.cmake.in @@ -0,0 +1,42 @@ +# Small script to stamp the JtTk license key on an executable +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +set(ENV{JTTK_DEV_PLATFORM} @BITS@) +set(ENV{JTTK_DEV_PATH} @JTTK_DEV_PATH@) +set(ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:@JTTK_LIBRARY_DIR@") +set(ENV{PATH} "$ENV{PATH}:@JTTK_DEV_PATH@/../bin/") + +message(STATUS "The stamp commands are being run with these environment variables:") +execute_process(COMMAND ${CMAKE_COMMAND} -E environment) + +set(JTTK_KEYS @JTTK_KEYS@) +foreach(_key ${JTTK_KEYS}) + execute_process(COMMAND ${_command} @JTTK_STAMP_COMMAND@ ${_key} @_binary@ + RESULT_VARIABLE _result) + + if(NOT "${_result}" EQUAL "0") + message(STATUS "Failed (error ${_result}) running stamp command: +@JTTK_STAMP_COMMAND@ ${_key} @_binary@") + + else() + message(STATUS "Succeeded running stamp command: +@JTTK_STAMP_COMMAND@ ${_key} @_binary@") + endif() + + execute_process(COMMAND @JTTK_STAMP_PLATFORM_COMMAND@ ${_key} @_binary@ + RESULT_VARIABLE _result) + + if(NOT "${_result}" EQUAL "0") + message(STATUS "Failed (error ${_result}) running stamp command: +@JTTK_STAMP_PLATFORM_COMMAND@ ${_key} @_binary@") + + else() + message(STATUS "Succeeded running stamp command: +@JTTK_STAMP_PLATFORM_COMMAND@ ${_key} @_binary@") + endif() + +endforeach() diff --git a/FindLAPACKLibs.cmake b/FindLAPACKLibs.cmake new file mode 100644 index 0000000..e8f149e --- /dev/null +++ b/FindLAPACKLibs.cmake @@ -0,0 +1,91 @@ +# - Try to find LAPACK and BLAS libraries +# Once done, this will define +# LAPACKLIBS_LIBRARIES, all libraries to link against +# LAPACKLIBS_FOUND, If false, do not try to use LAPACK library features. +# +# Users may wish to set: +# LAPACKLIBS_ROOT_DIR, location to start searching for LAPACK libraries +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(_check) + +set(LAPACKLIBS_ROOT_DIR + "${LAPACKLIBS_ROOT_DIR}" + CACHE + PATH + "Directory to search for LAPACK libraries") + +if(APPLE) + find_library(LAPACKLIBS_VECLIB_FRAMEWORK veclib) + find_library(LAPACKLIBS_ACCELERATE_FRAMEWORK accelerate) + mark_as_advanced(LAPACKLIBS_VECLIB_FRAMEWORK + LAPACKLIBS_ACCELERATE_FRAMEWORK) + + set(LAPACKLIBS_LIBRARIES + "${LAPACKLIBS_VECLIB_FRAMEWORK}" + "${LAPACKLIBS_ACCELERATE_FRAMEWORK}") + list(APPEND + _check + LAPACKLIBS_VECLIB_FRAMEWORK + LAPACKLIBS_ACCELERATE_FRAMEWORK) +elseif(WIN32) + # Tested to work with the files from http://www.fi.muni.cz/~xsvobod2/misc/lapack/ + # You might also see http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html for + # the libraries and headers. + + # Good luck! + + find_library(LAPACKLIBS_LAPACK_LIBRARY + NAMES + lapack_win32_MT + lapack + lapackd + HINTS + ${LAPACKLIBS_ROOT_DIR} + PATH_SUFFIXES + lapack-MT-release + lapack-MT-debug + lib) + find_library(LAPACKLIBS_BLAS_LIBRARY + NAMES + blas_win32_MT + blas + blasd + HINTS + ${LAPACKLIBS_ROOT_DIR} + PATH_SUFFIXES + lapack-MT-release + lapack-MT-debug + lib) + set(LAPACKLIBS_LIBRARIES + "${LAPACKLIBS_LAPACK_LIBRARY}" + "${LAPACKLIBS_BLAS_LIBRARY}") + list(APPEND _check LAPACKLIBS_LAPACK_LIBRARY LAPACKLIBS_BLAS_LIBRARY) +elseif(UNIX) + # All other Linux/Unix should have lapack without a fuss + list(APPEND _check LAPACKLIBS_LAPACK_LIBRARY) + find_library(LAPACKLIBS_LAPACK_LIBRARY lapack) + set(LAPACKLIBS_LIBRARIES "${LAPACKLIBS_LAPACK_LIBRARY}") +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LAPACKLibs + DEFAULT_MSG + ${_check}) + +if(LAPACKLIBS_FOUND) + mark_as_advanced(LAPACKLIBS_ROOT_DIR + LAPACKLIBS_LAPACK_LIBRARY + LAPACKLIBS_BLAS_LIBRARY) +endif() diff --git a/FindLuabind.cmake b/FindLuabind.cmake new file mode 100644 index 0000000..48585c3 --- /dev/null +++ b/FindLuabind.cmake @@ -0,0 +1,73 @@ +# - try to find Luabind +# +# Users may optionally supply: +# LUABIND_ROOT_DIR - a prefix to start searching +# +# Non-cache variables you might use in your CMakeLists.txt: +# LUABIND_FOUND +# LUABIND_DEFINITIONS +# LUABIND_INCLUDE_DIRS +# LUABIND_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(LUABIND_ROOT_DIR + "${LUABIND_ROOT_DIR}" + CACHE + PATH + "Path to search for Luabind") + +### +# Dependencies +### +find_package(Lua51 QUIET) + +### +# Configure Luabind +### +find_path(LUABIND_INCLUDE_DIR + NAMES + luabind/luabind.hpp + HINTS + "${LUABIND_ROOT_DIR}" + PATH_SUFFIXES + include) +mark_as_advanced(LUABIND_INCLUDE_DIR) + +find_library(LUABIND_LIBRARY + NAMES + luabind + HINTS + "${LUABIND_ROOT_DIR}" + PATH_SUFFIXES + lib64 + lib) +mark_as_advanced(LUABIND_LIBRARY) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Luabind + DEFAULT_MSG + LUABIND_LIBRARY + LUABIND_INCLUDE_DIR + LUA_LIBRARIES + LUA_INCLUDE_DIR) + +if(LUABIND_FOUND) + set(LUABIND_INCLUDE_DIRS "${LUABIND_INCLUDE_DIR}" "${LUA_INCLUDE_DIR}") + set(LUABIND_LIBRARIES "${LUABIND_LIBRARY}" ${LUA_LIBRARIES}) + set(LUABIND_DEFINITIONS "-DLUABIND_DYNAMIC_LINK") + mark_as_advanced(LUABIND_ROOT_DIR) +endif() diff --git a/FindLyX.cmake b/FindLyX.cmake new file mode 100644 index 0000000..a2c7eef --- /dev/null +++ b/FindLyX.cmake @@ -0,0 +1,146 @@ +# - Try to find LyX, and define some custom commands to export from LyX +# +# Once done, this will define: +# LYX_FOUND - system has LyX +# LYX_COMMAND - the command to run +# +# and the following new functions: +# lyx_export( +# INPUT [...] +# [OUTPUT_TO_SOURCE_DIR] +# [ EXTRA_DEPS [...] ]) - the base function +# +# These shortcut functions all have the same syntax: +# lyx_export_to_XXX( +# INPUT [...] +# [OUTPUT_TO_SOURCE_DIR] +# [ EXTRA_DEPS [...] ]) +# +# Available shortcuts: +# lyx_export_to_docbook_xml +# lyx_export_to_docbook +# lyx_export_to_pdf +# lyx_export_to_pdf_via_pdflatex +# lyx_export_to_pdf_via_dvi +# +# Useful configuration variables you might want to add to your cache: +# LYX_ROOT_DIR - A directory prefix to search +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +set(LYX_ROOT_DIR + "${LYX_ROOT_DIR}" + CACHE + PATH + "Directory to start our search in") + +find_program(LYX_COMMAND + NAMES + lyx + HINTS + "${LYX_ROOT_DIR}" + PATH_SUFFIXES + bin) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LyX DEFAULT_MSG LYX_COMMAND) + +if(LYX_FOUND) + mark_as_advanced(LYX_ROOT_DIR) +endif() + +mark_as_advanced(LYX_COMMAND) + +function(lyx_export _format _extension _outvar) + set(_nowhere) + set(_curdest _nowhere) + set(_val_args + EXTRA_DEPS + INPUT) + set(_bool_args OUTPUT_TO_SOURCE_DIR) + foreach(_arg ${_val_args} ${_bool_args}) + set(${_arg}) + endforeach() + foreach(_element ${ARGN}) + list(FIND _val_args "${_element}" _val_arg_find) + list(FIND _bool_args "${_element}" _bool_arg_find) + if("${_val_arg_find}" GREATER "-1") + set(_curdest "${_element}") + elseif("${_bool_arg_find}" GREATER "-1") + set("${_element}" ON) + set(_curdest _nowhere) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + + if(_nowhere) + message(FATAL_ERROR "Syntax error in use of a lyx_export command!") + endif() + + set(_out) + set(_outname) + foreach(_file ${INPUT}) + get_filename_component(_base "${_file}" NAME_WE) + + if(NOT OUTPUT_TO_SOURCE_DIR) + set(_outname "${CMAKE_CURRENT_BINARY_DIR}/${_base}.${_extension}") + else() + set(_outname "${CMAKE_CURRENT_SOURCE_DIR}/${_base}.${_extension}") + endif() + + list(APPEND _out "${_outname}") + if(LYX_COMMAND) + add_custom_command(OUTPUT "${_outname}" + COMMAND ${CMAKE_COMMAND} -E remove "${_outname}" + #COMMAND ${LYX_COMMAND} "${_file}" --export ${_format} + COMMAND ${LYX_COMMAND} "${_file}" + --execute + "buffer-export-custom ${_format} ${CMAKE_COMMAND} -E copy '$$$$FName' '${_outname}'" + --execute + "lyx-quit" + MAIN_DEPENDENCY "${_file}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS "${_file}" ${EXTRA_DEPS} + COMMENT "Exporting ${_file} to ${_format}...") + endif() + endforeach() + + set(${_outvar} ${_out} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_docbook_xml _outvar) + lyx_export(docbook-xml xml ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_docbook _outvar) + lyx_export(docbook sgml ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_pdf _outvar) + lyx_export(pdf pdf ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_pdf_via_pdflatex _outvar) + lyx_export(pdf2 pdf ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() + +function(lyx_export_to_pdf_via_dvi _outvar) + lyx_export(pdf3 pdf ${_outvar} ${ARGN}) + set(${_outvar} ${${_outvar}} PARENT_SCOPE) +endfunction() diff --git a/FindMacHID.cmake b/FindMacHID.cmake new file mode 100644 index 0000000..9b740ad --- /dev/null +++ b/FindMacHID.cmake @@ -0,0 +1,66 @@ +# - try to find Mac HID frameworks +# +# Cache Variables: (probably not for direct use in your scripts) +# MACHID_CoreFoundation_LIBRARY +# MACHID_CoreFoundation_INCLUDE_DIR +# MACHID_IOKit_LIBRARY +# MACHID_IOKit_INCLUDE_DIR +# MACOSX_HID_UINT32T (from CheckMacHIDAPI) +# +# Non-cache variables you should use in your CMakeLists.txt: +# MACHID_DEFINITIONS +# MACHID_LIBRARIES +# MACHID_INCLUDE_DIRS +# MACHID_FOUND - if this is not true, do not attempt to use this library +# +# Requires these CMake modules: +# CheckMacHIDAPI +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(APPLE) + find_library(MACHID_CoreFoundation_LIBRARY CoreFoundation) + find_path(MACHID_CoreFoundation_INCLUDE_DIR + CoreFoundation/CoreFoundation.h) + + find_library(MACHID_IOKit_LIBRARY IOKit) + find_path(MACHID_IOKit_INCLUDE_DIR IOKit/hid/IOHIDLib.h) + + include(CheckMacHIDAPI) + set(MACHID_DEFINITIONS "-DMACOSX_HID_UINT32T=${MACOSX_HID_UINT32T}") + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(MacHID + DEFAULT_MSG + MACHID_CoreFoundation_LIBRARY + MACHID_CoreFoundation_INCLUDE_DIR + MACHID_IOKit_LIBRARY + MACHID_IOKit_INCLUDE_DIR + MACOSX_HID_UINT32T) + +endif() + +if(MACHID_FOUND) + set(MACHID_LIBRARIES + "${MACHID_CoreFoundation_LIBRARY}" + "${MACHID_IOKit_LIBRARY}") + + set(MACHID_INCLUDE_DIRS + "${MACHID_CoreFoundation_INCLUDE_DIR}" + "${MACHID_IOKit_INCLUDE_DIR}") + + mark_as_advanced(MACHID_CoreFoundation_LIBRARY + MACHID_CoreFoundation_INCLUDE_DIR + MACHID_IOKit_LIBRARY + MACHID_IOKit_INCLUDE_DIR) + +endif() diff --git a/FindOpenCV.cmake b/FindOpenCV.cmake new file mode 100644 index 0000000..f015d56 --- /dev/null +++ b/FindOpenCV.cmake @@ -0,0 +1,233 @@ +# - Try to find OpenCV library installation +# See http://sourceforge.net/projects/opencvlibrary/ +# +# The following variable is optionally searched for defaults +# OPENCV_ROOT_DIR: Base directory of OpenCv tree to use. +# +# OPENCV_NEW_LIBRARY_NAMES Set to YES before searching if you want to +# The following are set after configuration is done: +# OPENCV_FOUND +# OPENCV_INCLUDE_DIRS +# OPENCV_LIBRARIES +# +# 2004/05 Jan Woetzel, Friso, Daniel Grest +# 2006/01 complete rewrite by Jan Woetzel +# 2006/09 2nd rewrite introducing ROOT_DIR and PATH_SUFFIXES +# to handle multiple installed versions gracefully by Jan Woetzel +# 2010/02 Ryan Pavlik (Iowa State University) - partial rewrite to standardize +# +# tested with: +# -OpenCV 0.97 (beta5a): MSVS 7.1, gcc 3.3, gcc 4.1 +# -OpenCV 0.99 (1.0rc1): MSVS 7.1 +# +# www.mip.informatik.uni-kiel.de/~jw +# academic.cleardefinition.com +# -------------------------------- + +set(OPENCV_ROOT_DIR + "${OPENCV_ROOT_DIR}" + CACHE + PATH + "Path to search for OpenCV") + +include(ProgramFilesGlob) + +# typical root dirs of installations, exactly one of them is used +program_files_glob(_dirs "/OpenCV*/") + +# +# select exactly ONE OPENCV base directory/tree +# to avoid mixing different version headers and libs +# +find_path(OPENCV_BASE_DIR + NAMES + cv/include/cv.h + include/opencv/cv.h + include/cv/cv.h + include/cv.h + HINTS + "${OPENCV_ROOT_DIR}" + "$ENV{OPENCV_ROOT_DIR}" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Intel(R) Open Source Computer Vision Library_is1;Inno Setup: App Path]" + ${_dirs}) + + + + +# header include dir suffixes appended to OPENCV_BASE_DIR +set(OPENCV_INCDIR_SUFFIXES + include + include/cv + include/opencv + cv/include + cxcore/include + cvaux/include + otherlibs/cvcam/include + otherlibs/highgui + otherlibs/highgui/include + otherlibs/_graphics/include) + +# library linkdir suffixes appended to OPENCV_BASE_DIR +set(OPENCV_LIBDIR_SUFFIXES lib lib64 OpenCV/lib otherlibs/_graphics/lib) + + +# +# find incdir for each lib +# +find_path(OPENCV_cv_INCLUDE_DIR + NAMES + cv.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) +find_path(OPENCV_cxcore_INCLUDE_DIR + NAMES + cxcore.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) +find_path(OPENCV_cxcore_INCLUDE_DIR + NAMES + cvaux.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) +find_path(OPENCV_highgui_INCLUDE_DIR + NAMES + highgui.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) +find_path(OPENCV_cvcam_INCLUDE_DIR + NAMES + cvcam.h + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_INCDIR_SUFFIXES}) + +# +# find sbsolute path to all libraries +# some are optionally, some may not exist on Linux +# +find_library(OPENCV_legacy_LIBRARY + NAMES + opencv_legacy + HINTS + "${OPENCV_BASE_DIR}" + "${OPENCV_ROOT_DIR}" + PATH_SUFFIXES + ${OPENCV_LIBDIR_SUFFIXES}) + +set(OPENCV_NEW_COMPONENTS calib3d contrib core features2d highgui imgproc legacy ml objdetect video) +set(OPENCV_OLD_COMPONENTS cv cvaux cvcam cvhaartraining cxcore cxts highgui ml trs) +set(opencv_components) +if(OPENCV_NEW_LIBRARY_NAMES OR OPENCV_legacy_LIBRARY) + + # New-style library names + foreach(component ${OPENCV_NEW_COMPONENTS}) + find_library(OPENCV_${component}_LIBRARY + NAMES + opencv_${component} + HINTS + ${OPENCV_BASE_DIR} + PATH_SUFFIXES + ${OPENCV_LIBDIR_SUFFIXES}) + endforeach() + + # cv components with header and library if COMPONENTS unspecified + if(NOT OpenCV_FIND_COMPONENTS) + # default + set(opencv_components core legacy imgproc highgui) + if(WIN32) + list(APPEND opencv_components video) # WIN32 only actually + endif() + else() + # TODO: clean up/convert to new components + string(TOLOWER "${OpenCV_FIND_COMPONENTS}" opencv_components) + endif() + +else() + # Old-style lib names + if(NOT OpenCV_FIND_COMPONENTS) + # default + set(opencv_components cv cxcore cvaux highgui) + if(WIN32) + list(APPEND opencv_components cvcam) # WIN32 only actually + endif() + else() + string(TOLOWER "${OpenCV_FIND_COMPONENTS}" opencv_components) + endif() + + foreach(component ${OPENCV_OLD_COMPONENTS}) + find_library(OPENCV_${component}_LIBRARY + NAMES + cvaux + HINTS + ${OPENCV_BASE_DIR} + PATH_SUFFIXES + ${OPENCV_LIBDIR_SUFFIXES}) + endforeach() +endif() + +# +# Logic selecting required libs and headers +# + +set(_req_check) +set(_req_libs) +set(_req_includes) +foreach(component ${opencv_components}) + #message(STATUS "Component requested: ${component}") + + # only good if header and library both found + list(APPEND + _req_check + OPENCV_${component}_LIBRARY) + list(APPEND _req_libs "${OPENCV_${component}_LIBRARY}") + if(DEFINED OPENCV_${component}_INCLUDE_DIR) + list(APPEND + _req_check + OPENCV_${component}_INCLUDE_DIR) + list(APPEND _req_includes "${OPENCV_${component}_INCLUDE_DIR}") + endif() + + +endforeach() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenCV + DEFAULT_MSG + OPENCV_cv_INCLUDE_DIR + ${_req_check}) + +if(OPENCV_FOUND) + set(OPENCV_LIBRARY_DIRS) + foreach(lib ${_req_libs}) + get_filename_component(dir "${lib}" PATH) + list(APPEND OPENCV_LIBRARY_DIRS "${dir}") + endforeach() + list(REVERSE OPENCV_LIBRARY_DIRS) + list(REMOVE_DUPLICATES OPENCV_LIBRARY_DIRS) + list(REVERSE OPENCV_LIBRARY_DIRS) + + set(OPENCV_INCLUDE_DIRS ${_req_includes}) + set(OPENCV_LIBRARIES ${_req_libs}) + mark_as_advanced(OPENCV_ROOT_DIR) +endif() + +mark_as_advanced(OPENCV_BASE_DIR) +foreach(component ${OPENCV_NEW_COMPONENTS} ${OPENCV_OLD_COMPONENTS}) + mark_as_advanced(OPENCV_${component}_LIBRARY OPENCV_${component}_INCLUDE_DIR) +endforeach() diff --git a/FindOpenHaptics.cmake b/FindOpenHaptics.cmake new file mode 100644 index 0000000..20c66b5 --- /dev/null +++ b/FindOpenHaptics.cmake @@ -0,0 +1,486 @@ +# - try to find OpenHaptics libraries +# +# Cache Variables: (probably not for direct use in your scripts) +# HDAPI_INCLUDE_DIR +# HDAPI_LIBRARY +# HDAPI_HDU_INCLUDE_DIR +# HDAPI_HDU_LIBRARY +# HDAPI_HDU_LIBRARY_RELEASE +# HDAPI_HDU_LIBRARY_DEBUG +# HLAPI_INCLUDE_DIR +# HLAPI_LIBRARY +# HLAPI_HLU_INCLUDE_DIR +# HLAPI_HLU_LIBRARY +# HLAPI_HLU_LIBRARY_RELEASE +# HLAPI_HLU_LIBRARY_DEBUG +# +# Non-cache variables you might use in your CMakeLists.txt: +# OPENHAPTICS_FOUND +# HDAPI_INCLUDE_DIRS +# HDAPI_LIBRARIES +# HDAPI_HDU_INCLUDE_DIRS +# HDAPI_HDU_LIBRARIES +# HLAPI_INCLUDE_DIRS +# HLAPI_LIBRARIES +# HLAPI_HLU_INCLUDE_DIRS +# HLAPI_HLU_LIBRARIES +# OPENHAPTICS_LIBRARIES - includes HD, HDU, HL, HLU +# OPENHAPTICS_RUNTIME_LIBRARY_DIRS +# OPENHAPTICS_ENVIRONMENT +# OPENHAPTICS_LIBRARY_DIRS +# OPENHAPTICS_INCLUDE_DIRS +# +# Requires these CMake modules: +# CleanDirectoryList +# CleanLibraryList +# ListCombinations +# ProgramFilesGlob +# SelectLibraryConfigurations (included with CMake >=2.8.0) +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# CMake 2.6.3 (uses "unset") +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +cmake_minimum_required(VERSION 2.6.3) + +set(OPENHAPTICS_ROOT_DIR + "${OPENHAPTICS_ROOT_DIR}" + CACHE + PATH + "Path to search for OpenHaptics") +option(OPENHAPTICS_NESTED_TARGETS + "Whether we should compile HDU and HLU, if needed, as a part of the solution" + ON) +mark_as_advanced(OPENHAPTICS_NESTED_TARGETS) + +### +# Configure OpenHaptics +### + +include(SelectLibraryConfigurations) +include(ListCombinations) +include(CleanDirectoryList) +include(CleanLibraryList) +include(ProgramFilesGlob) + +set(_nest_targets) +set(_incsearchdirs) +set(_libsearchdirs) +set(OPENHAPTICS_ENVIRONMENT) +set(OPENHAPTICS_RUNTIME_LIBRARY_DIRS) + +if(WIN32) + program_files_fallback_glob(_dirs "/Sensable/3DTouch*/") + if(MSVC60) + set(_vc "vc6") + elseif(MSVC70 OR MSVC71) + set(_vc "vc7") + elseif(MSVC80) + set(_vc "vc8") + endif() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit + list_combinations(_libsearch + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/lib/x64") + list_combinations(_libsearch2 + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/utilities/lib/x64") + else() + # 32-bit + list_combinations(_libsearch + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/lib" + "/lib/win32") + list_combinations(_libsearch2 + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/utilities/lib/Win32" + "/utilities/lib" + "/utilities/lib/${_vc}") + endif() + + clean_directory_list(_libsearchdirs ${_libsearch} ${_libsearch2}) +endif() + +list_combinations(_incsearch + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/include") +list_combinations(_incsearch2 + PREFIXES + "${OPENHAPTICS_ROOT_DIR}" + ${_dirs} + SUFFIXES + "/utilities/include") +clean_directory_list(_incsearchdirs ${_incsearch} ${_incsearch2}) + +set(_deps_check) +set(_deps_libs) + +### +# HDAPI: HD +### + +if(UNIX) + find_library(HDAPI_PHANToMIO_LIBRARY + NAMES + PHANToMIO + HINTS + ${_libsearchdirs}) + mark_as_advanced(HDAPI_PHANToMIO_LIBRARY) + list(APPEND _deps_check HDAPI_PHANToMIO_LIBRARY) + list(APPEND _deps_libs "${HDAPI_PHANToMIO_LIBRARY}") +endif() + +find_path(HDAPI_INCLUDE_DIR + NAMES + HD/hd.h + HINTS + ${_incsearchdirs}) + +find_library(HDAPI_LIBRARY + NAMES + HD + HINTS + ${_libsearchdirs}) + +### +# HDAPI: HDU +### +find_path(HDAPI_HDU_INCLUDE_DIR + NAMES + HDU/hdu.h + HINTS + ${_incsearchdirs}) + +find_library(HDAPI_HDU_LIBRARY_RELEASE + NAMES + HDU + PATH_SUFFIXES + ReleaseAcademicEdition + Release + HINTS + ${_libsearchdirs}) + +find_library(HDAPI_HDU_LIBRARY_DEBUG + NAMES + HDU + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +# Fallback +find_library(HDAPI_HDU_LIBRARY_DEBUG + NAMES + HDUD + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +select_library_configurations(HDAPI_HDU) + +if(OPENHAPTICS_NESTED_TARGETS OR NOT HDAPI_HDU_LIBRARY) + if(HDAPI_HDU_SOURCE_DIR AND NOT EXISTS "${HDAPI_HDU_SOURCE_DIR}/hdu.cpp") + unset(HDAPI_HDU_SOURCE_DIR) + endif() + find_path(HDAPI_HDU_SOURCE_DIR + NAMES + hdu.cpp + PATH_SUFFIXES + src + src/HDU + src/HDU/src + libsrc/HDU + HINTS + "${HDAPI_HDU_INCLUDE_DIR}/.." + "${HDAPI_HDU_INCLUDE_DIR}/../share/3DTouch") + list(APPEND _deps_check HDAPI_HDU_SOURCE_DIR) + if(HDAPI_HDU_SOURCE_DIR) + mark_as_advanced(HDAPI_HDU_SOURCE_DIR) + set(_nest_targets YES) + set(HDAPI_HDU_LIBRARY + "openhaptics_hdu_nested_target" + CACHE + STRING + "We will build the OpenHaptics HDU lib." + FORCE) + endif() +endif() + + +### +# HLAPI: HL +### +find_path(HLAPI_INCLUDE_DIR + NAMES + HL/hl.h + HINTS + ${_incsearchdirs}) + +find_library(HLAPI_LIBRARY + NAMES + HL + HINTS + ${_libsearchdirs}) + + +### +# HLAPI: HLU +### +find_path(HLAPI_HLU_INCLUDE_DIR + NAMES + HLU/hlu.h + HINTS + ${_incsearchdirs}) + +find_library(HLAPI_HLU_LIBRARY_RELEASE + NAMES + HLU + PATH_SUFFIXES + ReleaseAcademicEdition + Release + HINTS + ${_libsearchdirs}) + +find_library(HLAPI_HLU_LIBRARY_DEBUG + NAMES + HLU + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +# fallback +find_library(HLAPI_HLU_LIBRARY_DEBUG + NAMES + HLUD + PATH_SUFFIXES + DebugAcademicEdition + Debug + HINTS + ${_libsearchdirs}) + +select_library_configurations(HLAPI_HLU) + +if(OPENHAPTICS_NESTED_TARGETS OR NOT HLAPI_HLU_LIBRARY) + if(HLAPI_HLU_SOURCE_DIR AND NOT EXISTS "${HLAPI_HLU_SOURCE_DIR}/hlu.cpp") + unset(HLAPI_HLU_SOURCE_DIR) + endif() + find_path(HLAPI_HLU_SOURCE_DIR + NAMES + hlu.cpp + PATH_SUFFIXES + src + src/HLU + src/HLU/src + libsrc/HLU + HINTS + "${HLAPI_HLU_INCLUDE_DIR}/.." + "${HLAPI_HLU_INCLUDE_DIR}/../share/3DTouch") + list(APPEND _deps_check HLAPI_HLU_SOURCE_DIR) + if(HLAPI_HLU_SOURCE_DIR) + mark_as_advanced(HLAPI_HLU_SOURCE_DIR) + set(_nest_targets YES) + set(HLAPI_HLU_LIBRARY + "openhaptics_hlu_nested_target" + CACHE + STRING + "We will build the OpenHaptics HLU lib." + FORCE) + endif() +endif() + + +### +# Unix: check stdc++ version +### + +if(UNIX + AND + HDAPI_LIBRARY + AND + HDAPI_PHANToMIO_LIBRARY + AND + HDAPI_INCLUDE_DIR) + find_file(OPENHAPTICS_LINKTEST_FILE + FindOpenHaptics.cpp + PATHS + ${CMAKE_MODULE_PATH}) + mark_as_advanced(OPENHAPTICS_LINKTEST_FILE) + + try_compile(_result + ${CMAKE_CURRENT_BINARY_DIR}/FindOpenHaptics + "${OPENHAPTICS_LINKTEST_FILE}" + CMAKE_FLAGS + "-DLINK_LIBRARIES=${HDAPI_LIBRARY}\;${HDAPI_PHANToMIO_LIBRARY} -DINCLUDE_DIRECTORIES=${HDAPI_INCLUDE_DIR}") + if(NOT _result) + set(OPENHAPTICS_LIBSTDCPP_DIR + "${OPENHAPTICS_LIBSTDCPP_DIR}" + CACHE + PATH + "The path to search for a libstdc++ with GLIBCXX_3.4.9 defined.") + if(OPENHAPTICS_LIBSTDCPP_DIR) + mark_as_advanced(OPENHAPTICS_LIBSTDCPP_DIR) + endif() + find_library(OPENHAPTICS_LIBSTDCPP_LIBRARY + libstdc++ + PATHS + ${OPENHAPTICS_LIBSTDCPP_DIR} + NO_DEFAULT_PATH) + if(OPENHAPTICS_LIBSTDCPP_LIBRARY) + mark_as_advanced(OPENHAPTICS_LIBSTDCPP_LIBRARY) + endif() + list(APPEND _deps_check OPENHAPTICS_LIBSTDCPP_LIBRARY) + list(APPEND _deps_libs "${OPENHAPTICS_LIBSTDCPP_LIBRARY}") + + get_filename_component(_stdcppdir + "${OPENHAPTICS_LIBSTDCPP_LIBRARY}" + PATH) + list(APPEND + OPENHAPTICS_ENVIRONMENT + "LD_LIBRARY_PATH=${_stdcppdir}:$LD_LIBRARY_PATH") + list(APPEND OPENHAPTICS_RUNTIME_LIBRARY_DIRS "${_stdcppdir}") + endif() +endif() + + +### +# Add dependencies: Libraries +### +set(HDAPI_LIBRARIES "${HDAPI_LIBRARY}" ${_deps_libs}) + +if(HDAPI_HDU_LIBRARIES AND HDAPI_LIBRARIES) + list(APPEND HDAPI_HDU_LIBRARIES ${HDAPI_LIBRARIES}) +else() + set(HDAPI_HDU_LIBRARIES) +endif() + +if(HLAPI_LIBRARY AND HDAPI_LIBRARIES) + set(HLAPI_LIBRARIES ${HLAPI_LIBRARY} ${HDAPI_LIBRARIES}) +else() + set(HLAPI_LIBRARIES) +endif() + +if(HLAPI_HLU_LIBRARIES AND HLAPI_LIBRARIES) + list(APPEND HLAPI_HLU_LIBRARIES ${HLAPI_LIBRARIES}) +else() + set(HLAPI_HLU_LIBRARIES) +endif() + +### +# Add dependencies: Include dirs +### +if(HDAPI_INCLUDE_DIR) + set(HDAPI_INCLUDE_DIRS ${HDAPI_INCLUDE_DIR}) + + if(HDAPI_HDU_INCLUDE_DIR) + set(HDAPI_HDU_INCLUDE_DIRS + ${HDAPI_INCLUDE_DIRS} + ${HDAPI_HDU_INCLUDE_DIR}) + + if(HDAPI_HDU_INCLUDE_DIR) + set(HLAPI_INCLUDE_DIRS ${HDAPI_INCLUDE_DIRS} ${HLAPI_INCLUDE_DIR}) + + if(HLAPI_HLU_INCLUDE_DIR) + set(HLAPI_HLU_INCLUDE_DIRS + ${HLAPI_INCLUDE_DIRS} + ${HLAPI_HLU_INCLUDE_DIR}) + + endif() + endif() + endif() +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenHaptics + DEFAULT_MSG + HDAPI_LIBRARY + HDAPI_INCLUDE_DIR + HDAPI_HDU_INCLUDE_DIR + HDAPI_HDU_LIBRARY + HLAPI_INCLUDE_DIR + HLAPI_LIBRARY + HLAPI_HLU_INCLUDE_DIR + HLAPI_HLU_LIBRARY + ${_deps_check}) + +if(OPENHAPTICS_FOUND) + # Recurse into the nested targets subdirectory if needed + if(_nest_targets) + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + add_subdirectory("${_moddir}/nested_targets/OpenHaptics") + endif() + + set(OPENHAPTICS_LIBRARIES + ${HDAPI_LIBRARY} + ${HDAPI_HDU_LIBRARY} + ${HLAPI_LIBRARY} + ${HLAPI_HLU_LIBRARY}) + set(OPENHAPTICS_LIBRARY_DIRS) + foreach(_lib + ${_deps_check} + HDAPI_LIBRARY + HDAPI_HDU_LIBRARY_RELEASE + HDAPI_HDU_LIBRARY_DEBUG + HLAPI_LIBRARY + HLAPI_HLU_LIBRARY_RELEASE + HLAPI_HLU_LIBRARY_DEBUG) + get_filename_component(_libdir ${${_lib}} PATH) + list(APPEND OPENHAPTICS_LIBRARY_DIRS ${_libdir}) + endforeach() + + set(OPENHAPTICS_INCLUDE_DIRS + ${HLAPI_HLU_INCLUDE_DIRS} + ${HDAPI_HDU_INCLUDE_DIRS}) + + clean_directory_list(OPENHAPTICS_LIBRARY_DIRS) + clean_directory_list(OPENHAPTICS_INCLUDE_DIRS) + + list(APPEND + OPENHAPTICS_RUNTIME_LIBRARY_DIRS + ${OPENHAPTICS_LIBRARY_DIRS}) + + clean_library_list(OPENHAPTICS_LIBRARIES) + + mark_as_advanced(OPENHAPTICS_ROOT_DIR) +endif() + +mark_as_advanced(HDAPI_INCLUDE_DIR + HDAPI_LIBRARY + HDAPI_HDU_INCLUDE_DIR + HDAPI_HDU_LIBRARY_RELEASE + HDAPI_HDU_LIBRARY_DEBUG + HLAPI_INCLUDE_DIR + HLAPI_LIBRARY + HLAPI_HLU_INCLUDE_DIR + HLAPI_HLU_LIBRARY_RELEASE + HLAPI_HLU_LIBRARY_DEBUG) diff --git a/FindOpenHaptics.cpp b/FindOpenHaptics.cpp new file mode 100644 index 0000000..fe9edbb --- /dev/null +++ b/FindOpenHaptics.cpp @@ -0,0 +1,18 @@ +/** + * \file FindOpenHaptics.cpp + * \brief C++ source file used by CMake module FindOpenHaptics.cmake + * + * \author + * Ryan Pavlik, 2009-2010 + * + * http://academic.cleardefinition.com/ + * + * Used to check stdc++ version + * + */ + +#include + +int main(int argc, char* argv[]) { + return 0; +} diff --git a/FindParasolid.cmake b/FindParasolid.cmake new file mode 100644 index 0000000..479459b --- /dev/null +++ b/FindParasolid.cmake @@ -0,0 +1,305 @@ +# - try to find PARASOLID library +# Important note: If you are also using JtTk, do your +# find_package(JtTk) +# first, to avoid runtime PK_* errors! +# +# PARASOLID_LIBRARY_DIR, library search path +# PARASOLID_INCLUDE_DIR, include search path +# PARASOLID_{component}_LIBRARY, the library to link against +# PARASOLID_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Requires these CMake modules: +# CheckVersion +# ListCombinations +# ProgramFilesGlob +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(ListCombinations) +include(CheckVersion) +include(PrefixListGlob) +include(CleanDirectoryList) +if(WIN32) + include(ProgramFilesGlob) +endif() + +set(PARASOLID_ROOT_DIR + "${PARASOLID_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Parasolid") + +file(TO_CMAKE_PATH "${PARASOLID_ROOT_DIR}" PARASOLID_ROOT_DIR) + +# Do this by default +if(NOT DEFINED PARASOLID_NESTED_TARGETS) + set(PARASOLID_NESTED_TARGETS TRUE) +endif() + +set(PARASOLID_NESTED_TARGETS + "${PARASOLID_NESTED_TARGETS}" + CACHE + BOOL + "Whether we should compile fg and frustrum as a part of the solution") +mark_as_advanced(PARASOLID_NESTED_TARGETS) + +set(_nest_targets) + +### +# Configure Parasolid +### + +string(TOLOWER "${CMAKE_SYSTEM_NAME}" _lcsystem) +set(libsearchdirs) +if(WIN32) + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit + program_files_fallback_glob(dirs "/Parasolid*/kernel/x64_win/base") + program_files_fallback_glob(dirs2 "/Parasolid/kernel/*/x64_win/base") + list(APPEND dirs ${dirs2}) + else() + # 32-bit + program_files_glob(dirs "/Parasolid*/kernel/intel_nt/base") + program_files_fallback_glob(dirs2 "/Parasolid/kernel/*/intel_nt/base") + list(APPEND dirs ${dirs2}) + endif() + + list_combinations(libsearchdirs + PREFIXES + ${dirs} + "${PARASOLID_ROOT_DIR}" + SUFFIXES + "/dll") + list(APPEND libsearchdirs ${dirs} "${PARASOLID_ROOT_DIR}") +elseif("${_lcsystem}" MATCHES "linux") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit + prefix_list_glob(libsearchdirs + "/Parasolid*/kernel/intel_linux/base_lx64" + "${PARASOLID_ROOT_DIR}" + "/usr" + "/usr/local" + "/usr/local/ugs") + else() + # 32-bit + prefix_list_glob(libsearchdirs + "/Parasolid*/kernel/intel_linux/base_lx32" + "${PARASOLID_ROOT_DIR}" + "/usr" + "/usr/local" + "/usr/local/ugs") + endif() +endif() + +### +# Find the link library +### +find_library(PARASOLID_pskernel_LIBRARY + NAMES + pskernel + PATH_SUFFIXES + dll + shared_object + HINTS + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + + +# Don't add this library to the default list of libraries +find_library(PARASOLID_pskernel_archive_LIBRARY + NAMES + pskernel_archive + pskernel_archive.lib + HINTS + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") +mark_as_advanced(PARASOLID_pskernel_archive_LIBRARY) + + +### +# Prepare for the rest of our search based off of where we found the link library +### +get_filename_component(PARASOLID_LIBRARY_DIR + "${PARASOLID_pskernel_LIBRARY}" + PATH) + +# Setup include search path +get_filename_component(_includedir + "${PARASOLID_LIBRARY_DIR}/../include" + ABSOLUTE) +get_filename_component(_includedir2 + "${PARASOLID_LIBRARY_DIR}/.." + ABSOLUTE) +set(includesearchdirs + "${PARASOLID_LIBRARY_DIR}" + "${_includedir}" + "${_includedir2}") +clean_directory_list(includesearchdirs) + +### +# Find the headers +### +find_path(PARASOLID_INCLUDE_DIR + NAMES + parasolid_kernel.h + HINTS + ${includesearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + +### +# Find remaining libs +### + +# Default libs +foreach(lib fg frustrum) + find_library(PARASOLID_${lib}_LIBRARY + NAMES + ${lib} + PATH_SUFFIXES + dll + HINTS + "${PARASOLID_LIBRARY_DIR}" + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + +endforeach() + +if(PARASOLID_pskernel_LIBRARY OR PARASOLID_INCLUDE_DIR) + get_filename_component(_libdir "${PARASOLID_pskernel_LIBRARY}" PATH) + get_filename_component(_incdir "${PARASOLID_INCLUDE_DIR}" PATH) + + if(PARASOLID_NESTED_TARGETS OR NOT PARASOLID_fg_LIBRARY) + find_file(PARASOLID_FG_C + NAMES + fg.c + HINTS + "${_libdir}" + "${_libdir}/.." + "${_incdir}") + if(PARASOLID_FG_C) + mark_as_advanced(PARASOLID_FG_C) + set(_nest_targets YES) + set(PARASOLID_fg_LIBRARY + "parasolid_fg_nested_target" + CACHE + STRING + "We will build the Parasolid fg lib." + FORCE) + endif() + endif() + + if(PARASOLID_NESTED_TARGETS OR NOT PARASOLID_frustrum_LIBRARY) + find_file(PARASOLID_FRUSTRUM_C + NAMES + frustrum.c + HINTS + "${_libdir}" + "${_libdir}/.." + "${_incdir}") + if(PARASOLID_FRUSTRUM_C) + mark_as_advanced(PARASOLID_FRUSTRUM_C) + set(_nest_targets YES) + set(PARASOLID_frustrum_LIBRARY + "parasolid_frustrum_nested_target" + CACHE + STRING + "We will build the Parasolid frustrum lib." + FORCE) + endif() + endif() + +endif() + +# Non-default libs +foreach(lib testfr) + find_library(PARASOLID_${lib}_LIBRARY + NAMES + ${lib} + PATH_SUFFIXES + dll + HINTS + ${PARASOLID_LIBRARY_DIR} + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + mark_as_advanced(PARASOLID_${lib}_LIBRARY) +endforeach() + +### +# Find the DLL's +### + +if(JTTK_FOUND AND JTTK_pskernel_DLL) + # If we have JtTk, must use the dll there or we'll have weird runtime errors + # in parasolid + set(PARASOLID_pskernel_DLL "${JTTK_pskernel_DLL}") +else() + # Find the unversioned DLL + set(dll pskernel) + find_file(PARASOLID_${dll}_DLL + NAMES + ${dll}.dll + PATH_SUFFIXES + dll + HINTS + ${PARASOLID_LIBRARY_DIR} + ${libsearchdirs} + PATHS + "${PARASOLID_ROOT_DIR}") + list(APPEND PARASOLID_DLLS ${PARASOLID_${dll}_DLL}) + mark_as_advanced(PARASOLID_${dll}_DLL) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Parasolid + DEFAULT_MSG + PARASOLID_pskernel_LIBRARY + PARASOLID_fg_LIBRARY + PARASOLID_frustrum_LIBRARY + PARASOLID_INCLUDE_DIR) + +if(PARASOLID_FOUND) + # Recurse into the nested targets subdirectory if needed + if(_nest_targets) + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + add_subdirectory("${_moddir}/nested_targets/Parasolid") + endif() + + set(PARASOLID_INCLUDE_DIRS "${PARASOLID_INCLUDE_DIR}") + set(PARASOLID_LIBRARIES + "${PARASOLID_pskernel_LIBRARY}" + "${PARASOLID_fg_LIBRARY}" + "${PARASOLID_frustrum_LIBRARY}") + if(PARASOLID_pskernel_DLL) + get_filename_component(PARASOLID_RUNTIME_LIBRARY_DIRS + "${PARASOLID_pskernel_DLL}" + PATH) + endif() + mark_as_advanced(PARASOLID_ROOT_DIR) +endif() + +mark_as_advanced(PARASOLID_pskernel_LIBRARY + PARASOLID_pskernel_archive_LIBRARY + PARASOLID_fg_LIBRARY + PARASOLID_frustrum_LIBRARY + PARASOLID_INCLUDE_DIR + PARASOLID_FRUSTRUM_C + PARASOLID_FG_C) diff --git a/FindSonix12.cmake b/FindSonix12.cmake new file mode 100644 index 0000000..d2de3c2 --- /dev/null +++ b/FindSonix12.cmake @@ -0,0 +1,162 @@ +# - try to find Sonix 1.2 library +# Requires VPR 2.0 and GMTL (thus FindVPR20.cmake and FindGMTL.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# SONIX12_LIBRARY_DIR, library search path +# SONIX12_INCLUDE_DIR, include search path +# SONIX12_LIBRARY, the library to link against +# SONIX12_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# SONIX12_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +set(_HUMAN "Sonix 1.2") +set(_RELEASE_NAMES sonix-1_2 libsonix-1_2) +set(_DEBUG_NAMES sonix_d-1_2 libsonix_d-1_2) +set(_DIR sonix-1.2) +set(_HEADER snx/sonix.h) +set(_FP_PKG_NAME sonix) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(Sonix12_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(SONIX12_ROOT_DIR + "${SONIX12_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Sonix") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(SONIX12_ROOT_DIR) +endif() +if(NOT SONIX12_ROOT_DIR) + set(SONIX12_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${SONIX12_ROOT_DIR}") + +find_path(SONIX12_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(SONIX12_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(SONIX12_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(SONIX12) + +# Dependencies +if(NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +endif() + +if(NOT GMTL_FOUND) + find_package(GMTL ${_FIND_FLAGS}) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sonix12 + DEFAULT_MSG + SONIX12_LIBRARY + SONIX12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR + GMTL_FOUND + GMTL_INCLUDE_DIR) + +if(SONIX12_FOUND) + set(_DEPS ${VPR20_LIBRARIES}) + + set(SONIX12_INCLUDE_DIRS ${SONIX12_INCLUDE_DIR}) + list(APPEND + SONIX12_INCLUDE_DIRS + ${VPR20_INCLUDE_DIRS} + ${GMTL_INCLUDE_DIRS}) + + clean_directory_list(SONIX12_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(SONIX12 ${_DEPS}) + else() + clean_library_list(SONIX12_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(SONIX12_ROOT_DIR) +endif() + +mark_as_advanced(SONIX12_LIBRARY_RELEASE + SONIX12_LIBRARY_DEBUG + SONIX12_INCLUDE_DIR) diff --git a/FindTR1.cmake b/FindTR1.cmake new file mode 100644 index 0000000..0a4f4ee --- /dev/null +++ b/FindTR1.cmake @@ -0,0 +1,76 @@ +# - Try to find C++ TR1 headers and libraries +# Once done, this will define +# +# TR1_USE_FILE, which you may "include" in your CMake file to be able +# to use TR1 features transparently +# TR1_INCLUDE_DIRS, any directories needed to access TR1 headers +# TR1_LIBRARY_DIRS, any directories needed to access (auto-link) TR1 libraries +# TR1_FOUND, If false, do not try to use TR1 features. +# +# If TR1 features are not built-in, we will try to use Boost to +# substitute for them. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# If we were sought quietly, any dependencies should be quiet as well +if(TR1_FIND_QUIETLY) + set(_findflags QUIET) +else() + set(_findflags) +endif() + +set(_check) +set(TR1_INCLUDE_DIRS) +set(TR1_LIBRARY_DIRS) + +get_filename_component(_findtr1moddir + ${CMAKE_CURRENT_LIST_FILE} + PATH) +set(TR1_USE_FILE "${_findtr1moddir}/UseTR1.cmake") + +if(WIN32) + if(MSVC) + set(PLATFORM "Visual Studio - no workarounds") + else() + set(PLATFORM "Unknown Windows platform - no workarounds set") + endif() + + if(MSVC_VERSION LESS 1600) + # Earlier than VS 2010 + # Missing stdint.h/cstdint + set(PLATFORM "Visual Studio older than Visual Studio 2010") + endif() + + if(MSVC_VERSION LESS 1500) + # Earlier than VS 2008 + # Missing all of TR1 + # (The feature pack or SP1 is required for VS2008 TR support) + set(PLATFORM "Visual Studio older than Visual Studio 2008") + list(APPEND _check Boost_FOUND) + find_package(Boost COMPONENTS math_c99 math_tr1 ${_findflags}) + list(APPEND + TR1_INCLUDE_DIRS + "${Boost_INCLUDE_DIR}/boost/tr1/tr1" + "${Boost_INCLUDE_DIR}/boost/tr1" + "${Boost_INCLUDE_DIR}") + list(APPEND TR1_LIBRARY_DIRS ${Boost_LIBRARY_DIRS}) + endif() +else() + set(PLATFORM "Non-Windows Platform - no workarounds set") +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TR1 + DEFAULT_MSG + PLATFORM + ${_check}) diff --git a/FindTooN.cmake b/FindTooN.cmake new file mode 100644 index 0000000..3bc1a40 --- /dev/null +++ b/FindTooN.cmake @@ -0,0 +1,68 @@ +# - try to find TooN headers +# +# Users may optionally supply: +# TOON_ROOT_DIR - a prefix to start searching for the toon headers. +# +# Cache Variables: (probably not for direct use in your scripts) +# TOON_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# TOON_FOUND +# TOON_INCLUDE_DIRS +# TOON_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(TOON_ROOT_DIR + "${TOON_ROOT_DIR}" + CACHE + PATH + "Path to search for TooN") + +### +# Dependencies +### +if(NOT LAPACKLIBS_ROOT_DIR) + set(LAPACKLIBS_ROOT_DIR "${TOON_ROOT_DIR}") +endif() +find_package(LAPACKLibs QUIET) + +### +# Configure TooN +### +find_path(TOON_INCLUDE_DIR + NAMES + TooN/TooN.h + HINTS + "${TOON_ROOT_DIR}" + PATH_SUFFIXES + include) +mark_as_advanced(TOON_INCLUDE_DIR) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TooN + DEFAULT_MSG + TOON_INCLUDE_DIR + LAPACKLIBS_FOUND) + +if(TOON_FOUND) + set(TOON_INCLUDE_DIRS "${TOON_INCLUDE_DIR}") + set(TOON_LIBRARIES ${LAPACKLIBS_LIBRARIES}) + mark_as_advanced(TOON_ROOT_DIR) +endif() + + + diff --git a/FindTooNtag.cmake b/FindTooNtag.cmake new file mode 100644 index 0000000..923df9d --- /dev/null +++ b/FindTooNtag.cmake @@ -0,0 +1,84 @@ +# - try to find tag algorithm library (built on TooN) +# +# Users may optionally supply: +# TAG_ROOT_DIR - a prefix to start searching for the toon headers. +# +# Cache Variables: (probably not for direct use in your scripts) +# TAG_INCLUDE_DIR +# TAG_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# TOONTAG_FOUND +# TOONTAG_INCLUDE_DIRS +# TOONTAG_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(TOONTAG_ROOT_DIR + "${TOONTAG_ROOT_DIR}" + CACHE + PATH + "Path to search for tag") + +### +# Dependencies +### +if(NOT TOON_ROOT_DIR) + set(TOON_ROOT_DIR "${TOONTAG_ROOT_DIR}") +endif() +find_package(TooN QUIET) + +find_package(TR1 QUIET) +include("${TR1_USE_FILE}") + +### +# Configure tag +### +find_path(TOONTAG_INCLUDE_DIR + NAMES + tag/helpers.h + HINTS + "${TOONTAG_ROOT_DIR}" + PATH_SUFFIXES + tag + include) +mark_as_advanced(TOONTAG_INCLUDE_DIR) + +find_library(TOONTAG_LIBRARY + NAMES + toontag + HINTS + "${TOONTAG_ROOT_DIR}" + PATH_SUFFIXES + lib + lib64) +mark_as_advanced(TOONTAG_LIBRARY) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TooNtag + DEFAULT_MSG + TOONTAG_LIBRARY + TOONTAG_INCLUDE_DIR + TOON_FOUND) + +if(TOONTAG_FOUND) + set(TOONTAG_INCLUDE_DIRS "${TOONTAG_INCLUDE_DIR}" ${TOON_INCLUDE_DIRS}) + set(TOONTAG_LIBRARIES "${TOONTAG_LIBRARY}" ${TOON_LIBRARIES}) + mark_as_advanced(TOONTAG_ROOT_DIR) +endif() + + + diff --git a/FindTweek12.cmake b/FindTweek12.cmake new file mode 100644 index 0000000..2f0a6bf --- /dev/null +++ b/FindTweek12.cmake @@ -0,0 +1,153 @@ +# - try to find Tweek 1.2 library +# Requires VPR 2.0 (thus FindVPR20.cmake) +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# TWEEK12_LIBRARY_DIR, library search path +# TWEEK12_INCLUDE_DIR, include search path +# TWEEK12_LIBRARY, the library to link against +# TWEEK12_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# TWEEK12_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +set(_HUMAN "Tweek 1.2") +set(_RELEASE_NAMES tweek-1_2 libtweek-1_2) +set(_DEBUG_NAMES tweek_d-1_2 libtweek_d-1_2) +set(_DIR tweek-1.2) +set(_HEADER tweek/tweek.h) +set(_FP_PKG_NAME tweek) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(Tweek12_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(TWEEK12_ROOT_DIR + "${TWEEK12_ROOT_DIR}" + CACHE + PATH + "Root directory to search for Tweek") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(TWEEK12_ROOT_DIR) +endif() +if(NOT TWEEK12_ROOT_DIR) + set(TWEEK12_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${TWEEK12_ROOT_DIR}") + +find_path(TWEEK12_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(TWEEK12_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(TWEEK12_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(TWEEK12) + +# Dependency +if(NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Tweek12 + DEFAULT_MSG + TWEEK12_LIBRARY + TWEEK12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR) + +if(TWEEK12_FOUND) + set(_DEPS ${VPR20_LIBRARIES}) + + set(TWEEK12_INCLUDE_DIRS ${TWEEK12_INCLUDE_DIR}) + list(APPEND TWEEK12_INCLUDE_DIRS ${VPR20_INCLUDE_DIRS}) + + clean_directory_list(TWEEK12_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(TWEEK12 ${_DEPS}) + else() + clean_library_list(TWEEK12_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(TWEEK12_ROOT_DIR) +endif() + +mark_as_advanced(TWEEK12_LIBRARY_RELEASE + TWEEK12_LIBRARY_DEBUG + TWEEK12_INCLUDE_DIR) diff --git a/FindVPR20.cmake b/FindVPR20.cmake new file mode 100644 index 0000000..fc42ba6 --- /dev/null +++ b/FindVPR20.cmake @@ -0,0 +1,276 @@ +# - try to find VPR 2.0 library +# Requires Boost 1.33.1 or greater (including filesystem and signals libraries) +# (and thus FindBoost.cmake from 2.8rc3 or newer, preferably) +# Requires NSPR4 (and PLC4) on Windows +# Requires pthreads on Unix (Mac or Linux) +# Requires libuuid on Linux +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# VPR20_LIBRARY_DIR, library search path +# VPR20_INCLUDE_DIR, include search path +# VPR20_LIBRARY, the library to link against +# VPR20_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VPR20_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(_HUMAN "VPR 2.0") +set(_RELEASE_NAMES vpr-2_0 libvpr-2_0) +set(_DEBUG_NAMES vpr_d-2_0 libvpr_d-2_0) +set(_DIR vpr-2.0) +set(_HEADER vpr/vpr.h) +set(_FP_PKG_NAME vpr) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VPR20_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VPR20_ROOT_DIR + "${VPR20_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VPR") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(VPR20_ROOT_DIR) +endif() +if(NOT VPR20_ROOT_DIR) + set(VPR20_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VPR20_ROOT_DIR}") + +find_path(VPR20_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(VPR20_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VPR20_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VPR20) + +# Dependencies +set(_deps_libs) +set(_deps_includes) +set(_deps_check) +if(COMMAND cmake_policy) + cmake_policy(SET CMP0011 NEW) + cmake_policy(SET CMP0012 NEW) +endif() +if((NOT "${Boost_FOUND}") + OR (NOT "${Boost_FILESYSTEM_FOUND}") + OR (NOT "${Boost_SIGNALS_FOUND}") + OR (Boost_VERSION GREATER 103401 AND NOT Boost_SYSTEM_FOUND)) + if(VPR20_LIBRARY_RELEASE) + # Find Boost in the same place as VPR + get_filename_component(VPR20_LIBRARY_DIR + ${VPR20_LIBRARY_RELEASE} + PATH) + set(BOOST_ROOT ${VPR20_LIBRARY_DIR}/../) + + if(APPLE) + # VR Juggler 2.2.1 binaries for Mac are built against single-threaded boost. + set(Boost_USE_STATIC_LIBS ON) + #set(Boost_USE_MULTITHREADED OFF) + endif() + + find_package(Boost + 1.33.1 + ${_FIND_FLAGS} + COMPONENTS + filesystem + signals) + + mark_as_advanced(Boost_LIB_DIAGNOSTIC_DEFINITIONS) + + if(WIN32 AND NOT Boost_FOUND) + if(NOT VPR20_FIND_QUIETLY) + message(STATUS + "Searching for Boost using forced '-vc80' override...") + endif() + set(Boost_COMPILER "-vc80") + find_package(Boost + 1.33.1 + ${_FIND_FLAGS} + COMPONENTS + filesystem + signals) + endif() + + if(Boost_VERSION GREATER 103401) + find_package(Boost + ${_FIND_FLAGS} + COMPONENTS + filesystem + system + signals) + endif() + endif() + +endif() + +list(APPEND + _deps_libs + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_SIGNALS_LIBRARY}) +list(APPEND _deps_includes ${Boost_INCLUDE_DIRS}) +list(APPEND + _deps_check + Boost_FILESYSTEM_LIBRARY + Boost_SIGNALS_LIBRARY + Boost_INCLUDE_DIRS) + +if(NOT CPPDOM_FOUND) + find_package(CPPDOM ${_FIND_FLAGS}) +endif() + +list(APPEND _deps_libs ${CPPDOM_LIBRARIES}) +list(APPEND _deps_includes ${CPPDOM_INCLUDE_DIRS}) +list(APPEND _deps_check CPPDOM_LIBRARIES CPPDOM_INCLUDE_DIRS) + +if(UNIX AND NOT WIN32) + if(NOT THREADS_FOUND) + find_package(Threads ${_FIND_FLAGS}) + endif() + + list(APPEND _deps_check THREADS_FOUND) + list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT}) + + if(NOT APPLE) + find_library(VPR20_libuuid_LIBRARY NAMES uuid) + mark_as_advanced(VPR20_libuuid_LIBRARY) + list(APPEND _deps_check VPR20_libuuid_LIBRARY) + list(APPEND _deps_libs ${VPR20_libuuid_LIBRARY}) + endif() +endif() + +if(WIN32) + find_library(VPR20_libnspr4_LIBRARY + NAMES + nspr4 + libnspr4 + HINTS + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + "${_ROOT_DIR}" + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} NSPR4 library full path") + + find_library(VPR20_libplc4_LIBRARY + NAMES + plc4 + libplc4 + HINTS + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + "${_ROOT_DIR}" + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} PLC4 library full path") + mark_as_advanced(VPR20_libnspr4_LIBRARY VPR20_libplc4_LIBRARY) + list(APPEND _deps_check VPR20_libnspr4_LIBRARY VPR20_libplc4_LIBRARY) + list(APPEND + _deps_libs + ${VPR20_libnspr4_LIBRARY} + ${VPR20_libplc4_LIBRARY}) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VPR20 + DEFAULT_MSG + VPR20_LIBRARY + VPR20_INCLUDE_DIR + ${_deps_check}) + +if(VPR20_FOUND) + + set(VPR20_INCLUDE_DIRS "${VPR20_INCLUDE_DIR}" ${_deps_includes}) + + clean_directory_list(VPR20_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(VPR20 ${_deps_libs}) + else() + clean_library_list(VPR20_LIBRARIES ${VPR20_LIBRARY} ${_deps_libs}) + endif() + + mark_as_advanced(VPR20_ROOT_DIR) +endif() + +mark_as_advanced(VPR20_LIBRARY_RELEASE + VPR20_LIBRARY_DEBUG + VPR20_INCLUDE_DIR) diff --git a/FindVPS.cmake b/FindVPS.cmake new file mode 100644 index 0000000..bf6ce91 --- /dev/null +++ b/FindVPS.cmake @@ -0,0 +1,304 @@ +# - try to find VPS library +# +# VPS_LIBRARY_DIR, library search path +# VPS_INCLUDE_DIR, include search path +# VPS_{component}_LIBRARY, the library to link against +# VPS_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VPS_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(SelectLibraryConfigurations) +include(ListCombinations) +include(CheckVersion) +include(ListFilter) + +set(VPS_ROOT_DIR + "${VPS_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VPS") + +# Try the config file mode. +find_package(VPS QUIET NO_MODULE) +if(VPS_FOUND) + mark_as_advanced(VPS_DIR VPS_ROOT_DIR) + return() +endif() + +if(NOT BITS) + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(BITS 64) + else() + set(BITS 32) + endif() +endif() + +set(_vpslibnames) +set(_grviewerlibnames) + +### +# Cray MTA(Multi-Threaded Architecture) family: CMake build not tested +if("${CMAKE_SYSTEM_NAME}" STREQUAL "MTX") + set(VPS_PLATFORM MTX) + set(_VPS_FLAGS_32 "-pl all.pl -par") + set(_VPS_FLAGS_64 "-pl all.pl -par") +### +# Linux +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + set(VPS_PLATFORM LINUX) + set(_VPS_FLAGS_32 "-O2 -Wno-write-strings") + set(_VPS_FLAGS_64 "-m64 -O3 -ffast-math -funroll-all-loops -Wno-write-strings") + +### +# IBM-AIX: CMake build not tested +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "AIX") + set(VPS_PLATFORM AIX) + set(_VPS_FLAGS_32 "-q32") + set(_VPS_FLAGS_64 "-q64") + +### +# HP-UX: CMake build not tested +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "HP-UX") + set(VPS_PLATFORM HPUX) + set(_VPS_FLAGS_32 "-O") + +### +# SunOS: CMake build not tested +elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") + set(VPS_PLATFORM SOLARIS) + set(_VPS_FLAGS_32 "-O") + +### +# IRIX: CMake build not tested +elseif("${CMAKE_SYSTEM_NAME}" MATCHES "IRIX") + set(VPS_PLATFORM IRIX) + set(_VPS_FLAGS_32 "-O2 -OPT") + set(_VPS_FLAGS_64 "-64 -O2 -OPT") + +### +# Mac OS X +elseif(APPLE AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + set(VPS_PLATFORM MACOSX) + set(_VPS_FLAGS_32 "-O2 -lm -lobjc -lstdc++ -Wno-write-strings") + set(_VPS_FLAGS_64 "-m64 -O3 -ffast-math -funroll-all-loops -lm -lobjc -lstdc++ -Wno-write-strings") + +### +# Windows +elseif(WIN32) + set(VPS_PLATFORM WINDOWS) + set(_VPS_FLAGS_32 "-O2") + set(_VPS_FLAGS_64 "-O2") + + if(MSVC) + set(DEFS_32 -D_CRT_SECURE_NO_DEPRECATE) + set(DEFS_64 -D_CRT_SECURE_NO_DEPRECATE) + if(MSVC60) + set(VPS_CRT "VC6") + elseif(MSVC70) + set(VPS_CRT "VC7") + elseif(MSVC71) + set(VPS_CRT "VC71") + elseif(MSVC80) + set(VPS_CRT "VC8") + elseif(MSVC90) + set(VPS_CRT "VC9") + elseif(MSVC10) + set(VPS_CRT "VC10") + else() + set(VPS_CRT "VC") + endif() + endif() +endif() + +if(WIN32 AND MSVC) + set(PLATFORM win${BITS}) + set(_threadsuffix Mt) + if(MSVC71) + set(VC_VER vc71) + set(VC_VER_LONG vc71) + elseif(MSVC80) + set(VC_SHORT VC8) + set(VC_LONG MSVC80) + elseif(MSVC90) + set(VC_SHORT VC9) + set(VC_LONG MSVC90) + endif() + list(APPEND + _vpslibnames + "Vps${VC_SHORT}_${BITS}" + "Vps${VC_SHORT}_${BITS}${_threadsuffix}") +endif() + +list(APPEND _vpslibnames "Vps${VPS_PLATFORM}${VPS_CRT}_${BITS}") +list(APPEND + _grviewerlibnames + "Viewer" + "GrViewer${VPS_PLATFORM}${VPS_CRT}_${BITS}") + +### +# Configure VPS +### + +set(_incsearchdirs) +set(_libsearchdirs) + +if(WIN32) + include(ProgramFilesGlob) + program_files_glob(_dirs "/VPS*/") + program_files_glob(_dirs2 "/VPS/*/") + list(APPEND _dirs ${_dirs2}) +endif() + +list_combinations(_libsearchdirs + PREFIXES + "${VPS_ROOT_DIR}" + "${_dirs}" + SUFFIXES + "/lib" + "/Viewer") +list_combinations(_libsearchdirs2 + PREFIXES + ${_libsearchdirs} + SUFFIXES + "/Release" + "/RelWithDebInfo" + "/MinSizeRel" + "/Debug") +clean_directory_list(_libsearchdirs ${_libsearchdirs2}) + +list_combinations(_incsearchdirs + PREFIXES + "${VPS_ROOT_DIR}" + "${_dirs}" + SUFFIXES + "/include" + "/include/vps" + "/src" + "/../src" + "/Viewer" + "/../Viewer") +clean_directory_list(_incsearchdirs) + +# If a version was specified, the least we can do is remove any directories +# from our search that contain too low of versions +if(VPS_FIND_VERSION) + + set(_badversions) + foreach(_dir ${_libsearchdirs}) + string(REGEX MATCH "([0-9]).([0-9]).([0-9])" _ver "${_dir}") + if(_ver) + string(REGEX + REPLACE + "([0-9]).([0-9]).([0-9])" + "\\1.\\2.\\3" + _verstd + "${_ver}") + check_version(_result VPS "${_verstd}") + if(NOT _result) + list(APPEND _badversions "${_verstd}") + endif() + endif() + endforeach() + + foreach(_badver ${_badversions}) + list_filter_out(_libsearchdirs ${_badver} ${_libsearchdirs}) + list_filter_out(_incsearchdirs ${_badver} ${_incsearchdirs}) + endforeach() +endif() +if(_libsearchdirs) + list(SORT _libsearchdirs) + list(REVERSE _libsearchdirs) +endif() + +if(_incsearchdirs) + list(SORT _incsearchdirs) + list(REVERSE _incsearchdirs) +endif() + +find_library(VPS_vps_LIBRARY + NAMES + ${_vpslibnames} + PATH_SUFFIXES + LP + HINTS + ${_libsearchdirs} + PATHS + ${VPS_ROOT_DIR} + ${VPS_ROOT_DIR}/src + ${VPS_ROOT_DIR}/lib) + +find_path(VPS_vps_INCLUDE_DIR + NAMES + Vps.h + HINTS + ${_incsearchdirs} + PATHS + ${VPS_ROOT_DIR} + PATH_SUFFIXES + include + include/vps + src) + +find_library(VPS_grviewer_LIBRARY + NAMES + ${_grviewerlibnames} + HINTS + ${_libsearchdirs} + PATHS + ${VPS_ROOT_DIR} + PATH_SUFFIXES + lib + Viewer) + +find_path(VPS_grviewer_INCLUDE_DIR + NAMES + grViewerLib.h + HINTS + ${_incsearchdirs} + PATHS + ${VPS_ROOT_DIR} + PATH_SUFFIXES + include + include/vps + Viewer) + +mark_as_advanced(VPS_vps_LIBRARY + VPS_vps_INCLUDE_DIR + VPS_grviewer_LIBRARY + VPS_grviewer_INCLUDE_DIR) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VPS + DEFAULT_MSG + VPS_vps_LIBRARY + VPS_vps_INCLUDE_DIR) + +if(VPS_FOUND) + set(VPS_vps_INCLUDE_DIRS "${VPS_vps_INCLUDE_DIR}") + set(VPS_INCLUDE_DIRS "${VPS_vps_INCLUDE_DIR}") + set(VPS_grviewer_INCLUDE_DIRS + "${VPS_vps_INCLUDE_DIR}" + "${VPS_grviewer_INCLUDE_DIR}") + set(VPS_LIBRARIES "${VPS_vps_LIBRARY}") + set(VPS_grviewer_LIBRARIES + "${VPS_vps_LIBRARY}" + "${VPS_grviewer_LIBRARY}") + mark_as_advanced(VPS_ROOT_DIR VPS_DIR) +endif() diff --git a/FindVRJ22.cmake b/FindVRJ22.cmake new file mode 100644 index 0000000..fa90c88 --- /dev/null +++ b/FindVRJ22.cmake @@ -0,0 +1,210 @@ +# - try to find VR Juggler 2.2 core library +# Requires JCCL 1.2, Gadgeteer 1.2, VPR 2.0, and Sonix 1.2 +# (thus FindJCCL12.cmake, FindGadgeteer12.cmake, FindVPR20.cmake, +# and FindSonix12.cmake) +# Requires X11 if not on Mac or Windows. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# VRJ22_LIBRARY_DIR, library search path +# VRJ22_INCLUDE_DIR, include search path +# VRJ22_LIBRARY, the library to link against +# VRJ22_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VRJ22_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +set(_HUMAN "VR Juggler 2.2 Core") +set(_RELEASE_NAMES vrj-2_2 libvrj-2_2) +set(_DEBUG_NAMES vrj_d-2_2 libvrj_d-2_2) +set(_DIR vrjuggler-2.2) +set(_HEADER vrj/Kernel/Kernel.h) +set(_FP_PKG_NAME vrjuggler) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VRJ22_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_include_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_extra_libs(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VRJ22_ROOT_DIR + "${VRJ22_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VRJ") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(VRJ22_ROOT_DIR) +endif() +if(NOT VRJ22_ROOT_DIR) + set(VRJ22_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VRJ22_ROOT_DIR}") + +find_path(VRJ22_INCLUDE_DIR + ${_HEADER} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_INCLUDE_DIRS} + PATH_SUFFIXES + ${_DIR} + include/${_DIR} + include/ + DOC + "Path to ${_HUMAN} includes root") + +find_library(VRJ22_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VRJ22_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VRJ22) + +# Dependencies +if(NOT JCCL12_FOUND) + find_package(JCCL12 ${_FIND_FLAGS}) +endif() + +if(NOT GADGETEER12_FOUND) + find_package(Gadgeteer12 ${_FIND_FLAGS}) +endif() + +if(NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +endif() + +if(NOT SONIX12_FOUND) + find_package(Sonix12 ${_FIND_FLAGS}) +endif() + +if(UNIX AND NOT APPLE AND NOT WIN32) + if(NOT X11_FOUND) + find_package(X11 ${_FIND_FLAGS}) + endif() + set(_CHECK_EXTRAS + X11_FOUND + X11_X11_LIB + X11_ICE_LIB + X11_SM_LIB + X11_INCLUDE_DIR) +endif() +if(UNIX AND NOT WIN32) + find_library(VRJ22_libm_LIBRARY m) + mark_as_advanced(VRJ22_libm_LIBRARY) + list(APPEND _CHECK_EXTRAS VRJ22_libm_LIBRARY) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VRJ22 + DEFAULT_MSG + VRJ22_LIBRARY + VRJ22_INCLUDE_DIR + JCCL12_FOUND + JCCL12_LIBRARIES + JCCL12_INCLUDE_DIR + GADGETEER12_FOUND + GADGETEER12_LIBRARIES + GADGETEER12_INCLUDE_DIR + VPR20_FOUND + VPR20_LIBRARIES + VPR20_INCLUDE_DIR + SONIX12_FOUND + SONIX12_LIBRARIES + SONIX12_INCLUDE_DIR + ${_CHECK_EXTRAS}) + +if(VRJ22_FOUND) + set(_DEPS + ${JCCL12_LIBRARIES} + ${GADGETEER12_LIBRARIES} + ${VPR20_LIBRARIES} + ${SONIX12_LIBRARIES}) + if(UNIX AND NOT APPLE AND NOT WIN32) + list(APPEND _DEPS ${X11_X11_LIB} ${X11_ICE_LIB} ${X11_SM_LIB}) + endif() + if(UNIX AND NOT WIN32) + list(APPEND _DEPS ${VRJ22_libm_LIBRARY}) + endif() + + set(VRJ22_INCLUDE_DIRS "${VRJ22_INCLUDE_DIR}") + list(APPEND + VRJ22_INCLUDE_DIRS + ${JCCL12_INCLUDE_DIRS} + ${GADGETEER12_INCLUDE_DIRS} + ${VPR20_INCLUDE_DIRS} + ${SONIX12_INCLUDE_DIRS}) + clean_directory_list(VRJ22_INCLUDE_DIRS) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(VRJ22 ${_DEPS}) + else() + clean_library_list(VRJ22_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(VRJ22_ROOT_DIR) +endif() + +mark_as_advanced(VRJ22_LIBRARY_RELEASE + VRJ22_LIBRARY_DEBUG + VRJ22_INCLUDE_DIR) diff --git a/FindVRJOGL22.cmake b/FindVRJOGL22.cmake new file mode 100644 index 0000000..7e7c8a9 --- /dev/null +++ b/FindVRJOGL22.cmake @@ -0,0 +1,161 @@ +# - try to find VRJuggler 2.2 OpenGL library +# Requires VRJ core 2.2 (thus FindVRJ22.cmake) +# Requires OpenGL. +# Optionally uses Flagpoll and FindFlagpoll.cmake +# +# This library is a part of VR Juggler 2.2 - you probably want to use +# find_package(VRJuggler22) instead, for an easy interface to this and +# related scripts. See FindVRJuggler22.cmake for more information. +# +# VRJOGL22_LIBRARY_DIR, library search path +# VRJOGL22_INCLUDE_DIRS, include search path for dependencies +# VRJOGL22_LIBRARY, the library to link against +# VRJOGL22_FOUND, If false, do not try to use this library. +# +# Plural versions refer to this library and its dependencies, and +# are recommended to be used instead, unless you have a good reason. +# +# Useful configuration variables you might want to add to your cache: +# VRJOGL22_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# This script will use Flagpoll, if found, to provide hints to the location +# of this library, but does not use the compiler flags returned by Flagpoll +# directly. +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when searching for this component, so most sane build environments should +# "just work." Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +set(_HUMAN "VR Juggler 2.2 OpenGL Core") +set(_RELEASE_NAMES vrj_ogl-2_2 libvrj_ogl-2_2) +set(_DEBUG_NAMES vrj_ogl_d-2_2 libvrj_ogl_d-2_2) +set(_DIR vrjuggler-2.2) +set(_FP_PKG_NAME vrjuggler-opengl) + +include(SelectLibraryConfigurations) +include(CreateImportedTarget) +include(CleanLibraryList) +include(CleanDirectoryList) + +if(VRJOGL22_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +# Try flagpoll. +find_package(Flagpoll QUIET) + +if(FLAGPOLL) + flagpoll_get_library_dirs(${_FP_PKG_NAME} NO_DEPS) + flagpoll_get_library_names(${_FP_PKG_NAME} NO_DEPS) +endif() + +set(VRJOGL22_ROOT_DIR + "${VRJOGL22_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VRJOGL") +if(DEFINED VRJUGGLER22_ROOT_DIR) + mark_as_advanced(VRJOGL22_ROOT_DIR) +endif() +if(NOT VRJOGL22_ROOT_DIR) + set(VRJOGL22_ROOT_DIR "${VRJUGGLER22_ROOT_DIR}") +endif() + +set(_ROOT_DIR "${VRJOGL22_ROOT_DIR}") + +find_library(VRJOGL22_LIBRARY_RELEASE + NAMES + ${_RELEASE_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBSUFFIXES} + DOC + "${_HUMAN} release library full path") + +find_library(VRJOGL22_LIBRARY_DEBUG + NAMES + ${_DEBUG_NAMES} + HINTS + "${_ROOT_DIR}" + ${${_FP_PKG_NAME}_FLAGPOLL_LIBRARY_DIRS} + PATH_SUFFIXES + ${_VRJ_LIBDSUFFIXES} + DOC + "${_HUMAN} debug library full path") + +select_library_configurations(VRJOGL22) + +# Dependency +if(NOT VRJ22_FOUND) + find_package(VRJ22 ${_FIND_FLAGS}) +endif() + +if(NOT OPENGL_FOUND) + find_package(OpenGL ${_FIND_FLAGS}) +endif() + +if(APPLE) + set(VRJOGL22_AppKit_LIBRARY + "-framework AppKit" + CACHE + STRING + "AppKit framework for OSX") + set(VRJOGL22_Cocoa_LIBRARY + "-framework Cocoa" + CACHE + STRING + "Cocoa framework for OSX") + mark_as_advanced(VRJOGL22_AppKit_LIBRARY VRJOGL22_Cocoa_LIBRARY) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VRJOGL22 + DEFAULT_MSG + VRJOGL22_LIBRARY + VRJ22_FOUND + VRJ22_LIBRARIES + VRJ22_INCLUDE_DIRS + OPENGL_FOUND + OPENGL_LIBRARIES) + +if(VRJOGL22_FOUND) + set(_DEPS ${VRJ22_LIBRARIES} ${OPENGL_LIBRARIES}) + if(APPLE) + list(APPEND + _DEPS + ${VRJOGL22_AppKit_LIBRARY} + ${VRJOGL22_Cocoa_LIBRARY}) + endif() + + set(VRJOGL22_INCLUDE_DIRS ${VRJ22_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS}) + + if(VRJUGGLER22_CREATE_IMPORTED_TARGETS) + create_imported_target(VRJOGL22 ${_DEPS}) + else() + clean_library_list(VRJOGL22_LIBRARIES ${_DEPS}) + endif() + + mark_as_advanced(VRJOGL22_ROOT_DIR) +endif() + +mark_as_advanced(VRJOGL22_LIBRARY_RELEASE VRJOGL22_LIBRARY_DEBUG) diff --git a/FindVRJuggler22.cmake b/FindVRJuggler22.cmake new file mode 100644 index 0000000..e54f7e7 --- /dev/null +++ b/FindVRJuggler22.cmake @@ -0,0 +1,509 @@ +# - try to find VRJuggler 2.2-related packages (main finder) +# VRJUGGLER22_LIBRARY_DIRS, library search paths +# VRJUGGLER22_INCLUDE_DIRS, include search paths +# VRJUGGLER22_LIBRARIES, the libraries to link against +# VRJUGGLER22_ENVIRONMENT +# VRJUGGLER22_RUNTIME_LIBRARY_DIRS +# VRJUGGLER22_CXX_FLAGS +# VRJUGGLER22_DEFINITIONS +# VRJUGGLER22_FOUND, If false, do not try to use VR Juggler 2.2. +# +# Components available to search for (uses "VRJOGL22" by default): +# VRJOGL22 +# VRJ22 +# Gadgeteer12 +# JCCL12 +# VPR20 +# Sonix12 +# Tweek12 +# +# Additionally, a full setup requires these packages and their Find_.cmake scripts +# CPPDOM +# GMTL +# +# Optionally uses Flagpoll (and FindFlagpoll.cmake) +# +# Notes on components: +# - All components automatically include their dependencies. +# - You can search for the name above with or without the version suffix. +# - If you do not specify a component, VRJOGL22(the OpenGL view manager) +# will be used by default. +# - Capitalization of component names does not matter, but it's best to +# pretend it does and use the above capitalization. +# - Since this script calls find_package for your requested components and +# their dependencies, you can use any of the variables specified in those +# files in addition to the "summary" ones listed here, for more finely +# controlled building and linking. +# +# This CMake script requires all of the Find*.cmake scripts for the +# components listed above, as it is only a "meta-script" designed to make +# using those scripts more developer-friendly. +# +# Useful configuration variables you might want to add to your cache: +# (CAPS COMPONENT NAME)_ROOT_DIR - A directory prefix to search +# (a path that contains include/ as a subdirectory) +# +# The VJ_BASE_DIR environment variable is also searched (preferentially) +# when seeking any of the above components, as well as Flagpoll, CPPDOM, +# and Boost (from within VPR20), so most sane build environments should +# "just work." +# +# IMPORTANT: Note that you need to manually re-run CMake if you change +# this environment variable, because it cannot auto-detect this change +# and trigger an automatic re-run. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(CleanLibraryList) +include(CleanDirectoryList) +include(FindPackageMessage) + +set(VRJUGGLER22_ROOT_DIR + "${VRJUGGLER22_ROOT_DIR}" + CACHE + PATH + "Additional root directory to search for VR Juggler and its dependencies.") +if(NOT VRJUGGLER22_ROOT_DIR) + file(TO_CMAKE_PATH "$ENV{VJ_BASE_DIR}" VRJUGGLER22_ROOT_DIR) +endif() + +# Default required components +if(NOT VRJuggler22_FIND_COMPONENTS) + set(VRJuggler22_FIND_COMPONENTS vrjogl22) +endif() + +if(VRJuggler22_FIND_QUIETLY) + set(_FIND_FLAGS "QUIET") +else() + set(_FIND_FLAGS "") +endif() + +set(VRJUGGLER22_SUBMODULES + VRJ22 + VRJOGL22 + Gadgeteer12 + JCCL12 + VPR20 + Sonix12 + Tweek12) +string(TOUPPER "${VRJUGGLER22_SUBMODULES}" VRJUGGLER22_SUBMODULES_UC) +string(TOUPPER + "${VRJuggler22_FIND_COMPONENTS}" + VRJUGGLER22_FIND_COMPONENTS_UC) + +# Turn a potentially messy components list into a nice one with versions. +set(VRJUGGLER22_REQUESTED_COMPONENTS) +foreach(VRJUGGLER22_LONG_NAME ${VRJUGGLER22_SUBMODULES_UC}) + # Look at requested components + foreach(VRJUGGLER22_REQUEST ${VRJUGGLER22_FIND_COMPONENTS_UC}) + string(REGEX + MATCH + "${VRJUGGLER22_REQUEST}" + VRJUGGLER22_MATCHING + "${VRJUGGLER22_LONG_NAME}") + if(VRJUGGLER22_MATCHING) + list(APPEND + VRJUGGLER22_REQUESTED_COMPONENTS + ${VRJUGGLER22_LONG_NAME}) + list(APPEND + VRJUGGLER22_COMPONENTS_FOUND + ${VRJUGGLER22_LONG_NAME}_FOUND) + endif() + endforeach() +endforeach() + +if(VRJUGGLER22_REQUESTED_COMPONENTS) + list(REMOVE_DUPLICATES VRJUGGLER22_REQUESTED_COMPONENTS) +endif() + +if(VRJUGGLER22_COMPONENTS_FOUND) + list(REMOVE_DUPLICATES VRJUGGLER22_COMPONENTS_FOUND) +endif() + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_VRJ_LIBSUFFIXES lib64 lib) + set(_VRJ_LIBDSUFFIXES + debug + lib64/x86_64/debug + lib64/debug + lib64 + lib/x86_64/debug + lib/debug + lib) + set(_VRJ_LIBDSUFFIXES_ONLY + debug + lib64/x86_64/debug + lib64/debug + lib/x86_64/debug + lib/debug) +else() + set(_VRJ_LIBSUFFIXES lib) + set(_VRJ_LIBDSUFFIXES debug lib/i686/debug lib/debug lib) + set(_VRJ_LIBDSUFFIXES_ONLY debug lib/i686/debug lib/debug) +endif() + +if(NOT VRJuggler22_FIND_QUIETLY + AND NOT VRJUGGLER22_FOUND + AND NOT "${_VRJUGGLER22_SEARCH_COMPONENTS}" STREQUAL "${VRJUGGLER22_REQUESTED_COMPONENTS}") + message(STATUS + "Searching for these requested VR Juggler 2.2 components and their dependencies: ${VRJUGGLER22_REQUESTED_COMPONENTS}") +endif() + +# Find components +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "VRJOGL22" AND NOT VRJOGL22_FOUND) + find_package(VRJOGL22 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "VRJ22" AND NOT VRJ22_FOUND) + find_package(VRJ22 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "JCCL12" AND NOT JCCL12_FOUND) + find_package(JCCL22 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "GADGETEER12" AND NOT GADGETEER12_FOUND) + find_package(Gadgeteer12 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "SONIX12" AND NOT SONIX12_FOUND) + find_package(Sonix12 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "TWEEK12" AND NOT TWEEK12_FOUND) + find_package(Tweek12 ${_FIND_FLAGS}) +endif() + +if("${VRJUGGLER22_REQUESTED_COMPONENTS}" MATCHES "VPR20" AND NOT VPR20_FOUND) + find_package(VPR20 ${_FIND_FLAGS}) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VRJuggler22 + DEFAULT_MSG + ${VRJUGGLER22_COMPONENTS_FOUND}) + +if(VRJUGGLER22_FOUND) + foreach(VRJUGGLER22_REQUEST ${VRJUGGLER22_REQUESTED_COMPONENTS}) + list(APPEND VRJUGGLER22_LIBRARIES ${${VRJUGGLER22_REQUEST}_LIBRARIES}) + list(APPEND + VRJUGGLER22_INCLUDE_DIRS + ${${VRJUGGLER22_REQUEST}_INCLUDE_DIRS}) + endforeach() + + clean_library_list(VRJUGGLER22_LIBRARIES) + + clean_directory_list(VRJUGGLER22_INCLUDE_DIRS) + + set(_vjbase) + set(_vjbaseclean) + foreach(_lib + ${VPR20_LIBRARY} + ${VRJ22_LIBRARY} + ${VRJOGL22_LIBRARY} + ${JCCL12_LIBRARY} + ${GADGETEER12_LIBRARY}) + get_filename_component(_libpath "${_lib}" PATH) + get_filename_component(_abspath "${_libpath}/.." ABSOLUTE) + list(APPEND _vjbase "${_abspath}") + endforeach() + + clean_directory_list(_vjbase) + + set(_vrj22_have_base_dir NO) + list(LENGTH _vjbase _vjbaselen) + if("${_vjbaselen}" EQUAL 1 AND NOT VRJUGGLER22_VJ_BASE_DIR) + list(GET _vjbase 0 VRJUGGLER22_VJ_BASE_DIR) + mark_as_advanced(VRJUGGLER22_VJ_BASE_DIR) + if(NOT VRJUGGLER22_VJ_BASE_DIR STREQUAL _vrj22_base_dir) + unset(VRJUGGLER22_VJ_CFG_DIR) + endif() + set(_vrj22_have_base_dir YES) + else() + list(GET _vjbase 0 _calculated_base_dir) + if(NOT + "${_calculated_base_dir}" + STREQUAL + "${VRJUGGLER22_VJ_BASE_DIR}") + message("It looks like you might be mixing VR Juggler versions... ${_vjbaselen} ${_vjbase}") + message("If you are, fix your libraries then remove the VRJUGGLER22_VJ_BASE_DIR variable in CMake, then configure again") + message("If you aren't, set the VRJUGGLER22_VJ_BASE_DIR variable to the desired VJ_BASE_DIR to use when running") + else() + if(NOT VRJUGGLER22_VJ_BASE_DIR STREQUAL _vrj22_base_dir) + unset(VRJUGGLER22_VJ_CFG_DIR) + endif() + set(_vrj22_have_base_dir YES) + endif() + endif() + + set(_vrj22_base_dir "${VRJUGGLER22_VJ_BASE_DIR}") + set(_vrj22_base_dir "${_vrj22_base_dir}" CACHE INTERNAL "" FORCE) + + if(_vrj22_have_base_dir) + file(GLOB + _poss_dirs + ${VRJUGGLER22_VJ_BASE_DIR}/share/vrjuggler*/data/configFiles) + find_path(VRJUGGLER22_VJ_CFG_DIR + standalone.jconf + PATHS + ${_poss_dirs} + NO_DEFAULT_PATH) + mark_as_advanced(VRJUGGLER22_VJ_CFG_DIR) + endif() + + set(VRJUGGLER22_VJ_BASE_DIR + "${VRJUGGLER22_VJ_BASE_DIR}" + CACHE + PATH + "Base directory to use as VJ_BASE_DIR when running your app." + FORCE) + set(VRJUGGLER22_ENVIRONMENT + "VJ_BASE_DIR=${VRJUGGLER22_VJ_BASE_DIR}" + "JCCL_BASE_DIR=${VRJUGGLER22_VJ_BASE_DIR}" + "SONIX_BASE_DIR=${VRJUGGLER22_VJ_BASE_DIR}" + "TWEEK_BASE_DIR=${VRJUGGLER22_VJ_BASE_DIR}" + "VJ_CFG_DIR=${VRJUGGLER22_VJ_CFG_DIR}") + + include(GetDirectoryList) + + get_directory_list(VRJUGGLER22_RUNTIME_LIBRARY_DIRS + ${VRJUGGLER22_LIBRARIES}) + if(WIN32) + foreach(dir ${VRJUGGLER22_RUNTIME_LIBRARY_DIRS}) + list(APPEND VRJUGGLER22_RUNTIME_LIBRARY_DIRS "${dir}/../bin") + endforeach() + endif() + + if(MSVC) + # Needed to make linking against boost work with 2.2.1 binaries - rp20091022 + # BOOST_ALL_DYN_LINK + set(VRJUGGLER22_DEFINITIONS + "-DBOOST_ALL_DYN_LINK" + "-DCPPDOM_DYN_LINK" + "-DCPPDOM_AUTO_LINK") + + # Disable these annoying warnings + # 4275: non dll-interface class used as base for dll-interface class + # 4251: needs to have dll-interface to be used by clients of class + # 4100: unused parameter + # 4512: assignment operator could not be generated + # 4127: (Not currently disabled) conditional expression in loop evaluates to constant + + set(VRJUGGLER22_CXX_FLAGS "/wd4275 /wd4251 /wd4100 /wd4512") + elseif(CMAKE_COMPILER_IS_GNUCXX) + # Silence annoying warnings about deprecated hash_map. + set(VRJUGGLER22_CXX_FLAGS "-Wno-deprecated") + + set(VRJUGGLER22_DEFINITIONS "") + endif() + set(VRJUGGLER22_CXX_FLAGS + "${VRJUGGLER22_CXX_FLAGS} ${CPPDOM_CXX_FLAGS}") + + list(APPEND VRJUGGLER22_DEFINITIONS + "-DJUGGLER_DEBUG") + + set(_VRJUGGLER22_SEARCH_COMPONENTS + "${VRJUGGLER22_REQUESTED_COMPONENTS}" + CACHE + INTERNAL + "Requested components, used as a flag.") + + + + set(_plugin_dirs) + foreach(_libdir ${VRJUGGLER22_RUNTIME_LIBRARY_DIRS}) + # Find directories of Gadgeteer plugins and drivers + if(EXISTS "${_libdir}/gadgeteer") + list(APPEND + _plugin_dirs + "${_libdir}/gadgeteer/drivers" + "${_libdir}/gadgeteer/plugins") + elseif(EXISTS "${_libdir}/gadgeteer-1.2") + list(APPEND + _plugin_dirs + "${_libdir}/gadgeteer-1.2/drivers" + "${_libdir}/gadgeteer-1.2/plugins") + endif() + + # Find directories of Sonix plugins + if(EXISTS "${_libdir}/sonix") + list(APPEND _plugin_dirs "${_libdir}/sonix/plugins/dbg") + list(APPEND _plugin_dirs "${_libdir}/sonix/plugins/opt") + elseif(EXISTS "${_libdir}/sonix-1.2") + list(APPEND _plugin_dirs "${_libdir}/sonix-1.2/plugins/dbg") + list(APPEND _plugin_dirs "${_libdir}/sonix-1.2/plugins/opt") + endif() + endforeach() + + # Grab the actual plugins + foreach(_libdir ${_plugin_dirs}) + if(EXISTS "${_libdir}") + list(APPEND VRJUGGLER22_RUNTIME_LIBRARY_DIRS "${_libdir}") + file(GLOB _plugins "${_libdir}/*${CMAKE_SHARED_LIBRARY_SUFFIX}") + list(APPEND VRJUGGLER22_BUNDLE_PLUGINS ${_plugins}) + endif() + endforeach() + + mark_as_advanced(VRJUGGLER22_ROOT_DIR) +endif() + +mark_as_advanced(VRJUGGLER22_DEFINITIONS) + +function(install_vrjuggler22_data_files prefix) + set(base "${VRJUGGLER22_VJ_CFG_DIR}/..") + get_filename_component(base "${base}" ABSOLUTE) + file(RELATIVE_PATH reldest "${VRJUGGLER22_VJ_BASE_DIR}" "${base}") + if(prefix STREQUAL "" OR prefix STREQUAL "." OR prefix STREQUAL "./") + set(DEST "${reldest}") + else() + set(DEST "${prefix}/${reldest}") + endif() + + # configFiles *.jconf + file(GLOB + _vj_config_files + "${base}/configFiles/*.jconf") + install(FILES ${_vj_config_files} DESTINATION "${DEST}/configFiles/") + + # definitions *.jdef + file(GLOB + _vj_defs_files + "${base}/definitions/*.jdef") + install(FILES ${_vj_defs_files} DESTINATION "${DEST}/definitions/") + + # models *.flt + file(GLOB + _vj_model_files + "${base}/models/*.flt") + install(FILES ${_vj_model_files} DESTINATION "${DEST}/models/") + + # sounds *.wav + file(GLOB + _vj_sound_files + "${base}/sounds/*.wav") + install(FILES ${_vj_sound_files} DESTINATION "${DEST}/sounds/") + + # calibration.table - needed? + file(GLOB + _vj_config_files + "${base}/configFiles/*.jconf") + install(FILES "${base}/calibration.table" DESTINATION "${DEST}") +endfunction() + +function(install_vrjuggler22_plugins prefix varForFilenames) + set(DEST "${prefix}") + + set(out) + foreach(plugin ${VRJUGGLER22_BUNDLE_PLUGINS}) + get_filename_component(full "${plugin}" ABSOLUTE) + file(RELATIVE_PATH relloc "${VRJUGGLER22_VJ_BASE_DIR}" "${full}") + set(filedest "${DEST}/${relloc}") + get_filename_component(path "${filedest}" PATH) + list(APPEND out "${filedest}") + install(FILES "${full}" DESTINATION "${path}") + endforeach() + + set(${varForFilenames} ${out} PARENT_SCOPE) + +endfunction() + +function(get_vrjuggler_bundle_sources _target_sources) + if(APPLE) + if(NOT MACOSX_PACKAGE_DIR) + set(MACOSX_PACKAGE_DIR ${CMAKE_SOURCE_DIR}/cmake/package/macosx) + endif() + + set(_vj_base_dir .) + set(_vj_data_dir ${vj_base_dir}/share/vrjuggler-2.2) + + # Append Mac-specific sources to source list + set(_vj_bundle_src + ${MACOSX_PACKAGE_DIR}/Resources/vrjuggler.icns + ${MACOSX_PACKAGE_DIR}/Resources/vrjuggler.plist + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/classes.nib + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/info.nib + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/keyedobjects.nib) + + message(STATUS "vjbundlesrc: ${_vj_bundle_src}") + set(${_target_sources} + ${${_target_sources}} + ${_vj_bundle_src} + PARENT_SCOPE) + + # Set destination of nib files + set_source_files_properties(${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/classes.nib + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/info.nib + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/keyedobjects.nib + PROPERTIES + MACOSX_PACKAGE_LOCATION + Resources/en.lproj/MainMenu.nib/) + + # Set destination of Resources + set_source_files_properties(${MACOSX_PACKAGE_DIR}/Resources/vrjuggler.icns + ${MACOSX_PACKAGE_DIR}/Resources/vrjuggler.plist + PROPERTIES + MACOSX_PACKAGE_LOCATION + Resources/) + endif() +endfunction() + +function(fixup_vrjuggler_app_bundle + _target + _targetInstallDest + _extralibs + _libdirs) + + if(NOT VRJUGGLER22_FOUND) + return() + endif() + + if(NOT MACOSX_PACKAGE_DIR) + set(MACOSX_PACKAGE_DIR ${CMAKE_SOURCE_DIR}/cmake/package/macosx) + endif() + + set(TARGET_LOCATION + "${_targetInstallDest}/${_target}${CMAKE_EXECUTABLE_SUFFIX}") + if(APPLE) + set(TARGET_LOCATION "${TARGET_LOCATION}.app") + endif() + + set_target_properties(${_target} + PROPERTIES + MACOSX_BUNDLE + true + MACOSX_BUNDLE_INFO_PLIST + ${MACOSX_PACKAGE_DIR}/VRJuggler22BundleInfo.plist.in + MACOSX_BUNDLE_ICON_FILE + vrjuggler.icns + MACOSX_BUNDLE_INFO_STRING + "${PROJECT_NAME} (VR Juggler Application) version ${CPACK_PACKAGE_VERSION}, created by ${CPACK_PACKAGE_VENDOR}" + MACOSX_BUNDLE_GUI_IDENTIFIER + org.vrjuggler.${PROJECT_NAME} + MACOSX_BUNDLE_SHORT_VERSION_STRING + ${CPACK_PACKAGE_VERSION} + MACOSX_BUNDLE_BUNDLE_VERSION + ${CPACK_PACKAGE_VERSION}) + + if(WIN32) + list(APPEND _libdirs "${VRJUGGLER22_VJ_BASE_DIR}/bin") + endif() + + set(BUNDLE_LIBS ${_extralibs}) + set(BUNDLE_LIB_DIRS "${VRJUGGLER22_VJ_BASE_DIR}" ${_libdirs}) + + configure_file(${MACOSX_PACKAGE_DIR}/fixupbundle.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${_target}-fixupbundle-juggler.cmake + @ONLY) + install(SCRIPT + "${CMAKE_CURRENT_BINARY_DIR}/${_target}-fixupbundle-juggler.cmake") +endfunction() diff --git a/FindVRPN.cmake b/FindVRPN.cmake new file mode 100644 index 0000000..b128ba0 --- /dev/null +++ b/FindVRPN.cmake @@ -0,0 +1,108 @@ +# - try to find VRPN library +# +# Cache Variables: +# VRPN_LIBRARY +# VRPN_SERVER_LIBRARY +# VRPN_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# VRPN_FOUND +# VRPN_SERVER_LIBRARIES +# VRPN_LIBRARIES +# VRPN_INCLUDE_DIRS +# +# VRPN_ROOT_DIR is searched preferentially for these files +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(VRPN_ROOT_DIR + "${VRPN_ROOT_DIR}" + CACHE + PATH + "Root directory to search for VRPN") + +if("${CMAKE_SIZEOF_VOID_P}" MATCHES "8") + set(_libsuffixes lib64 lib) +else() + set(_libsuffixes lib) +endif() + +### +# Configure VRPN +### + +find_path(VRPN_INCLUDE_DIR + NAMES + vrpn_Connection.h + PATH_SUFFIXES + include + include/vrpn + HINTS + "${VRPN_ROOT_DIR}") + +find_library(VRPN_LIBRARY + NAMES + vrpn + PATH_SUFFIXES + ${_libsuffixes} + HINTS + "${VRPN_ROOT_DIR}") + +find_library(VRPN_SERVER_LIBRARY + NAMES + vrpnserver + PATH_SUFFIXES + ${_libsuffixes} + HINTS + "${VRPN_ROOT_DIR}") + +### +# Dependencies +### +set(_deps_libs) +set(_deps_includes) +set(_deps_check) + +find_package(quatlib) +list(APPEND _deps_libs ${QUATLIB_LIBRARIES}) +list(APPEND _deps_includes ${QUATLIB_INCLUDE_DIRS}) +list(APPEND _deps_check QUATLIB_FOUND) + +if(NOT WIN32) + find_package(Threads) + list(APPEND _deps_libs ${CMAKE_THREAD_LIBS_INIT}) + list(APPEND _deps_check CMAKE_HAVE_THREADS_LIBRARY) +endif() + + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VRPN + DEFAULT_MSG + VRPN_LIBRARY + VRPN_INCLUDE_DIR + ${_deps_check}) + +if(VRPN_FOUND) + set(VRPN_INCLUDE_DIRS "${VRPN_INCLUDE_DIR}" ${_deps_includes}) + set(VRPN_LIBRARIES "${VRPN_LIBRARY}" ${_deps_libs}) + set(VRPN_SERVER_LIBRARIES "${VRPN_SERVER_LIBRARY}" ${_deps_libs}) + + mark_as_advanced(VRPN_ROOT_DIR) +endif() + +mark_as_advanced(VRPN_LIBRARY + VRPN_SERVER_LIBRARY + VRPN_INCLUDE_DIR) diff --git a/FindVirtuoseAPI.cmake b/FindVirtuoseAPI.cmake new file mode 100644 index 0000000..639d00d --- /dev/null +++ b/FindVirtuoseAPI.cmake @@ -0,0 +1,93 @@ +# - try to find Haption VirtuoseAPI library and include files +# +# VIRTUOSEAPI_INCLUDE_DIRS, where to find headers +# VIRTUOSEAPI_LIBRARIES, the libraries to link against +# VIRTUOSEAPI_FOUND, If false, do not try to use this library +# VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use. +# VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install + +set(VIRTUOSEAPI_ROOT_DIR + "${VIRTUOSEAPI_ROOT_DIR}" + CACHE + PATH + "Path to search for VirtuoseAPI") + +set(_dirs) +if(WIN32) + include(ProgramFilesGlob) + program_files_fallback_glob(_dirs "/VirtuoseAPI_v*/") +endif() + +find_path(VIRTUOSEAPI_INCLUDE_DIR + virtuoseAPI.h + VirtuoseAPI.h + PATHS + ${_dirs} + HINTS + "${VIRTUOSEAPI_ROOT_DIR}") + +set(_suffixes) +if(WIN32) + set(_lib_name virtuoseDLL) + set(_runtime_name virtuoseAPI.dll) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_suffixes win64) + else() + set(_suffixes win32) + endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(_lib_name virtuose) + set(_runtime_name virtuoseAPI.so) + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(_suffixes linux-64b) + else() + set(_suffixes linux linux-2.6) + endif() +endif() + +if(_suffixes) + find_library(VIRTUOSEAPI_LIBRARY + NAMES + ${_lib_name} + PATHS + ${_dirs} + HINTS + "${VIRTUOSEAPI_ROOT_DIR}" + PATH_SUFFIXES + ${_suffixes}) + find_file(VIRTUOSEAPI_RUNTIME_LIBRARY + NAMES + ${_runtime_name} + PATHS + ${_dirs} + HINTS + "${VIRTUOSEAPI_ROOT_DIR}" + PATH_SUFFIXES + ${_suffixes}) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VirtuoseAPI + DEFAULT_MSG + VIRTUOSEAPI_LIBRARY + VIRTUOSEAPI_RUNTIME_LIBRARY + VIRTUOSEAPI_INCLUDE_DIR) + +if(VIRTUOSEAPI_FOUND) + set(VIRTUOSEAPI_LIBRARIES "${VIRTUOSEAPI_LIBRARY}") + set(VIRTUOSEAPI_RUNTIME_LIBRARIES "${VIRTUOSEAPI_RUNTIME_LIBRARY}") + set(VIRTUOSEAPI_INCLUDE_DIRS "${VIRTUOSEAPI_INCLUDE_DIR}") + get_filename_component(VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS + "${VIRTUOSEAPI_RUNTIME_LIBRARY}" + PATH) + + mark_as_advanced(VIRTUOSEAPI_ROOT_DIR) +endif() + +mark_as_advanced(VIRTUOSEAPI_LIBRARY + VIRTUOSEAPI_RUNTIME_LIBRARY + VIRTUOSEAPI_INCLUDE_DIR) diff --git a/FindVirtuoseVPP.cmake b/FindVirtuoseVPP.cmake new file mode 100644 index 0000000..0cd45fc --- /dev/null +++ b/FindVirtuoseVPP.cmake @@ -0,0 +1,49 @@ +# - try to find Haption VirtuoseAPI C++ wrapper include files +# +# Use of this header depends on the VirtuoseAPI, so we search for that too. +# +# VIRTUOSEVPP_INCLUDE_DIRS, where to find headers +# VIRTUOSEVPP_LIBRARIES, the libraries to link against +# VIRTUOSEVPP_FOUND, If false, do not try to use this library +# VIRTUOSEVPP_RUNTIME_LIBRARY_DIRS, path to DLL/SO for runtime use. +# VIRTUOSEAPI_RUNTIME_LIBRARIES, runtime libraries you might want to install + +set(VIRTUOSEVPP_ROOT_DIR + "${VIRTUOSEVPP_ROOT_DIR}" + CACHE + PATH + "Path to search for VirtuoseAPI VPP wrapper") + +find_package(VirtuoseAPI) + +find_path(VIRTUOSEVPP_INCLUDE_DIR + vpp.h + PATHS + ${_dirs} + HINTS + "${VIRTUOSEVPP_ROOT_DIR}") + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VirtuoseVPP + DEFAULT_MSG + VIRTUOSEVPP_INCLUDE_DIR + VIRTUOSEAPI_LIBRARY + VIRTUOSEAPI_RUNTIME_LIBRARIES + VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS + VIRTUOSEAPI_INCLUDE_DIR) + +if(VIRTUOSEVPP_FOUND) + set(VIRTUOSEVPP_LIBRARIES "${VIRTUOSEAPI_LIBRARY}") + set(VIRTUOSEVPP_INCLUDE_DIRS + "${VIRTUOSEAPI_INCLUDE_DIR}" + "${VIRTUOSEVPP_INCLUDE_DIR}") + set(VIRTUOSEVPP_RUNTIME_LIBRARIES "${VIRTUOSEAPI_RUNTIME_LIBRARIES}") + set(VIRTUOSEVPP_RUNTIME_LIBRARY_DIRS + "${VIRTUOSEAPI_RUNTIME_LIBRARY_DIRS}") + + mark_as_advanced(VIRTUOSEVPP_ROOT_DIR) +endif() + +mark_as_advanced(VIRTUOSEVPP_INCLUDE_DIR) diff --git a/FindWiiSCAAT.cmake b/FindWiiSCAAT.cmake new file mode 100644 index 0000000..c453697 --- /dev/null +++ b/FindWiiSCAAT.cmake @@ -0,0 +1,79 @@ +# - try to find the Wii SCAAT library +# +# Users may optionally supply: +# WIISCAAT_ROOT_DIR - a prefix to start searching for the headers. +# +# Cache Variables: (probably not for direct use in your scripts) +# WIISCAAT_INCLUDE_DIR +# WIISCAAT_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# WIISCAAT_FOUND +# WIISCAAT_INCLUDE_DIRS +# WIISCAAT_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(WIISCAAT_ROOT_DIR + "${WIISCAAT_ROOT_DIR}" + CACHE + PATH + "Path to search for Wii SCAAT module") + +### +# Prereq: tag +### +if(NOT TOONTAG_ROOT_DIR) + set(TOONTAG_ROOT_DIR "${WIISCAAT_ROOT_DIR}") +endif() +find_package(TooNtag QUIET) + +### +# Configure tag +### +find_path(WIISCAAT_INCLUDE_DIR + NAMES + HeadCollection.h + HINTS + "${WIISCAAT_ROOT_DIR}" + PATH_SUFFIXES + include) +mark_as_advanced(WIISCAAT_INCLUDE_DIR) + +find_library(WIISCAAT_LIBRARY + NAMES + wiiscaattracker + HINTS + "${WIISCAAT_ROOT_DIR}" + PATH_SUFFIXES + lib + lib64) +mark_as_advanced(WIISCAAT_LIBRARY) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WiiSCAAT + DEFAULT_MSG + WIISCAAT_LIBRARY + WIISCAAT_INCLUDE_DIR + TOONTAG_FOUND) + +if(WIISCAAT_FOUND) + set(WIISCAAT_INCLUDE_DIRS + "${WIISCAAT_INCLUDE_DIR}" + ${TOONTAG_INCLUDE_DIRS}) + set(WIISCAAT_LIBRARIES "${WIISCAAT_LIBRARY}" ${TOONTAG_LIBRARIES}) + mark_as_advanced(WIISCAAT_ROOT_DIR) +endif() diff --git a/FindWiiUse.cmake b/FindWiiUse.cmake new file mode 100644 index 0000000..d906911 --- /dev/null +++ b/FindWiiUse.cmake @@ -0,0 +1,89 @@ +# - try to find WiiUse library +# +# Cache Variables: (probably not for direct use in your scripts) +# WIIUSE_INCLUDE_DIR +# WIIUSE_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# WIIUSE_FOUND +# WIIUSE_INCLUDE_DIRS +# WIIUSE_LIBRARIES +# WIIUSE_RUNTIME_LIBRARIES - aka the dll for installing +# WIIUSE_RUNTIME_LIBRARY_DIRS +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(WIIUSE_ROOT_DIR + "${WIIUSE_ROOT_DIR}" + CACHE + PATH + "Directory to search for WiiUse") + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_LIBSUFFIXES /lib64 /lib) +else() + set(_LIBSUFFIXES /lib) +endif() + +find_library(WIIUSE_LIBRARY + NAMES + wiiuse + PATHS + "${WIIUSE_ROOT_DIR}" + PATH_SUFFIXES + "${_LIBSUFFIXES}") + +get_filename_component(_libdir "${WIIUSE_LIBRARY}" PATH) + +find_path(WIIUSE_INCLUDE_DIR + NAMES + wiiuse.h + HINTS + "${_libdir}" + "${_libdir}/.." + PATHS + "${WIIUSE_ROOT_DIR}" + PATH_SUFFIXES + include/) + +set(_deps_check) +if(WIN32) + find_file(WIIUSE_RUNTIME_LIBRARY NAMES wiiuse.dll HINTS "${_libdir}") + set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}") + get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS + "${WIIUSE_RUNTIME_LIBRARY}" + PATH) + list(APPEND _deps_check WIIUSE_RUNTIME_LIBRARY) +else() + get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS + "${WIIUSE_LIBRARY}" + PATH) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WiiUse + DEFAULT_MSG + WIIUSE_LIBRARY + WIIUSE_INCLUDE_DIR + ${_deps_check}) + +if(WIIUSE_FOUND) + set(WIIUSE_LIBRARIES "${WIIUSE_LIBRARY}") + set(WIIUSE_INCLUDE_DIRS "${WIIUSE_INCLUDE_DIR}") + mark_as_advanced(WIIUSE_ROOT_DIR) +endif() + +mark_as_advanced(WIIUSE_INCLUDE_DIR + WIIUSE_LIBRARY + WIIUSE_RUNTIME_LIBRARY) diff --git a/Findargp.cmake b/Findargp.cmake new file mode 100644 index 0000000..e911352 --- /dev/null +++ b/Findargp.cmake @@ -0,0 +1,81 @@ +# - try to find the argp library/component of glibc +# +# Users may optionally supply: +# ARGP_ROOT_DIR - a prefix to start searching. +# +# Cache Variables: (probably not for direct use in your scripts) +# ARGP_INCLUDE_DIR +# ARGP_LIBRARY, only defined if linking to an extra library is required +# +# Non-cache variables you might use in your CMakeLists.txt: +# ARGP_FOUND +# ARGP_INCLUDE_DIRS +# ARGP_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(ARGP_ROOT_DIR + "${ARGP_ROOT_DIR}" + CACHE + PATH + "Path to search for ARGP library") + +### +# Configure ARGP +### +set(_check ARGP_INCLUDE_DIR) + +find_path(ARGP_INCLUDE_DIR + NAMES + argp.h + HINTS + "${ARGP_ROOT_DIR}" + PATHS + /usr/local + /opt/local + /sw) +mark_as_advanced(ARGP_INCLUDE_DIR) + +include(CheckFunctionExists) +check_function_exists(argp_parse ARGP_BUILTIN) + +if(NOT ARGP_BUILTIN) + find_library(ARGP_LIBRARY + NAMES + argp + HINTS + "${ARGP_ROOT_DIR}" + PATH_SUFFIXES + lib + lib64 + PATHS + /usr/local + /opt/local + /sw) + list(APPEND _check ARGP_LIBRARY) + mark_as_advanced(ARGP_LIBRARY) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(argp + DEFAULT_MSG + ${_check}) + +if(ARGP_FOUND) + set(ARGP_INCLUDE_DIRS "${ARGP_INCLUDE_DIR}") + set(ARGP_LIBRARIES "${ARGP_LIBRARY}") + mark_as_advanced(ARGP_ROOT_DIR) +endif() diff --git a/Findcppcheck.cmake b/Findcppcheck.cmake new file mode 100644 index 0000000..c1d3234 --- /dev/null +++ b/Findcppcheck.cmake @@ -0,0 +1,142 @@ +# - try to find cppcheck tool +# +# Cache Variables: +# CPPCHECK_EXECUTABLE +# +# Non-cache variables you might use in your CMakeLists.txt: +# CPPCHECK_FOUND +# CPPCHECK_POSSIBLEERROR_ARG +# CPPCHECK_UNUSEDFUNC_ARG +# CPPCHECK_STYLE_ARG +# CPPCHECK_QUIET_ARG +# CPPCHECK_INCLUDEPATH_ARG +# CPPCHECK_FAIL_REGULAR_EXPRESSION +# CPPCHECK_WARN_REGULAR_EXPRESSION +# CPPCHECK_MARK_AS_ADVANCED - whether to mark our vars as advanced even +# if we don't find this program. +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +file(TO_CMAKE_PATH "${CPPCHECK_ROOT_DIR}" CPPCHECK_ROOT_DIR) +set(CPPCHECK_ROOT_DIR + "${CPPCHECK_ROOT_DIR}" + CACHE + PATH + "Path to search for cppcheck") + +# cppcheck app bundles on Mac OS X are GUI, we want command line only +set(_oldappbundlesetting ${CMAKE_FIND_APPBUNDLE}) +set(CMAKE_FIND_APPBUNDLE NEVER) + +# If we have a custom path, look there first. +if(CPPCHECK_ROOT_DIR) + find_program(CPPCHECK_EXECUTABLE + NAMES + cppcheck + cli + PATHS + "${CPPCHECK_ROOT_DIR}" + PATH_SUFFIXES + cli + NO_DEFAULT_PATH) +endif() + +find_program(CPPCHECK_EXECUTABLE NAMES cppcheck) + +# Restore original setting for appbundle finding +set(CMAKE_FIND_APPBUNDLE ${_oldappbundlesetting}) + +if(CPPCHECK_EXECUTABLE) + # Find out where our test file is + get_filename_component(_cppcheckmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + set(_cppcheckdummyfile "${_cppcheckmoddir}/Findcppcheck.cpp") + + # Check for the two types of command line arguments by just trying them + execute_process(COMMAND + "${CPPCHECK_EXECUTABLE}" + "--enable=style" + "--quiet" + "${_cppcheckdummyfile}" + RESULT_VARIABLE + _cppcheck_new_result + OUTPUT_QUIET + ERROR_QUIET) + execute_process(COMMAND + "${CPPCHECK_EXECUTABLE}" + "--style" + "--quiet" + "${_cppcheckdummyfile}" + RESULT_VARIABLE + _cppcheck_old_result + OUTPUT_QUIET + ERROR_QUIET) + if("${_cppcheck_new_result}" EQUAL 0) + # New arguments + set(CPPCHECK_UNUSEDFUNC_ARG "--enable=unusedFunctions") + set(CPPCHECK_POSSIBLEERROR_ARG "--enable=possibleError") + set(CPPCHECK_STYLE_ARG "--enable=style") + set(CPPCHECK_QUIET_ARG "--quiet") + set(CPPCHECK_INCLUDEPATH_ARG "-I") + if(MSVC) + set(CPPCHECK_TEMPLATE_ARG --template vs) + set(CPPCHECK_FAIL_REGULAR_EXPRESSION "[(]error[)]") + set(CPPCHECK_WARN_REGULAR_EXPRESSION "[(]style[)]") + elseif(CMAKE_COMPILER_IS_GNUCXX) + set(CPPCHECK_TEMPLATE_ARG --template gcc) + set(CPPCHECK_FAIL_REGULAR_EXPRESSION " error: ") + set(CPPCHECK_WARN_REGULAR_EXPRESSION " style: ") + else() + message(STATUS + "Warning: FindCppcheck doesn't know how to format error messages for your compiler!") + set(CPPCHECK_TEMPLATE_ARG --template gcc) + set(CPPCHECK_FAIL_REGULAR_EXPRESSION " error: ") + set(CPPCHECK_WARN_REGULAR_EXPRESSION " style: ") + endif() + elseif("${_cppcheck_old_result}" EQUAL 0) + # Old arguments + set(CPPCHECK_UNUSEDFUNC_ARG "--unused-functions") + set(CPPCHECK_POSSIBLEERROR_ARG "--all") + set(CPPCHECK_STYLE_ARG "--style") + set(CPPCHECK_QUIET_ARG "--quiet") + set(CPPCHECK_INCLUDEPATH_ARG "-I") + set(CPPCHECK_FAIL_REGULAR_EXPRESSION "error:") + set(CPPCHECK_WARN_REGULAR_EXPRESSION "[(]style[)]") + else() + # No idea - some other issue must be getting in the way + message(STATUS + "WARNING: Can't detect whether CPPCHECK wants new or old-style arguments!") + endif() + + +endif() + +set(CPPCHECK_ALL + "${CPPCHECK_EXECUTABLE} ${CPPCHECK_POSSIBLEERROR_ARG} ${CPPCHECK_UNUSEDFUNC_ARG} ${CPPCHECK_STYLE_ARG} ${CPPCHECK_QUIET_ARG} ${CPPCHECK_INCLUDEPATH_ARG} some/include/path") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cppcheck + DEFAULT_MSG + CPPCHECK_ALL + CPPCHECK_EXECUTABLE + CPPCHECK_POSSIBLEERROR_ARG + CPPCHECK_UNUSEDFUNC_ARG + CPPCHECK_STYLE_ARG + CPPCHECK_INCLUDEPATH_ARG + CPPCHECK_QUIET_ARG) + +if(CPPCHECK_FOUND OR CPPCHECK_MARK_AS_ADVANCED) + mark_as_advanced(CPPCHECK_ROOT_DIR) +endif() + +mark_as_advanced(CPPCHECK_EXECUTABLE) diff --git a/Findcppcheck.cpp b/Findcppcheck.cpp new file mode 100644 index 0000000..84350db --- /dev/null +++ b/Findcppcheck.cpp @@ -0,0 +1,16 @@ +/** + * \file Findcppcheck.cpp + * \brief Dummy C++ source file used by CMake module Findcppcheck.cmake + * + * \author + * Ryan Pavlik, 2009-2010 + * + * http://academic.cleardefinition.com/ + * + */ + + + +int main(int argc, char* argv[]) { + return 0; +} diff --git a/Findcutil.cmake b/Findcutil.cmake new file mode 100644 index 0000000..9441d0d --- /dev/null +++ b/Findcutil.cmake @@ -0,0 +1,48 @@ +# - find NVIDIA CUDA and source for the cutil library, building cutil if needed. +# +# CUTIL_LIBRARIES - Libraries to link against to use CUTIL +# CUTIL_INCLUDE_DIRS - Include directories to add before building a CUTIL app. +# +# Functions: +# install_cutil({RUNTIME_LIBRARY_DESTINATION}) - Install the CUTIL shared lib if created. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +find_package(CUDA QUIET) + + +file(TO_CMAKE_PATH "${CUDA_SDK_ROOT_DIR}/C/common" CUTIL_ROOT_DIR) + +if(NOT EXISTS "${CUTIL_ROOT_DIR}//src/cutil.cpp") + set(CUDA_SDK_ROOT_DIR not-found CACHE PATH "NVIDIA GPU Computing SDK dir" FORCE) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cutil DEFAULT_MSG CUDA_SDK_ROOT_DIR CUDA_FOUND) + +if(CUTIL_FOUND) + get_filename_component(_moddir "${CMAKE_CURRENT_LIST_FILE}" PATH) + add_subdirectory("${_moddir}/nested_targets/cutil") + + + function(install_cutil dest) + install(TARGETS cutil + RUNTIME DESTINATION "${dest}" + LIBRARY DESTINATION "${dest}") + endfunction() +else() + function(install_cutil) + message(FATAL_ERROR "Can't install cutil - didn't find it!") + endfunction() +endif() diff --git a/Finddb2pdf.cmake b/Finddb2pdf.cmake new file mode 100644 index 0000000..9d1a4ee --- /dev/null +++ b/Finddb2pdf.cmake @@ -0,0 +1,73 @@ +# - Try to find db2pdf, and define a custom command to turn docbook into pdf +# +# Once done, this will define: +# DB2PDF_FOUND - system has LyX +# DB2PDF_COMMAND - the command to run +# +# and the following function: +# docbook_to_pdf( ) +# +# Useful configuration variables you might want to add to your cache: +# DB2PDF_ROOT_DIR - A directory prefix to search +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +set(DB2PDF_ROOT_DIR + "${DB2PDF_ROOT_DIR}" + CACHE + PATH + "Directory to start our search in") + +find_program(DB2PDF_COMMAND + NAMES + db2pdf + HINTS + "${DB2PDF_ROOT_DIR}" + PATH_SUFFIXES + bin) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(db2pdf DEFAULT_MSG DB2PDF_COMMAND) + +if(DB2PDF_FOUND) + mark_as_advanced(DB2PDF_ROOT_DIR) +endif() + +mark_as_advanced(DB2PDF_COMMAND) + +function(docbook_to_pdf _outvar) + set(INPUT ${ARGN}) + set(_out) + set(_outname) + + foreach(_file ${INPUT}) + get_filename_component(_base "${_file}" NAME_WE) + set(_outname "${CMAKE_CURRENT_BINARY_DIR}/${_base}.pdf") + list(APPEND _out "${_outname}") + if(DB2PDF_COMMAND) + add_custom_command(OUTPUT + "${_outname}" + COMMAND + ${DB2PDF_COMMAND} + -o + "${CMAKE_CURRENT_BINARY_DIR}" + "${_file}" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + MAIN_DEPENDENCY + "${_file}") + endif() + endforeach() + set(${_outvar} ${_out} PARENT_SCOPE) +endfunction() diff --git a/FindosgLua.cmake b/FindosgLua.cmake new file mode 100644 index 0000000..aa04dbd --- /dev/null +++ b/FindosgLua.cmake @@ -0,0 +1,71 @@ +# - try to find osgLua +# +# Users may optionally supply: +# OSGLUA_ROOT_DIR - a prefix to start searching +# +# Non-cache variables you might use in your CMakeLists.txt: +# OSGLUA_FOUND +# OSGLUA_INCLUDE_DIRS +# OSGLUA_LIBRARIES +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(OSGLUA_ROOT_DIR + "${OSGLUA_ROOT_DIR}" + CACHE + PATH + "Path to search for osgLua") + +### +# Dependencies +### +find_package(Lua51 QUIET) + +### +# Configure Luabind +### +find_path(OSGLUA_INCLUDE_DIR + NAMES + osgLua/Script + HINTS + "${OSGLUA_ROOT_DIR}" + PATH_SUFFIXES + include) +mark_as_advanced(OSGLUA_INCLUDE_DIR) + +find_library(OSGLUA_LIBRARY + NAMES + osgLua + HINTS + "${OSGLUA_ROOT_DIR}" + PATH_SUFFIXES + lib64 + lib) +mark_as_advanced(OSGLUA_LIBRARY) + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(osgLua + DEFAULT_MSG + OSGLUA_LIBRARY + OSGLUA_INCLUDE_DIR + LUA_LIBRARIES + LUA_INCLUDE_DIR) + +if(OSGLUA_FOUND) + set(OSGLUA_INCLUDE_DIRS "${OSGLUA_INCLUDE_DIR}" "${LUA_INCLUDE_DIR}") + set(OSGLUA_LIBRARIES "${OSGLUA_LIBRARY}" ${LUA_LIBRARIES}) + mark_as_advanced(OSGLUA_ROOT_DIR) +endif() diff --git a/Findquatlib.cmake b/Findquatlib.cmake new file mode 100644 index 0000000..1eab8fa --- /dev/null +++ b/Findquatlib.cmake @@ -0,0 +1,90 @@ +# - Find quatlib +# Find the quatlib headers and libraries. +# +# QUATLIB_INCLUDE_DIRS - where to find quat.h +# QUATLIB_LIBRARIES - List of libraries when using quatlib. +# QUATLIB_FOUND - True if quatlib found. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(TARGET quat) + # Look for the header file. + find_path(QUATLIB_INCLUDE_DIR NAMES quat.h + PATHS ${quatlib_SOURCE_DIR}) + + set(QUATLIB_LIBRARY "quat") + +else() + set(QUATLIB_ROOT_DIR + "${QUATLIB_ROOT_DIR}" + CACHE + PATH + "Root directory to search for quatlib") + if(DEFINED VRPN_ROOT_DIR AND NOT QUATLIB_ROOT_DIR) + set(QUATLIB_ROOT_DIR "${VRPN_ROOT_DIR}") + mark_as_advanced(QUATLIB_ROOT_DIR) + endif() + + if("${CMAKE_SIZEOF_VOID_P}" MATCHES "8") + set(_libsuffixes lib64 lib) + else() + set(_libsuffixes lib) + endif() + + # Look for the header file. + find_path(QUATLIB_INCLUDE_DIR + NAMES + quat.h + HINTS + "${QUATLIB_ROOT_DIR}" + PATH_SUFFIXES + include + PATHS + "C:/Program Files/quatlib/include" + "../quat") + + # Look for the library. + find_library(QUATLIB_LIBRARY + NAMES + quat.lib + libquat.a + HINTS + "${QUATLIB_ROOT_DIR}" + PATH_SUFFIXES + ${_libsuffixes} + PATHS + "C:/Program Files/quatlib/lib" + "../buildquat" + "../buildquat/release") +endif() + +# handle the QUIETLY and REQUIRED arguments and set QUATLIB_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(quatlib + DEFAULT_MSG + QUATLIB_LIBRARY + QUATLIB_INCLUDE_DIR) + +if(QUATLIB_FOUND) + set(QUATLIB_LIBRARIES ${QUATLIB_LIBRARY}) + if(NOT WIN32) + list(APPEND QUATLIB_LIBRARIES m) + endif() + set(QUATLIB_INCLUDE_DIRS ${QUATLIB_INCLUDE_DIR}) + + mark_as_advanced(QUATLIB_ROOT_DIR) +else() + set(QUATLIB_LIBRARIES) + set(QUATLIB_INCLUDE_DIRS) +endif() + +mark_as_advanced(QUATLIB_LIBRARY QUATLIB_INCLUDE_DIR) diff --git a/GetCPUDetails.cmake b/GetCPUDetails.cmake new file mode 100644 index 0000000..fe7cfa2 --- /dev/null +++ b/GetCPUDetails.cmake @@ -0,0 +1,173 @@ +# - Set a number of variables to indicate things about the current CPU and OS +# +# CPU_INTEL +# CPU_EXE_64BIT +# CPU_EXE_32BIT +# CPU_HAS_SSE +# CPU_HAS_SSE2 +# CPU_HAS_SSE3 +# CPU_HAS_SSSE3 +# CPU_HAS_SSE4_1 +# CPU_HAS_SSE4_2 +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# + + +if(__get_cpu_details) + return() +endif() +set(__get_cpu_details YES) + +function(get_cpu_details) + option(CPUDETAILS_VERBOSE + "Should we display results of the CPU info check?" + NO) + mark_as_advanced(CPUDETAILS_VERBOSE) + + ### + # CPU_INTEL + + if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "i[3456]86") + set(CPU_INTEL YES) + elseif(APPLE) + # Mac Intel boxes return i386 in 10.5 - so assume this is a PPC + set(CPU_INTEL NO) + else() + # TODO: Assuming yes in case of doubt - probably not a great idea + set(CPU_INTEL YES) + endif() + + set(CPU_INTEL + ${CPU_INTEL} + CACHE + INTERNAL + "Intel x86 or x86_64 architecture machine?") + + ### + # CPU_EXE_64BIT/32BIT + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(CPU_EXE_64BIT ON) + set(CPU_EXE_32BIT OFF) + else() + set(CPU_EXE_64BIT OFF) + set(CPU_EXE_32BIT ON) + endif() + + ### + # CPU_HAS_SSE/SSE2/SSE3/SSSE3/SSE4.1/SSE4.2 + if(CPU_INTEL) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # Use /proc/cpuinfo to find this out. + file(STRINGS "/proc/cpuinfo" _cpuinfo) + if(_cpuinfo MATCHES "(sse)|(xmm)") + set(CPU_HAS_SSE YES) + else() + set(CPU_HAS_SSE NO) + endif() + + if(_cpuinfo MATCHES "(sse2)|(xmm2)") + set(CPU_HAS_SSE2 YES) + else() + set(CPU_HAS_SSE2 NO) + endif() + + if(_cpuinfo MATCHES "(sse3)|(xmm3)") + set(CPU_HAS_SSE3 YES) + else() + set(CPU_HAS_SSE3 NO) + endif() + + if(_cpuinfo MATCHES "ssse3") + set(CPU_HAS_SSSE3 YES) + else() + set(CPU_HAS_SSSE3 NO) + endif() + + if(_cpuinfo MATCHES "(sse4_1)|(xmm4_1)") + set(CPU_HAS_SSE4_1 YES) + else() + set(CPU_HAS_SSE4_1 NO) + endif() + + if(_cpuinfo MATCHES "(sse4_2)|(xmm4_2)") + set(CPU_HAS_SSE4_2 YES) + else() + set(CPU_HAS_SSE4_2 NO) + endif() + + elseif(APPLE) + # Mac OS X Intel requires SSE3 + set(CPU_HAS_SSE YES) + set(CPU_HAS_SSE2 YES) + set(CPU_HAS_SSE3 YES) + set(CPU_HAS_SSSE3 NO) + set(CPU_HAS_SSE4_1 NO) + set(CPU_HAS_SSE4_2 NO) + elseif(WIN32) + if(CPU_EXE_64BIT) + #TODO: Assume only common-denominator for 64-bit machines, + # since I don't know how to check. + set(CPU_HAS_SSE YES) + set(CPU_HAS_SSE2 YES) + set(CPU_HAS_SSE3 NO) + set(CPU_HAS_SSSE3 NO) + set(CPU_HAS_SSE4_1 NO) + set(CPU_HAS_SSE4_2 NO) + else() + #TODO: Assume no SSE, since I don't know how to check. + set(CPU_HAS_SSE NO) + set(CPU_HAS_SSE2 NO) + set(CPU_HAS_SSE3 NO) + set(CPU_HAS_SSSE3 NO) + set(CPU_HAS_SSE4_1 NO) + set(CPU_HAS_SSE4_2 NO) + endif() + endif() + endif() + + set(CPU_INTEL + ${CPU_INTEL} + CACHE + INTERNAL + "Intel x86 or x86_64 architecture machine?") + + foreach(_var + CPU_EXE_64BIT + CPU_EXE_32BIT + CPU_HAS_SSE + CPU_HAS_SSE2 + CPU_HAS_SSE3 + CPU_HAS_SSSE3 + CPU_HAS_SSE4_1 + CPU_HAS_SSE4_2) + set(${_var} ${${_var}} CACHE INTERNAL "") + endforeach() + + if(CPUDETAILS_VERBOSE) + foreach(_var + CPU_INTEL + CPU_EXE_64BIT + CPU_EXE_32BIT + CPU_HAS_SSE + CPU_HAS_SSE2 + CPU_HAS_SSE3 + CPU_HAS_SSSE3 + CPU_HAS_SSE4_1 + CPU_HAS_SSE4_2) + get_property(_help CACHE ${_var} PROPERTY HELPSTRING) + message(STATUS "[get_cpu_details] ${_var} (${_help}): ${${_var}}") + endforeach() + endif() +endfunction() diff --git a/GetCompilerInfoString.cmake b/GetCompilerInfoString.cmake new file mode 100644 index 0000000..db28212 --- /dev/null +++ b/GetCompilerInfoString.cmake @@ -0,0 +1,181 @@ +# - Utility function to return a human-useful-only string ID'ing the compiler +# +# get_compiler_info_string() +# +# and some helper functions: +# get_gcc_version() +# get_vs_short_version_string( ) +# +# You might consider using it when setting up CTest options, for example: +# include(GetCompilerInfoString) +# get_compiler_info_string(COMPILERID) +# set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}-${CMAKE_SYSTEM_PROCESSOR}-${COMPILERID}") +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# Some functions based on cmake-2.8.0 modules FindBoost.cmake and CTest.cmake +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2008 Andreas Schneider +# Copyright 2007 Wengo +# Copyright 2007 Mike Jackson +# Copyright 2008 Andreas Pakulat +# Copyright 2008-2009 Philip Lowman +# Copyright 2010 Iowa State University (Ryan Pavlik ) +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# CMake - Cross Platform Makefile Generator +# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +if(__get_compiler_info_string) + return() +endif() +set(__get_compiler_info_string YES) + + +function(get_compiler_info_string _var) + set(_out) + + if(CTEST_CMAKE_GENERATOR AND NOT CMAKE_GENERATOR) + # We're running in CTest - use that generator. + set(CMAKE_GENERATOR ${CTEST_CMAKE_GENERATOR}) + endif() + + if(NOT CMAKE_CXX_COMPILER) + # Also for use in CTest scripts + include(CMakeDetermineCXXCompiler) + endif() + + if(MSVC) + # Parse version for Visual Studio + get_vs_short_version_string("${CMAKE_GENERATOR}" _verstring) + if(${CMAKE_GENERATOR} MATCHES "Win64") + set(_verstring "${_verstring}win64") + endif() + + elseif(CMAKE_COMPILER_IS_GNUCXX) + # Parse version for GCC + get_gcc_version(_gccver) + set(_verstring "gcc${_gccver}") + + else() + # Some other compiler we don't handle yet. + message(STATUS + "WARNING: Not GCC or MSVC, so we invented a messy compiler info string") + string(REGEX REPLACE " " "_" _verstring "${CMAKE_GENERATOR}") + set(_verstring "generator:${_verstring}") + endif() + + # Return _verstring + set(${_var} "${_verstring}" PARENT_SCOPE) +endfunction() + +## Based on a function in FindBoost.cmake from CMake 2.8.0 +#------------------------------------------------------------------------------- +# +# Runs compiler with "-dumpversion" and parses major/minor +# version with a regex. +# +function(get_gcc_version _var) + exec_program(${CMAKE_CXX_COMPILER} + ARGS + ${CMAKE_CXX_COMPILER_ARG1} + -dumpversion + OUTPUT_VARIABLE + _compilerinfo_COMPILER_VERSION) + + string(REGEX + MATCH + "([.0-9]+)" + "\\1" + _compilerinfo_COMPILER_VERSION + "${_compilerinfo_COMPILER_VERSION}") + + set(${_var} ${_compilerinfo_COMPILER_VERSION} PARENT_SCOPE) +endfunction() + +## Based on a function in CTest.cmake from CMake 2.8.0 +#------------------------------------------------------------------------------- +# +# function to turn generator name into a version string +# like vs7 vs71 vs8 vs9 +# +function(get_vs_short_version_string _generator _var) + set(_ver_string) + if("${_generator}" MATCHES "Visual Studio") + string(REGEX + REPLACE + "Visual Studio ([0-9][0-9]?)($|.*)" + "\\1" + _vsver + "${_generator}") + if("${_generator}" MATCHES "Visual Studio 7 .NET 2003") + # handle the weird one + set(_ver_string "vs71") + else() + set(_ver_string "vs${_vsver}") + endif() + elseif(MSVC) + if(MSVC71) + set(_ver_string "vs71") + else() + foreach(_ver 6 7 8 9 10) + if(MSVC${_ver}0) + set(_ver_string "vs${_ver}") + break() + endif() + endforeach() + endif() + endif() + + if(_ver_string) + set(${_var} ${_ver_string} PARENT_SCOPE) + endif() +endfunction() diff --git a/GetDirectoryList.cmake b/GetDirectoryList.cmake new file mode 100644 index 0000000..2e85c42 --- /dev/null +++ b/GetDirectoryList.cmake @@ -0,0 +1,49 @@ +# - Returns a list of the parent directories of all files passed +# +# get_directory_list( [...]) +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_directory_list) + return() +endif() +set(__get_directory_list YES) + +function(get_directory_list _var) + # combine variable's current value with additional list items + set(_in ${ARGN}) + + if(_in) + # Initial list cleaning + list(REMOVE_DUPLICATES _in) + + # Grab the absolute path of each actual directory + set(_out) + foreach(_file ${_in}) + get_filename_component(_dir "${_file}" PATH) + if(IS_DIRECTORY "${_dir}") + get_filename_component(_dir "${_dir}" ABSOLUTE) + file(TO_CMAKE_PATH "${_dir}" _dir) + list(APPEND _out "${_dir}") + endif() + endforeach() + + if(_out) + # Clean up the output list now + list(REMOVE_DUPLICATES _out) + endif() + + # return _out + set(${_var} "${_out}" PARENT_SCOPE) + endif() +endfunction() diff --git a/GetFileList.cmake b/GetFileList.cmake new file mode 100644 index 0000000..4f2608a --- /dev/null +++ b/GetFileList.cmake @@ -0,0 +1,45 @@ +# - Returns a list of the file names of all files passed +# +# get_file_list( [...]) +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_file_list) + return() +endif() +set(__get_file_list YES) + +function(get_file_list _var) + # combine variable's current value with additional list items + set(_in ${ARGN}) + + if(_in) + # Initial list cleaning + list(REMOVE_DUPLICATES _in) + + # Grab the absolute path of each actual directory + set(_out) + foreach(_file ${_in}) + get_filename_component(_fn "${_file}" FILE) + list(APPEND _out "${_fn}") + endforeach() + + if(_out) + # Clean up the output list now + list(REMOVE_DUPLICATES _out) + endif() + + # return _out + set(${_var} "${_out}" PARENT_SCOPE) + endif() +endfunction() diff --git a/GetForceIncludeDefinitions.cmake b/GetForceIncludeDefinitions.cmake new file mode 100644 index 0000000..6548de5 --- /dev/null +++ b/GetForceIncludeDefinitions.cmake @@ -0,0 +1,44 @@ +# - Get the platform-appropriate flags to add to force inclusion of a file +# +# The most common use of this is to use a generated config.h-type file +# placed out of the source tree in all files. +# +# get_force_include_definitions(var forcedincludefiles...) - +# where var is the name of your desired output variable, and everything +# else is a source file to forcibly include. +# a list item to be filtered. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_force_include_definitions) + return() +endif() +set(__get_force_include_definitions YES) + +function(get_force_include_definitions var) + set(_flagprefix) + if(CMAKE_COMPILER_IS_GNUCXX) + set(_flag "-include") + elseif(MSVC) + set(_flag "/FI") + else() + message(SEND_ERROR "You don't seem to be using MSVC or GCC, but") + message(SEND_ERROR "the project called get_force_include_definitions.") + message(SEND_ERROR "Contact this project with the name of your") + message(FATAL_ERROR "compiler and preferably the flag to force includes") + endif() + + set(_out) + foreach(_item ${ARGN}) + list(APPEND _out "${_flag} \"${_item}\"") + endforeach() + set(${var} "${_out}" PARENT_SCOPE) +endfunction() diff --git a/GetSubprojectStatus.cmake b/GetSubprojectStatus.cmake new file mode 100644 index 0000000..7e99993 --- /dev/null +++ b/GetSubprojectStatus.cmake @@ -0,0 +1,31 @@ +# - Returns whether the current project is on its own or within another project's build +# +# get_subproject_status() - resultvar will be YES if we are +# included in another project, or NO if we are being built separately +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_subproject_status) + return() +endif() +set(__get_subproject_status YES) + +function(get_subproject_status _var) + if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + # Base source dir is our source dir - we are top-level + set(${_var} NO PARENT_SCOPE) + else() + # Base source dir is not our source dir - we are a subproject + set(${_var} YES PARENT_SCOPE) + endif() +endfunction() diff --git a/LICENSE_1_0.txt b/LICENSE_1_0.txt new file mode 100644 index 0000000..36b7cd9 --- /dev/null +++ b/LICENSE_1_0.txt @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/Licensing.cmake b/Licensing.cmake new file mode 100644 index 0000000..e89f66b --- /dev/null +++ b/Licensing.cmake @@ -0,0 +1,133 @@ +# - Building a licensing description file +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +define_property(GLOBAL + PROPERTY + PROPRIETARY_LICENSES + BRIEF_DOCS + "Text for proprietary licenses" + FULL_DOCS + "Text for proprietary licenses") +define_property(GLOBAL + PROPERTY + SHAREALIKE_LICENSES + BRIEF_DOCS + "Text for share-alike licenses" + FULL_DOCS + "Text for share-alike licenses (e.g. GPL)") +define_property(GLOBAL + PROPERTY + PERMISSIVE_LICENSES + BRIEF_DOCS + "Text for permissive licenses" + FULL_DOCS + "Text for permissive licenses (e.g. BSD, MIT, X11)") +define_property(GLOBAL + PROPERTY + PACKAGES_LICENSED + BRIEF_DOCS + "List of all packages whose licenses are registered here" + FULL_DOCS + "List of all packages whose licenses are registered here") +define_property(GLOBAL + PROPERTY + REDISTRIBUTION_WARNINGS + BRIEF_DOCS + "Text for important redistribution warnings" + FULL_DOCS + "Text for important redistribution warnings, such as 'This is not redistributable!'") + + +function(add_license LICENSE_TYPE_PROPERTY package license) + get_property(def GLOBAL PROPERTY LICENSE_PACKAGE_${package} DEFINED) + if(NOT def) + define_property(GLOBAL + PROPERTY + LICENSE_PACKAGE_${package} + BRIEF_DOCS + "Flag to indicate the addition of the license for ${package}" + FULL_DOCS + "Flag to indicate the addition of the license for ${package}") + get_property(existing GLOBAL PROPERTY ${LICENSE_TYPE_PROPERTY}) + set_property(GLOBAL + PROPERTY + ${LICENSE_TYPE_PROPERTY} + "${existing}${license}\n\n") + + if(ARGN) + define_property(GLOBAL + PROPERTY + LICENSE_EXTRAS_PACKAGE_${package} + BRIEF_DOCS + "Extras (like URL) for the license for ${package}" + FULL_DOCS + "Extras (like URL) for the license for ${package}") + set_property(GLOBAL + PROPERTY + LICENSE_EXTRAS_PACKAGE_${package} + "${ARGN}") + endif() + + get_property(allpackages GLOBAL PROPERTY PACKAGES_LICENSED) + list(APPEND allpackages "${package}") + set_property(GLOBAL PROPERTY PACKAGES_LICENSED "${allpackages}") + endif() +endfunction() + +function(add_proprietary_license package license) + add_license(PROPRIETARY_LICENSES "${package}" "${license}" ${ARGN}) +endfunction() + +function(add_sharealike_license package license) + add_license(SHAREALIKE_LICENSES "${package}" "${license}" ${ARGN}) +endfunction() + +function(add_permissive_license package license) + add_license(PERMISSIVE_LICENSES "${package}" "${license}" ${ARGN}) +endfunction() + +function(add_redistribution_warning warning) + get_property(existing GLOBAL PROPERTY REDISTRIBUTION_WARNINGS) + set_property(GLOBAL + PROPERTY + REDISTRIBUTION_WARNINGS + "${warning} ${existing}") +endfunction() + +function(configure_license_file input output) + get_property(PACKAGES_LICENSED GLOBAL PROPERTY PACKAGES_LICENSED) + if(PACKAGES_LICENSED) + list(SORT PACKAGES_LICENSED) + set(PACKAGES_LICENSED_BULLETED) + foreach(package ${PACKAGES_LICENSED}) + set(EXTRAS) + get_property(package_extras + GLOBAL + PROPERTY + "LICENSE_EXTRAS_PACKAGE_${package}") + if(package_extras) + set(EXTRAS " ${package_extras}") + endif() + set(PACKAGES_LICENSED_BULLETED + "${PACKAGES_LICENSED_BULLETED} * ${package}${EXTRAS}\n") + endforeach() + endif() + get_property(REDISTRIBUTION_WARNINGS + GLOBAL + PROPERTY + REDISTRIBUTION_WARNINGS) + get_property(PROPRIETARY_LICENSES GLOBAL PROPERTY PROPRIETARY_LICENSES) + get_property(SHAREALIKE_LICENSES GLOBAL PROPERTY SHAREALIKE_LICENSES) + get_property(PERMISSIVE_LICENSES GLOBAL PROPERTY PERMISSIVE_LICENSES) + configure_file("${input}" "${output}" ${ARGN}) +endfunction() + diff --git a/ListCombinations.cmake b/ListCombinations.cmake new file mode 100644 index 0000000..c94a505 --- /dev/null +++ b/ListCombinations.cmake @@ -0,0 +1,53 @@ +# - Combine lists of prefixes and suffixes in all combinations +# +# list_combinations(var PREFIXES listitems... SUFFIXES listitems...) - +# where var is the name of your desired output variable and PREFIXES +# and SUFFIXES are special arguments that indicate the start of your +# list of prefixes or suffixes respectively. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__list_combinations) + return() +endif() +set(__list_combinations YES) + +function(list_combinations var) + # Parse arguments + set(_prefixes) + set(_suffixes) + set(_nowhere) + set(_curdest _nowhere) + foreach(_element ${ARGN}) + if("${_element}" STREQUAL "PREFIXES") + set(_curdest _prefixes) + elseif("${_element}" STREQUAL "SUFFIXES") + set(_curdest _suffixes) + else() + list(APPEND ${_curdest} "${_element}") + endif() + endforeach() + if(_nowhere) + message(STATUS "_prefixes ${_prefixes}") + message(STATUS "_prefixes ${_suffixes}") + message(STATUS "_prefixes ${_nowhere}") + message(FATAL_ERROR + "Syntax error in use of ${CMAKE_CURRENT_LIST_FILE}") + endif() + + foreach(_prefix ${_prefixes}) + foreach(_suffix ${_suffixes}) + list(APPEND _out "${_prefix}${_suffix}") + endforeach() + endforeach() + + set(${var} "${_out}" PARENT_SCOPE) +endfunction() diff --git a/ListFilter.cmake b/ListFilter.cmake new file mode 100644 index 0000000..fa4237a --- /dev/null +++ b/ListFilter.cmake @@ -0,0 +1,50 @@ +# - List filtering functions +# +# list_filter(var regex listitems...) - where var is the name of +# your desired output variable, regex is the regex whose matching items +# WILL be put in the output variable, and everything else is considered +# a list item to be filtered. +# +# list_filter_out(var regex listitems...) - where var is the name of +# your desired output variable, regex is the regex whose matching items +# will NOT be put in the output variable, and everything else is considered +# a list item to be filtered. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__list_filter_out) + return() +endif() +set(__list_filter_out YES) + +function(list_filter_out var regex) + set(_out) + foreach(_item ${ARGN}) + set(_re) + string(REGEX MATCH "${regex}" _re "${_item}") + if(NOT _re) + list(APPEND _out "${_item}") + endif() + endforeach() + set(${var} "${_out}" PARENT_SCOPE) +endfunction() + +function(list_filter var regex) + set(_out) + foreach(_item ${ARGN}) + set(_re) + string(REGEX MATCH "${regex}" _re "${_item}") + if(_re) + list(APPEND _out "${_item}") + endif() + endforeach() + set(${var} "${_out}" PARENT_SCOPE) +endfunction() diff --git a/LuaTargets.cmake b/LuaTargets.cmake new file mode 100644 index 0000000..9e8b220 --- /dev/null +++ b/LuaTargets.cmake @@ -0,0 +1,88 @@ +# - Copy lua source files as a custom target +# +# include(LuaTargets) +# add_lua_target( [ ]) +# Relative paths for the destination directory are considered with +# with respect to CMAKE_CURRENT_BINARY_DIR +# +# install_lua_target( [arguments to INSTALL(PROGRAMS ...) ]) +# +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__add_lua) + return() +endif() +set(__add_lua YES) + +define_property(TARGET + PROPERTY + LUA_TARGET + BRIEF_DOCS + "Lua target" + FULL_DOCS + "Is this a Lua target created by add_lua_target?") + +function(add_lua_target _target _dest) + if(NOT ARGN) + message(WARNING + "In add_lua_target call for target ${_target}, no Lua files were specified!") + return() + endif() + + set(ALLFILES) + foreach(luafile ${ARGN}) + if(IS_ABSOLUTE "${luafile}") + set(luapath "${luafile}") + get_filename_component(luafile "${luafile}" NAME) + else() + set(luapath "${CMAKE_CURRENT_SOURCE_DIR}/${luafile}") + endif() + add_custom_command(OUTPUT "${_dest}/${luafile}" + COMMAND + ${CMAKE_COMMAND} + ARGS -E make_directory "${_dest}" + COMMAND + ${CMAKE_COMMAND} + ARGS -E copy "${luapath}" "${_dest}" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS "${luapath}" + COMMENT "Copying ${luapath} to ${_dest}/${luafile}") + list(APPEND ALLFILES "${_dest}/${luafile}") + endforeach() + + # Custom target depending on all the lua file commands + add_custom_target(${_target} + SOURCES ${ARGN} + DEPENDS ${ALLFILES}) + + set_property(TARGET ${_target} PROPERTY LUA_TARGET YES) +endfunction() + +function(install_lua_target _target) + get_target_property(_isLua ${_target} LUA_TARGET) + if(NOT _isLua) + message(WARNING + "install_lua_target called on a target not created with add_lua_target!") + return() + endif() + + # Get sources + get_target_property(_srcs ${_target} SOURCES) + + # Remove the "fake" file forcing build + list(REMOVE_AT _srcs 0) + + # Forward the call to install + install(PROGRAMS ${_srcs} ${ARGN}) +endfunction() diff --git a/MSVCMultipleProcessCompile.cmake b/MSVCMultipleProcessCompile.cmake new file mode 100644 index 0000000..989c083 --- /dev/null +++ b/MSVCMultipleProcessCompile.cmake @@ -0,0 +1,31 @@ +# - Compile with multiple processes on MSVC +# +# include(MSVCMultipleProcessCompile) +# +# Requires these CMake modules: +# ListCombinations.cmake +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(MSVC AND NOT "${MSVC_VERSION}" LESS 1400) + # Only available in VS 2005 and newer + string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC) + include(ListCombinations) + list_combinations(_varnames + PREFIXES + CMAKE_C_FLAGS_ + CMAKE_CXX_FLAGS_ + SUFFIXES + ${_conftypesUC}) + foreach(_var ${_varnames}) + set(${_var} "${${_var}} /MP") + endforeach() +endif() diff --git a/MSVCStaticRuntime.cmake b/MSVCStaticRuntime.cmake new file mode 100644 index 0000000..94ca1d6 --- /dev/null +++ b/MSVCStaticRuntime.cmake @@ -0,0 +1,33 @@ +# - Modify compile flags to use the static runtimes of MSVC +# +# include(MSVCStaticRuntime) +# +# Requires these CMake modules: +# ListCombinations.cmake +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(MSVC) + string(TOUPPER "${CMAKE_CONFIGURATION_TYPES}" _conftypesUC) + include(ListCombinations) + list_combinations(_varnames + PREFIXES + CMAKE_C_FLAGS_ + CMAKE_CXX_FLAGS_ + SUFFIXES + ${_conftypesUC}) + foreach(_var ${_varnames}) + string(REPLACE "/MDd" "/MTd" ${_var} "${${_var}}") + string(REPLACE "/MD" "/MT" ${_var} "${${_var}}") + endforeach() +endif() + +set(Boost_USE_STATIC_LIBS ON) diff --git a/MSVCVerboseLinking.cmake b/MSVCVerboseLinking.cmake new file mode 100644 index 0000000..c2e770d --- /dev/null +++ b/MSVCVerboseLinking.cmake @@ -0,0 +1,48 @@ +# - Add appropriate linker flags to show link details on Visual Studio +# +# include(MSVCVerboseLinking) - to add the flags automaticlly if applicable +# +# Be sure to include this module _BEFORE_ adding your targets, or the targets +# won't pick up the updated flags. +# +# Requires these CMake modules: +# - none +# +# Original Author: +# 2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(MSVC) + if(NOT DEFINED MSVC_LINK_REALLY_VERBOSE) + if(IN_DASHBOARD_SCRIPT) + set(MSVC_LINK_REALLY_VERBOSE TRUE) + else() + set(MSVC_LINK_REALLY_VERBOSE FALSE) + endif() + endif() + set(MSVC_LINK_REALLY_VERBOSE + "${MSVC_LINK_REALLY_VERBOSE}" + CACHE + BOOL + "Provide maximum linker messages?") + mark_as_advanced(MSVC_LINK_REALLY_VERBOSE) + + if(MSVC_LINK_REALLY_VERBOSE) + set(_verbose_flag "/VERBOSE") + else() + set(_verbose_flag "/VERBOSE:LIB") + endif() + + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} ${_verbose_flag}") + set(CMAKE_MODULE_LINKER_FLAGS + "${CMAKE_MODULE_LINKER_FLAGS} ${_verbose_flag}") + set(CMAKE_SHARED_LINKER_FLAGS + "${CMAKE_SHARED_LINKER_FLAGS} ${_verbose_flag}") +endif() diff --git a/MakeVRJugglerAppBundle.cmake b/MakeVRJugglerAppBundle.cmake new file mode 100644 index 0000000..a03065e --- /dev/null +++ b/MakeVRJugglerAppBundle.cmake @@ -0,0 +1,149 @@ +# - A script to turn a VR Juggler app target into a Mac OS X bundle +# +# add_vrjuggler_bundle_sources(SOURCES_VAR_NAME) - run before add_executable +# finish_vrjuggler_bundle(TARGET_NAME LIB_DIRS) - run after add_executable +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +function(add_vrjuggler_bundle_sources _target_sources) + if(APPLE) + if(NOT MACOSX_PACKAGE_DIR) + set(MACOSX_PACKAGE_DIR ${CMAKE_SOURCE_DIR}/cmake/package/macosx) + endif() + + set(_vj_base_dir .) + set(_vj_data_dir ${vj_base_dir}/share/vrjuggler-2.2) + + # Append Mac-specific sources to source list + set(_vj_bundle_src + ${MACOSX_PACKAGE_DIR}/Resources/vrjuggler.icns + ${MACOSX_PACKAGE_DIR}/Resources/vrjuggler.plist + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/classes.nib + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/info.nib + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/keyedobjects.nib) + + # Add and set destination of VR Juggler required files + + # configFiles *.jconf + file(GLOB + _vj_config_files + ${VRJ22_LIBRARY_DIR}/../share/vrjuggler-2.2/data/configFiles/*.jconf) + list(APPEND _vj_bundle_src ${_vj_config_files}) + + # definitions *.jdef + file(GLOB + _vj_defs_files + ${VRJ22_LIBRARY_DIR}/../share/vrjuggler-2.2/data/definitions/*.jdef) + list(APPEND _vj_bundle_src ${_vj_defs_files}) + + # models *.flt + file(GLOB + _vj_model_files + ${VRJ22_LIBRARY_DIR}/../share/vrjuggler-2.2/data/models/*.flt) + list(APPEND _vj_bundle_src ${_vj_model_files}) + + # sounds *.wav + file(GLOB + _vj_sound_files + ${VRJ22_LIBRARY_DIR}/../share/vrjuggler-2.2/data/sounds/*.wav) + list(APPEND _vj_bundle_src ${_vj_sound_files}) + + # calibration.table - needed? + list(APPEND + _vj_bundle_src + ${VRJ22_LIBRARY_DIR}/../share/vrjuggler-2.2/data/calibration.table) + + message(STATUS "vjbundlesrc: ${_vj_bundle_src}") + set(${_target_sources} + ${${_target_sources}} + ${_vj_bundle_src} + PARENT_SCOPE) + + # Set destination of nib files + set_source_files_properties(${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/classes.nib + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/info.nib + ${MACOSX_PACKAGE_DIR}/Resources/en.lproj/MainMenu.nib/keyedobjects.nib + PROPERTIES + MACOSX_PACKAGE_LOCATION + Resources/en.lproj/MainMenu.nib/) + + # Set destination of Resources + set_source_files_properties(${MACOSX_PACKAGE_DIR}/Resources/vrjuggler.icns + ${MACOSX_PACKAGE_DIR}/Resources/vrjuggler.plist + PROPERTIES + MACOSX_PACKAGE_LOCATION + Resources/) + + set_source_files_properties(${_vj_config_files} + PROPERTIES + MACOSX_PACKAGE_LOCATION + ${_vj_data_dir}/data/configFiles/) + set_source_files_properties(${_vj_defs_files} + PROPERTIES + MACOSX_PACKAGE_LOCATION + ${_vj_data_dir}/data/definitions/) + set_source_files_properties(${_vj_model_files} + PROPERTIES + MACOSX_PACKAGE_LOCATION + ${_vj_data_dir}/data/models/) + set_source_files_properties(${_vj_sound_files} + PROPERTIES + MACOSX_PACKAGE_LOCATION + ${_vj_data_dir}/data/sounds/) + set_source_files_properties(${VRJ22_LIBRARY_DIR}/../share/vrjuggler-2.2/data/calibration.table + PROPERTIES + MACOSX_PACKAGE_LOCATION + ${_vj_data_dir}/data/) + + endif() +endfunction() + +function(finish_vrjuggler_bundle _target _libdirs) + if(APPLE) + if(NOT MACOSX_PACKAGE_DIR) + set(MACOSX_PACKAGE_DIR ${CMAKE_SOURCE_DIR}/cmake/package/macosx) + endif() + set_target_properties(${_target} + PROPERTIES + MACOSX_BUNDLE + true + MACOSX_BUNDLE_INFO_PLIST + ${MACOSX_PACKAGE_DIR}/VRJuggler22BundleInfo.plist.in + MACOSX_BUNDLE_ICON_FILE + vrjuggler.icns + MACOSX_BUNDLE_INFO_STRING + "${PROJECT_NAME} (VR Juggler Application) version ${CPACK_PACKAGE_VERSION}, created by ${CPACK_PACKAGE_VENDOR}" + MACOSX_BUNDLE_GUI_IDENTIFIER + org.vrjuggler.${PROJECT_NAME} + MACOSX_BUNDLE_SHORT_VERSION_STRING + ${CPACK_PACKAGE_VERSION} + MACOSX_BUNDLE_BUNDLE_VERSION + ${CPACK_PACKAGE_VERSION}) + + set(BUNDLE_LIBS + libboost_filesystem-1_34_1.dylib + libboost_signals-1_34_1.dylib) + set(BUNDLE_LIB_DIRS ${_libdirs}) + + configure_file(${MACOSX_PACKAGE_DIR}/fixupbundle.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${_target}-fixupbundle.cmake + @ONLY) + add_custom_command(TARGET + ${_target} + POST_BUILD + COMMAND + ${CMAKE_COMMAND} + -P + ${CMAKE_CURRENT_BINARY_DIR}/${_target}-fixupbundle.cmake + VERBATIM) + + endif() +endfunction() diff --git a/PrefixListGlob.cmake b/PrefixListGlob.cmake new file mode 100644 index 0000000..5514a9e --- /dev/null +++ b/PrefixListGlob.cmake @@ -0,0 +1,36 @@ +# - For each given prefix in a list, glob using the prefix+pattern +# +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__prefix_list_glob) + return() +endif() +set(__prefix_list_glob YES) + +function(prefix_list_glob var pattern) + set(_out) + set(_result) + foreach(prefix ${ARGN}) + file(GLOB _globbed ${prefix}${pattern}) + if(_globbed) + list(SORT _globbed) + list(REVERSE _globbed) + list(APPEND _out ${_globbed}) + endif() + endforeach() + foreach(_name ${_out}) + get_filename_component(_name "${_name}" ABSOLUTE) + list(APPEND _result "${_name}") + endforeach() + + set(${var} "${_result}" PARENT_SCOPE) +endfunction() diff --git a/ProgramFilesGlob.cmake b/ProgramFilesGlob.cmake new file mode 100644 index 0000000..5f70398 --- /dev/null +++ b/ProgramFilesGlob.cmake @@ -0,0 +1,94 @@ +# - Find bit-appropriate program files directories matching a given pattern +# +# Requires these CMake modules: +# CleanDirectoryList +# PrefixListGlob +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(PrefixListGlob) +include(CleanDirectoryList) + +if(__program_files_glob) + return() +endif() +set(__program_files_glob YES) + +function(program_files_glob var pattern) + # caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch + # of the running executable which, since CMake is 32-bit on Windows as + # I write this, will always be = $ENV{ProgramFiles(x86)}. + # Thus, we only use this environment variable if we are on a 32 machine + + # 32-bit dir on win32, useless to us on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) + + # 32-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86) + + # 64-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432) + + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit build on win64 + set(_PROGFILESDIRS "${_PROG_FILES_W6432}") + else() + if(_PROG_FILES_W6432) + # 32-bit build on win64 + set(_PROGFILESDIRS "${_PROG_FILES_X86}") + else() + # 32-bit build on win32 + set(_PROGFILESDIRS "${_PROG_FILES}") + endif() + endif() + + prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS}) + clean_directory_list(_prefixed) + set(${var} ${_prefixed} PARENT_SCOPE) +endfunction() + +function(program_files_fallback_glob var pattern) + # caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch + # of the running executable which, since CMake is 32-bit on Windows as + # I write this, will always be = $ENV{ProgramFiles(x86)}. + # Thus, we only use this environment variable if we are on a 32 machine + + # 32-bit dir on win32, useless to us on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) + + # 32-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86) + + # 64-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432) + + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit build on win64 + # look in the "32 bit" (c:\program files (x86)\) directory as a + # fallback in case of weird/poorly written installers, like those + # that put both 64- and 32-bit libs in the same program files directory + set(_PROGFILESDIRS "${_PROG_FILES_W6432}" "${_PROG_FILES_X86}") + else() + if(_PROG_FILES_W6432) + # 32-bit build on win64 + # look in the "64 bit" (c:\program files\) directory as a fallback + # in case of old/weird/poorly written installers + set(_PROGFILESDIRS "${_PROG_FILES_X86}" "${_PROG_FILES_W6432}") + else() + # 32-bit build on win32 + set(_PROGFILESDIRS "${_PROG_FILES}") + endif() + endif() + + prefix_list_glob(_prefixed "${pattern}" ${_PROGFILESDIRS}) + clean_directory_list(_prefixed) + set(${var} ${_prefixed} PARENT_SCOPE) +endfunction() diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..c437bce --- /dev/null +++ b/README.markdown @@ -0,0 +1,92 @@ +VRAC CMake Modules +================== + +Ryan Pavlik + + + + +Iowa State University HCI Graduate Program/VRAC + +Introduction +------------ + +This is a collection of CMake modules that I've produced during the course +of a variety of software development. There are a number of find modules, +especially for virtual reality and physical simulation packages, some utility +modules of more general interest, and some patches or workarounds for +CMake itself. + +Each module is generally documented, and depending on how busy I was +when I created it, the documentation can be fairly complete. + +How to Integrate +---------------- + +These modules are probably best placed wholesale into a "cmake" subdirectory +of your project source. + +If you use Git, try installing [git-subtree][1], +so you can easily use this repository for subtree merges, updating simply. + +For the initial checkout: + + cd projectdir + + git subtree add --squash --prefix=cmake git://github.com/rpavlik/cmake-modules.git master + +For updates: + + cd projectdir + + git subtree pull --squash --prefix=cmake git://github.com/rpavlik/cmake-modules.git master + +If you use some other version control, you can export a copy of this directory +without the git metadata by calling: + + ./export-to-directory.sh yourprojectdir/cmake + +You might also consider exporting to a temp directory and merging changes, since +this will not overwrite by default. You can pass -f to overwrite existing files. + +How to Use +---------- + +At the minimum, all you have to do is add a line like this near the top +of your root CMakeLists.txt file (but not before your project() call): + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + +You might also want the extra automatic features/fixes included with the +modules, for that, just add another line following the first one: + + include(UseBackportedModules) + + +Licenses +-------- + +The modules that I wrote myself are all subject to this license: + +> Copyright Iowa State University 2009-2010 +> +> Distributed under the Boost Software License, Version 1.0. +> +> (See accompanying file `LICENSE_1_0.txt` or copy at +> ) + +Modules based on those included with CMake are under the OSI-approved +BSD license, which is included in each of those modules. A few other modules +are modified from other sources - when in doubt, look at the .cmake. + +Important License Note! +----------------------- + +If you find this file inside of another project, rather at the top-level +directory, you're in a separate project that is making use of these modules. +That separate project can (and probably does) have its own license specifics. + + + + +[1]: http://github.com/apenwarr/git-subtree "Git Subtree master" diff --git a/ResetConfigurations.cmake b/ResetConfigurations.cmake new file mode 100644 index 0000000..ab7b6e5 --- /dev/null +++ b/ResetConfigurations.cmake @@ -0,0 +1,31 @@ +# - Re-set the available configurations to just RelWithDebInfo and Release +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# + + +if(__reset_configurations) + return() +endif() +set(__reset_configurations YES) + +if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Release") + set(CMAKE_CONFIGURATION_TYPES + "${CMAKE_CONFIGURATION_TYPES}" + CACHE + STRING + "Reset the configurations to what we need" + FORCE) +endif() diff --git a/SearchProgramFilesForOpenSceneGraph.cmake b/SearchProgramFilesForOpenSceneGraph.cmake new file mode 100644 index 0000000..20de666 --- /dev/null +++ b/SearchProgramFilesForOpenSceneGraph.cmake @@ -0,0 +1,64 @@ +# - Use some smarts to try to find OpenSceneGraph in the Program Files dirs +# +# Also uses the OSGHOME environment variable as OSG_DIR, if it's found. +# +# Usage: +# include(SearchProgramFilesForOpenSceneGraph OPTIONAL) +# +# Requires these CMake modules: +# ListFilter +# ProgramFilesGlob +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(ListFilter) +include(ProgramFilesGlob) +include(CleanDirectoryList) + +# Try to find an OSG installation +set(_osgpaths) +if(WIN32) + program_files_glob(_osgpaths "/OpenSceneGraph*") + if(_osgpaths) + if(MSVC80) + list_filter_out(_osgpaths "[vV][cC]9" ${_osgpaths}) + elseif(MSVC90) + list_filter_out(_osgpaths "[vV][cC]8" ${_osgpaths}) + endif() + list(SORT _osgpaths) + list(REVERSE _osgpaths) + endif() +else() + prefix_list_glob(_osgpaths "/OpenSceneGraph*" /usr /usr/local /opt) + if(_osgpaths) + clean_directory_list(_osgpaths) + if(_osgpaths) + list(SORT _osgpaths) + list(REVERSE _osgpaths) + endif() + endif() +endif() + + +if(_osgpaths) + # Want them in reverse order so newer versions come up first + list(SORT _osgpaths) + list(REVERSE _osgpaths) + + # fallback last-ditch effort - use the environment variable + list(APPEND _osgpaths "$ENV{OSGHOME}") + clean_directory_list(_osgpaths) + + list(APPEND CMAKE_PREFIX_PATH ${_osgpaths}) +endif() + +# Not completely related +set(OpenSceneGraph_MARK_AS_ADVANCED TRUE) diff --git a/SetDefaultBuildType.cmake b/SetDefaultBuildType.cmake new file mode 100644 index 0000000..4cfd01f --- /dev/null +++ b/SetDefaultBuildType.cmake @@ -0,0 +1,31 @@ +# - Set a developer-chosen default build type +# +# Requires these CMake modules: +# no additional modules required +# +# Original Author: +# 2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# + + +if(__set_default_build_type) + return() +endif() +set(__set_default_build_type YES) + +function(set_default_build_type _type) + #if(DEFINED CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE) + if("${CMAKE_GENERATOR}" MATCHES "Makefiles" AND NOT CMAKE_BUILD_TYPE) + if(NOT __DEFAULT_BUILD_TYPE_SET) + set(CMAKE_BUILD_TYPE "${_type}" CACHE STRING "" FORCE) + set(__DEFAULT_BUILD_TYPE_SET YES CACHE INTERNAL "") + endif() + endif() +endfunction() diff --git a/SplitLibraryList.cmake b/SplitLibraryList.cmake new file mode 100644 index 0000000..f565e83 --- /dev/null +++ b/SplitLibraryList.cmake @@ -0,0 +1,40 @@ +# - Given a list of libraries with OPTIMIZED, DEBUG, etc. +# +# split_library_list(_generalvar _releasevar _debugvar) +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +function(split_library_list _generalvar _releasevar _debugvar) + set(_general) + set(_debug) + set(_release) + set(_dest _general) + + foreach(item ${ARGN}) + if(${item} MATCHES "[dD][eE][bB][uU][gG]") + set(_dest _debug) + elseif(${item} MATCHES "[oO][pP][tT][iI][mM][iI][zZ][eE][dD]") + set(_dest _release) + elseif(${item} MATCHES "[gG][eE][nN][eE][rR][aA][lL]") + set(_dest _general) + else() + list(APPEND ${_dest} "${item}") + set(_dest _general) + endif() + endforeach() + + set(${_releasevar} ${_release} PARENT_SCOPE) + set(${_debugvar} ${_debug} PARENT_SCOPE) + set(${_generalvar} ${_general} PARENT_SCOPE) +endfunction() diff --git a/StampSourcesWithVersion.cmake b/StampSourcesWithVersion.cmake new file mode 100644 index 0000000..009a1d8 --- /dev/null +++ b/StampSourcesWithVersion.cmake @@ -0,0 +1,180 @@ +# - When enabled, stamp the current version on C/C++ sources +# +# To set up your source code for proper stamping, start your file +# with a Doxygen-style comment block, starting with /* and ending with */ +# On a line by itself, with unimportant whitespace, add the standard Doxygen +# "version" command: +# @version xxx +# or +# \version xxx +# +# To make sure it works, please do actually put xxx as the current version: +# when you save, add one of the command below to your cmake build, and run +# cmake, it should replace xxx with the current version. (It replaces anything +# between the end of the whitespace after \version and the end of the line +# with the version that you pass in your build script, so put nothing else +# on that line!) +# +# For , I recommend passing the value of a CMake variable like +# ${CPACK_PACKAGE_VERSION} +# Remember, reduced duplication of information means reduced errors! +# +# WARNING! +# This does edit your source directory, but will only execute if the +# (hidden/advanced, default OFF) variable ENABLE_VERSION_STAMPING is on. +# +# Additionally, it tries to be very careful: +# - It will not edit files that are outside your source tree +# - It will only attempt a substitution within the first C-style comment block +# of your code (that is, the first /* */), but only if // is not found first +# +# stamp_target_with_version( [HEADERS_ONLY | ...]) - +# If no source file is specified, all will be processed. +# +# stamp_sources_with_version( [ ...]) - +# Use for files not directly associated with a target. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__stamp_sources_with_version) + return() +endif() +set(__stamp_sources_with_version YES) + +if(NOT APPLE) + option(ENABLE_VERSION_STAMPING + "Modify source files to update the version in the comment header. Maintainers only!" + OFF) + mark_as_advanced(ENABLE_VERSION_STAMPING) +endif() + +# Stash where our data is, at include() time +get_filename_component(_sswv_mod_dir ${CMAKE_CURRENT_LIST_FILE} PATH) + + +# Internal utility function - not for outside use +function(_stamp_file_with_version version filename) + if(NOT SED_EXECUTABLE) + find_program(SED_EXECUTABLE sed) + mark_as_advanced(SED_EXECUTABLE) + endif() + # TODO: fix the sed script on Mac + if(SED_EXECUTABLE AND ENABLE_VERSION_STAMPING AND NOT APPLE) + get_source_file_property(_abs "${filename}" LOCATION) + if(NOT _abs) + get_filename_component(_abs "${filename}" ABSOLUTE) + endif() + file(RELATIVE_PATH _rel "${CMAKE_SOURCE_DIR}" "${_abs}") + if(NOT "${_rel}" MATCHES "[.][.]") + # Only if this file is in the source tree + get_filename_component(_name "${filename}" NAME) + set(_in_source_dir YES) + # Create the sed script + configure_file("${_sswv_mod_dir}/StampSourcesWithVersion.sed.in" + "${CMAKE_CURRENT_BINARY_DIR}/stamp-${_name}.sed" + @ONLY) + + if(APPLE) + set(extendedre_arg -E) + else() + set(extendedre_arg -r) + endif() + + set(sedargs + ${extendedre_arg} + -f + "${CMAKE_CURRENT_BINARY_DIR}/stamp-${_name}.sed" + ${filename}) + + # Run the sed script + execute_process(COMMAND + ${SED_EXECUTABLE} + ${sedargs} + OUTPUT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/stampedoutput-${_name}.out" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}") + + # Check to see if changes were made + execute_process(COMMAND + ${CMAKE_COMMAND} + -E + compare_files + "${CMAKE_CURRENT_BINARY_DIR}/stampedoutput-${_name}.out" + ${filename} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + files_different + OUTPUT_QUIET + ERROR_QUIET) + + # if so, run it again, but in-place this time + if(files_different) + message(STATUS "Stamping file ${_rel} with version ${version}") + execute_process(COMMAND + ${SED_EXECUTABLE} + -i + ${sedargs} + OUTPUT_FILE + "${CMAKE_CURRENT_BINARY_DIR}/stampedoutput-${_name}.out" + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}") + else() + message(STATUS "Version stamp up-to-date on file ${_rel}") + endif() + endif() + endif() +endfunction() + +function(stamp_sources_with_version version) + foreach(_file ${ARGN}) + _stamp_file_with_version("${version}" "${_file}") + endforeach() +endfunction() + +function(stamp_target_with_version version target_name) + + set(_target_stampables) + + get_target_property(_target_sources ${target_name} SOURCES) + foreach(_source ${_target_sources}) + get_source_file_property(_lang "${_source}" LANGUAGE) + get_source_file_property(_loc "${_source}" LOCATION) + if("${_lang}" MATCHES "CXX" OR "${_lang}" MATCHES "C") + list(APPEND _target_stampables "${_loc}") + endif() + endforeach() + + set(_src_to_stamp) + if("${ARGN}" STREQUAL "HEADERS_ONLY") + # We were passed HEADERS_ONLY + foreach(_file ${_target_stampables}) + get_filename_component(_ext "${_file}" EXT) + if("${_ext}" MATCHES "[.]([hH]|hpp|HPP|hxx|HXX)$" OR NOT _ext) + list(APPEND _src_to_stamp "${_file}") + endif() + endforeach() + + elseif(ARGN) + # We were passed a list of files + set(_src_to_stamp ${ARGN}) + + else() + # We were passed only a target - process all source in the source tree. + set(_src_to_stamp ${_target_stampables}) + endif() + + stamp_sources_with_version(${version} ${_src_to_stamp}) +endfunction() + + + diff --git a/StampSourcesWithVersion.sed.in b/StampSourcesWithVersion.sed.in new file mode 100644 index 0000000..6fddf90 --- /dev/null +++ b/StampSourcesWithVersion.sed.in @@ -0,0 +1,13 @@ +# Line by line summary: +# Until we find the first */ or // { +# In sections between /* and */ (that is, a block comment) { +# substitute @version WHATEVER with @version and the +# cmake-substituted version string. +# } +# } + +0,/[*/][/]/ { + /\/\*/,/\*\// { + s_([@\\])version(\s*).*$_\1version\2@version@_1g + } +} \ No newline at end of file diff --git a/TCHARWorkaround.cmake b/TCHARWorkaround.cmake new file mode 100644 index 0000000..5bea61b --- /dev/null +++ b/TCHARWorkaround.cmake @@ -0,0 +1,38 @@ +# - Script to compile Win32-developed sources using tchar without modifying the code +# Requires that ${CMAKE_SOURCE_DIR}/cmake/workarounds/tchar/ be present. +# +# TCHAR_WORKAROUND, automatically set to on when not on win32 +# TCHAR_INCLUDE_DIR, location of our fake tchar.h file +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(NOT WIN32) + option(TCHAR_WORKAROUND "Work around missing tchar error" on) +else() + option(TCHAR_WORKAROUND "Work around missing tchar error" off) +endif() + +mark_as_advanced(TCHAR_WORKAROUND) + +if(TCHAR_WORKAROUND) + find_path(TCHAR_INCLUDE_DIR + tchar.h + PATHS + ${CMAKE_SOURCE_DIR}/cmake/workarounds/tchar/ + ./workarounds/tchar/ + PATH_SUFFIXES + workarounds/ + workarounds/tchar/) + if(TCHAR_INCLUDE_DIR) + include_directories(${TCHAR_INCLUDE_DIR}) + mark_as_advanced(TCHAR_INCLUDE_DIR) + endif() +endif() diff --git a/UseBackportedModules.cmake b/UseBackportedModules.cmake new file mode 100644 index 0000000..5c39d9b --- /dev/null +++ b/UseBackportedModules.cmake @@ -0,0 +1,114 @@ +# - Do a version-dependent check and auto-include backported modules dirs +# +# Name your module directories cmake-*-modules where * is the full +# (maj.min.patch) version number that they came from. You can use +# subdirectories within those directories, if you like - all directories +# inside of a cmake-*-modules dir for a newer version of CMake that what +# we're running, that contain one or more .cmake files, will be appended +# to the CMAKE_MODULE_PATH. +# +# When backporting modules, be sure to test them and follow copyright +# instructions (usually updating copyright notices) +# +# Requires these CMake modules: +# CleanDirectoryList +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(NOT CMAKE_VERSION) # defined in >=2.6.3 + set(_cmver + "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}") +else() + set(_cmver "${CMAKE_VERSION}") +endif() + +include(CleanDirectoryList) + +# No debugging output please +set(USE_BACKPORTED_MODULES_VERBOSE NO) + +get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH) +file(GLOB _globbed "${_moddir}/cmake-*-modules") + +if(USE_BACKPORTED_MODULES_VERBOSE) + message(STATUS + "UseBackportedModules: Detected use of CMake version ${_cmver}") + message(STATUS "Checking these base directories: ${_globbed}") +endif() + +foreach(_dir ${_globbed}) + string(REGEX + MATCH + "cmake-[0-9].[0-9].[0-9]-modules" + _dirname + "${_dir}") + string(REGEX + REPLACE + "cmake-([0-9].[0-9].[0-9])-modules" + "\\1" + _ver + "${_dirname}") + string(REGEX + REPLACE + "cmake-([0-9]).([0-9]).([0-9])-modules" + "\\1_\\2_\\3" + _ver_clean + "${_dirname}") + + if(USE_BACKPORTED_MODULES_VERBOSE) + message(STATUS "${_dir}: ${_ver} ${_ver_clean}") + endif() + + if("${_cmver}" VERSION_LESS "${_ver}") + list(APPEND _upgradever "${_ver_clean}") + file(GLOB_RECURSE _modules "${_dir}/*.cmake") + + foreach(_mod ${_modules}) + get_filename_component(_path "${_mod}" PATH) + list(APPEND _paths_${_ver_clean} "${_path}") + endforeach() + + endif() +endforeach() + + +# Autoinclude files from oldest version to newest version +if(_upgradever) + set(_save_cmake_module_path ${CMAKE_MODULE_PATH}) + list(REMOVE_DUPLICATES _upgradever) + list(SORT _upgradever) + foreach(_ver_clean ${_upgradever}) + clean_directory_list(_paths_${_ver_clean}) + foreach(_dir ${_paths_${_ver_clean}}) + set(CMAKE_MODULE_PATH ${_dir} ${_save_cmake_module_path}) + include("${_dir}/autoinclude.cmake" OPTIONAL RESULT_VARIABLE _result) + if(USE_BACKPORTED_MODULES_VERBOSE) + message(STATUS "${_dir} - Autoincluded: ${_result}") + endif() + endforeach() + endforeach() + set(CMAKE_MODULE_PATH ${_save_cmake_module_path}) +endif() + +# Add the module path from newest version to oldest version +set(_added_module_path) +if(_upgradever) + list(REVERSE _upgradever) + foreach(_ver_clean ${_upgradever}) + list(APPEND _added_module_path ${_paths_${_ver_clean}}) + endforeach() +endif() + +list(APPEND CMAKE_MODULE_PATH ${_added_module_path}) + +if(USE_BACKPORTED_MODULES_VERBOSE) + message(STATUS "New module path: ${CMAKE_MODULE_PATH}") +endif() diff --git a/UseTR1.cmake b/UseTR1.cmake new file mode 100644 index 0000000..0cb4d08 --- /dev/null +++ b/UseTR1.cmake @@ -0,0 +1,28 @@ +# - Use settings to enable access to C++ TR1 +# +# This calls include_directories and link_directories as needed to +# permit TR1 support. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__use_tr1) + return() +endif() +set(__use_tr1 YES) + + +if(TR1_INCLUDE_DIRS) + include_directories(${TR1_INCLUDE_DIRS}) +endif() + +if(TR1_LIBRARY_DIRS) + link_directories(${TR1_LIBRARY_DIRS}) +endif() diff --git a/WarningDev.cmake b/WarningDev.cmake new file mode 100644 index 0000000..3796270 --- /dev/null +++ b/WarningDev.cmake @@ -0,0 +1,24 @@ +# - Print a developer warning, using author_warning if we have cmake 2.8 +# +# warning_dev("your desired message") +# +# Original Author: +# 2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +function(warning_dev _yourmsg) + if("1.${CMAKE_VERSION}" VERSION_LESS "1.2.8.0") + # CMake version <2.8.0 + message(STATUS + "The following is a developer warning - end users may ignore it") + message(STATUS "Dev Warning: ${_yourmsg}") + else() + message(AUTHOR_WARNING "${_yourmsg}") + endif() +endfunction() diff --git a/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake b/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake new file mode 100644 index 0000000..ee1220c --- /dev/null +++ b/cmake-2.8.0-modules/features/SelectLibraryConfigurations.cmake @@ -0,0 +1,108 @@ +# select_library_configurations( basename ) +# +# This macro takes a library base name as an argument, and will choose good +# values for basename_LIBRARY, basename_LIBRARIES, basename_LIBRARY_DEBUG, and +# basename_LIBRARY_RELEASE depending on what has been found and set. If only +# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG, +# and basename_LIBRARY_RELEASE will be set to the release value. If only +# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY, +# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value. +# +# If the generator supports configuration types, then basename_LIBRARY and +# basename_LIBRARIES will be set with debug and optimized flags specifying the +# library to be used for the given configuration. If no build type has been set +# or the generator in use does not support configuration types, then +# basename_LIBRARY and basename_LIBRARIES will take only the release values. + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Will Dicharry +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= +# This macro was adapted from the FindQt4 CMake module and is maintained by Will +# Dicharry . + +# Utility macro to check if one variable exists while another doesn't, and set +# one that doesn't exist to the one that exists. +macro( _set_library_name basename GOOD BAD ) + if( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} ) + set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} ) + set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} ) + endif( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} ) +endmacro( _set_library_name ) + +macro( select_library_configurations basename ) + # if only the release version was found, set the debug to be the release + # version. + _set_library_name( ${basename} RELEASE DEBUG ) + # if only the debug version was found, set the release value to be the + # debug value. + _set_library_name( ${basename} DEBUG RELEASE ) + if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE ) + # if the generator supports configuration types or CMAKE_BUILD_TYPE + # is set, then set optimized and debug options. + if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + set( ${basename}_LIBRARY + optimized ${${basename}_LIBRARY_RELEASE} + debug ${${basename}_LIBRARY_DEBUG} ) + set( ${basename}_LIBRARIES + optimized ${${basename}_LIBRARY_RELEASE} + debug ${${basename}_LIBRARY_DEBUG} ) + else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + # If there are no configuration types or build type, just use + # the release version + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} ) + endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE ) + + set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH + "The ${basename} library" ) + + if( ${basename}_LIBRARY ) + set( ${basename}_FOUND TRUE ) + endif( ${basename}_LIBRARY ) + + mark_as_advanced( ${basename}_LIBRARY + ${basename}_LIBRARY_RELEASE + ${basename}_LIBRARY_DEBUG + ) +endmacro( select_library_configurations ) + diff --git a/cmake-2.8.0-modules/osg/FindOpenSceneGraph.cmake b/cmake-2.8.0-modules/osg/FindOpenSceneGraph.cmake new file mode 100644 index 0000000..a86d8ed --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindOpenSceneGraph.cmake @@ -0,0 +1,273 @@ +# - Find OpenSceneGraph +# This module searches for the OpenSceneGraph core "osg" library as well as +# OpenThreads, and whatever additional COMPONENTS (nodekits) that you specify. +# See http://www.openscenegraph.org +# +# NOTE: To use this module effectively you must either require CMake >= 2.6.3 +# with cmake_minimum_required(VERSION 2.6.3) or download and place +# FindOpenThreads.cmake, Findosg_functions.cmake, Findosg.cmake, +# and Find.cmake files into your CMAKE_MODULE_PATH. +# +#================================== +# +# This module accepts the following variables (note mixed case) +# +# OpenSceneGraph_DEBUG - Enable debugging output +# +# OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced +# automatically +# +# The following environment variables are also respected for finding the OSG +# and it's various components. CMAKE_PREFIX_PATH can also be used for this +# (see find_library() CMake documentation). +# +# _DIR (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file) +# OSG_DIR +# OSGDIR +# OSG_ROOT +# +# This module defines the following output variables: +# +# OPENSCENEGRAPH_FOUND - Was the OSG and all of the specified components found? +# +# OPENSCENEGRAPH_VERSION - The version of the OSG which was found +# +# OPENSCENEGRAPH_INCLUDE_DIRS - Where to find the headers +# +# OPENSCENEGRAPH_LIBRARIES - The OSG libraries +# +#================================== +# Example Usage: +# +# find_package(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil) +# # libOpenThreads & libosg automatically searched +# include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) +# +# add_executable(foo foo.cc) +# target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES}) +# + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Philip Lowman +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# +# Naming convention: +# Local variables of the form _osg_foo +# Input variables of the form OpenSceneGraph_FOO +# Output variables of the form OPENSCENEGRAPH_FOO +# + +include(Findosg_functions) + +set(_osg_modules_to_process) +foreach(_osg_component ${OpenSceneGraph_FIND_COMPONENTS}) + list(APPEND _osg_modules_to_process ${_osg_component}) +endforeach() +list(APPEND _osg_modules_to_process "osg" "OpenThreads") +list(REMOVE_DUPLICATES _osg_modules_to_process) + +if(OpenSceneGraph_DEBUG) + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Components = ${_osg_modules_to_process}") +endif() + +# +# First we need to find and parse osg/Version +# +OSG_FIND_PATH(OSG osg/Version) +if(OpenSceneGraph_MARK_AS_ADVANCED) + OSG_MARK_AS_ADVANCED(OSG) +endif() + +# Try to ascertain the version... +if(OSG_INCLUDE_DIR) + if(OpenSceneGraph_DEBUG) + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}") + endif() + + set(_osg_Version_file "${OSG_INCLUDE_DIR}/osg/Version") + if("${OSG_INCLUDE_DIR}" MATCHES "\\.framework$" AND NOT EXISTS "${_osg_Version_file}") + set(_osg_Version_file "${OSG_INCLUDE_DIR}/Headers/Version") + endif() + + if(EXISTS "${_osg_Version_file}") + file(READ "${_osg_Version_file}" _osg_Version_contents) + else() + set(_osg_Version_contents "unknown") + endif() + + string(REGEX MATCH ".*#define OSG_VERSION_MAJOR[ \t]+[0-9]+.*" + _osg_old_defines "${_osg_Version_contents}") + string(REGEX MATCH ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+[0-9]+.*" + _osg_new_defines "${_osg_Version_contents}") + if(_osg_old_defines) + string(REGEX REPLACE ".*#define OSG_VERSION_MAJOR[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_MAJOR ${_osg_Version_contents}) + string(REGEX REPLACE ".*#define OSG_VERSION_MINOR[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_MINOR ${_osg_Version_contents}) + string(REGEX REPLACE ".*#define OSG_VERSION_PATCH[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_PATCH ${_osg_Version_contents}) + elseif(_osg_new_defines) + string(REGEX REPLACE ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_MAJOR ${_osg_Version_contents}) + string(REGEX REPLACE ".*#define OPENSCENEGRAPH_MINOR_VERSION[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_MINOR ${_osg_Version_contents}) + string(REGEX REPLACE ".*#define OPENSCENEGRAPH_PATCH_VERSION[ \t]+([0-9]+).*" + "\\1" _osg_VERSION_PATCH ${_osg_Version_contents}) + else() + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Failed to parse version number, please report this as a bug") + endif() + + set(OPENSCENEGRAPH_VERSION "${_osg_VERSION_MAJOR}.${_osg_VERSION_MINOR}.${_osg_VERSION_PATCH}" + CACHE INTERNAL "The version of OSG which was detected") + if(OpenSceneGraph_DEBUG) + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Detected version ${OPENSCENEGRAPH_VERSION}") + endif() +endif() + +# +# Version checking +# +if(OpenSceneGraph_FIND_VERSION AND OPENSCENEGRAPH_VERSION) + if(OpenSceneGraph_FIND_VERSION_EXACT) + if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION}) + set(_osg_version_not_exact TRUE) + endif() + else() + # version is too low + if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION} AND + NOT OPENSCENEGRAPH_VERSION VERSION_GREATER ${OpenSceneGraph_FIND_VERSION}) + set(_osg_version_not_high_enough TRUE) + endif() + endif() +endif() + +set(_osg_quiet) +if(OpenSceneGraph_FIND_QUIETLY) + set(_osg_quiet "QUIET") +endif() +# +# Here we call FIND_PACKAGE() on all of the components +# +foreach(_osg_module ${_osg_modules_to_process}) + if(OpenSceneGraph_DEBUG) + message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " + "Calling find_package(${_osg_module} ${_osg_required} ${_osg_quiet})") + endif() + find_package(${_osg_module} ${_osg_quiet}) + + string(TOUPPER ${_osg_module} _osg_module_UC) + list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR}) + list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES}) + + if(OpenSceneGraph_MARK_AS_ADVANCED) + OSG_MARK_AS_ADVANCED(${_osg_module}) + endif() +endforeach() + +if(OPENSCENEGRAPH_INCLUDE_DIR) + list(REMOVE_DUPLICATES OPENSCENEGRAPH_INCLUDE_DIR) +endif() + +# +# Inform the users with an error message based on +# what version they have vs. what version was +# required. +# +if(OpenSceneGraph_FIND_REQUIRED) + set(_osg_version_output_type FATAL_ERROR) +else() + set(_osg_version_output_type STATUS) +endif() +if(_osg_version_not_high_enough) + set(_osg_EPIC_FAIL TRUE) + if(NOT OpenSceneGraph_FIND_QUIETLY) + message(${_osg_version_output_type} + "ERROR: Version ${OpenSceneGraph_FIND_VERSION} or higher of the OSG " + "is required. Version ${OPENSCENEGRAPH_VERSION} was found.") + endif() +elseif(_osg_version_not_exact) + set(_osg_EPIC_FAIL TRUE) + if(NOT OpenSceneGraph_FIND_QUIETLY) + message(${_osg_version_output_type} + "ERROR: Version ${OpenSceneGraph_FIND_VERSION} of the OSG is required " + "(exactly), version ${OPENSCENEGRAPH_VERSION} was found.") + endif() +else() + + # + # Check each module to see if it's found + # + if(OpenSceneGraph_FIND_REQUIRED) + set(_osg_missing_message) + foreach(_osg_module ${_osg_modules_to_process}) + string(TOUPPER ${_osg_module} _osg_module_UC) + if(NOT ${_osg_module_UC}_FOUND) + set(_osg_missing_nodekit_fail true) + set(_osg_missing_message "${_osg_missing_message} ${_osg_module}") + endif() + endforeach() + + if(_osg_missing_nodekit_fail) + message(FATAL_ERROR "ERROR: Missing the following osg " + "libraries: ${_osg_missing_message}.\n" + "Consider using CMAKE_PREFIX_PATH or the OSG_DIR " + "environment variable. See the " + "${CMAKE_CURRENT_LIST_FILE} for more details.") + endif() + endif() + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph DEFAULT_MSG OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR) +endif() + +if(_osg_EPIC_FAIL) + # Zero out everything, we didn't meet version requirements + set(OPENSCENEGRAPH_FOUND FALSE) + set(OPENSCENEGRAPH_LIBRARIES) + set(OPENSCENEGRAPH_INCLUDE_DIR) +endif() + +set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR}) + diff --git a/cmake-2.8.0-modules/osg/FindOpenThreads.cmake b/cmake-2.8.0-modules/osg/FindOpenThreads.cmake new file mode 100644 index 0000000..b946889 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindOpenThreads.cmake @@ -0,0 +1,150 @@ +# OpenThreads is a C++ based threading library. Its largest userbase +# seems to OpenSceneGraph so you might notice I accept OSGDIR as an +# environment path. +# I consider this part of the Findosg* suite used to find OpenSceneGraph +# components. +# Each component is separate and you must opt in to each module. +# +# Locate OpenThreads +# This module defines +# OPENTHREADS_LIBRARY +# OPENTHREADS_FOUND, if false, do not try to link to OpenThreads +# OPENTHREADS_INCLUDE_DIR, where to find the headers +# +# $OPENTHREADS_DIR is an environment variable that would +# correspond to the ./configure --prefix=$OPENTHREADS_DIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include + +# To make it easier for one-step automated configuration/builds, +# we leverage environmental paths. This is preferable +# to the -DVAR=value switches because it insulates the +# users from changes we may make in this script. +# It also offers a little more flexibility than setting +# the CMAKE_*_PATH since we can target specific components. +# However, the default CMake behavior will search system paths +# before anything else. This is problematic in the cases +# where you have an older (stable) version installed, but +# are trying to build a newer version. +# CMake doesn't offer a nice way to globally control this behavior +# so we have to do a nasty "double FIND_" in this module. +# The first FIND disables the CMAKE_ search paths and only checks +# the environmental paths. +# If nothing is found, then the second find will search the +# standard install paths. +# Explicit -DVAR=value arguments should still be able to override everything. + +find_path(OPENTHREADS_INCLUDE_DIR OpenThreads/Thread + HINTS + # enough environment variables? + $ENV{OPENTHREADS_INCLUDE_DIR} + $ENV{OPENTHREADS_DIR} + $ENV{OSG_INCLUDE_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OpenThreads_ROOT} + $ENV{OSG_ROOT} + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + PATH_SUFFIXES include +) + + +find_library(OPENTHREADS_LIBRARY + NAMES OpenThreads OpenThreadsWin32 + HINTS + $ENV{OPENTHREADS_LIBRARY_DIR} + $ENV{OPENTHREADS_DIR} + $ENV{OSG_LIBRARY_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OpenThreads_ROOT} + $ENV{OSG_ROOT} + PATHS + /sw + /opt/local + /opt/csw + /opt + /usr/freeware + PATH_SUFFIXES lib64 lib +) + +find_library(OPENTHREADS_LIBRARY_DEBUG + NAMES OpenThreadsd OpenThreadsWin32d + HINTS + $ENV{OPENTHREADS_DEBUG_LIBRARY_DIR} + $ENV{OPENTHREADS_LIBRARY_DIR} + $ENV{OPENTHREADS_DIR} + $ENV{OSG_LIBRARY_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OpenThreads_ROOT} + $ENV{OSG_ROOT} + PATHS + /sw + /opt/local + /opt/csw + /opt + /usr/freeware + PATH_SUFFIXES lib64 lib +) + +if(OPENTHREADS_LIBRARY_DEBUG) + set(OPENTHREADS_LIBRARIES + optimized ${OPENTHREADS_LIBRARY} + debug ${OPENTHREADS_LIBRARY_DEBUG}) +else() + set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY}) +endif() + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG + OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/Findosg.cmake b/cmake-2.8.0-modules/osg/Findosg.cmake new file mode 100644 index 0000000..b9591a2 --- /dev/null +++ b/cmake-2.8.0-modules/osg/Findosg.cmake @@ -0,0 +1,81 @@ +# +# NOTE: It is highly recommended that you use the new FindOpenSceneGraph.cmake +# introduced in CMake 2.6.3 and not use this Find module directly. +# +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osg +# This module defines +# +# OSG_FOUND - Was the Osg found? +# OSG_INCLUDE_DIR - Where to find the headers +# OSG_LIBRARIES - The libraries to link against for the OSG (use this) +# +# OSG_LIBRARY - The OSG library +# OSG_LIBRARY_DEBUG - The OSG debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSG osg/PositionAttitudeTransform) +OSG_FIND_LIBRARY(OSG osg) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osg DEFAULT_MSG OSG_LIBRARY OSG_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgAnimation.cmake b/cmake-2.8.0-modules/osg/FindosgAnimation.cmake new file mode 100644 index 0000000..57bd5d8 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgAnimation.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgAnimation +# This module defines +# +# OSGANIMATION_FOUND - Was osgAnimation found? +# OSGANIMATION_INCLUDE_DIR - Where to find the headers +# OSGANIMATION_LIBRARIES - The libraries to link against for the OSG (use this) +# +# OSGANIMATION_LIBRARY - The OSG library +# OSGANIMATION_LIBRARY_DEBUG - The OSG debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGANIMATION osgAnimation/Animation) +OSG_FIND_LIBRARY(OSGANIMATION osgAnimation) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgAnimation DEFAULT_MSG + OSGANIMATION_LIBRARY OSGANIMATION_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgDB.cmake b/cmake-2.8.0-modules/osg/FindosgDB.cmake new file mode 100644 index 0000000..9900896 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgDB.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgDB +# This module defines +# +# OSGDB_FOUND - Was osgDB found? +# OSGDB_INCLUDE_DIR - Where to find the headers +# OSGDB_LIBRARIES - The libraries to link against for the osgDB (use this) +# +# OSGDB_LIBRARY - The osgDB library +# OSGDB_LIBRARY_DEBUG - The osgDB debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGDB osgDB/DatabasePager) +OSG_FIND_LIBRARY(OSGDB osgDB) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgDB DEFAULT_MSG + OSGDB_LIBRARY OSGDB_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgFX.cmake b/cmake-2.8.0-modules/osg/FindosgFX.cmake new file mode 100644 index 0000000..8fb2225 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgFX.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgFX +# This module defines +# +# OSGFX_FOUND - Was osgFX found? +# OSGFX_INCLUDE_DIR - Where to find the headers +# OSGFX_LIBRARIES - The libraries to link against for the osgFX (use this) +# +# OSGFX_LIBRARY - The osgFX library +# OSGFX_LIBRARY_DEBUG - The osgFX debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGFX osgFX/BumpMapping) +OSG_FIND_LIBRARY(OSGFX osgFX) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgFX DEFAULT_MSG + OSGFX_LIBRARY OSGFX_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgGA.cmake b/cmake-2.8.0-modules/osg/FindosgGA.cmake new file mode 100644 index 0000000..1e0f06e --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgGA.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgGA +# This module defines +# +# OSGGA_FOUND - Was osgGA found? +# OSGGA_INCLUDE_DIR - Where to find the headers +# OSGGA_LIBRARIES - The libraries to link against for the osgGA (use this) +# +# OSGGA_LIBRARY - The osgGA library +# OSGGA_LIBRARY_DEBUG - The osgGA debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGGA osgGA/FlightManipulator) +OSG_FIND_LIBRARY(OSGGA osgGA) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgGA DEFAULT_MSG + OSGGA_LIBRARY OSGGA_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgIntrospection.cmake b/cmake-2.8.0-modules/osg/FindosgIntrospection.cmake new file mode 100644 index 0000000..0ebb45f --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgIntrospection.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgINTROSPECTION +# This module defines +# +# OSGINTROSPECTION_FOUND - Was osgIntrospection found? +# OSGINTROSPECTION_INCLUDE_DIR - Where to find the headers +# OSGINTROSPECTION_LIBRARIES - The libraries to link for osgIntrospection (use this) +# +# OSGINTROSPECTION_LIBRARY - The osgIntrospection library +# OSGINTROSPECTION_LIBRARY_DEBUG - The osgIntrospection debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGINTROSPECTION osgIntrospection/Reflection) +OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgIntrospection DEFAULT_MSG + OSGINTROSPECTION_LIBRARY OSGINTROSPECTION_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgManipulator.cmake b/cmake-2.8.0-modules/osg/FindosgManipulator.cmake new file mode 100644 index 0000000..b2362aa --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgManipulator.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgManipulator +# This module defines +# +# OSGMANIPULATOR_FOUND - Was osgManipulator found? +# OSGMANIPULATOR_INCLUDE_DIR - Where to find the headers +# OSGMANIPULATOR_LIBRARIES - The libraries to link for osgManipulator (use this) +# +# OSGMANIPULATOR_LIBRARY - The osgManipulator library +# OSGMANIPULATOR_LIBRARY_DEBUG - The osgManipulator debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGMANIPULATOR osgManipulator/TrackballDragger) +OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgManipulator DEFAULT_MSG + OSGMANIPULATOR_LIBRARY OSGMANIPULATOR_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgParticle.cmake b/cmake-2.8.0-modules/osg/FindosgParticle.cmake new file mode 100644 index 0000000..c668739 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgParticle.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgParticle +# This module defines +# +# OSGPARTICLE_FOUND - Was osgParticle found? +# OSGPARTICLE_INCLUDE_DIR - Where to find the headers +# OSGPARTICLE_LIBRARIES - The libraries to link for osgParticle (use this) +# +# OSGPARTICLE_LIBRARY - The osgParticle library +# OSGPARTICLE_LIBRARY_DEBUG - The osgParticle debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGPARTICLE osgParticle/FireEffect) +OSG_FIND_LIBRARY(OSGPARTICLE osgParticle) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgParticle DEFAULT_MSG + OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgProducer.cmake b/cmake-2.8.0-modules/osg/FindosgProducer.cmake new file mode 100644 index 0000000..dd28b16 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgProducer.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgProducer +# This module defines +# +# OSGPRODUCER_FOUND - Was osgProducer found? +# OSGPRODUCER_INCLUDE_DIR - Where to find the headers +# OSGPRODUCER_LIBRARIES - The libraries to link for osgProducer (use this) +# +# OSGPRODUCER_LIBRARY - The osgProducer library +# OSGPRODUCER_LIBRARY_DEBUG - The osgProducer debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGPRODUCER osgProducer/OsgSceneHandler) +OSG_FIND_LIBRARY(OSGPRODUCER osgProducer) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgProducer DEFAULT_MSG + OSGPRODUCER_LIBRARY OSGPRODUCER_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgShadow.cmake b/cmake-2.8.0-modules/osg/FindosgShadow.cmake new file mode 100644 index 0000000..60da582 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgShadow.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgShadow +# This module defines +# +# OSGSHADOW_FOUND - Was osgShadow found? +# OSGSHADOW_INCLUDE_DIR - Where to find the headers +# OSGSHADOW_LIBRARIES - The libraries to link for osgShadow (use this) +# +# OSGSHADOW_LIBRARY - The osgShadow library +# OSGSHADOW_LIBRARY_DEBUG - The osgShadow debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGSHADOW osgShadow/ShadowTexture) +OSG_FIND_LIBRARY(OSGSHADOW osgShadow) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgShadow DEFAULT_MSG + OSGSHADOW_LIBRARY OSGSHADOW_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgSim.cmake b/cmake-2.8.0-modules/osg/FindosgSim.cmake new file mode 100644 index 0000000..14c3909 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgSim.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgSim +# This module defines +# +# OSGSIM_FOUND - Was osgSim found? +# OSGSIM_INCLUDE_DIR - Where to find the headers +# OSGSIM_LIBRARIES - The libraries to link for osgSim (use this) +# +# OSGSIM_LIBRARY - The osgSim library +# OSGSIM_LIBRARY_DEBUG - The osgSim debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGSIM osgSim/ImpostorSprite) +OSG_FIND_LIBRARY(OSGSIM osgSim) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgSim DEFAULT_MSG + OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgTerrain.cmake b/cmake-2.8.0-modules/osg/FindosgTerrain.cmake new file mode 100644 index 0000000..20cf569 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgTerrain.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgTerrain +# This module defines +# +# OSGTERRAIN_FOUND - Was osgTerrain found? +# OSGTERRAIN_INCLUDE_DIR - Where to find the headers +# OSGTERRAIN_LIBRARIES - The libraries to link for osgTerrain (use this) +# +# OSGTERRAIN_LIBRARY - The osgTerrain library +# OSGTERRAIN_LIBRARY_DEBUG - The osgTerrain debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGTERRAIN osgTerrain/Terrain) +OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgTerrain DEFAULT_MSG + OSGTERRAIN_LIBRARY OSGTERRAIN_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgText.cmake b/cmake-2.8.0-modules/osg/FindosgText.cmake new file mode 100644 index 0000000..81f9740 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgText.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgText +# This module defines +# +# OSGTEXT_FOUND - Was osgText found? +# OSGTEXT_INCLUDE_DIR - Where to find the headers +# OSGTEXT_LIBRARIES - The libraries to link for osgText (use this) +# +# OSGTEXT_LIBRARY - The osgText library +# OSGTEXT_LIBRARY_DEBUG - The osgText debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGTEXT osgText/Text) +OSG_FIND_LIBRARY(OSGTEXT osgText) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgText DEFAULT_MSG + OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgUtil.cmake b/cmake-2.8.0-modules/osg/FindosgUtil.cmake new file mode 100644 index 0000000..0884096 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgUtil.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgUtil +# This module defines +# +# OSGUTIL_FOUND - Was osgUtil found? +# OSGUTIL_INCLUDE_DIR - Where to find the headers +# OSGUTIL_LIBRARIES - The libraries to link for osgUtil (use this) +# +# OSGUTIL_LIBRARY - The osgUtil library +# OSGUTIL_LIBRARY_DEBUG - The osgUtil debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGUTIL osgUtil/SceneView) +OSG_FIND_LIBRARY(OSGUTIL osgUtil) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgUtil DEFAULT_MSG + OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgViewer.cmake b/cmake-2.8.0-modules/osg/FindosgViewer.cmake new file mode 100644 index 0000000..04df413 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgViewer.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgViewer +# This module defines +# +# OSGVIEWER_FOUND - Was osgViewer found? +# OSGVIEWER_INCLUDE_DIR - Where to find the headers +# OSGVIEWER_LIBRARIES - The libraries to link for osgViewer (use this) +# +# OSGVIEWER_LIBRARY - The osgViewer library +# OSGVIEWER_LIBRARY_DEBUG - The osgViewer debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGVIEWER osgViewer/Viewer) +OSG_FIND_LIBRARY(OSGVIEWER osgViewer) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgViewer DEFAULT_MSG + OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgVolume.cmake b/cmake-2.8.0-modules/osg/FindosgVolume.cmake new file mode 100644 index 0000000..6c666c4 --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgVolume.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgVolume +# This module defines +# +# OSGVOLUME_FOUND - Was osgVolume found? +# OSGVOLUME_INCLUDE_DIR - Where to find the headers +# OSGVOLUME_LIBRARIES - The libraries to link for osgVolume (use this) +# +# OSGVOLUME_LIBRARY - The osgVolume library +# OSGVOLUME_LIBRARY_DEBUG - The osgVolume debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# Created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGVOLUME osgVolume/Volume) +OSG_FIND_LIBRARY(OSGVOLUME osgVolume) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgVolume DEFAULT_MSG + OSGVOLUME_LIBRARY OSGVOLUME_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/FindosgWidget.cmake b/cmake-2.8.0-modules/osg/FindosgWidget.cmake new file mode 100644 index 0000000..227bbce --- /dev/null +++ b/cmake-2.8.0-modules/osg/FindosgWidget.cmake @@ -0,0 +1,78 @@ +# This is part of the Findosg* suite used to find OpenSceneGraph components. +# Each component is separate and you must opt in to each module. You must +# also opt into OpenGL and OpenThreads (and Producer if needed) as these +# modules won't do it for you. This is to allow you control over your own +# system piece by piece in case you need to opt out of certain components +# or change the Find behavior for a particular module (perhaps because the +# default FindOpenGL.cmake module doesn't work with your system as an +# example). +# If you want to use a more convenient module that includes everything, +# use the FindOpenSceneGraph.cmake instead of the Findosg*.cmake modules. +# +# Locate osgWidget +# This module defines +# +# OSGWIDGET_FOUND - Was osgWidget found? +# OSGWIDGET_INCLUDE_DIR - Where to find the headers +# OSGWIDGET_LIBRARIES - The libraries to link for osgWidget (use this) +# +# OSGWIDGET_LIBRARY - The osgWidget library +# OSGWIDGET_LIBRARY_DEBUG - The osgWidget debug library +# +# $OSGDIR is an environment variable that would +# correspond to the ./configure --prefix=$OSGDIR +# used in building osg. +# +# FindosgWidget.cmake tweaked from Findosg* suite as created by Eric Wing. + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Header files are presumed to be included like +# #include +# #include + +include(Findosg_functions) +OSG_FIND_PATH (OSGWIDGET osgWidget/Widget) +OSG_FIND_LIBRARY(OSGWIDGET osgWidget) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgWidget DEFAULT_MSG + OSGWIDGET_LIBRARY OSGWIDGET_INCLUDE_DIR) diff --git a/cmake-2.8.0-modules/osg/Findosg_functions.cmake b/cmake-2.8.0-modules/osg/Findosg_functions.cmake new file mode 100644 index 0000000..19f1803 --- /dev/null +++ b/cmake-2.8.0-modules/osg/Findosg_functions.cmake @@ -0,0 +1,132 @@ +# +# This CMake file contains two macros to assist with searching for OSG +# libraries and nodekits. +# + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Philip Lowman +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# +# OSG_FIND_PATH +# +function(OSG_FIND_PATH module header) + string(TOUPPER ${module} module_uc) + + # Try the user's environment request before anything else. + find_path(${module_uc}_INCLUDE_DIR ${header} + HINTS + $ENV{${module_uc}_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OSG_ROOT} + PATH_SUFFIXES include + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + ) +endfunction(OSG_FIND_PATH module header) + + +# +# OSG_FIND_LIBRARY +# +function(OSG_FIND_LIBRARY module library) + string(TOUPPER ${module} module_uc) + + find_library(${module_uc}_LIBRARY + NAMES ${library} + HINTS + $ENV{${module_uc}_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OSG_ROOT} + PATH_SUFFIXES lib64 lib + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + ) + + find_library(${module_uc}_LIBRARY_DEBUG + NAMES ${library}d + HINTS + $ENV{${module_uc}_DIR} + $ENV{OSG_DIR} + $ENV{OSGDIR} + $ENV{OSG_ROOT} + PATH_SUFFIXES lib64 lib + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/freeware + ) + + if(NOT ${module_uc}_LIBRARY_DEBUG) + # They don't have a debug library + set(${module_uc}_LIBRARY_DEBUG ${${module_uc}_LIBRARY} PARENT_SCOPE) + set(${module_uc}_LIBRARIES ${${module_uc}_LIBRARY} PARENT_SCOPE) + else() + # They really have a FOO_LIBRARY_DEBUG + set(${module_uc}_LIBRARIES + optimized ${${module_uc}_LIBRARY} + debug ${${module_uc}_LIBRARY_DEBUG} + PARENT_SCOPE + ) + endif() +endfunction(OSG_FIND_LIBRARY module library) + +# +# OSG_MARK_AS_ADVANCED +# Just a convenience function for calling MARK_AS_ADVANCED +# +function(OSG_MARK_AS_ADVANCED _module) + string(TOUPPER ${_module} _module_UC) + mark_as_advanced(${_module_UC}_INCLUDE_DIR) + mark_as_advanced(${_module_UC}_LIBRARY) + mark_as_advanced(${_module_UC}_LIBRARY_DEBUG) +endfunction() diff --git a/cmake-2.8.1-modules/patchctestbug10149/CTest.cmake b/cmake-2.8.1-modules/patchctestbug10149/CTest.cmake new file mode 100644 index 0000000..0c5aaf4 --- /dev/null +++ b/cmake-2.8.1-modules/patchctestbug10149/CTest.cmake @@ -0,0 +1,363 @@ +# - Configure a project for testing with CTest/CDash +# Include this module in the top CMakeLists.txt file of a project to +# enable testing with CTest and dashboard submissions to CDash: +# project(MyProject) +# ... +# include(CTest) +# The module automatically creates a BUILD_TESTING option that selects +# whether to enable testing support (ON by default). After including +# the module, use code like +# if(BUILD_TESTING) +# # ... CMake code to create tests ... +# endif() +# to creating tests when testing is enabled. +# +# To enable submissions to a CDash server, create a CTestConfig.cmake +# file at the top of the project with content such as +# set(CTEST_PROJECT_NAME "MyProject") +# set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") +# set(CTEST_DROP_METHOD "http") +# set(CTEST_DROP_SITE "my.cdash.org") +# set(CTEST_DROP_LOCATION "/submit.php?project=MyProject") +# set(CTEST_DROP_SITE_CDASH TRUE) +# (the CDash server can provide the file to a project administrator +# who configures 'MyProject'). +# Settings in the config file are shared by both this CTest module and +# the CTest command-line tool's dashboard script mode (ctest -S). +# +# While building a project for submission to CDash, CTest scans the +# build output for errors and warnings and reports them with +# surrounding context from the build log. This generic approach works +# for all build tools, but does not give details about the command +# invocation that produced a given problem. One may get more detailed +# reports by adding +# set(CTEST_USE_LAUNCHERS 1) +# to the CTestConfig.cmake file. When this option is enabled, the +# CTest module tells CMake's Makefile generators to invoke every +# command in the generated build system through a CTest launcher +# program. (Currently the CTEST_USE_LAUNCHERS option is ignored on +# non-Makefile generators.) During a manual build each launcher +# transparently runs the command it wraps. During a CTest-driven +# build for submission to CDash each launcher reports detailed +# information when its command fails or warns. +# (Setting CTEST_USE_LAUNCHERS in CTestConfig.cmake is convenient, but +# also adds the launcher overhead even for manual builds. One may +# instead set it in a CTest dashboard script and add it to the CMake +# cache for the build tree.) + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +option(BUILD_TESTING "Build the testing tree." ON) + +# function to turn generator name into a version string +# like vs7 vs71 vs8 vs9 +function(get_vs_version_string generator var) + string(REGEX + REPLACE + "Visual Studio ([0-9][0-9]?)($|.*)" + "\\1" + NUMBER + "${generator}") + if("${generator}" MATCHES "Visual Studio 7 .NET 2003") + set(ver_string "vs71") + else() + set(ver_string "vs${NUMBER}") + endif() + set(${var} ${ver_string} PARENT_SCOPE) +endfunction() + +if(BUILD_TESTING) + # Setup some auxilary macros + macro(set_if_not_set var val) + if(NOT DEFINED "${var}") + set("${var}" "${val}") + endif() + endmacro() + + macro(set_if_set var val) + if(NOT "${val}" MATCHES "^$") + set("${var}" "${val}") + endif() + endmacro() + + macro(set_if_set_and_not_set var val) + if(NOT "${val}" MATCHES "^$") + set_if_not_set("${var}" "${val}") + endif() + endmacro() + + # Make sure testing is enabled + enable_testing() + + if(EXISTS "${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + include("${PROJECT_SOURCE_DIR}/CTestConfig.cmake") + set_if_set_and_not_set(NIGHTLY_START_TIME + "${CTEST_NIGHTLY_START_TIME}") + set_if_set_and_not_set(DROP_METHOD "${CTEST_DROP_METHOD}") + set_if_set_and_not_set(DROP_SITE "${CTEST_DROP_SITE}") + set_if_set_and_not_set(DROP_SITE_USER "${CTEST_DROP_SITE_USER}") + set_if_set_and_not_set(DROP_SITE_PASSWORD + "${CTEST_DROP_SITE_PASWORD}") + set_if_set_and_not_set(DROP_SITE_MODE "${CTEST_DROP_SITE_MODE}") + set_if_set_and_not_set(DROP_LOCATION "${CTEST_DROP_LOCATION}") + set_if_set_and_not_set(TRIGGER_SITE "${CTEST_TRIGGER_SITE}") + set_if_set_and_not_set(UPDATE_TYPE "${CTEST_UPDATE_TYPE}") + endif() + + # the project can have a DartConfig.cmake file + if(EXISTS "${PROJECT_SOURCE_DIR}/DartConfig.cmake") + include("${PROJECT_SOURCE_DIR}/DartConfig.cmake") + else() + # Dashboard is opened for submissions for a 24 hour period starting at + # the specified NIGHTLY_START_TIME. Time is specified in 24 hour format. + set_if_not_set(NIGHTLY_START_TIME "00:00:00 EDT") + set_if_not_set(DROP_METHOD "http") + set_if_not_set(COMPRESS_SUBMISSION ON) + endif() + set_if_not_set(NIGHTLY_START_TIME "00:00:00 EDT") + + if(NOT UPDATE_TYPE) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") + set(UPDATE_TYPE cvs) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") + set(UPDATE_TYPE svn) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") + set(UPDATE_TYPE bzr) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") + set(UPDATE_TYPE hg) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + set(UPDATE_TYPE git) + endif() + endif() + + if(NOT UPDATE_TYPE) + if(NOT __CTEST_UPDATE_TYPE_COMPLAINED) + set(__CTEST_UPDATE_TYPE_COMPLAINED + 1 + CACHE + INTERNAL + "Already complained about update type.") + message(STATUS + "CTest cannot determine repository type. Please set UPDATE_TYPE to cvs, svn, bzr, hg, or git. CTest update will not work.") + endif() + endif() + + string(TOLOWER "${UPDATE_TYPE}" _update_type) + if("${_update_type}" STREQUAL "cvs") + find_program(CVSCOMMAND cvs) + set(CVS_UPDATE_OPTIONS + "-d -A -P" + CACHE + STRING + "Options passed to the cvs update command.") + set(UPDATE_COMMAND "${CVSCOMMAND}") + set(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}") + + elseif("${_update_type}" STREQUAL "svn") + find_program(SVNCOMMAND svn) + set(UPDATE_COMMAND "${SVNCOMMAND}") + set(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") + + elseif("${_update_type}" STREQUAL "bzr") + find_program(BZRCOMMAND bzr) + set(UPDATE_COMMAND "${BZRCOMMAND}") + set(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") + + elseif("${_update_type}" STREQUAL "hg") + find_program(HGCOMMAND hg) + set(UPDATE_COMMAND "${HGCOMMAND}") + set(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") + + elseif("${_update_type}" STREQUAL "git") + find_program(GITCOMMAND git) + set(UPDATE_COMMAND "${GITCOMMAND}") + set(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}") + endif() + + set(DART_TESTING_TIMEOUT + 1500 + CACHE + STRING + "Maximum time allowed before CTest will kill the test.") + + find_program(MEMORYCHECK_COMMAND + NAMES + purify + valgrind + boundscheck + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]" + DOC + "Path to the memory checking command, used for memory error detection.") + find_program(SLURM_SBATCH_COMMAND + sbatch + DOC + "Path to the SLURM sbatch executable") + find_program(SLURM_SRUN_COMMAND + srun + DOC + "Path to the SLURM srun executable") + set(MEMORYCHECK_SUPPRESSIONS_FILE + "" + CACHE + FILEPATH + "File that contains suppressions for the memory checker") + find_program(SCPCOMMAND + scp + DOC + "Path to scp command, used by CTest for submitting results to a Dart server") + find_program(COVERAGE_COMMAND + gcov + DOC + "Path to the coverage program that CTest uses for performing coverage inspection") + + # set the site name + site_name(SITE) + # set the build name + if(NOT BUILDNAME) + set(DART_COMPILER "${CMAKE_CXX_COMPILER}") + + if(NOT DART_COMPILER) + set(DART_COMPILER "${CMAKE_C_COMPILER}") + endif() + + if(NOT DART_COMPILER) + set(DART_COMPILER "unknown") + endif() + + if(WIN32) + set(DART_NAME_COMPONENT "NAME_WE") + else() + set(DART_NAME_COMPONENT "NAME") + endif() + + if(NOT BUILD_NAME_SYSTEM_NAME) + set(BUILD_NAME_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") + endif() + + if(WIN32) + set(BUILD_NAME_SYSTEM_NAME "Win32") + endif() + + if(UNIX OR BORLAND) + get_filename_component(DART_CXX_NAME + "${CMAKE_CXX_COMPILER}" + ${DART_NAME_COMPONENT}) + else() + get_filename_component(DART_CXX_NAME + "${CMAKE_BUILD_TOOL}" + ${DART_NAME_COMPONENT}) + endif() + + if(DART_CXX_NAME MATCHES "msdev") + set(DART_CXX_NAME "vs60") + endif() + + if(DART_CXX_NAME MATCHES "devenv") + get_vs_version_string("${CMAKE_GENERATOR}" DART_CXX_NAME) + endif() + + set(BUILDNAME "${BUILD_NAME_SYSTEM_NAME}-${DART_CXX_NAME}") + endif() + + # the build command + build_command(MAKECOMMAND CONFIGURATION "\${CTEST_CONFIGURATION_TYPE}") + set(MAKECOMMAND + ${MAKECOMMAND} + CACHE + STRING + "Command to build the project") + + # the default build configuration the ctest build handler will use + # if there is no -C arg given to ctest: + set(DEFAULT_CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}") + if(DEFAULT_CTEST_CONFIGURATION_TYPE STREQUAL "") + set(DEFAULT_CTEST_CONFIGURATION_TYPE "Release") + endif() + + if(NOT "${CMAKE_GENERATOR}" MATCHES "Make") + set(CTEST_USE_LAUNCHERS 0) + endif() + + if(CTEST_USE_LAUNCHERS) + set(CTEST_LAUNCH_COMPILE + "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --source --language --") + set(CTEST_LAUNCH_LINK + "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --target-type --language --") + set(CTEST_LAUNCH_CUSTOM + "\"${CMAKE_CTEST_COMMAND}\" --launch --target-name --build-dir --output --") + set_property(GLOBAL + PROPERTY + RULE_LAUNCH_COMPILE + "${CTEST_LAUNCH_COMPILE}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CTEST_LAUNCH_LINK}") + set_property(GLOBAL + PROPERTY + RULE_LAUNCH_CUSTOM + "${CTEST_LAUNCH_CUSTOM}") + endif() + + mark_as_advanced(COVERAGE_COMMAND + CVSCOMMAND + SVNCOMMAND + BZRCOMMAND + HGCOMMAND + GITCOMMAND + CVS_UPDATE_OPTIONS + SVN_UPDATE_OPTIONS + BZR_UPDATE_OPTIONS + HG_UPDATE_OPTIONS + GIT_UPDATE_OPTIONS + MAKECOMMAND + MEMORYCHECK_COMMAND + MEMORYCHECK_SUPPRESSIONS_FILE + PURIFYCOMMAND + SCPCOMMAND + SLURM_SBATCH_COMMAND + SLURM_SRUN_COMMAND + SITE) + + if(NOT RUN_FROM_DART) + set(RUN_FROM_CTEST_OR_DART 1) + include(CTestTargets) + set(RUN_FROM_CTEST_OR_DART) + endif() +endif() diff --git a/cmake-2.8.1-modules/patchctestbug10149/CTestScriptMode.cmake b/cmake-2.8.1-modules/patchctestbug10149/CTestScriptMode.cmake new file mode 100644 index 0000000..e6ab634 --- /dev/null +++ b/cmake-2.8.1-modules/patchctestbug10149/CTestScriptMode.cmake @@ -0,0 +1,51 @@ +# This file is read by ctest in script mode (-S) + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Determine the current system, so this information can be used +# in ctest scripts +include(CMakeDetermineSystem) + +# Also load the system specific file, which sets up e.g. the search paths. +# This makes the FIND_XXX() calls work much better +include(CMakeSystemSpecificInformation) + diff --git a/cmake-2.8.1-modules/patchctestbug10149/CTestTargets.cmake b/cmake-2.8.1-modules/patchctestbug10149/CTestTargets.cmake new file mode 100644 index 0000000..a964a03 --- /dev/null +++ b/cmake-2.8.1-modules/patchctestbug10149/CTestTargets.cmake @@ -0,0 +1,131 @@ + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +if(NOT RUN_FROM_CTEST_OR_DART) + message(FATAL_ERROR "Do not incldue CTestTargets.cmake directly") +endif() + +# make directories in the binary tree +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/Testing/Temporary) +get_filename_component(CMAKE_HOST_PATH ${CMAKE_COMMAND} PATH) +set(CMAKE_TARGET_PATH ${EXECUTABLE_OUTPUT_PATH}) +find_program(CMAKE_CTEST_COMMAND + ctest + ${CMAKE_HOST_PATH} + ${CMAKE_TARGET_PATH}) +mark_as_advanced(CMAKE_CTEST_COMMAND) + +# Use CTest +# configure files + +if(CTEST_NEW_FORMAT) + configure_file(${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in + ${PROJECT_BINARY_DIR}/CTestConfiguration.ini) +else() + configure_file(${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in + ${PROJECT_BINARY_DIR}/DartConfiguration.tcl) +endif() + +# +# Section 3: +# +# Custom targets to perform dashboard builds and submissions. +# These should NOT need to be modified from project to project. +# + +set(__conf_types "") +if(CMAKE_CONFIGURATION_TYPES) + # We need to pass the configuration type on the test command line. + set(__conf_types -C "${CMAKE_CFG_INTDIR}") +endif() + +# Add convenience targets. Do this at most once in case of nested +# projects. +define_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED + BRIEF_DOCS "Internal property used by CTestTargets module." + FULL_DOCS "Set by the CTestTargets module to track addition of testing targets.") + +get_property(_CTEST_TARGETS_ADDED GLOBAL PROPERTY CTEST_TARGETS_ADDED) +if(NOT _CTEST_TARGETS_ADDED) + set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) + + # For all generators add basic testing targets. + foreach(mode Experimental Nightly Continuous NightlyMemoryCheck) + add_custom_target(${mode} + ${CMAKE_CTEST_COMMAND} + ${__conf_types} + -D + ${mode}) + set_property(TARGET ${mode} PROPERTY RULE_LAUNCH_CUSTOM "") + endforeach() + + # For Makefile generators add more granular targets. + if("${CMAKE_GENERATOR}" MATCHES Make) + # Make targets for Experimental builds + foreach(mode Nightly Experimental Continuous) + foreach(testtype + Start + Update + Configure + Build + Test + Coverage + MemCheck + Submit) # missing purify + + add_custom_target(${mode}${testtype} + ${CMAKE_CTEST_COMMAND} + ${__conf_types} + -D + ${mode}${testtype}) + set_property(TARGET + ${mode}${testtype} + PROPERTY + RULE_LAUNCH_CUSTOM + "") + endforeach() + endforeach() + endif() # makefile generators + +endif() diff --git a/cmake-2.8.3-modules/FixWinInstallPrefix.cmake b/cmake-2.8.3-modules/FixWinInstallPrefix.cmake new file mode 100644 index 0000000..a606920 --- /dev/null +++ b/cmake-2.8.3-modules/FixWinInstallPrefix.cmake @@ -0,0 +1,77 @@ +# - Automatically fix CMAKE_INSTALL_PREFIX to be bit-appropriate on Win +# +# This is a workaround for CMake bug #9992 in at least <=2.8.0 - see +# http://public.kitware.com/Bug/view.php?id=9992 +# +# It runs automatically when included on a Windows build (passes if(WIN32)) - +# include after setting your project name (and your module search path, +# obviously) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(WIN32) + # caution - ENV{ProgramFiles} on Win64 is adjusted to point to the arch + # of the running executable which, since CMake is 32-bit on Windows as + # I write this, will always be = $ENV{ProgramFiles(x86)}. + # Thus, we only use this environment variable if we are on a 32 machine + + # 32-bit dir on win32, useless to us on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) + + # 32-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86) + + # 64-bit dir: only set on win64 + file(TO_CMAKE_PATH "$ENV{ProgramW6432}" _PROG_FILES_W6432) + + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64-bit build on win64 + set(_PROGFILESDIR "${_PROG_FILES_W6432}") + else() + if(_PROG_FILES_W6432) + # 32-bit build on win64 + set(_PROGFILESDIR "${_PROG_FILES_X86}") + else() + # 32-bit build on win32 + set(_PROGFILESDIR "${_PROG_FILES}") + endif() + endif() + + if(NOT FIXWININSTALLPREFIX_PREFIX) + set(_needsfix yes) + elseif(NOT + "${FIXWININSTALLPREFIX_PREFIX}" + STREQUAL + "${CMAKE_INSTALL_PREFIX}") + set(_needsfix yes) + else() + set(_needsfix) + endif() + + if(_needsfix) + if("${CMAKE_INSTALL_PREFIX}" + STREQUAL + "${_PROG_FILES}/${CMAKE_PROJECT_NAME}") + # The user didn't change this yet - it's the potentially broken default + set(CMAKE_INSTALL_PREFIX + "${_PROGFILESDIR}/${CMAKE_PROJECT_NAME}" + CACHE + PATH + "Where to install the project - has been adjusted by FixWinInstallPrefix" + FORCE) + endif() + set(FIXWININSTALLPREFIX_PREFIX + "${CMAKE_INSTALL_PREFIX}" + CACHE + INTERNAL + "We've fixed the prefix.") + endif() +endif() diff --git a/cmake-2.8.3-modules/autoinclude.cmake b/cmake-2.8.3-modules/autoinclude.cmake new file mode 100644 index 0000000..0190ad3 --- /dev/null +++ b/cmake-2.8.3-modules/autoinclude.cmake @@ -0,0 +1,13 @@ +# - Autoinclude these policies automatically +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(FixWinInstallPrefix) diff --git a/cmake-2.8.4-modules/ImproveEclipseGCCErrors.cmake b/cmake-2.8.4-modules/ImproveEclipseGCCErrors.cmake new file mode 100644 index 0000000..bd88619 --- /dev/null +++ b/cmake-2.8.4-modules/ImproveEclipseGCCErrors.cmake @@ -0,0 +1,19 @@ +# - Add a GCC flag so that the errors are more suitable to parsing by Eclipse +# +# include(ImproveEclipseGCCErrors) +# +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if("${CMAKE_GENERATOR}" MATCHES "Eclipse" AND CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") +endif() diff --git a/cmake-2.8.4-modules/autoinclude.cmake b/cmake-2.8.4-modules/autoinclude.cmake new file mode 100644 index 0000000..3934734 --- /dev/null +++ b/cmake-2.8.4-modules/autoinclude.cmake @@ -0,0 +1,13 @@ +# - Autoinclude these policies automatically +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(ImproveEclipseGCCErrors) diff --git a/cmake-2.8.4-modules/boost/FindBoost.cmake b/cmake-2.8.4-modules/boost/FindBoost.cmake new file mode 100644 index 0000000..033ab08 --- /dev/null +++ b/cmake-2.8.4-modules/boost/FindBoost.cmake @@ -0,0 +1,1169 @@ +# - Try to find Boost include dirs and libraries +# Usage of this module as follows: +# +# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below. +# Due to Boost naming conventions and limitations in CMake this find +# module is NOT future safe with respect to Boost version numbers, +# and may break. +# +# == Using Header-Only libraries from within Boost: == +# +# find_package( Boost 1.36.0 ) +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# endif() +# +# +# == Using actual libraries from within Boost: == +# +# set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_MULTITHREADED ON) +# set(Boost_USE_STATIC_RUNTIME OFF) +# find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... ) +# +# if(Boost_FOUND) +# include_directories(${Boost_INCLUDE_DIRS}) +# add_executable(foo foo.cc) +# target_link_libraries(foo ${Boost_LIBRARIES}) +# endif() +# +# +# The components list needs to contain actual names of boost libraries only, +# such as "date_time" for "libboost_date_time". If you're using parts of +# Boost that contain header files only (e.g. foreach) you do not need to +# specify COMPONENTS. +# +# You should provide a minimum version number that should be used. If you provide this +# version number and specify the REQUIRED attribute, this module will fail if it +# can't find the specified or a later version. If you specify a version number this is +# automatically put into the considered list of version numbers and thus doesn't need +# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below). +# +# NOTE for Visual Studio Users: +# Automatic linking is used on MSVC & Borland compilers by default when +# #including things in Boost. It's important to note that setting +# Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking, +# should you need this feature. Automatic linking typically uses static +# libraries with a few exceptions (Boost.Python is one). +# +# Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for +# more details. Adding a TARGET_LINK_LIBRARIES() as shown in the example +# above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS +# gets set to OFF. It is suggested you avoid automatic linking since it +# will make your application less portable. +# +# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============ +# +# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of +# boost version numbers that should be taken into account when searching +# for Boost. Unfortunately boost puts the version number into the +# actual filename for the libraries, so this variable will certainly be needed +# in the future when new Boost versions are released. +# +# Currently this module searches for the following version numbers: +# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, +# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, +# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0 +# +# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should +# add both 1.x and 1.x.0 as shown above. Official Boost include directories +# omit the 3rd version number from include paths if it is 0 although not all +# binary Boost releases do so. +# +# SET(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") +# +# ===================================== ============= ======================== +# +# Variables used by this module, they can change the default behaviour and +# need to be set before calling find_package: +# +# Boost_USE_MULTITHREADED Can be set to OFF to use the non-multithreaded +# boost libraries. If not specified, defaults +# to ON. +# +# Boost_USE_STATIC_LIBS Can be set to ON to force the use of the static +# boost libraries. Defaults to OFF. +# +# Boost_NO_SYSTEM_PATHS Set to TRUE to suppress searching in system +# paths (or other locations outside of BOOST_ROOT +# or BOOST_INCLUDEDIR). Useful when specifying +# BOOST_ROOT. Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STATIC_RUNTIME If enabled, searches for boost libraries +# linked against a static C++ standard library +# ('s' ABI tag). This option should be set to +# ON or OFF because the default behavior +# if not specified is platform dependent +# for backwards compatibility. +# [Since CMake 2.8.3] +# +# Boost_USE_DEBUG_PYTHON If enabled, searches for boost libraries +# compiled against a special debug build of +# Python ('y' ABI tag). Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STLPORT If enabled, searches for boost libraries +# compiled against the STLPort standard +# library ('p' ABI tag). Defaults to OFF. +# [Since CMake 2.8.3] +# +# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS +# If enabled, searches for boost libraries +# compiled against the deprecated STLPort +# "native iostreams" feature ('n' ABI tag). +# Defaults to OFF. +# [Since CMake 2.8.3] +# +# Other Variables used by this module which you may want to set. +# +# Boost_ADDITIONAL_VERSIONS A list of version numbers to use for searching +# the boost include directory. Please see +# the documentation above regarding this +# annoying, but necessary variable :( +# +# Boost_DEBUG Set this to TRUE to enable debugging output +# of FindBoost.cmake if you are having problems. +# Please enable this before filing any bug +# reports. +# +# Boost_DETAILED_FAILURE_MSG FindBoost doesn't output detailed information +# about why it failed or how to fix the problem +# unless this is set to TRUE or the REQUIRED +# keyword is specified in find_package(). +# [Since CMake 2.8.0] +# +# Boost_COMPILER Set this to the compiler suffix used by Boost +# (e.g. "-gcc43") if FindBoost has problems finding +# the proper Boost installation +# +# Boost_THREADAPI When building boost.thread, sometimes the name of the +# library contains an additional "pthread" or "win32" +# string known as the threadapi. This can happen when +# compiling against pthreads on Windows or win32 threads +# on Cygwin. You may specify this variable and if set +# when FindBoost searches for the Boost threading library +# it will first try to match the threadapi you specify. +# For Example: libboost_thread_win32-mgw45-mt-1_43.a +# might be found if you specified "win32" here before +# falling back on libboost_thread-mgw45-mt-1_43.a. +# [Since CMake 2.8.3] +# +# Boost_REALPATH Resolves symbolic links for discovered boost libraries +# to assist with packaging. For example, instead of +# Boost_SYSTEM_LIBRARY_RELEASE being resolved to +# "/usr/lib/libboost_system.so" it would be +# "/usr/lib/libboost_system.so.1.42.0" instead. +# This does not affect linking and should not be +# enabled unless the user needs this information. +# [Since CMake 2.8.3] +# + + +# +# These last three variables are available also as environment variables: +# +# BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for +# Boost. Set this if the module has problems finding +# the proper Boost installation. To prevent falling +# back on the system paths, set Boost_NO_SYSTEM_PATHS +# to true. +# +# BOOST_INCLUDEDIR Set this to the include directory of Boost, if the +# module has problems finding the proper Boost installation +# +# BOOST_LIBRARYDIR Set this to the lib directory of Boost, if the +# module has problems finding the proper Boost installation +# +# Variables defined by this module: +# +# Boost_FOUND System has Boost, this means the include dir was +# found, as well as all the libraries specified in +# the COMPONENTS list. +# +# Boost_INCLUDE_DIRS Boost include directories: not cached +# +# Boost_INCLUDE_DIR This is almost the same as above, but this one is +# cached and may be modified by advanced users +# +# Boost_LIBRARIES Link to these to use the Boost libraries that you +# specified: not cached +# +# Boost_LIBRARY_DIRS The path to where the Boost library files are. +# +# Boost_VERSION The version number of the boost libraries that +# have been found, same as in version.hpp from Boost +# +# Boost_LIB_VERSION The version number in filename form as +# it's appended to the library filenames +# +# Boost_MAJOR_VERSION major version number of boost +# Boost_MINOR_VERSION minor version number of boost +# Boost_SUBMINOR_VERSION subminor version number of boost +# +# Boost_LIB_DIAGNOSTIC_DEFINITIONS [WIN32 Only] You can call +# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +# to have diagnostic information about Boost's +# automatic linking outputted during compilation time. +# +# For each component you specify in find_package(), the following (UPPER-CASE) +# variables are set. You can use these variables if you would like to pick and +# choose components for your targets instead of just using Boost_LIBRARIES. +# +# Boost_${COMPONENT}_FOUND True IF the Boost library "component" was found. +# +# Boost_${COMPONENT}_LIBRARY Contains the libraries for the specified Boost +# "component" (includes debug and optimized keywords +# when needed). + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2008 Andreas Schneider +# Copyright 2007 Wengo +# Copyright 2007 Mike Jackson +# Copyright 2008 Andreas Pakulat +# Copyright 2008-2010 Philip Lowman +# +# Distributed under the OSI-approved BSD License (the "License"); +# see below. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +#------------------------------------------------------------------------------- +# FindBoost functions & macros +# +############################################ +# +# Check the existence of the libraries. +# +############################################ +# This macro was taken directly from the FindQt4.cmake file that is included +# with the CMake distribution. This is NOT my work. All work was done by the +# original authors of the FindQt4.cmake file. Only minor modifications were +# made to remove references to Qt and make this file more generally applicable +# And ELSE/ENDIF pairs were removed for readability. +######################################################################### + +MACRO (_Boost_ADJUST_LIB_VARS basename) + IF (Boost_INCLUDE_DIR ) + IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) + # if the generator supports configuration types then set + # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value + IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) + ELSE() + # if there are no configuration types and CMAKE_BUILD_TYPE has no value + # then just use the release libraries + SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) + ENDIF() + # FIXME: This probably should be set for both cases + SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) + ENDIF() + + # if only the release version was found, set the debug variable also to the release version + IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) + SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) + SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) + SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) + ENDIF() + + # if only the debug version was found, set the release variable also to the debug version + IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) + SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) + SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) + SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) + ENDIF() + + IF (Boost_${basename}_LIBRARY) + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") + + # Remove superfluous "debug" / "optimized" keywords from + # Boost_LIBRARY_DIRS + FOREACH(_boost_my_lib ${Boost_${basename}_LIBRARY}) + GET_FILENAME_COMPONENT(_boost_my_lib_path "${_boost_my_lib}" PATH) + LIST(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path}) + ENDFOREACH() + LIST(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) + + set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") + SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") + ENDIF(Boost_${basename}_LIBRARY) + + ENDIF (Boost_INCLUDE_DIR ) + # Make variables changeble to the advanced user + MARK_AS_ADVANCED( + Boost_${basename}_LIBRARY + Boost_${basename}_LIBRARY_RELEASE + Boost_${basename}_LIBRARY_DEBUG + ) +ENDMACRO (_Boost_ADJUST_LIB_VARS) + +#------------------------------------------------------------------------------- + +# +# Runs compiler with "-dumpversion" and parses major/minor +# version with a regex. +# +FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) + + EXEC_PROGRAM(${CMAKE_CXX_COMPILER} + ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion + OUTPUT_VARIABLE _boost_COMPILER_VERSION + ) + STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" + _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) + + SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) +ENDFUNCTION() + +# +# A convenience function for marking desired components +# as found or not +# +function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no) + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE) + endforeach() +endfunction() + +# +# Take a list of libraries with "thread" in it +# and prepend duplicates with "thread_${Boost_THREADAPI}" +# at the front of the list +# +function(_Boost_PREPEND_LIST_WITH_THREADAPI _output) + set(_orig_libnames ${ARGN}) + string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames ${_orig_libnames}) + set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE) +endfunction() + +# +# If a library is found, replace its cache entry with its REALPATH +# +function(_Boost_SWAP_WITH_REALPATH _library _docstring) + if(${_library}) + get_filename_component(_boost_filepathreal ${${_library}} REALPATH) + unset(${_library} CACHE) + set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}") + endif() +endfunction() + +# +# End functions/macros +# +#------------------------------------------------------------------------------- + + + + +IF(NOT DEFINED Boost_USE_MULTITHREADED) + SET(Boost_USE_MULTITHREADED TRUE) +ENDIF() + +if(Boost_FIND_VERSION_EXACT) + # The version may appear in a directory with or without the patch + # level, even when the patch level is non-zero. + set(_boost_TEST_VERSIONS + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" + "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") +else(Boost_FIND_VERSION_EXACT) + # The user has not requested an exact version. Among known + # versions, find those that are acceptable to the user request. + set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} + "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" + "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" + "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" + "1.34" "1.33.1" "1.33.0" "1.33") + set(_boost_TEST_VERSIONS) + if(Boost_FIND_VERSION) + set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + # Select acceptable versions. + foreach(version ${_Boost_KNOWN_VERSIONS}) + if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") + # This version is high enough. + list(APPEND _boost_TEST_VERSIONS "${version}") + elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") + # This version is a short-form for the requested version with + # the patch level dropped. + list(APPEND _boost_TEST_VERSIONS "${version}") + endif() + endforeach(version) + else(Boost_FIND_VERSION) + # Any version is acceptable. + set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") + endif(Boost_FIND_VERSION) +endif(Boost_FIND_VERSION_EXACT) + +# The reason that we failed to find Boost. This will be set to a +# user-friendly message when we fail to find some necessary piece of +# Boost. +set(Boost_ERROR_REASON) + +SET( _boost_IN_CACHE TRUE) +IF(Boost_INCLUDE_DIR) + + # On versions < 1.35, remove the System library from the considered list + # since it wasn't added until 1.35. + if(Boost_VERSION AND Boost_FIND_COMPONENTS) + if(Boost_VERSION LESS 103500) + list(REMOVE_ITEM Boost_FIND_COMPONENTS system) + endif() + endif() + + FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) + STRING(TOUPPER ${COMPONENT} COMPONENT) + IF(NOT Boost_${COMPONENT}_FOUND) + SET( _boost_IN_CACHE FALSE) + ENDIF(NOT Boost_${COMPONENT}_FOUND) + ENDFOREACH(COMPONENT) +ELSE(Boost_INCLUDE_DIR) + SET( _boost_IN_CACHE FALSE) +ENDIF(Boost_INCLUDE_DIR) + +IF (_boost_IN_CACHE) + # in cache already + SET(Boost_FOUND TRUE) + FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) + STRING(TOUPPER ${COMPONENT} COMPONENT) + _Boost_ADJUST_LIB_VARS( ${COMPONENT} ) + SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY}) + ENDFOREACH(COMPONENT) + SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) + IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} " + "is already in the cache. To view debugging messages, please clear the cache.") + endif() +ELSE (_boost_IN_CACHE) + # Need to search for boost + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost not in cache") + # Output some of their choices + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") + endif() + + IF(WIN32) + # In windows, automatic linking is performed, so you do not have + # to specify the libraries. If you are linking to a dynamic + # runtime, then you can choose to link to either a static or a + # dynamic Boost library, the default is to do a static link. You + # can alter this for a specific library "whatever" by defining + # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be + # linked dynamically. Alternatively you can force all Boost + # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. + + # This feature can be disabled for Boost library "whatever" by + # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining + # BOOST_ALL_NO_LIB. + + # If you want to observe which libraries are being linked against + # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking + # code to emit a #pragma message each time a library is selected + # for linking. + SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS + "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") + ENDIF(WIN32) + + set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM + C:/boost/include + C:/boost + "$ENV{ProgramFiles}/boost/include" + "$ENV{ProgramFiles}/boost" + /sw/local/include + ) + + # If Boost_ROOT was defined, gently correct the user + if(Boost_ROOT) + message("WARNING: Boost_ROOT was set which is incorrect and is being ignored. " + "You need to use BOOST_ROOT instead. " + "Also, we suggest setting Boost_NO_SYSTEM_PATHS.") + endif() + + # If BOOST_ROOT was defined in the environment, use it. + if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") + set(BOOST_ROOT $ENV{BOOST_ROOT}) + endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") + + # If BOOSTROOT was defined in the environment, use it. + if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") + set(BOOST_ROOT $ENV{BOOSTROOT}) + endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") + + # If BOOST_INCLUDEDIR was defined in the environment, use it. + IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) + set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) + ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) + + # If BOOST_LIBRARYDIR was defined in the environment, use it. + IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) + set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) + ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) + + IF( BOOST_ROOT ) + file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) + ENDIF( BOOST_ROOT ) + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Declared as CMake or Environmental Variables:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_ROOT = ${BOOST_ROOT}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") + endif() + + if( Boost_NO_SYSTEM_PATHS) + set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + else() + set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM}) + endif() + + if( BOOST_ROOT ) + set(_boost_INCLUDE_SEARCH_DIRS + ${BOOST_ROOT}/include + ${BOOST_ROOT} + ${_boost_INCLUDE_SEARCH_DIRS}) + endif() + + # prepend BOOST_INCLUDEDIR to search path if specified + if( BOOST_INCLUDEDIR ) + file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR) + set(_boost_INCLUDE_SEARCH_DIRS + ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS}) + endif( BOOST_INCLUDEDIR ) + + # ------------------------------------------------------------------------ + # Search for Boost include DIR + # ------------------------------------------------------------------------ + # Try to find Boost by stepping backwards through the Boost versions + # we know about. + IF( NOT Boost_INCLUDE_DIR ) + # Build a list of path suffixes for each version. + SET(_boost_PATH_SUFFIXES) + FOREACH(_boost_VER ${_boost_TEST_VERSIONS}) + # Add in a path suffix, based on the required version, ideally + # we could read this from version.hpp, but for that to work we'd + # need to know the include dir already + set(_boost_BOOSTIFIED_VERSION) + + # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 + IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") + STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+") + STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" + _boost_BOOSTIFIED_VERSION ${_boost_VER}) + ENDIF() + + list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") + list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") + + ENDFOREACH(_boost_VER) + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Include debugging info:") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") + endif() + + # Look for a standard boost header file. + FIND_PATH(Boost_INCLUDE_DIR + NAMES boost/config.hpp + HINTS ${_boost_INCLUDE_SEARCH_DIRS} + PATH_SUFFIXES ${_boost_PATH_SUFFIXES} + ${_boost_FIND_OPTIONS} + ) + ENDIF( NOT Boost_INCLUDE_DIR ) + + # ------------------------------------------------------------------------ + # Extract version information from version.hpp + # ------------------------------------------------------------------------ + + IF(Boost_INCLUDE_DIR) + # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp + # Read the whole file: + # + SET(BOOST_VERSION 0) + SET(BOOST_LIB_VERSION "") + FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") + endif() + + STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") + STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") + + SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") + SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") + + IF(NOT "${Boost_VERSION}" STREQUAL "0") + MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") + ENDIF(NOT "${Boost_VERSION}" STREQUAL "0") + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "version.hpp reveals boost " + "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + endif() + ELSE(Boost_INCLUDE_DIR) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") + ENDIF(Boost_INCLUDE_DIR) + + # ------------------------------------------------------------------------ + # Suffix initialization and compiler suffix detection. + # ------------------------------------------------------------------------ + + # Setting some more suffixes for the library + SET (Boost_LIB_PREFIX "") + if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) + SET (Boost_LIB_PREFIX "lib") + endif() + + if (Boost_COMPILER) + set(_boost_COMPILER ${Boost_COMPILER}) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "using user-specified Boost_COMPILER = ${_boost_COMPILER}") + endif() + else(Boost_COMPILER) + # Attempt to guess the compiler suffix + # NOTE: this is not perfect yet, if you experience any issues + # please report them and use the Boost_COMPILER variable + # to work around the problems. + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + if(WIN32) + set (_boost_COMPILER "-iw") + else() + set (_boost_COMPILER "-il") + endif() + elseif (MSVC90) + SET (_boost_COMPILER "-vc90") + elseif (MSVC10) + SET (_boost_COMPILER "-vc100") + elseif (MSVC80) + SET (_boost_COMPILER "-vc80") + elseif (MSVC71) + SET (_boost_COMPILER "-vc71") + elseif (MSVC70) # Good luck! + SET (_boost_COMPILER "-vc7") # yes, this is correct + elseif (MSVC60) # Good luck! + SET (_boost_COMPILER "-vc6") # yes, this is correct + elseif (BORLAND) + SET (_boost_COMPILER "-bcb") + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro") + set(_boost_COMPILER "-sw") + elseif (MINGW) + if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) + SET(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 + else() + _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) + SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") + endif() + elseif (UNIX) + if (CMAKE_COMPILER_IS_GNUCXX) + if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) + SET(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 + else() + _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) + # Determine which version of GCC we have. + IF(APPLE) + IF(Boost_MINOR_VERSION) + IF(${Boost_MINOR_VERSION} GREATER 35) + # In Boost 1.36.0 and newer, the mangled compiler name used + # on Mac OS X/Darwin is "xgcc". + SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") + ELSE(${Boost_MINOR_VERSION} GREATER 35) + # In Boost <= 1.35.0, there is no mangled compiler name for + # the Mac OS X/Darwin version of GCC. + SET(_boost_COMPILER "") + ENDIF(${Boost_MINOR_VERSION} GREATER 35) + ELSE(Boost_MINOR_VERSION) + # We don't know the Boost version, so assume it's + # pre-1.36.0. + SET(_boost_COMPILER "") + ENDIF(Boost_MINOR_VERSION) + ELSE() + SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") + ENDIF() + endif() + endif (CMAKE_COMPILER_IS_GNUCXX) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "guessed _boost_COMPILER = ${_boost_COMPILER}") + endif() + endif(Boost_COMPILER) + + set (_boost_MULTITHREADED "-mt") + if( NOT Boost_USE_MULTITHREADED ) + set (_boost_MULTITHREADED "") + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") + endif() + + #====================== + # Systematically build up the Boost ABI tag + # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming + set( _boost_RELEASE_ABI_TAG "-") + set( _boost_DEBUG_ABI_TAG "-") + # Key Use this library when: + # s linking statically to the C++ standard library and + # compiler runtime support libraries. + if(Boost_USE_STATIC_RUNTIME) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") + endif() + # g using debug versions of the standard and runtime + # support libraries + if(WIN32) + if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") + endif() + endif() + # y using special debug build of python + if(Boost_USE_DEBUG_PYTHON) + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y") + endif() + # d using a debug version of your code + set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d") + # p using the STLport standard library rather than the + # default one supplied with your compiler + if(Boost_USE_STLPORT) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}p") + endif() + # n using the STLport deprecated "native iostreams" feature + if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) + set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n") + set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}n") + endif() + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") + endif() + + # ------------------------------------------------------------------------ + # Begin finding boost libraries + # ------------------------------------------------------------------------ + + if(BOOST_ROOT) + set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS + ${BOOST_ROOT}/lib + ${BOOST_ROOT}/stage/lib) + endif() + set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS + ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS} + ${Boost_INCLUDE_DIR}/lib + ${Boost_INCLUDE_DIR}/../lib + ${Boost_INCLUDE_DIR}/stage/lib + ) + set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM + C:/boost/lib + C:/boost + "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib" + "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib" + "$ENV{ProgramFiles}/boost/lib" + "$ENV{ProgramFiles}/boost" + /sw/local/lib + ) + set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}) + if( Boost_NO_SYSTEM_PATHS ) + set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH) + else() + list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM}) + endif() + + # prepend BOOST_LIBRARYDIR to search path if specified + if( BOOST_LIBRARYDIR ) + file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR) + set(_boost_LIBRARY_SEARCH_DIRS + ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS}) + endif() + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}") + endif() + + # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES + if( Boost_USE_STATIC_LIBS ) + set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) + endif() + endif() + + # We want to use the tag inline below without risking double dashes + if(_boost_RELEASE_ABI_TAG) + if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") + set(_boost_RELEASE_ABI_TAG "") + endif() + endif() + if(_boost_DEBUG_ABI_TAG) + if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") + set(_boost_DEBUG_ABI_TAG "") + endif() + endif() + + # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled + # on WIN32 was to: + # 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) + # 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) + # We maintain this behavior since changing it could break people's builds. + # To disable the ambiguous behavior, the user need only + # set Boost_USE_STATIC_RUNTIME either ON or OFF. + set(_boost_STATIC_RUNTIME_WORKAROUND false) + if(WIN32 AND Boost_USE_STATIC_LIBS) + if(NOT DEFINED Boost_USE_STATIC_RUNTIME) + set(_boost_STATIC_RUNTIME_WORKAROUND true) + endif() + endif() + + + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) + set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" ) + set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" ) + set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND") + + set( _boost_docstring_release "Boost ${COMPONENT} library (release)") + set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") + + # + # Find RELEASE libraries + # + set(_boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") + endif() + find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE + NAMES ${_boost_RELEASE_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + ${_boost_FIND_OPTIONS} + DOC "${_boost_docstring_release}" + ) + + # + # Find DEBUG libraries + # + set(_boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} + ${Boost_LIB_PREFIX}boost_${COMPONENT} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + endif() + if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) + endif() + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") + endif() + find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG + NAMES ${_boost_DEBUG_NAMES} + HINTS ${_boost_LIBRARY_SEARCH_DIRS} + ${_boost_FIND_OPTIONS} + DOC "${_boost_docstring_debug}" + ) + + if(Boost_REALPATH) + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") + _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) + endif() + + _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) + + endforeach(COMPONENT) + + # Restore the original find library ordering + if( Boost_USE_STATIC_LIBS ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() + # ------------------------------------------------------------------------ + # End finding boost libraries + # ------------------------------------------------------------------------ + + SET(Boost_INCLUDE_DIRS + ${Boost_INCLUDE_DIR} + ) + + SET(Boost_FOUND FALSE) + IF(Boost_INCLUDE_DIR) + SET( Boost_FOUND TRUE ) + + # Check the version of Boost against the requested version. + if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) + message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34") + endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) + if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) + set( Boost_FOUND FALSE ) + set(_Boost_VERSION_AGE "old") + elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) + if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) + set( Boost_FOUND FALSE ) + set(_Boost_VERSION_AGE "old") + elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) + if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) + set( Boost_FOUND FALSE ) + set(_Boost_VERSION_AGE "old") + endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" ) + endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" ) + endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" ) + + if (NOT Boost_FOUND) + _Boost_MARK_COMPONENTS_FOUND(OFF) + endif() + + if (Boost_FOUND AND Boost_FIND_VERSION_EXACT) + # If the user requested an exact version of Boost, check + # that. We already know that the Boost version we have is >= the + # requested version. + set(_Boost_VERSION_AGE "new") + + # If the user didn't specify a patchlevel, it's 0. + if (NOT Boost_FIND_VERSION_PATCH) + set(Boost_FIND_VERSION_PATCH 0) + endif (NOT Boost_FIND_VERSION_PATCH) + + # We'll set Boost_FOUND true again if we have an exact version match. + set(Boost_FOUND FALSE) + _Boost_MARK_COMPONENTS_FOUND(OFF) + if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) + if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) + if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) + set( Boost_FOUND TRUE ) + _Boost_MARK_COMPONENTS_FOUND(ON) + endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" ) + endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" ) + endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" ) + endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT) + + if(NOT Boost_FOUND) + # State that we found a version of Boost that is too new or too old. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + if (Boost_FIND_VERSION_PATCH) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") + endif (Boost_FIND_VERSION_PATCH) + if (NOT Boost_FIND_VERSION_EXACT) + set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") + endif (NOT Boost_FIND_VERSION_EXACT) + set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") + endif (NOT Boost_FOUND) + + # Always check for missing components + set(_boost_CHECKED_COMPONENT FALSE) + set(_Boost_MISSING_COMPONENTS "") + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} COMPONENT) + set(_boost_CHECKED_COMPONENT TRUE) + if(NOT Boost_${COMPONENT}_FOUND) + string(TOLOWER ${COMPONENT} COMPONENT) + list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) + set( Boost_FOUND FALSE) + endif(NOT Boost_${COMPONENT}_FOUND) + endforeach(COMPONENT) + + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") + endif() + + if (_Boost_MISSING_COMPONENTS) + # We were unable to find some libraries, so generate a sensible + # error message that lists the libraries we were unable to find. + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n") + foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON} boost_${COMPONENT}\n") + endforeach(COMPONENT) + + list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) + list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) + if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) + set(Boost_ERROR_REASON + "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) + endif (_Boost_MISSING_COMPONENTS) + + IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + # Compatibility Code for backwards compatibility with CMake + # 2.4's FindBoost module. + + # Look for the boost library path. + # Note that the user may not have installed any libraries + # so it is quite possible the Boost_LIBRARY_PATH may not exist. + SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) + + IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") + GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") + + IF("${_boost_LIB_DIR}" MATCHES "/include$") + # Strip off the trailing "/include" in the path. + GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + ENDIF("${_boost_LIB_DIR}" MATCHES "/include$") + + IF(EXISTS "${_boost_LIB_DIR}/lib") + SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib) + ELSE(EXISTS "${_boost_LIB_DIR}/lib") + IF(EXISTS "${_boost_LIB_DIR}/stage/lib") + SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) + ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib") + SET(_boost_LIB_DIR "") + ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib") + ENDIF(EXISTS "${_boost_LIB_DIR}/lib") + + IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") + ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + + ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + + ELSE(Boost_INCLUDE_DIR) + SET( Boost_FOUND FALSE) + ENDIF(Boost_INCLUDE_DIR) + + IF (Boost_FOUND) + IF (NOT Boost_FIND_QUIETLY) + MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if(Boost_FIND_COMPONENTS) + message(STATUS "Found the following Boost libraries:") + endif() + ENDIF(NOT Boost_FIND_QUIETLY) + FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} ) + STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT ) + IF ( Boost_${UPPERCOMPONENT}_FOUND ) + IF (NOT Boost_FIND_QUIETLY) + MESSAGE (STATUS " ${COMPONENT}") + ENDIF(NOT Boost_FIND_QUIETLY) + SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) + ENDIF ( Boost_${UPPERCOMPONENT}_FOUND ) + ENDFOREACH(COMPONENT) + else() + if(Boost_FIND_REQUIRED) + message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") + else() + if(NOT Boost_FIND_QUIETLY) + # we opt not to automatically output Boost_ERROR_REASON here as + # it could be quite lengthy and somewhat imposing in it's requests + # Since Boost is not always a required dependency we'll leave this + # up to the end-user. + if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) + message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") + else() + message(STATUS "Could NOT find Boost") + endif() + endif() + endif(Boost_FIND_REQUIRED) + endif() + + # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view + MARK_AS_ADVANCED(Boost_INCLUDE_DIR + Boost_INCLUDE_DIRS + Boost_LIBRARY_DIRS + ) +ENDIF(_boost_IN_CACHE) diff --git a/cmake-2.9.0-modules/RequireOutOfSourceBuild.cmake b/cmake-2.9.0-modules/RequireOutOfSourceBuild.cmake new file mode 100644 index 0000000..c86f078 --- /dev/null +++ b/cmake-2.9.0-modules/RequireOutOfSourceBuild.cmake @@ -0,0 +1,44 @@ +# - Issue an error if the source tree is in or equal to the build tree +# +# include(RequireOutOfSourceBuild) +# +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +get_filename_component(_src "${CMAKE_SOURCE_DIR}" ABSOLUTE) +get_filename_component(_cur_src "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) +get_filename_component(_bin "${CMAKE_BINARY_DIR}" ABSOLUTE) + +string(LENGTH "${_src}" _src_len) +string(LENGTH "${_cur_src}" _cur_src_len) +string(LENGTH "${_bin}" _bin_len) + +set(_test) + +if(NOT "${_bin_len}" GREATER "${_src_len}") + list(APPEND _test _src) + #message(STATUS "Checking ${_src}") +endif() + +if(NOT "${_bin_len}" GREATER "${_cur_src_len}") + list(APPEND _test _cur_src) + #message(STATUS "Checking ${_cur_src}") +endif() + +foreach(_var ${_test}) + string(SUBSTRING "${${_var}}" 0 ${_bin_len} _chopped) + #message(STATUS "comparing ${_bin} and ${_chopped}") + if("${_bin}" STREQUAL "${_chopped}") + get_filename_component(_parent "${CMAKE_SOURCE_DIR}/.." ABSOLUTE) + message(FATAL_ERROR + "You must set a binary directory that is different from your source directory. You might consider ${CMAKE_SOURCE_DIR}/build or ${_parent}/build-${CMAKE_PROJECT_NAME}") + endif() +endforeach() diff --git a/cmake-2.9.0-modules/autoinclude.cmake b/cmake-2.9.0-modules/autoinclude.cmake new file mode 100644 index 0000000..3d0464f --- /dev/null +++ b/cmake-2.9.0-modules/autoinclude.cmake @@ -0,0 +1,13 @@ +# - Autoinclude these policies automatically +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include(RequireOutOfSourceBuild) diff --git a/export-to-directory.sh b/export-to-directory.sh new file mode 100755 index 0000000..1736e5c --- /dev/null +++ b/export-to-directory.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +src="$(dirname $(readlink -f $0))" + +if [ "x$1" = "x-f" ]; then + dst="$(readlink -mn $2)/" + args="-f" +else + dst="$(readlink -mn $1)/" + args="$2" +fi + +echo "Exporting the modules from '$src' to '$dst'" + +mkdir -p $dst +( + cd "$src" + git checkout-index -a $args "--prefix=$dst" +) + +echo "Done!" + diff --git a/ghost-fake-stl/iostream.h b/ghost-fake-stl/iostream.h new file mode 100644 index 0000000..7361d64 --- /dev/null +++ b/ghost-fake-stl/iostream.h @@ -0,0 +1,20 @@ +/** @file list.h + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2010 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::istream; +using std::ostream; +using std::cerr; +using std::endl; \ No newline at end of file diff --git a/ghost-fake-stl/list.h b/ghost-fake-stl/list.h new file mode 100644 index 0000000..017aeb1 --- /dev/null +++ b/ghost-fake-stl/list.h @@ -0,0 +1,20 @@ +/** @file list.h + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2010 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::list; + +// Disable dll export that depends on the SGI STL implementation +#undef GHOST_EXTRA_TEMPLATE_DECLARATIONS \ No newline at end of file diff --git a/ghost-fake-stl/set.h b/ghost-fake-stl/set.h new file mode 100644 index 0000000..0f37e1a --- /dev/null +++ b/ghost-fake-stl/set.h @@ -0,0 +1,17 @@ +/** @file set.h + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2010 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::set; \ No newline at end of file diff --git a/ghost-fake-stl/vector.h b/ghost-fake-stl/vector.h new file mode 100644 index 0000000..e95b731 --- /dev/null +++ b/ghost-fake-stl/vector.h @@ -0,0 +1,20 @@ +/** @file vector.h + @brief Fake header to allow GHOST 4.09 use with MSVC 2005 + + @date 2010 + + @author + Ryan Pavlik + and + http://academic.cleardefinition.com/ + Iowa State University Virtual Reality Applications Center + Human-Computer Interaction Graduate Program +*/ + +#pragma once + +#include +using std::vector; + +// Disable dll export that depends on the SGI STL implementation +#undef GHOST_EXTRA_TEMPLATE_DECLARATIONS \ No newline at end of file diff --git a/launcher-templates/genericlauncher.cmd.in b/launcher-templates/genericlauncher.cmd.in new file mode 100644 index 0000000..91e5b68 --- /dev/null +++ b/launcher-templates/genericlauncher.cmd.in @@ -0,0 +1,14 @@ +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ + +IF NOT [x%1]==[x--debugger] GOTO SkipDebuggingMess + +ECHO Need to ditch the debugger! +SHIFT /1 +%1 %2 %3 %4 %5 %6 %7 %8 %9 +GOTO EOF + +:SkipDebuggingMess +%* + +:EOF \ No newline at end of file diff --git a/launcher-templates/genericlauncher.sh.in b/launcher-templates/genericlauncher.sh.in new file mode 100644 index 0000000..cb83ecd --- /dev/null +++ b/launcher-templates/genericlauncher.sh.in @@ -0,0 +1,14 @@ +#!/bin/sh +bindir=$(pwd) +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ +if test "x$1" = "x--debugger"; then + shift + cmd="$1" + shift + echo "r $@" > $bindir/gdbscript + echo "bt" >> $bindir/gdbscript + gdb $cmd -command=$bindir/gdbscript -batch --return-child-result +else + $@ +fi diff --git a/launcher-templates/launcher.env.cmd.in b/launcher-templates/launcher.env.cmd.in new file mode 100644 index 0000000..d69ebca --- /dev/null +++ b/launcher-templates/launcher.env.cmd.in @@ -0,0 +1 @@ +set @_arg@ diff --git a/launcher-templates/launcher.env.sh.in b/launcher-templates/launcher.env.sh.in new file mode 100644 index 0000000..428cfff --- /dev/null +++ b/launcher-templates/launcher.env.sh.in @@ -0,0 +1 @@ +export @_arg@ diff --git a/launcher-templates/perconfig.vcproj.user.in b/launcher-templates/perconfig.vcproj.user.in new file mode 100644 index 0000000..a5d1dc8 --- /dev/null +++ b/launcher-templates/perconfig.vcproj.user.in @@ -0,0 +1,28 @@ + + + diff --git a/launcher-templates/targetlauncher.cmd.in b/launcher-templates/targetlauncher.cmd.in new file mode 100644 index 0000000..0c92cb1 --- /dev/null +++ b/launcher-templates/targetlauncher.cmd.in @@ -0,0 +1,8 @@ +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ +if [%1]==[--debugger] ( + SHIFT +) + +"@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@ +pause diff --git a/launcher-templates/targetlauncher.sh.in b/launcher-templates/targetlauncher.sh.in new file mode 100644 index 0000000..0888cf4 --- /dev/null +++ b/launcher-templates/targetlauncher.sh.in @@ -0,0 +1,12 @@ +#!/bin/sh +bindir=$(pwd) +cd @USERFILE_WORKING_DIRECTORY@ +@USERFILE_ENV_COMMANDS@ +if test "x$1" = "x--debugger"; then + shift + echo "r @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@" > $bindir/gdbscript + echo "bt" >> $bindir/gdbscript + gdb @USERFILE_COMMAND@ -command=$bindir/gdbscript -batch --return-child-result +else + "@USERFILE_COMMAND@" @LAUNCHERSCRIPT_COMMAND_ARGUMENTS@ +fi diff --git a/launcher-templates/vcproj.user.in b/launcher-templates/vcproj.user.in new file mode 100644 index 0000000..71f0bc3 --- /dev/null +++ b/launcher-templates/vcproj.user.in @@ -0,0 +1,10 @@ + + + +@USERFILE_CONFIGSECTIONS@ + + diff --git a/module-docs/AllModuleDependencies.dot b/module-docs/AllModuleDependencies.dot new file mode 100644 index 0000000..9110002 --- /dev/null +++ b/module-docs/AllModuleDependencies.dot @@ -0,0 +1,72 @@ +digraph { + size="7.5,10" + nodesep = .25 + ranksep = 1.0 + label = "Dependencies of CMake Modules - All require CMake 2.6 or newer"; + + subgraph cluster_upstream { + label = "Included with upstream 2.8.0 or cmake-2.8.0-modules"; + SelectLibraryConfigurations; + FindBoost; + FindOpenSceneGraph -> { FindOpenThreads; FindosgALL [label = "Findosg*"]; } + } + + // Directories + PackageMacosxDirectory [label = "cmake/package/macosx/"]; + workaroundsTcharDirectory [label = "cmake/workarounds/tchar/"]; + cmakeUpstreamModulesDirectories [label = "cmake/cmake-*-modules/"]; + + // other Modules + BundleOSGRuntime; + BundleVRJ22Runtime; + CheckMacHIDAPI; + CheckVersion; + CleanDirectoryList; + CleanLibraryList; + CreateMSVCUserFiles -> { ListFilter; ProgramFilesGlob; CleanDirectoryList; } + FixWinInstallPrefix; + GetCompilerInfoString; + GetForceIncludeDefinitions; + ListCombinations; + ListFilter; + MakeVRJugglerAppBundle -> PackageMacosxDirectory; + PrefixListGlob; + ProgramFilesGlob -> { PrefixListGlob; CleanDirectoryList;} + SearchProgramFilesForOpenSceneGraph -> { ProgramFilesGlob; ListFilter; PrefixListGlob; CleanDirectoryList; } + + + subgraph cluster_findmodules { + label = "find_package Find Modules"; + + subgraph cluster_vrjuggler22 { + label = "VR Juggler 2.2 suite: All require CleanLibraryList and CleanDirectoryList, and recommend FindFlagpoll"; + FindTweek12 -> FindVPR20; + FindJCCL12 -> FindVPR20; + FindGadgeteer12 -> { FindJCCL12; FindVPR20; } + FindSonix12 -> FindVPR20; + FindVRJ22 -> { FindJCCL12; FindGadgeteer12; FindSonix12; FindVPR20; } + FindVRJOGL22 -> FindVRJ22; + FindVRJuggler22 -> FindVRJOGL22; + } -> {FindFlagpoll; CleanLibraryList; CleanDirectoryList;} + FindVPR20 -> { FindBoost; FindCPPDOM; } + FindGadgeteer12 -> FindGMTL; + FindSonix12 -> FindGMTL; + //cluster_vrjuggler22 -> {FindFlagpoll; CleanLibraryList;} + BundleVRJ22Runtime -> FindVRJuggler22; + + FindGLUI; + FindGPM; + FindJtTk -> { ListCombinations; CheckVersion; PrefixListGlob; ProgramFilesGlob; } + FindMacHID -> CheckMacHIDAPI; + FindOpenHaptics -> { SelectLibraryConfigurations; CleanDirectoryList; CleanLibraryList; ListCombinations; ProgramFilesGlob; } + FindParasolid -> { ListCombinations; CheckVersion; ProgramFilesGlob; } + Findquatlib; + FindVPS -> { SelectLibraryConfigurations; ListCombinations; CheckVersion; ListFilter; } + FindWiiUse; + } + + + + TCHARWorkaround -> workaroundsTcharDirectory; + UseBackportedModules -> cmakeUpstreamModulesDirectories; +} diff --git a/module-docs/AllModuleDependencies.jpg b/module-docs/AllModuleDependencies.jpg new file mode 100644 index 0000000..16de0c1 Binary files /dev/null and b/module-docs/AllModuleDependencies.jpg differ diff --git a/module-docs/AllModuleDependencies.pdf b/module-docs/AllModuleDependencies.pdf new file mode 100644 index 0000000..6222872 Binary files /dev/null and b/module-docs/AllModuleDependencies.pdf differ diff --git a/module-docs/AllModuleDependencies.png b/module-docs/AllModuleDependencies.png new file mode 100644 index 0000000..23deadb Binary files /dev/null and b/module-docs/AllModuleDependencies.png differ diff --git a/module-docs/Example-FindMyPackage-UsingImportedTargets.cmake b/module-docs/Example-FindMyPackage-UsingImportedTargets.cmake new file mode 100644 index 0000000..23ac10b --- /dev/null +++ b/module-docs/Example-FindMyPackage-UsingImportedTargets.cmake @@ -0,0 +1,193 @@ +# - try to find MyPackage library +# +# Example-FindMyPackage-UsingImportedTargets.cmake +# +# This module does the same thing as Example-FindMyPackage.cmake +# except that rather than passing along full path names for libraries, +# it creates imported targets. The end result is roughly the same to +# the end-user. Please see that other file for the full documentation +# of the example. +# +# Note that if you're going to be installing target export files, this +# is probably what you should prefer. See cmake mailing list archives. +# +# Start of what would be a minimal module documentation block: +# +# Cache Variables: (not for direct use in CMakeLists.txt) +# MYPACKAGE_ROOT +# MYPACKAGE_LIBRARY +# MYPACKAGE_INCLUDE_DIR +# MYPACKAGE_a_LIBRARY +# MYPACKAGE_a_INCLUDE_DIR +# MYPACKAGE_b_LIBRARY +# MYPACKAGE_b_INCLUDE_DIR +# MYPACKAGE_c_LIBRARY +# MYPACKAGE_c_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# MYPACKAGE_FOUND +# +# MYPACKAGE_LIBRARIES +# MYPACKAGE_INCLUDE_DIRS +# MYPACKAGE_LINKER_FLAGS +# +# MYPACKAGE_a_LIBRARIES +# MYPACKAGE_a_INCLUDE_DIRS +# MYPACKAGE_a_LINKER_FLAGS +# +# MYPACKAGE_b_LIBRARIES +# MYPACKAGE_b_INCLUDE_DIRS +# MYPACKAGE_b_LINKER_FLAGS +# +# MYPACKAGE_c_LIBRARIES +# MYPACKAGE_c_INCLUDE_DIRS +# MYPACKAGE_c_LINKER_FLAGS +# +# Use this module this way: +# find_package(MyPackage) +# include_directories(${MYPACKAGE_INCLUDE_DIRS}) +# add_executable(myapp ${SOURCES}) +# target_link_libraries(myapp ${MYPACKAGE_LIBRARIES}) +# set_property(TARGET myapp PROPERTY LINK_FLAGS ${MYPACKAGE_LINKER_FLAGS}) +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (CMake standard module) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +set(MYPACKAGE_ROOT + "${MYPACKAGE_ROOT}" + CACHE + PATH + "Root directory to look in") + +find_library(MYPACKAGE_LIBRARY + NAMES + mypackagecore + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + lib) + +find_path(MYPACKAGE_INCLUDE_DIR + NAMES + mypackage/mypackage.h + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + include) + +# Assuming that the components are named libmypackagea, libmypackageb, etc +foreach(lib a b c) + find_library(MYPACKAGE_${lib}_LIBRARY + NAMES + mypackage${lib} + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + lib) + + find_path(MYPACKAGE_${lib}_INCLUDE_DIR + NAMES + mypackage/${lib}/${lib}.h + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + include) + +endforeach() + +# see /usr/share/cmake-2.x/Modules/FindBLAS.cmake for the variables this will define +if(NOT BLAS_FOUND) + find_package(BLAS QUIETLY) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MyPackage + DEFAULT_MSG + MYPACKAGE_LIBRARY + MYPACKAGE_INCLUDE_DIR + MYPACKAGE_a_LIBRARY + MYPACKAGE_a_INCLUDE_DIR + MYPACKAGE_b_LIBRARY + MYPACKAGE_b_INCLUDE_DIR + MYPACKAGE_c_LIBRARY + MYPACKAGE_c_INCLUDE_DIR + BLAS_FOUND) + +if(MYPACKAGE_FOUND) + # Set variables containing libraries and their dependencies + # Always use the plural form for the variables defined by other find modules: + # they might have dependencies too! + + add_library(mypackage_c IMPORTED) + set_target_properties(mypackage_c + PROPERTIES + IMPORTED_LOCATION + ${MYPACKAGE_c_LIBRARY} + IMPORTED_LINK_INTERFACE_LIBRARIES + ${BLAS_LIBRARIES}) + set(MYPACKAGE_c_LIBRARIES mypackage_c) + set(MYPACKAGE_c_INCLUDE_DIRS ${MYPACKAGE_c_INCLUDE_DIR}) # No include dir for BLAS? + set(MYPACKAGE_c_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) + + add_library(mypackage_b IMPORTED) + set_target_properties(mypackage_b + PROPERTIES + IMPORTED_LOCATION + ${MYPACKAGE_b_LIBRARY} + IMPORTED_LINK_INTERFACE_LIBRARIES + ${MYPACKAGE_c_LIBRARIES}) + set(MYPACKAGE_b_LIBRARIES mypackage_b) + set(MYPACKAGE_b_INCLUDE_DIRS + ${MYPACKAGE_b_INCLUDE_DIR} + ${MYPACKAGE_c_INCLUDE_DIRS}) + set(MYPACKAGE_b_LINKER_FLAGS ${MYPACKAGE_c_LINKER_FLAGS}) + + add_library(mypackage_a IMPORTED) + set_target_properties(mypackage_a + PROPERTIES + IMPORTED_LOCATION + ${MYPACKAGE_a_LIBRARY} + IMPORTED_LINK_INTERFACE_LIBRARIES + ${MYPACKAGE_b_LIBRARIES}) + set(MYPACKAGE_a_LIBRARIES mypackage_a) + set(MYPACKAGE_a_INCLUDE_DIRS + ${MYPACKAGE_a_INCLUDE_DIR} + ${MYPACKAGE_b_INCLUDE_DIRS}) + set(MYPACKAGE_a_LINKER_FLAGS ${MYPACKAGE_b_LINKER_FLAGS}) + + add_library(mypackage_core IMPORTED) + set_target_properties(mypackage_core + PROPERTIES + IMPORTED_LOCATION + ${MYPACKAGE_LIBRARY} + IMPORTED_LINK_INTERFACE_LIBRARIES + ${MYPACKAGE_a_LIBRARIES}) + set(MYPACKAGE_LIBRARIES mypackage_core) + set(MYPACKAGE_INCLUDE_DIRS + ${MYPACKAGE_INCLUDE_DIR} + ${MYPACKAGE_a_INCLUDE_DIRS}) + set(MYPACKAGE_LINKER_FLAGS ${MYPACKAGE_a_LINKER_FLAGS}) + +endif() + +mark_as_advanced(MYPACKAGE_LIBRARY + MYPACKAGE_INCLUDE_DIR + MYPACKAGE_a_LIBRARY + MYPACKAGE_a_INCLUDE_DIR + MYPACKAGE_b_LIBRARY + MYPACKAGE_b_INCLUDE_DIR + MYPACKAGE_c_LIBRARY + MYPACKAGE_c_INCLUDE_DIR) + +if(MYPACKAGE_FOUND) + mark_as_advanced(MYPACKAGE_ROOT) +endif() + +# End of Example-FindMyPackage-UsingImportedTargets.cmake diff --git a/module-docs/Example-FindMyPackage.cmake b/module-docs/Example-FindMyPackage.cmake new file mode 100644 index 0000000..cdf3bfc --- /dev/null +++ b/module-docs/Example-FindMyPackage.cmake @@ -0,0 +1,189 @@ +# - try to find MyPackage library +# +# Example-FindMyPackage.cmake +# +# This example is for a fairly in-depth library that has four +# internal dependencies as well as an external dependency. +# The dependency tree is described below, in graphviz/dot format, and you +# can remove the #'s from the following lines and run it through graphviz, +# with this command: dot dependencies.dot -O -Tpdf +# +# --- start of dependencies.dot --- +# digraph { +# BLAS; +# subgraph cluster_mypackage { +# label = "Components that are part of MyPackage"; +# libmypackagecore -> libmypackagea; +# libmypackagea -> libmypackageb; +# libmypackageb -> libmypackagec; +# libmypackagec -> BLAS; +# } +# } +# --- end of dependencies.dot --- +# +# Because our imaginary component "c" requires BLAS and BLAS needs some +# linker flags, MYPACKAGE_..._LINKER_FLAGS joins the usual group of +# _LIBRARY/_LIBRARIES and _INCLUDE_DIR/_INCLUDE_DIRS variables. If +# you don't use a library like that, you don't need to include the +# lines dealing with that group of variables. +# +# Most library aren't nearly this complex - but some are, and many +# have some parts of the complexity handled here. +# +# Start of what would be a minimal module documentation block: +# +# Cache Variables: (not for direct use in CMakeLists.txt) +# MYPACKAGE_ROOT +# MYPACKAGE_LIBRARY +# MYPACKAGE_INCLUDE_DIR +# MYPACKAGE_a_LIBRARY +# MYPACKAGE_a_INCLUDE_DIR +# MYPACKAGE_b_LIBRARY +# MYPACKAGE_b_INCLUDE_DIR +# MYPACKAGE_c_LIBRARY +# MYPACKAGE_c_INCLUDE_DIR +# +# Non-cache variables you might use in your CMakeLists.txt: +# MYPACKAGE_FOUND +# +# MYPACKAGE_LIBRARIES +# MYPACKAGE_INCLUDE_DIRS +# MYPACKAGE_LINKER_FLAGS +# +# MYPACKAGE_a_LIBRARIES +# MYPACKAGE_a_INCLUDE_DIRS +# MYPACKAGE_a_LINKER_FLAGS +# +# MYPACKAGE_b_LIBRARIES +# MYPACKAGE_b_INCLUDE_DIRS +# MYPACKAGE_b_LINKER_FLAGS +# +# MYPACKAGE_c_LIBRARIES +# MYPACKAGE_c_INCLUDE_DIRS +# MYPACKAGE_c_LINKER_FLAGS +# +# Use this module this way: +# find_package(MyPackage) +# include_directories(${MYPACKAGE_INCLUDE_DIRS}) +# add_executable(myapp ${SOURCES}) +# target_link_libraries(myapp ${MYPACKAGE_LIBRARIES}) +# set_property(TARGET myapp PROPERTY LINK_FLAGS ${MYPACKAGE_LINKER_FLAGS}) +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (CMake standard module) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +set(MYPACKAGE_ROOT + "${MYPACKAGE_ROOT}" + CACHE + PATH + "Root directory to look in") + +find_library(MYPACKAGE_LIBRARY + NAMES + mypackagecore + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + lib) + +find_path(MYPACKAGE_INCLUDE_DIR + NAMES + mypackage/mypackage.h + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + include) + +# Assuming that the components are named libmypackagea, libmypackageb, etc +foreach(lib a b c) + find_library(MYPACKAGE_${lib}_LIBRARY + NAMES + mypackage${lib} + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + lib) + + find_path(MYPACKAGE_${lib}_INCLUDE_DIR + NAMES + mypackage/${lib}/${lib}.h + PATHS + "${MYPACKAGE_ROOT}" + PATH_SUFFIXES + include) + +endforeach() + +# Searching for dependencies here - always quiet. +# see /usr/share/cmake-2.x/Modules/FindBLAS.cmake for the variables this will define +if(NOT BLAS_FOUND) + find_package(BLAS QUIETLY) +endif() + +# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MyPackage + DEFAULT_MSG + MYPACKAGE_LIBRARY + MYPACKAGE_INCLUDE_DIR + MYPACKAGE_a_LIBRARY + MYPACKAGE_a_INCLUDE_DIR + MYPACKAGE_b_LIBRARY + MYPACKAGE_b_INCLUDE_DIR + MYPACKAGE_c_LIBRARY + MYPACKAGE_c_INCLUDE_DIR + BLAS_FOUND) + +if(MYPACKAGE_FOUND) + # Set variables containing libraries and their dependencies + # Always use the plural form for the variables defined by other find modules: + # they might have dependencies too! + + set(MYPACKAGE_c_LIBRARIES ${MYPACKAGE_c_LIBRARY} ${BLAS_LIBRARIES}) + set(MYPACKAGE_c_INCLUDE_DIRS ${MYPACKAGE_c_INCLUDE_DIR}) # No include dir for BLAS? + set(MYPACKAGE_c_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) + + set(MYPACKAGE_b_LIBRARIES + ${MYPACKAGE_b_LIBRARY} + ${MYPACKAGE_c_LIBRARIES}) + set(MYPACKAGE_b_INCLUDE_DIRS + ${MYPACKAGE_b_INCLUDE_DIR} + ${MYPACKAGE_c_INCLUDE_DIRS}) + set(MYPACKAGE_b_LINKER_FLAGS ${MYPACKAGE_c_LINKER_FLAGS}) + + set(MYPACKAGE_a_LIBRARIES + ${MYPACKAGE_a_LIBRARY} + ${MYPACKAGE_b_LIBRARIES}) + set(MYPACKAGE_a_INCLUDE_DIRS + ${MYPACKAGE_a_INCLUDE_DIR} + ${MYPACKAGE_b_INCLUDE_DIRS}) + set(MYPACKAGE_a_LINKER_FLAGS ${MYPACKAGE_b_LINKER_FLAGS}) + + set(MYPACKAGE_LIBRARIES ${MYPACKAGE_LIBRARY} ${MYPACKAGE_a_LIBRARIES}) + set(MYPACKAGE_INCLUDE_DIRS + ${MYPACKAGE_INCLUDE_DIR} + ${MYPACKAGE_a_INCLUDE_DIRS}) + set(MYPACKAGE_LINKER_FLAGS ${MYPACKAGE_a_LINKER_FLAGS}) + +endif() + +mark_as_advanced(MYPACKAGE_LIBRARY + MYPACKAGE_INCLUDE_DIR + MYPACKAGE_a_LIBRARY + MYPACKAGE_a_INCLUDE_DIR + MYPACKAGE_b_LIBRARY + MYPACKAGE_b_INCLUDE_DIR + MYPACKAGE_c_LIBRARY + MYPACKAGE_c_INCLUDE_DIR) + +if(MYPACKAGE_FOUND) + mark_as_advanced(MYPACKAGE_ROOT) +endif() + +# End of Example-FindMyPackage.cmake diff --git a/module-docs/Example-FindMySimplePackage.cmake b/module-docs/Example-FindMySimplePackage.cmake new file mode 100644 index 0000000..8f86388 --- /dev/null +++ b/module-docs/Example-FindMySimplePackage.cmake @@ -0,0 +1,101 @@ +# - try to find MySimplePackage library +# +# Example-MySimplePackage.cmake +# +# This example is for a pretty simple library but that is still fairly +# common in its complexity. +# +# Cache Variables: (probably not for direct use in your scripts) +# MYSIMPLEPACKAGE_INCLUDE_DIR +# MYSIMPLEPACKAGE_LIBRARY +# +# Non-cache variables you might use in your CMakeLists.txt: +# MYSIMPLEPACKAGE_FOUND +# MYSIMPLEPACKAGE_INCLUDE_DIRS +# MYSIMPLEPACKAGE_LIBRARIES +# MYSIMPLEPACKAGE_RUNTIME_LIBRARIES - aka the dll for installing +# MYSIMPLEPACKAGE_RUNTIME_LIBRARY_DIRS +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(MYSIMPLEPACKAGE_ROOT_DIR + "${MYSIMPLEPACKAGE_ROOT_DIR}" + CACHE + PATH + "Directory to search") + +if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_LIBSUFFIXES /lib64 /lib) +else() + set(_LIBSUFFIXES /lib) +endif() + +find_library(MYSIMPLEPACKAGE_LIBRARY + NAMES + mysimplepackage + PATHS + "${MYSIMPLEPACKAGE_ROOT_DIR}" + PATH_SUFFIXES + "${_LIBSUFFIXES}") + +# Might want to look close to the library first for the includes. +get_filename_component(_libdir "${MYSIMPLEPACKAGE_LIBRARY}" PATH) + +find_path(MYSIMPLEPACKAGE_INCLUDE_DIR + NAMES + mysimplepackage.h + HINTS + "${_libdir}" # the library I based this on was sometimes bundled right next to its include + "${_libdir}/.." + PATHS + "${MYSIMPLEPACKAGE_ROOT_DIR}" + PATH_SUFFIXES + include/) + +# There's a DLL to distribute on Windows - find where it is. +set(_deps_check) +if(WIN32) + find_file(MYSIMPLEPACKAGE_RUNTIME_LIBRARY + NAMES + mysimplepackage.dll + HINTS + "${_libdir}") + set(MYSIMPLEPACKAGE_RUNTIME_LIBRARIES + "${MYSIMPLEPACKAGE_RUNTIME_LIBRARY}") + get_filename_component(MYSIMPLEPACKAGE_RUNTIME_LIBRARY_DIRS + "${MYSIMPLEPACKAGE_RUNTIME_LIBRARY}" + PATH) + list(APPEND _deps_check MYSIMPLEPACKAGE_RUNTIME_LIBRARY) +else() + get_filename_component(MYSIMPLEPACKAGE_RUNTIME_LIBRARY_DIRS + "${MYSIMPLEPACKAGE_LIBRARY}" + PATH) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MySimplePackage + DEFAULT_MSG + MYSIMPLEPACKAGE_LIBRARY + MYSIMPLEPACKAGE_INCLUDE_DIR + ${_deps_check}) + +if(MYSIMPLEPACKAGE_FOUND) + set(MYSIMPLEPACKAGE_LIBRARIES "${MYSIMPLEPACKAGE_LIBRARY}") + set(MYSIMPLEPACKAGE_INCLUDE_DIRS "${MYSIMPLEPACKAGE_INCLUDE_DIR}") + mark_as_advanced(MYSIMPLEPACKAGE_ROOT_DIR) +endif() + +mark_as_advanced(MYSIMPLEPACKAGE_INCLUDE_DIR + MYSIMPLEPACKAGE_LIBRARY + MYSIMPLEPACKAGE_RUNTIME_LIBRARY) diff --git a/module-docs/Makefile b/module-docs/Makefile new file mode 100644 index 0000000..da3d218 --- /dev/null +++ b/module-docs/Makefile @@ -0,0 +1,34 @@ +#! make +# +# Automatically generate PDF, PNG, and JPG files from DOT files. +# +# Original Author: +# 2009 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC + +pdfs := $(patsubst %.dot,%.pdf,$(wildcard *.dot)) +pngs := $(patsubst %.dot,%.png,$(wildcard *.dot)) +jpgs := $(patsubst %.dot,%.jpg,$(wildcard *.dot)) + +all: $(pdfs) $(pngs) $(jpgs) +pdf: $(pdfs) +png: $(pngs) +jpg: $(jpgs) + +clean: + -rm -f $(pdfs) $(pngs) $(jpgs) +realclean: clean + -rm -f *~ + +.PHONY: all pdf png jpg clean realclean + +$(pdfs): %.pdf: %.dot + dot -Tpdf $< -o$@ + +$(pngs): %.png: %.dot + dot -Tpng $< -o$@ + +$(jpgs): %.jpg: %.dot + dot -Tjpg $< -o$@ + diff --git a/nested_targets/OpenHaptics/CMakeLists.txt b/nested_targets/OpenHaptics/CMakeLists.txt new file mode 100644 index 0000000..ec024ce --- /dev/null +++ b/nested_targets/OpenHaptics/CMakeLists.txt @@ -0,0 +1,91 @@ +# - Build the OpenHaptics utility libraries as a part of your solution. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include_directories("${HDAPI_HDU_INCLUDE_DIR}" + "${HDAPI_INCLUDE_DIR}" + "${HLAPI_HLU_INCLUDE_DIR}" + "${HLAPI_INCLUDE_DIR}") + +if(HDAPI_HDU_LIBRARY STREQUAL "openhaptics_hdu_nested_target") + add_library(openhaptics_hdu_nested_target + STATIC + EXCLUDE_FROM_ALL + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduBoundBox.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduError.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduGenericMatrix.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hdu.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduHapticDevice.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduLine.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduLineSegment.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduMath.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduMatrix.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduPlane.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduQuaternion.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduRecord.h" + "${HDAPI_HDU_INCLUDE_DIR}/HDU/hduVector.h" + "${HDAPI_HDU_SOURCE_DIR}/hdu.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduAfx.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduAfx.h" + "${HDAPI_HDU_SOURCE_DIR}/hduDecompose.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduDecompose.h" + "${HDAPI_HDU_SOURCE_DIR}/hduError.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduHapticDevice.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduLine.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduLineSegment.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduMatrix.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduPlane.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduQuaternion.cpp" + "${HDAPI_HDU_SOURCE_DIR}/hduRecord.cpp") + target_link_libraries(openhaptics_hdu_nested_target ${HDAPI_LIBRARIES}) + set_property(TARGET + openhaptics_hdu_nested_target + PROPERTY + PROJECT_LABEL + "OpenHaptics HDU Library") + + if(MSVC) + # Disable warnings - no sense in warning about Sensable's potential bugs. + set_property(TARGET + openhaptics_hdu_nested_target + PROPERTY + COMPILE_FLAGS + "/wd4189 /wd4701") + endif() +endif() + + +if(HLAPI_HLU_LIBRARY STREQUAL "openhaptics_hlu_nested_target") + add_library(openhaptics_hlu_nested_target + STATIC + EXCLUDE_FROM_ALL + "${HLAPI_HLU_INCLUDE_DIR}/HLU/hlu.h" + "${HLAPI_HLU_SOURCE_DIR}/hlu.cpp" + "${HLAPI_HLU_SOURCE_DIR}/hluAfx.cpp" + "${HLAPI_HLU_SOURCE_DIR}/hluAfx.h") + target_link_libraries(openhaptics_hlu_nested_target ${HLAPI_LIBRARIES}) + + set_property(TARGET + openhaptics_hlu_nested_target + PROPERTY + PROJECT_LABEL + "OpenHaptics HLU Library") + + if(MSVC) + # Disable warnings - no sense in warning about Sensable's potential bugs. + set_property(TARGET + openhaptics_hlu_nested_target + APPEND + PROPERTY + COMPILE_FLAGS + /wd4189) + endif() +endif() diff --git a/nested_targets/Parasolid/CMakeLists.txt b/nested_targets/Parasolid/CMakeLists.txt new file mode 100644 index 0000000..5565396 --- /dev/null +++ b/nested_targets/Parasolid/CMakeLists.txt @@ -0,0 +1,93 @@ +# - Build the Parasolid utility libraries as a part of your solution. +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +include_directories("${HDAPI_HDU_INCLUDE_DIR}" + "${HDAPI_INCLUDE_DIR}" + "${HLAPI_HLU_INCLUDE_DIR}" + "${HLAPI_INCLUDE_DIR}") + +if(PARASOLID_fg_LIBRARY STREQUAL "parasolid_fg_nested_target") + get_filename_component(_fgdir "${PARASOLID_FG_C}" PATH) + include_directories("${_fgdir}") + add_library(parasolid_fg_nested_target + STATIC + EXCLUDE_FROM_ALL + "${PARASOLID_FG_C}") + + set_property(TARGET + parasolid_fg_nested_target + PROPERTY + COMPILE_DEFINITIONS + _CRT_SECURE_NO_DEPRECATE) + if(MSVC) + set_property(TARGET + parasolid_fg_nested_target + PROPERTY + COMPILE_FLAGS + "/Gs /GF /GS- /fp:fast") + endif() + + set_property(TARGET + parasolid_fg_nested_target + PROPERTY + PROJECT_LABEL + "Parasolid Foreign Geometry Example Library") + + if(MSVC) + # Disable warnings - no sense in warning about a third party's potential bugs. + # set_property(TARGET + # parasolid_fg_nested_target + # PROPERTY + # COMPILE_FLAGS + # "/wd4189 /wd4701") + endif() +endif() + + +if(PARASOLID_frustrum_LIBRARY + STREQUAL + "parasolid_frustrum_nested_target") + get_filename_component(_frustrumdir "${PARASOLID_FRUSTRUM_C}" PATH) + include_directories("${_frustrumdir}") + add_library(parasolid_frustrum_nested_target + STATIC + EXCLUDE_FROM_ALL + "${PARASOLID_FRUSTRUM_C}") + + set_property(TARGET + parasolid_frustrum_nested_target + PROPERTY + COMPILE_DEFINITIONS + _CRT_SECURE_NO_DEPRECATE) + if(MSVC) + set_property(TARGET + parasolid_frustrum_nested_target + PROPERTY + COMPILE_FLAGS + "/Gs /GF /GS- /fp:fast") + endif() + + set_property(TARGET + parasolid_frustrum_nested_target + PROPERTY + PROJECT_LABEL + "Parasolid Frustrum Example Library") + + if(MSVC) + # Disable warnings - no sense in warning about a third party's potential bugs. + # set_property(TARGET + # parasolid_frustrum_nested_target + # PROPERTY + # COMPILE_FLAGS + # "/wd4189 /wd4701") + endif() +endif() diff --git a/nested_targets/cutil/CMakeLists.txt b/nested_targets/cutil/CMakeLists.txt new file mode 100644 index 0000000..b1bf2b1 --- /dev/null +++ b/nested_targets/cutil/CMakeLists.txt @@ -0,0 +1,41 @@ +# CMake cross-platform build system +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com/ +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + + +### +# Build the project +### + +include_directories("${CUTIL_ROOT_DIR}/inc") +set(SOURCES + "${CUTIL_ROOT_DIR}/src/bank_checker.cpp" + "${CUTIL_ROOT_DIR}/src/cmd_arg_reader.cpp" + "${CUTIL_ROOT_DIR}/src/cutil.cpp" + "${CUTIL_ROOT_DIR}/src/stopwatch.cpp" + "${CUTIL_ROOT_DIR}/src/multithreading.cpp") + +if(WIN32) + list(APPEND SOURCES + "${CUDA_SDK_ROOT_DIR}/C/common/src/stopwatch_win.cpp") + add_definitions(-DWIN32 -D_WINDOWS -DBUILD_DLL) + set(TYPE SHARED) + +else() + list(APPEND SOURCES + "${CUTIL_ROOT_DIR}/src/stopwatch_linux.cpp") + set(TYPE STATIC) + +endif() + +cuda_add_library(cutil ${TYPE} EXCLUDE_FROM_ALL ${SOURCES}) + +set(CUTIL_INCLUDE_DIRS "${CUTIL_ROOT_DIR}/inc" PARENT_SCOPE) +set(CUTIL_LIBRARIES cutil PARENT_SCOPE) + diff --git a/package-licensing/Boost.cmake b/package-licensing/Boost.cmake new file mode 100644 index 0000000..ececdaf --- /dev/null +++ b/package-licensing/Boost.cmake @@ -0,0 +1,13 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(Boost + "Based in part on the work of the Boost project. Boost is distributed under the Boost Software License, Version 1.0. See copy at http://www.boost.org/LICENSE_1_0.txt" + "") diff --git a/package-licensing/Eigen.cmake b/package-licensing/Eigen.cmake new file mode 100644 index 0000000..9f09b26 --- /dev/null +++ b/package-licensing/Eigen.cmake @@ -0,0 +1,13 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(Eigen + "Based in part on the work of the Eigen project. Eigen is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.\nEigen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details." + "") diff --git a/package-licensing/FLTK.cmake b/package-licensing/FLTK.cmake new file mode 100644 index 0000000..824da78 --- /dev/null +++ b/package-licensing/FLTK.cmake @@ -0,0 +1,14 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(FLTK + "Based in part on the work of the FLTK project, available under the terms of the FLTK License (GNU Library General Public LIcense with exceptions). FLTK is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nFLTK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details." + "") +add_permissive_license(FLTK "Based in part on the work of the FLTK project, available under the terms of the FLTK License (GNU Library General Public LIcense with exceptions). FLTK is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nFLTK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details." "") \ No newline at end of file diff --git a/package-licensing/Lua.cmake b/package-licensing/Lua.cmake new file mode 100644 index 0000000..fd41984 --- /dev/null +++ b/package-licensing/Lua.cmake @@ -0,0 +1,14 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(Lua + "Based in part on the work of the Lua project, Copyright 1994-2008 Lua.org, PUC-Rio. Lua is licensed under the terms of the MIT license, reproduced at http://www.lua.org/license.html#5" + "") + diff --git a/package-licensing/LuaBind.cmake b/package-licensing/LuaBind.cmake new file mode 100644 index 0000000..2ce06fc --- /dev/null +++ b/package-licensing/LuaBind.cmake @@ -0,0 +1,15 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(LuaBind + "Based in part on the work of the LuaBind project. LuaBind is licensed under the terms of the MIT license, reproduced at http://www.lua.org/license.html#5" + "") + +include("package-licensing/Boost") diff --git a/package-licensing/OpenHapticsAcademicEdition.cmake b/package-licensing/OpenHapticsAcademicEdition.cmake new file mode 100644 index 0000000..527cb7d --- /dev/null +++ b/package-licensing/OpenHapticsAcademicEdition.cmake @@ -0,0 +1,15 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_proprietary_license(OpenHapticsAE + "Based in part on the Sensable OpenHaptics Toolkit Academic Edition as licensed to Iowa State University. NOT FOR REDISTRIBUTION." + "") + +add_redistribution_warning("NOT FOR REDISTRIBUTION - OpenHaptics Toolkit Academic Edition licensed to Iowa State University.") diff --git a/package-licensing/OpenSceneGraph.cmake b/package-licensing/OpenSceneGraph.cmake new file mode 100644 index 0000000..eb13065 --- /dev/null +++ b/package-licensing/OpenSceneGraph.cmake @@ -0,0 +1,13 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(OpenSceneGraph + "Based in part on the work of the OpenSceneGraph project. OpenSceneGraph is open source and may be redistributed and/or modified under the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at your option) any later version. The full license is on the openscenegraph.org website.\n\nOpenSceneGraph is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the OpenSceneGraph Public License for more details." + "") diff --git a/package-licensing/PhysicalModelingUtils.cmake b/package-licensing/PhysicalModelingUtils.cmake new file mode 100644 index 0000000..4c59b62 --- /dev/null +++ b/package-licensing/PhysicalModelingUtils.cmake @@ -0,0 +1,13 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(PhysicalModelingUtils + "Based in part on the work of the PhysicalModelingUtils project, Copyright 2009-2010 Iowa State University. PhysicalModelingUtils is distributed under the Boost Software License, Version 1.0. See copy at http://www.boost.org/LICENSE_1_0.txt" + "") diff --git a/package-licensing/Qt-LGPL.cmake b/package-licensing/Qt-LGPL.cmake new file mode 100644 index 0000000..ac64392 --- /dev/null +++ b/package-licensing/Qt-LGPL.cmake @@ -0,0 +1,13 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(Qt + "Based in part on the work of the Qt GUI Toolkit project. The Qt GUI Toolkit is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). You may use, distribute and copy the Qt GUI Toolkit under the terms of GNU Lesser General Public License version 2.1, as published by the Free Software Foundation." + "") diff --git a/package-licensing/VPS.cmake b/package-licensing/VPS.cmake new file mode 100644 index 0000000..44a0f73 --- /dev/null +++ b/package-licensing/VPS.cmake @@ -0,0 +1,15 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_proprietary_license(VPS + "Based in part on Voxmap PointShell(TM) software from Boeing, licensed to Iowa State University. NOT FOR REDISTRIBUTION." + "") + +add_redistribution_warning("NOT FOR REDISTRIBUTION - Voxmap PointShell(TM) software licensed only to Iowa State University.") diff --git a/package-licensing/VRJuggLua.cmake b/package-licensing/VRJuggLua.cmake new file mode 100644 index 0000000..6f3823c --- /dev/null +++ b/package-licensing/VRJuggLua.cmake @@ -0,0 +1,19 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_proprietary_license("VR JuggLua" + "Based in part on VR JuggLua, Copyright 2010 Iowa State University. This version of VR JuggLua is unreleased research software - NOT FOR REDISTRIBUTION.") +add_redistribution_warning("This version of VR JuggLua is unreleased research software - NOT FOR REDISTRIBUTION.") +include("package-licensing/VRJuggler") +include("package-licensing/OpenSceneGraph") +include("package-licensing/Lua") +include("package-licensing/LuaBind") +include("package-licensing/osgLua") +include("package-licensing/Boost") diff --git a/package-licensing/VRJuggler.cmake b/package-licensing/VRJuggler.cmake new file mode 100644 index 0000000..8e62231 --- /dev/null +++ b/package-licensing/VRJuggler.cmake @@ -0,0 +1,15 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license("VR Juggler" + "Based in part on the work of the VR Juggler project. VR Juggler is Copyright 1998-2010 Iowa State University. VR Juggler is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nVR Juggler is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details." + "") + +include("package-licensing/Boost") diff --git a/package-licensing/VirtuoseAPI.cmake b/package-licensing/VirtuoseAPI.cmake new file mode 100644 index 0000000..aee6a02 --- /dev/null +++ b/package-licensing/VirtuoseAPI.cmake @@ -0,0 +1,14 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_proprietary_license(VirtuoseAPI + "Based in part on the Haption VirtuoseAPI." + "") +add_redistribution_warning("Redistribution of the VirtuoseAPI may be restricted.") diff --git a/package-licensing/osgLua.cmake b/package-licensing/osgLua.cmake new file mode 100644 index 0000000..789f652 --- /dev/null +++ b/package-licensing/osgLua.cmake @@ -0,0 +1,16 @@ +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +add_permissive_license(osgLua + "Based in part on the work of the osgLua project. osgLua is open source and may be redistributed and/or modified under the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or (at your option) any later version. The full license is on the openscenegraph.org website.\n\nosgLua is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the OpenSceneGraph Public License for more details." + "") + +include("package-licensing/OpenSceneGraph") +include("package-licensing/Lua") diff --git a/package/macosx/Resources/en.lproj/MainMenu.nib/classes.nib b/package/macosx/Resources/en.lproj/MainMenu.nib/classes.nib new file mode 100644 index 0000000..b9b4b09 --- /dev/null +++ b/package/macosx/Resources/en.lproj/MainMenu.nib/classes.nib @@ -0,0 +1,4 @@ +{ + IBClasses = ({CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }); + IBVersion = 1; +} \ No newline at end of file diff --git a/package/macosx/Resources/en.lproj/MainMenu.nib/info.nib b/package/macosx/Resources/en.lproj/MainMenu.nib/info.nib new file mode 100644 index 0000000..13edb9b --- /dev/null +++ b/package/macosx/Resources/en.lproj/MainMenu.nib/info.nib @@ -0,0 +1,23 @@ + + + + + IBDocumentLocation + 94 80 356 240 0 0 1280 832 + IBEditorPositions + + 29 + 501 350 260 44 0 0 1280 832 + + IBFramework Version + 446.1 + IBOldestOS + 3 + IBOpenObjects + + 29 + + IBSystem Version + 8P135 + + diff --git a/package/macosx/Resources/en.lproj/MainMenu.nib/keyedobjects.nib b/package/macosx/Resources/en.lproj/MainMenu.nib/keyedobjects.nib new file mode 100644 index 0000000..e20b88c Binary files /dev/null and b/package/macosx/Resources/en.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/package/macosx/Resources/vrjuggler.icns b/package/macosx/Resources/vrjuggler.icns new file mode 100644 index 0000000..2ba448a Binary files /dev/null and b/package/macosx/Resources/vrjuggler.icns differ diff --git a/package/macosx/Resources/vrjuggler.plist b/package/macosx/Resources/vrjuggler.plist new file mode 100644 index 0000000..ea27692 --- /dev/null +++ b/package/macosx/Resources/vrjuggler.plist @@ -0,0 +1,10 @@ + + + + + VRJConfigHandling + + VRJDelegateClass + VRJBasicDelegate + + diff --git a/package/macosx/VRJuggler22BundleInfo.plist.in b/package/macosx/VRJuggler22BundleInfo.plist.in new file mode 100644 index 0000000..161c823 --- /dev/null +++ b/package/macosx/VRJuggler22BundleInfo.plist.in @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleGetInfoString + ${MACOSX_BUNDLE_INFO_STRING} + CFBundleIconFile + ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + ${MACOSX_BUNDLE_LONG_VERSION_STRING} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CSResourcesFileMapped + + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/package/macosx/fixupbundle.cmake.in b/package/macosx/fixupbundle.cmake.in new file mode 100644 index 0000000..0e722f2 --- /dev/null +++ b/package/macosx/fixupbundle.cmake.in @@ -0,0 +1,56 @@ +# - Configurable script to fix up a VR Juggler bundle +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file ../../LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +function(gp_resolve_item_override _context _item _exepath _dirs _resolved_item _resolved) + if(NOT ${_resolved}) + set(ri "ri-NOTFOUND") + if("${_item}" MATCHES "@executable_path") + get_filename_component(itemname "${_item}" NAME) + message(STATUS "Was incompletely embedded, now looking for ${itemname}") + find_file(ri "${itemname}" ${_exepath} ${_dirs} NO_DEFAULT_PATH) + find_file(ri "${itemname}" ${_exepath} ${_dirs} /usr/lib) + if(ri) + get_filename_component(ri "${ri}" REALPATH) + message(STATUS "override info: 'find_file' on filename '${itemname} in exepath/dirs (${ri})") + set(${_resolved} 1 PARENT_SCOPE) + set(${_resolved_item} "${ri}" PARENT_SCOPE) + set(ri "ri-NOTFOUND") + endif() + endif() + endif() + +endfunction() + + +set(CMAKE_MODULE_PATH @CMAKE_MODULE_PATH@) + +include(BundleUtilities) +set(IS_XCODE @IS_XCODE@) +if(IS_XCODE) + set(APP "$ENV{TARGET_BUILD_DIR}/@_target@.app") +else() + set(APP "@TARGET_LOCATION@") +endif() +#set(APP "@_target@") + +set(BUNDLE_LIBS_INPUT "@BUNDLE_LIBS@") +foreach(lib ${BUNDLE_LIBS_INPUT}) + if(IS_ABSOLUTE "${lib}") + list(APPEND BUNDLE_LIBS "${lib}") + message(STATUS " ${lib}") + else() + message(STATUS "* ${CMAKE_INSTALL_PREFIX}/${lib}") + list(APPEND BUNDLE_LIBS "${CMAKE_INSTALL_PREFIX}/${lib}") + endif() +endforeach() + +fixup_bundle("${CMAKE_INSTALL_PREFIX}/${APP}" "${BUNDLE_LIBS}" "@BUNDLE_LIB_DIRS@") \ No newline at end of file diff --git a/workarounds/mac-alut-framework/AL/alut.h b/workarounds/mac-alut-framework/AL/alut.h new file mode 100644 index 0000000..8e5b939 --- /dev/null +++ b/workarounds/mac-alut-framework/AL/alut.h @@ -0,0 +1 @@ +#include diff --git a/workarounds/mac-gl/GL/gl.h b/workarounds/mac-gl/GL/gl.h new file mode 100644 index 0000000..1cbb3cd --- /dev/null +++ b/workarounds/mac-gl/GL/gl.h @@ -0,0 +1 @@ +#include diff --git a/workarounds/mac-gl/GL/glui.h b/workarounds/mac-gl/GL/glui.h new file mode 100644 index 0000000..f6a993a --- /dev/null +++ b/workarounds/mac-gl/GL/glui.h @@ -0,0 +1 @@ +#include diff --git a/workarounds/mac-gl/GL/glut.h b/workarounds/mac-gl/GL/glut.h new file mode 100644 index 0000000..d3182a2 --- /dev/null +++ b/workarounds/mac-gl/GL/glut.h @@ -0,0 +1 @@ +#include diff --git a/workarounds/mac-openal/AL/al.h b/workarounds/mac-openal/AL/al.h new file mode 100644 index 0000000..b032a63 --- /dev/null +++ b/workarounds/mac-openal/AL/al.h @@ -0,0 +1 @@ +#include diff --git a/workarounds/mac-openal/AL/alc.h b/workarounds/mac-openal/AL/alc.h new file mode 100644 index 0000000..8ddbddc --- /dev/null +++ b/workarounds/mac-openal/AL/alc.h @@ -0,0 +1 @@ +#include diff --git a/workarounds/tchar/tchar.h b/workarounds/tchar/tchar.h new file mode 100644 index 0000000..aff036b --- /dev/null +++ b/workarounds/tchar/tchar.h @@ -0,0 +1,2 @@ +#define _tmain main +#define _TCHAR char \ No newline at end of file