Skip to content

Commit 3fe03cd

Browse files
committed
Initial commit
0 parents  commit 3fe03cd

File tree

135 files changed

+12570
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+12570
-0
lines changed

BoostTestTargets.cmake

+198
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# - Add tests using boost::test
2+
#
3+
# Add this line to your test files in place of including a basic boost test header:
4+
# #include <BoostTestTargetConfig.h>
5+
#
6+
# If you cannot do that and must use the included form for a given test,
7+
# include the line
8+
# // OVERRIDE_BOOST_TEST_INCLUDED_WARNING
9+
# in the same file with the boost test include.
10+
#
11+
# include(BoostTestTargets)
12+
# add_boost_test(<testdriver_name> SOURCES <source1> [<more sources...>]
13+
# [LIBRARIES <library> [<library>...]]
14+
# [RESOURCES <resource> [<resource>...]]
15+
# [TESTS <testcasename> [<testcasename>...]])
16+
#
17+
# If for some reason you need access to the executable target created,
18+
# it is ${BOOST_TEST_TARGET_PREFIX}${testdriver_name} as specified when
19+
# you called add_boost_test
20+
#
21+
# Requires CMake 2.6 or newer (uses the 'function' command)
22+
#
23+
# Requires:
24+
# GetForceIncludeDefinitions
25+
# CopyResourcesToBuildTree
26+
#
27+
# Original Author:
28+
# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]>
29+
# http://academic.cleardefinition.com
30+
# Iowa State University HCI Graduate Program/VRAC
31+
32+
if(__add_boost_test)
33+
return()
34+
endif()
35+
set(__add_boost_test YES)
36+
37+
set(BOOST_TEST_TARGET_PREFIX "boosttesttarget_")
38+
39+
if(NOT Boost_FOUND)
40+
find_package(Boost 1.34.0 QUIET)
41+
endif()
42+
if("${Boost_VERSION}0" LESS "1034000")
43+
set(_shared_msg "NOTE: boost::test-based targets and tests cannot "
44+
"be added: boost >= 1.34.0 required but not found. "
45+
"(found: '${Boost_VERSION}'; want >=103400) ")
46+
if(BUILD_TESTING)
47+
message(FATAL_ERROR ${_shared_msg}
48+
"You may disable BUILD_TESTING to continue without the "
49+
"tests.")
50+
else()
51+
message(STATUS ${_shared_msg}
52+
"BUILD_TESTING disabled, so continuing anyway.")
53+
endif()
54+
endif()
55+
56+
include(GetForceIncludeDefinitions)
57+
include(CopyResourcesToBuildTree)
58+
59+
if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000")
60+
if(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
61+
find_package(Boost 1.34.0 QUIET COMPONENTS unit_test_framework)
62+
endif()
63+
if(Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
64+
set(_boosttesttargets_libs ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
65+
if(Boost_USE_STATIC_LIBS)
66+
set(_boostConfig "BoostTestTargetsStatic.h")
67+
else()
68+
set(_boostConfig "BoostTestTargetsDynamic.h")
69+
endif()
70+
else()
71+
set(_boosttesttargets_libs)
72+
set(_boostConfig "BoostTestTargetsIncluded.h")
73+
endif()
74+
get_filename_component(_moddir ${CMAKE_CURRENT_LIST_FILE} PATH)
75+
configure_file("${_moddir}/${_boostConfig}" "${CMAKE_CURRENT_BINARY_DIR}/BoostTestTargetConfig.h" COPYONLY)
76+
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
77+
endif()
78+
79+
function(add_boost_test _name)
80+
if(NOT BUILD_TESTING)
81+
return()
82+
endif()
83+
# parse arguments
84+
set(_nowhere)
85+
set(_curdest _nowhere)
86+
set(_val_args
87+
SOURCES
88+
LIBRARIES
89+
RESOURCES
90+
TESTS)
91+
set(_bool_args
92+
USE_COMPILED_LIBRARY)
93+
foreach(_arg ${_val_args} ${_bool_args})
94+
set(${_arg})
95+
endforeach()
96+
foreach(_element ${ARGN})
97+
list(FIND _val_args "${_element}" _val_arg_find)
98+
list(FIND _bool_args "${_element}" _bool_arg_find)
99+
if("${_val_arg_find}" GREATER "-1")
100+
set(_curdest "${_element}")
101+
elseif("${_bool_arg_find}" GREATER "-1")
102+
set("${_element}" ON)
103+
set(_curdest _nowhere)
104+
else()
105+
list(APPEND ${_curdest} "${_element}")
106+
endif()
107+
endforeach()
108+
109+
if(_nowhere)
110+
message(FATAL_ERROR "Syntax error in use of add_boost_test!")
111+
endif()
112+
113+
if(NOT SOURCES)
114+
message(FATAL_ERROR "Syntax error in use of add_boost_test: at least one source file required!")
115+
endif()
116+
117+
if(Boost_FOUND AND NOT "${Boost_VERSION}0" LESS "1034000")
118+
119+
include_directories(${Boost_INCLUDE_DIRS})
120+
121+
set(includeType)
122+
foreach(src ${SOURCES})
123+
file(READ ${src} thefile)
124+
if("${thefile}" MATCHES ".*BoostTestTargetConfig.h.*")
125+
set(includeType CONFIGURED)
126+
set(includeFileLoc ${src})
127+
break()
128+
elseif("${thefile}" MATCHES ".*boost/test/included/unit_test.hpp.*")
129+
set(includeType INCLUDED)
130+
set(includeFileLoc ${src})
131+
set(_boosttesttargets_libs) # clear this out - linking would be a bad idea
132+
if(NOT "${thefile}" MATCHES ".*OVERRIDE_BOOST_TEST_INCLUDED_WARNING.*")
133+
message("Please replace the include line in ${src} with this alternate include line instead:")
134+
message(" \#include <BoostTestTargetConfig.h>")
135+
message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)")
136+
endif()
137+
break()
138+
endif()
139+
endforeach()
140+
141+
if(NOT _boostTestTargetsNagged${_name} STREQUAL "${includeType}")
142+
if("includeType" STREQUAL "CONFIGURED")
143+
message(STATUS "Test '${_name}' uses the CMake-configurable form of the boost test framework - congrats! (Including File: ${includeFileLoc})")
144+
elseif("${includeType}" STREQUAL "INCLUDED")
145+
message("In test '${_name}': ${includeFileLoc} uses the 'included' form of the boost unit test framework.")
146+
else()
147+
message("In test '${_name}': Didn't detect the CMake-configurable boost test include.")
148+
message("Please replace your existing boost test include in that test with the following:")
149+
message(" \#include <BoostTestTargetConfig.h>")
150+
message("Once you've saved your changes, re-run CMake. (See BoostTestTargets.cmake for more info)")
151+
endif()
152+
endif()
153+
set(_boostTestTargetsNagged${_name} "${includeType}" CACHE INTERNAL "" FORCE)
154+
155+
156+
if(RESOURCES)
157+
list(APPEND SOURCES ${RESOURCES})
158+
endif()
159+
160+
add_executable(${BOOST_TEST_TARGET_PREFIX}${_name} ${SOURCES})
161+
162+
#if(USE_COMPILED_LIBRARY)
163+
list(APPEND LIBRARIES ${_boosttesttargets_libs})
164+
#endif()
165+
if(LIBRARIES)
166+
target_link_libraries(${BOOST_TEST_TARGET_PREFIX}${_name} ${LIBRARIES})
167+
endif()
168+
169+
if(RESOURCES)
170+
set_property(TARGET
171+
${BOOST_TEST_TARGET_PREFIX}${_name}
172+
PROPERTY
173+
RESOURCE
174+
${RESOURCES})
175+
copy_resources_to_build_tree(${BOOST_TEST_TARGET_PREFIX}${_name})
176+
endif()
177+
178+
if(NOT Boost_TEST_FLAGS)
179+
# set(Boost_TEST_FLAGS --catch_system_error=yes --output_format=XML)
180+
set(Boost_TEST_FLAGS --catch_system_error=yes)
181+
endif()
182+
183+
# TODO: Figure out why only recent boost handles individual test running properly
184+
if(TESTS AND ("${Boost_VERSION}" VERSION_GREATER "103799"))
185+
foreach(_test ${TESTS})
186+
add_test(${_name}-${_test} ${BOOST_TEST_TARGET_PREFIX}${_name} --run_test=${_test} ${Boost_TEST_FLAGS})
187+
endforeach()
188+
else()
189+
add_test(${_name}-boost::test ${BOOST_TEST_TARGET_PREFIX}${_name} ${Boost_TEST_FLAGS})
190+
endif()
191+
192+
# CppCheck the test if we can.
193+
if(COMMAND add_cppcheck)
194+
add_cppcheck(${BOOST_TEST_TARGET_PREFIX}${_name} STYLE UNUSED_FUNCTIONS)
195+
endif()
196+
197+
endif()
198+
endfunction()

BoostTestTargetsDynamic.h

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Small header computed by CMake to set up boost test.
2+
// include AFTER #define BOOST_TEST_MODULE whatever
3+
// but before any other boost test includes.
4+
5+
#define BOOST_TEST_DYN_LINK
6+
#include <boost/test/unit_test.hpp>
7+

BoostTestTargetsIncluded.h

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Small header computed by CMake to set up boost test.
2+
// include AFTER #define BOOST_TEST_MODULE whatever
3+
// but before any other boost test includes.
4+
5+
#include <boost/test/included/unit_test.hpp>

BoostTestTargetsStatic.h

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Small header computed by CMake to set up boost test.
2+
// include AFTER #define BOOST_TEST_MODULE whatever
3+
// but before any other boost test includes.
4+
5+
#include <boost/test/unit_test.hpp>
6+

BundleOSGRuntime.cmake

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# - Include the OpenSceneGraph runtime files in an installation or built package.
2+
#
3+
# OSGRUNTIME_BUNDLE - Set to "yes" to enable this behavior
4+
# OSGRUNTIME_zlib1dll - Must be set to the location of zlib1.dll on Windows
5+
# OSGRUNTIME_zlib1ddll - Can be set to the location of zlib1d.dll (debug) on Windows.
6+
# If set, will be installed.
7+
#
8+
# Requires these CMake modules:
9+
# no additional modules required
10+
#
11+
# Original Author:
12+
# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]>
13+
# http://academic.cleardefinition.com
14+
# Iowa State University HCI Graduate Program/VRAC
15+
16+
if(OPENSCENEGRAPH_FOUND)
17+
if(WIN32)
18+
get_filename_component(_osglibdir "${OSG_LIBRARY}" PATH)
19+
get_filename_component(_osgroot "${_osglibdir}/.." ABSOLUTE)
20+
find_file(OSGBUNDLE_zlib1dll
21+
zlib1.dll
22+
PATHS
23+
"${_osgroot}/bin"
24+
"${_osgroot}/lib")
25+
find_file(OSGBUNDLE_zlib1ddll
26+
zlib1d.dll
27+
PATHS
28+
"${_osgroot}/bin"
29+
"${_osgroot}/lib")
30+
mark_as_advanced(OSGBUNDLE_zlib1dll OSGBUNDLE_zlib1ddll)
31+
set(_osgbundle_required OSGBUNDLE_zlib1dll)
32+
set(_osgbundle_platformOK on)
33+
else()
34+
# TODO - how to handle when not on Windows?
35+
endif()
36+
endif()
37+
38+
if(_osgbundle_platformOK)
39+
set(_osgbundle_caninstall on)
40+
foreach(_var ${_osgbundle_required})
41+
if(NOT ${_var})
42+
# If we are missing a single required file, cut out now.
43+
set(_osgbundle_caninstall off)
44+
option(OSGRUNTIME_BUNDLE
45+
"Install a local copy of the OpenSceneGraph runtime files with the project."
46+
off)
47+
endif()
48+
endforeach()
49+
if(_osgbundle_caninstall)
50+
option(OSGRUNTIME_BUNDLE
51+
"Install a local copy of the OpenSceneGraph runtime files with the project."
52+
on)
53+
endif()
54+
endif()
55+
56+
mark_as_advanced(OSGRUNTIME_BUNDLE)
57+
58+
if(OSGRUNTIME_BUNDLE AND OPENSCENEGRAPH_FOUND AND _osgbundle_caninstall)
59+
if(WIN32)
60+
install(FILES "${OSGBUNDLE_zlib1dll}"
61+
DESTINATION bin)
62+
63+
if(OSGBUNDLE_zlib1ddll)
64+
install(FILES "${OSGBUNDLE_zlib1ddll}"
65+
DESTINATION bin)
66+
endif()
67+
68+
install(DIRECTORY "${_osgroot}/bin/" "${_osgroot}/lib/"
69+
DESTINATION bin
70+
FILES_MATCHING
71+
72+
# Runtime files
73+
PATTERN "*.dll")
74+
else()
75+
# TODO - how to handle when not on Windows?
76+
endif()
77+
endif()

BundleVRJ22Runtime.cmake

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# - Include the VR Juggler runtime files in an installation or built package.
2+
#
3+
# VRJUGGLERRUNTIME_BUNDLE
4+
# VRJUGGLERRUNTIME_BUNDLE_DEBUG - set to yes to include debug dll's as well
5+
#
6+
# Requires these CMake modules:
7+
# FindVRJuggler22 and its dependencies
8+
#
9+
# Original Author:
10+
# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]>
11+
# http://academic.cleardefinition.com
12+
# Iowa State University HCI Graduate Program/VRAC
13+
14+
if(WIN32)
15+
option(VRJUGGLERRUNTIME_BUNDLE
16+
"Install a local copy of the VR Juggler runtime files with the project."
17+
on)
18+
option(VRJUGGLERRUNTIME_BUNDLE_DEBUG
19+
"Install the VR Juggler debug runtime files as well."
20+
off)
21+
mark_as_advanced(VRJUGGLERRUNTIME_BUNDLE_DEBUG)
22+
else()
23+
# TODO - how to handle when not on Windows?
24+
#option(VRJUGGLERRUNTIME_BUNDLE "Install a local copy of the VR Juggler runtime files with the project." off)
25+
endif()
26+
27+
mark_as_advanced(VRJUGGLERRUNTIME_BUNDLE VRJUGGLERRUNTIME_BUNDLE_DEBUG)
28+
29+
if(VRJUGGLERRUNTIME_BUNDLE AND VRJUGGLER22_FOUND)
30+
if(WIN32)
31+
get_filename_component(_vrjroot ${VRJ22_LIBRARY_DIR}/../ ABSOLUTE)
32+
33+
# TODO - make sure gadgeteer and sonix can find their DSO's at runtime...
34+
35+
foreach(_dir bin lib)
36+
if(VRJUGGLERRUNTIME_BUNDLE_DEBUG)
37+
install(DIRECTORY ${_vrjroot}/${_dir}/
38+
DESTINATION bin
39+
PATTERN "*.lib" EXCLUDE # exclude static and link libraries
40+
PATTERN "*.exe" EXCLUDE # exclude unneeded executables
41+
PATTERN "*.py" EXCLUDE # exclude unneeded python executables
42+
PATTERN "*.pyc" EXCLUDE # exclude unneeded python executables
43+
)
44+
else()
45+
install(DIRECTORY ${_vrjroot}/${_dir}/
46+
DESTINATION bin
47+
PATTERN "*.lib" EXCLUDE # exclude static and link libraries
48+
PATTERN "*.exe" EXCLUDE # exclude unneeded executables
49+
PATTERN "*.py" EXCLUDE # exclude unneeded python executables
50+
PATTERN "*.pyc" EXCLUDE # exclude unneeded python executables
51+
52+
PATTERN "*d.dll" EXCLUDE # exclude debug dll's
53+
PATTERN "*-gd-*.dll" EXCLUDE # exclude Boost debug dll's
54+
)
55+
endif()
56+
57+
endforeach()
58+
59+
install(DIRECTORY ${_vrjroot}/share/
60+
DESTINATION share
61+
FILES_MATCHING
62+
63+
# Runtime files
64+
PATTERN "*.dll"
65+
PATTERN "*.jar"
66+
67+
# Data files
68+
PATTERN "*.wav"
69+
PATTERN "*.xml"
70+
PATTERN "*.xsl"
71+
PATTERN "*.xsd"
72+
PATTERN "*.flt"
73+
PATTERN "*.dat"
74+
PATTERN "*.table"
75+
76+
77+
# Config files
78+
PATTERN "*.jdef"
79+
PATTERN "*.jconf"
80+
PATTERN "*.cfg"
81+
PATTERN "hosts.allow"
82+
83+
# Other Files
84+
PATTERN "*.txt"
85+
PATTERN "COPYING*"
86+
PATTERN "ChangeLog"
87+
)
88+
89+
endif()
90+
91+
92+
93+
endif()

0 commit comments

Comments
 (0)