PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/test_apps/llplugintest/CMakeLists.txt

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 538 lines | 263 code | 50 blank | 225 comment | 8 complexity | 8e576bd77996348f3625456d2dd8d0af MD5 | raw file
  1# -*- cmake -*-
  2project(llplugintest)
  3
  4include(00-Common)
  5include(FindOpenGL)
  6include(LLCommon)
  7include(LLPlugin)
  8include(Linking)
  9include(LLSharedLibs)
 10include(PluginAPI)
 11include(LLImage)
 12include(LLMath)
 13include(LLMessage)
 14include(LLRender)
 15include(LLWindow)
 16include(Glut)
 17include(Glui)
 18
 19include_directories(
 20    ${LLPLUGIN_INCLUDE_DIRS}
 21    ${LLCOMMON_INCLUDE_DIRS}
 22    ${LLIMAGE_INCLUDE_DIRS}
 23    ${LLMATH_INCLUDE_DIRS}
 24    ${LLMESSAGE_INCLUDE_DIRS}
 25    ${LLRENDER_INCLUDE_DIRS}
 26    ${LLWINDOW_INCLUDE_DIRS}
 27)
 28
 29if (DARWIN)
 30    include(CMakeFindFrameworks)
 31    find_library(COREFOUNDATION_LIBRARY CoreFoundation)
 32endif (DARWIN)
 33
 34### demo_plugin
 35
 36#set(demo_plugin_SOURCE_FILES
 37#    demo_plugin.cpp
 38#    )
 39#
 40#add_library(demo_plugin
 41#    SHARED
 42#    ${demo_plugin_SOURCE_FILES}
 43#)
 44#
 45#target_link_libraries(demo_plugin
 46#  ${LLPLUGIN_LIBRARIES}
 47#  ${LLCOMMON_LIBRARIES}
 48#  ${PLUGIN_API_WINDOWS_LIBRARIES}
 49#)
 50#
 51#add_dependencies(demo_plugin
 52#  ${LLPLUGIN_LIBRARIES}
 53#  ${LLCOMMON_LIBRARIES}
 54#)
 55#
 56#if (DARWIN)
 57#  # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name
 58#  set_target_properties(
 59#    demo_plugin
 60#    PROPERTIES
 61#    PREFIX ""
 62#    BUILD_WITH_INSTALL_RPATH 1
 63#    INSTALL_NAME_DIR "@executable_path"
 64#  )
 65#endif (DARWIN)
 66
 67### plugin_host
 68
 69#set(plugin_host_SOURCE_FILES
 70#    plugin_host.cpp
 71#    )
 72#
 73#add_executable(plugin_host
 74#    WIN32
 75#    ${plugin_host_SOURCE_FILES}
 76#)
 77#
 78#set_target_properties(plugin_host
 79#    PROPERTIES
 80#    WIN32_EXECUTABLE
 81#    FALSE
 82#)
 83#
 84#target_link_libraries(plugin_host
 85#  ${LLPLUGIN_LIBRARIES}
 86#  ${LLCOMMON_LIBRARIES}
 87#  ${PLUGIN_API_WINDOWS_LIBRARIES}
 88#)
 89#
 90#add_dependencies(plugin_host
 91#  demo_plugin
 92#  ${LLPLUGIN_LIBRARIES}
 93#  ${LLCOMMON_LIBRARIES}
 94#)
 95
 96### plugin_process_launcher
 97
 98#set(plugin_process_launcher_SOURCE_FILES
 99#    plugin_process_launcher.cpp
