diff options
author | Steve Bennetts <steve@lindenlab.com> | 2009-10-20 10:52:53 -0700 |
---|---|---|
committer | Steve Bennetts <steve@lindenlab.com> | 2009-10-20 10:52:53 -0700 |
commit | afcccc3b36d96ababe61ca04dc6c9e02f4b20d81 (patch) | |
tree | f351783fb94e36ba6229bf4a9531eb4e42a4272f /indra/test_apps/llplugintest | |
parent | 91fe3e7c790317420619aff1aae9ae14d38fa606 (diff) | |
parent | aa75245a1aee3b64aeed31744e58fe96afa1ce7e (diff) |
merge
Diffstat (limited to 'indra/test_apps/llplugintest')
-rw-r--r-- | indra/test_apps/llplugintest/CMakeLists.txt | 189 | ||||
-rw-r--r-- | indra/test_apps/llplugintest/llmediaplugintest.cpp | 31 |
2 files changed, 210 insertions, 10 deletions
diff --git a/indra/test_apps/llplugintest/CMakeLists.txt b/indra/test_apps/llplugintest/CMakeLists.txt index 789ead04fe..88c4ba8ad9 100644 --- a/indra/test_apps/llplugintest/CMakeLists.txt +++ b/indra/test_apps/llplugintest/CMakeLists.txt @@ -28,7 +28,7 @@ include_directories( if (DARWIN) include(CMakeFindFrameworks) - find_library(CARBON_LIBRARY Carbon) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) endif (DARWIN) ### demo_plugin @@ -136,7 +136,7 @@ endif (DARWIN) # ${media_simple_test_SOURCE_FILES} #) # -#add_dependencies(media_simple_test copy_win_libs) +#add_dependencies(media_simple_test stage_third_party_libs) # #set_target_properties(media_simple_test # PROPERTIES @@ -177,7 +177,7 @@ endif (DARWIN) #) # #add_dependencies(media_plugin_test -# copy_win_libs +# stage_third_party_libs # SLPlugin # demo_media_plugin # ${LLPLUGIN_LIBRARIES} @@ -261,6 +261,7 @@ set(llmediaplugintest_SOURCE_FILES add_executable(llmediaplugintest WIN32 + MACOSX_BUNDLE ${llmediaplugintest_SOURCE_FILES} ) @@ -280,8 +281,15 @@ target_link_libraries(llmediaplugintest ${PLUGIN_API_WINDOWS_LIBRARIES} ) +if (DARWIN) + # The testbed needs to use a couple of CoreFoundation calls now, to deal with being a bundled app. + target_link_libraries(llmediaplugintest + ${COREFOUNDATION_LIBRARY} + ) +endif (DARWIN) + add_dependencies(llmediaplugintest - copy_win_libs + stage_third_party_libs SLPlugin media_plugin_quicktime media_plugin_webkit @@ -300,22 +308,64 @@ endif (DARWIN OR LINUX) # Gather build products of the various dependencies into the build directory for the testbed. +if (DARWIN) + # path inside the app bundle where we'll need to copy plugins and other related files + set(PLUGINS_DESTINATION_DIR + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llmediaplugintest.app/Contents/Resources + ) + + # create the Contents/Resources directory + add_custom_command( + TARGET llmediaplugintest POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS + -E + make_directory + ${PLUGINS_DESTINATION_DIR} + COMMENT "Creating Resources directory in app bundle." + ) + + # copy the llcommon dylib and its dependencies to Contents/Resources. + get_target_property(BUILT_LLCOMMON llcommon LOCATION) + add_custom_command(TARGET llmediaplugintest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON} ${PLUGINS_DESTINATION_DIR} + DEPENDS ${BUILT_LLCOMMON} + ) + # FIXME: these paths should come from somewhere reliable. The canonical list seems to be in indra/newview/viewer_manifest.py + add_custom_command(TARGET llmediaplugintest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.0.3.7.dylib ${PLUGINS_DESTINATION_DIR} + DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libapr-1.0.3.7.dylib + ) + add_custom_command(TARGET llmediaplugintest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.0.3.8.dylib ${PLUGINS_DESTINATION_DIR} + DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libaprutil-1.0.3.8.dylib + ) + add_custom_command(TARGET llmediaplugintest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.0.5.0.dylib ${PLUGINS_DESTINATION_DIR} + DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libexpat.0.5.0.dylib + ) +else (DARWIN) + set(PLUGINS_DESTINATION_DIR + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ + ) +endif (DARWIN) + get_target_property(BUILT_SLPLUGIN SLPlugin LOCATION) add_custom_command(TARGET llmediaplugintest POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_SLPLUGIN} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ + COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_SLPLUGIN} ${PLUGINS_DESTINATION_DIR} DEPENDS ${BUILT_SLPLUGIN} ) if (DARWIN OR WINDOWS) get_target_property(BUILT_WEBKIT_PLUGIN media_plugin_webkit LOCATION) add_custom_command(TARGET llmediaplugintest POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_WEBKIT_PLUGIN} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ + COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_WEBKIT_PLUGIN} ${PLUGINS_DESTINATION_DIR} DEPENDS ${BUILT_WEBKIT_PLUGIN} ) get_target_property(BUILT_QUICKTIME_PLUGIN media_plugin_quicktime LOCATION) add_custom_command(TARGET llmediaplugintest POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_QUICKTIME_PLUGIN} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ + COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_QUICKTIME_PLUGIN} ${PLUGINS_DESTINATION_DIR} DEPENDS ${BUILT_QUICKTIME_PLUGIN} ) @@ -325,18 +375,137 @@ if (DARWIN OR WINDOWS) COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${CMAKE_CURRENT_BINARY_DIR}/ DEPENDS ${BUILT_LLMEDIAPLUGINTEST} ) - # also copy it to the build configuration directory, which is what the mac wants... + # also copy it to the same place as SLPlugin, which is what the mac wants... add_custom_command(TARGET llmediaplugintest POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${PLUGINS_DESTINATION_DIR} DEPENDS ${BUILT_LLMEDIAPLUGINTEST} ) endif (DARWIN OR WINDOWS) if (DARWIN) add_custom_command(TARGET llmediaplugintest POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib ${PLUGINS_DESTINATION_DIR} DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib ) endif (DARWIN) +if(WINDOWS) + #******************** + # Plugin test library deploy + # + # Debug config runtime files required for the plugin test mule + set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug") + set(plugintest_debug_files + libeay32.dll + libglib-2.0-0.dll + libgmodule-2.0-0.dll + libgobject-2.0-0.dll + libgthread-2.0-0.dll + qtcored4.dll + qtguid4.dll + qtnetworkd4.dll + qtopengld4.dll + qtwebkitd4.dll + ssleay32.dll + ) + copy_if_different( + ${plugintest_debug_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/Debug" + out_targets + ${plugintest_debug_files} + ) + set(plugin_test_targets ${plugin_test_targets} ${out_targets}) + + # Debug config runtime files required for the plugin test mule (Qt image format plugins) + set(plugintest_debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug/imageformats") + set(plugintest_debug_files + qgifd4.dll + qicod4.dll + qjpegd4.dll + qmngd4.dll + qsvgd4.dll + qtiffd4.dll + ) + copy_if_different( + ${plugintest_debug_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/Debug/imageformats" + out_targets + ${plugintest_debug_files} + ) + set(plugin_test_targets ${plugin_test_targets} ${out_targets}) + + # Release & ReleaseDebInfo config runtime files required for the plugin test mule + set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release") + set(plugintest_release_files + libeay32.dll + libglib-2.0-0.dll + libgmodule-2.0-0.dll + libgobject-2.0-0.dll + libgthread-2.0-0.dll + qtcore4.dll + qtgui4.dll + qtnetwork4.dll + qtopengl4.dll + qtwebkit4.dll + ssleay32.dll + ) + copy_if_different( + ${plugintest_release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/Release" + out_targets + ${plugintest_release_files} + ) + set(plugin_test_targets ${plugin_test_targets} ${out_targets}) + + copy_if_different( + ${plugintest_release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo" + out_targets + ${plugintest_release_files} + ) + set(plugin_test_targets ${plugin_test_targets} ${out_targets}) + + # Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins) + set(plugintest_release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release/imageformats") + set(plugintest_release_files + qgif4.dll + qico4.dll + qjpeg4.dll + qmng4.dll + qsvg4.dll + qtiff4.dll + ) + copy_if_different( + ${plugintest_release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/Release/imageformats" + out_targets + ${plugintest_release_files} + ) + set(plugin_test_targets ${plugin_test_targets} ${out_targets}) + + copy_if_different( + ${plugintest_release_src_dir} + "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/imageformats" + out_targets + ${plugintest_release_files} + ) + set(plugin_test_targets ${plugin_test_targets} ${out_targets}) + + copy_if_different( + "${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}" + "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" + out_targets + llcommon.dll libapr-1.dll libaprutil-1.dll libapriconv-1.dll + ) + set(plugin_test_targets ${plugin_test_targets} ${out_targets}) + + add_custom_target(copy_plugintest_libs ALL + DEPENDS + ${plugin_test_targets} + llcommon + ) + + add_dependencies(llmediaplugintest copy_plugintest_libs) + +endif(WINDOWS) diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp index 7869763302..234422b68a 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.cpp +++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp @@ -44,6 +44,7 @@ #if __APPLE__ #include <GLUT/glut.h> + #include <CoreFoundation/CoreFoundation.h> #else #define FREEGLUT_STATIC #include "GL/freeglut.h" @@ -137,6 +138,8 @@ LLMediaPluginTest::LLMediaPluginTest( int app_window, int window_width, int wind mMediaBrowserControlBackButtonFlag( true ), mMediaBrowserControlForwardButtonFlag( true ), mHomeWebUrl( "http://www.google.com/" ) + //mHomeWebUrl( "file:///C|/Program Files/QuickTime/Sample.mov" ) + //mHomeWebUrl( "http://movies.apple.com/movies/wb/watchmen/watchmen-tlr2_480p.mov" ) { // debugging spam std::cout << std::endl << " GLUT version: " << "3.7.6" << std::endl; // no way to get real version from GLUT @@ -2007,6 +2010,11 @@ void LLMediaPluginTest::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e std::cerr << "Media event: MEDIA_EVENT_STATUS_TEXT_CHANGED, new status text is: " << self->getStatusText() << std::endl; break; + case MEDIA_EVENT_NAME_CHANGED: + std::cerr << "Media event: MEDIA_EVENT_NAME_CHANGED, new name is: " << self->getMediaName() << std::endl; + glutSetWindowTitle( self->getMediaName().c_str() ); + break; + case MEDIA_EVENT_LOCATION_CHANGED: { std::cerr << "Media event: MEDIA_EVENT_LOCATION_CHANGED, new uri is: " << self->getLocation() << std::endl; @@ -2033,6 +2041,10 @@ void LLMediaPluginTest::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e case MEDIA_EVENT_PLUGIN_FAILED: std::cerr << "Media event: MEDIA_EVENT_PLUGIN_FAILED" << std::endl; break; + + case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH: + std::cerr << "Media event: MEDIA_EVENT_PLUGIN_FAILED_LAUNCH" << std::endl; + break; } } @@ -2107,6 +2119,25 @@ void glutMouseButton( int button, int state, int x, int y ) // int main( int argc, char* argv[] ) { +#if LL_DARWIN + // Set the current working directory to <application bundle>/Contents/Resources/ + CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); + if(resources_url != NULL) + { + CFStringRef resources_string = CFURLCopyFileSystemPath(resources_url, kCFURLPOSIXPathStyle); + CFRelease(resources_url); + if(resources_string != NULL) + { + char buffer[PATH_MAX] = ""; + if(CFStringGetCString(resources_string, buffer, sizeof(buffer), kCFStringEncodingUTF8)) + { + chdir(buffer); + } + CFRelease(resources_string); + } + } +#endif + glutInit( &argc, argv ); glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB ); |