100#    )
101#
102#add_executable(plugin_process_launcher
103#    WIN32
104#    ${plugin_process_launcher_SOURCE_FILES}
105#)
106#
107#set_target_properties(plugin_process_launcher
108#    PROPERTIES
109#    WIN32_EXECUTABLE
110#    FALSE
111#)
112#
113#target_link_libraries(plugin_process_launcher
114#  ${LLPLUGIN_LIBRARIES}
115#  ${LLMESSAGE_LIBRARIES}
116#  ${LLCOMMON_LIBRARIES}
117#  ${PLUGIN_API_WINDOWS_LIBRARIES}
118#)
119#
120#add_dependencies(plugin_process_launcher
121#  SLPlugin
122#  demo_plugin
123#  ${LLPLUGIN_LIBRARIES}
124#  ${LLMESSAGE_LIBRARIES}
125#  ${LLCOMMON_LIBRARIES}
126#)
127
128### media_simple_test
129
130#set(media_simple_test_SOURCE_FILES
131#    media_simple_test.cpp
132#    )
133#
134#add_executable(media_simple_test
135#    WIN32
136#    ${media_simple_test_SOURCE_FILES}
137#)
138#
139#add_dependencies(media_simple_test stage_third_party_libs)
140#
141#set_target_properties(media_simple_test
142#    PROPERTIES
143#    WIN32_EXECUTABLE
144#    FALSE
145#)
146#
147#target_link_libraries(media_simple_test
148#  ${GLUT_LIBRARY}
149#  ${OPENGL_LIBRARIES}
150#  ${LLCOMMON_LIBRARIES}
151#)
152
153### media_plugin_test
154
155#set(media_plugin_test_SOURCE_FILES
156#    media_plugin_test.cpp
157#    )
158#
159#add_executable(media_plugin_test
160#    WIN32
161#    ${media_plugin_test_SOURCE_FILES}
162#)
163#
164#set_target_properties(media_plugin_test
165#    PROPERTIES
166#    WIN32_EXECUTABLE
167#    FALSE
168#)
169#
170#target_link_libraries(media_plugin_test
171#  ${GLUT_LIBRARY}
172#  ${OPENGL_LIBRARIES}
173#  ${LLPLUGIN_LIBRARIES}
174#  ${LLMESSAGE_LIBRARIES}
175#  ${LLCOMMON_LIBRARIES}
176#  ${PLUGIN_API_WINDOWS_LIBRARIES}
177#)
178#
179#add_dependencies(media_plugin_test
180#  stage_third_party_libs
181#  SLPlugin
182#  demo_media_plugin
183#  ${LLPLUGIN_LIBRARIES}
184#  ${LLMESSAGE_LIBRARIES}
185#  ${LLCOMMON_LIBRARIES}
186#)
187
188### demo_media_plugin
189
190#set(demo_media_plugin_SOURCE_FILES
191#    demo_media_plugin.cpp
192#    )
193#
194#add_library(demo_media_plugin
195#    SHARED
196#    ${demo_media_plugin_SOURCE_FILES}
197#)
198#
199#target_link_libraries(demo_media_plugin
200#  ${LLPLUGIN_LIBRARIES}
201#  ${LLCOMMON_LIBRARIES}
202#  ${PLUGIN_API_WINDOWS_LIBRARIES}
203#)
204#
205#add_dependencies(demo_media_plugin
206#  ${LLPLUGIN_LIBRARIES}
207#  ${LLCOMMON_LIBRARIES}
208#)
209#
210#if (DARWIN)
211#  # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name
212#  set_target_properties(
213#    demo_media_plugin
214#    PROPERTIES
215#    PREFIX ""
216#    BUILD_WITH_INSTALL_RPATH 1
217#    INSTALL_NAME_DIR "@executable_path"
218#  )
219#endif (DARWIN)
220
221### demo_media_plugin_2
222
223#set(demo_media_plugin_2_SOURCE_FILES
224#    demo_media_plugin_2.cpp
225#    )
226#
227#add_library(demo_media_plugin_2
228#    SHARED
229#    ${demo_media_plugin_2_SOURCE_FILES}
230#)
231#
232#target_link_libraries(demo_media_plugin_2
233#  ${LLPLUGIN_LIBRARIES}
234#  ${LLCOMMON_LIBRARIES}
235#  ${PLUGIN_API_WINDOWS_LIBRARIES}
236#)
237#
238#add_dependencies(demo_media_plugin_2
239#  ${LLPLUGIN_LIBRARIES}
240#  ${LLCOMMON_LIBRARIES}
241#)
242#
243#if (DARWIN)
244#  # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name
245#  set_target_properties(
246#    demo_media_plugin_2
247#    PROPERTIES
248#    PREFIX ""
249#    BUILD_WITH_INSTALL_RPATH 1
250#    INSTALL_NAME_DIR "@executable_path"
251#  )
252#endif (DARWIN)
253
254### llmediaplugintest
255
256set(llmediaplugintest_SOURCE_FILES
257    llmediaplugintest.cpp
258    llmediaplugintest.h
259    bookmarks.txt
260    )
261
262add_executable(llmediaplugintest
263    WIN32
264    MACOSX_BUNDLE
265    ${llmediaplugintest_SOURCE_FILES}
266)
267
268set_target_properties(llmediaplugintest
269    PROPERTIES
270    WIN32_EXECUTABLE
271    FALSE
272)
273
274target_link_libraries(llmediaplugintest
275  ${GLUT_LIBRARY}
276  ${GLUI_LIBRARY}
277  ${OPENGL_LIBRARIES}
278  ${LLPLUGIN_LIBRARIES}
279  ${LLMESSAGE_LIBRARIES}
280  ${LLCOMMON_LIBRARIES}
281  ${PLUGIN_API_WINDOWS_LIBRARIES}
282)
283
284if (DARWIN)
285  # The testbed needs to use a couple of CoreFoundation calls now, to deal with being a bundled app.
286  target_link_libraries(llmediaplugintest
287    ${COREFOUNDATION_LIBRARY}
288  )
289endif (DARWIN)
290
291add_dependencies(llmediaplugintest
292  stage_third_party_libs
293  SLPlugin
294  media_plugin_quicktime
295  media_plugin_webkit
296  media_plugin_example
297  ${LLPLUGIN_LIBRARIES}
298  ${LLMESSAGE_LIBRARIES}
299  ${LLCOMMON_LIBRARIES}
300)
301
302# turn off weird GLUI pragma 
303add_definitions(-DGLUI_NO_LIB_PRAGMA)
304
305if (DARWIN OR LINUX)
306  # glui.h contains code that triggers the "overloaded-virtual" warning in gcc.  
307  set_source_files_properties(llmediaplugintest.cpp PROPERTIES COMPILE_FLAGS "-Wno-overloaded-virtual")
308endif (DARWIN OR LINUX)
309
310# Gather build products of the various dependencies into the build directory for the testbed.
311
312if (DARWIN)
313  # path inside the app bundle where we'll need to copy plugins and other related files
314  set(PLUGINS_DESTINATION_DIR
315    ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llmediaplugintest.app/Contents/Resources
316  )
317  
318  # create the Contents/Resources directory
319  add_custom_command(
320    TARGET llmediaplugintest POST_BUILD
321    COMMAND ${CMAKE_COMMAND}
322    ARGS
323      -E
324      make_directory
325      ${PLUGINS_DESTINATION_DIR}
326    COMMENT "Creating Resources directory in app bundle."
327  ) 
328else (DARWIN)
329  set(PLUGINS_DESTINATION_DIR
330    ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
331  )
332endif (DARWIN)
333
334get_target_property(BUILT_SLPLUGIN SLPlugin LOCATION)
335add_custom_command(TARGET llmediaplugintest POST_BUILD
336  COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_SLPLUGIN}  ${PLUGINS_DESTINATION_DIR}
337  DEPENDS ${BUILT_SLPLUGIN}
338)
339
340get_target_property(BUILT_LLCOMMON llcommon LOCATION)
341add_custom_command(TARGET llmediaplugintest POST_BUILD
342  COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON}  ${PLUGINS_DESTINATION_DIR}
343  DEPENDS ${BUILT_LLCOMMON}
344)
345
346
347if (DARWIN OR WINDOWS)
348  get_target_property(BUILT_WEBKIT_PLUGIN media_plugin_webkit LOCATION)
349  add_custom_command(TARGET llmediaplugintest POST_BUILD
350    COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_WEBKIT_PLUGIN}  ${PLUGINS_DESTINATION_DIR}
351    DEPENDS ${BUILT_WEBKIT_PLUGIN}
352  )
353
354  get_target_property(BUILT_QUICKTIME_PLUGIN media_plugin_quicktime LOCATION)
355  add_custom_command(TARGET llmediaplugintest POST_BUILD
356    COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_QUICKTIME_PLUGIN}  ${PLUGINS_DESTINATION_DIR}
357    DEPENDS ${BUILT_QUICKTIME_PLUGIN}
358  )
359  
360  get_target_property(BUILT_EXAMPLE_PLUGIN media_plugin_example LOCATION)
361  add_custom_command(TARGET llmediaplugintest POST_BUILD
362    COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_EXAMPLE_PLUGIN}  ${PLUGINS_DESTINATION_DIR}
363    DEPENDS ${BUILT_EXAMPLE_PLUGIN}
364  )
365  
366  # copy over bookmarks file if llmediaplugintest gets built
367  get_target_property(BUILT_LLMEDIAPLUGINTEST llmediaplugintest LOCATION)
368  add_custom_command(TARGET llmediaplugintest POST_BUILD
369    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${CMAKE_CURRENT_BINARY_DIR}/
370    DEPENDS ${BUILT_LLMEDIAPLUGINTEST}
371  )
372  # also copy it to the same place as SLPlugin, which is what the mac wants...
373  add_custom_command(TARGET llmediaplugintest POST_BUILD
374    COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${PLUGINS_DESTINATION_DIR}
375    DEPENDS ${BUILT_LLMEDIAPLUGINTEST}
376  )
377endif (DARWIN OR WINDOWS)
378
379if (DARWIN)
380  add_custom_command(TARGET llmediaplugintest POST_BUILD
381    COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib ${PLUGINS_DESTINATION_DIR}
382    DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib
383  )
384endif (DARWIN)
385
386if(WINDOWS)
387  #********************
388  # Plugin test library deploy
389  #
390  # Debug config runtime files required for the plugin test mule
391  set(plugintest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
392  set(plugintest_debug_files
393    libeay32.dll
394    libglib-2.0-0.dll
395    libgmodule-2.0-0.dll
396    libgobject-2.0-0.dll
397    libgthread-2.0-0.dll
398    qtcored4.dll
399    qtguid4.dll
400    qtnetworkd4.dll
401    qtopengld4.dll
402    qtwebkitd4.dll
403    ssleay32.dll
404    )
405  copy_if_different(
406    ${plugintest_debug_src_dir}
407    "${CMAKE_CURRENT_BINARY_DIR}/Debug"
408    out_targets
409    ${plugintest_debug_files}
410    )
411  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
412  
413  # Debug config runtime files required for the plugin test mule (Qt image format plugins)
414  set(plugintest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}/imageformats")
415  set(plugintest_debug_files
416    qgifd4.dll
417    qicod4.dll
418    qjpegd4.dll
419    qmngd4.dll
420    qsvgd4.dll
421    qtiffd4.dll
422    )
423  copy_if_different(
424    ${plugintest_debug_src_dir}
425    "${CMAKE_CURRENT_BINARY_DIR}/Debug/imageformats"
426    out_targets
427    ${plugintest_debug_files}
428    )
429  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
430
431  # Debug config runtime files required for the plugin test mule (Qt codec plugins)
432  set(plugintest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}/codecs")
433  set(plugintest_debug_files
434    qcncodecsd4.dll
435    qjpcodecsd4.dll
436    qkrcodecsd4.dll
437    qtwcodecsd4.dll
438    )
439  copy_if_different(
440    ${plugintest_debug_src_dir}
441    "${CMAKE_CURRENT_BINARY_DIR}/Debug/codecs"
442    out_targets
443    ${plugintest_debug_files}
444    )
445  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
446 
447  # Release & ReleaseDebInfo config runtime files required for the plugin test mule
448  set(plugintest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
449  set(plugintest_release_files
450    libeay32.dll
451    libglib-2.0-0.dll
452    libgmodule-2.0-0.dll
453    libgobject-2.0-0.dll
454    libgthread-2.0-0.dll
455    qtcore4.dll
456    qtgui4.dll
457    qtnetwork4.dll
458    qtopengl4.dll
459    qtwebkit4.dll
460    qtxmlpatterns4.dll
461    ssleay32.dll
462    )
463  copy_if_different(
464    ${plugintest_release_src_dir}
465    "${CMAKE_CURRENT_BINARY_DIR}/Release"
466    out_targets
467    ${plugintest_release_files}
468    )
469  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
470
471  copy_if_different(
472    ${plugintest_release_src_dir}
473    "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
474    out_targets
475    ${plugintest_release_files}
476    )
477  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
478
479  # Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins)
480  set(plugintest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}/imageformats")
481  set(plugintest_release_files
482    qgif4.dll
483    qico4.dll
484    qjpeg4.dll
485    qmng4.dll
486    qsvg4.dll
487    qtiff4.dll
488    )
489  copy_if_different(
490    ${plugintest_release_src_dir}
491    "${CMAKE_CURRENT_BINARY_DIR}/Release/imageformats"
492    out_targets
493    ${plugintest_release_files}
494    )
495  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
496
497  copy_if_different(
498    ${plugintest_release_src_dir}
499    "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/imageformats"
500    out_targets
501    ${plugintest_release_files}
502    )
503  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
504
505  # Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt codec plugins)
506  set(plugintest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}/codecs")
507  set(plugintest_release_files
508    qcncodecs4.dll  
509    qjpcodecs4.dll  
510    qkrcodecs4.dll  
511    qtwcodecs4.dll  
512    )
513  copy_if_different(
514    ${plugintest_release_src_dir}
515    "${CMAKE_CURRENT_BINARY_DIR}/Release/codecs"
516    out_targets
517    ${plugintest_release_files}
518    )
519  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
520
521  copy_if_different(
522    ${plugintest_release_src_dir}
523    "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/codecs"
524    out_targets
525    ${plugintest_release_files}
526    )
527  set(plugin_test_targets ${plugin_test_targets} ${out_targets})
528 
529   add_custom_target(copy_plugintest_libs ALL
530     DEPENDS 
531     ${plugin_test_targets}
532     )
533
534  add_dependencies(llmediaplugintest copy_plugintest_libs)
535
536endif(WINDOWS)
537
538ll_deploy_sharedlibs_command(llmediaplugintest)