Copy3rdPartyLibs.cmake
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:13k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. # -*- cmake -*-
  2. # The copy_win_libs folder contains file lists and a script used to
  3. # copy dlls, exes and such needed to run the SecondLife from within
  4. # VisualStudio.
  5. include(CMakeCopyIfDifferent)
  6. ###################################################################
  7. # set up platform specific lists of files that need to be copied
  8. ###################################################################
  9. if(WINDOWS)
  10.     set(SHARED_LIB_STAGING_DIR_DEBUG            "${SHARED_LIB_STAGING_DIR}/Debug")
  11.     set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO   "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo")
  12.     set(SHARED_LIB_STAGING_DIR_RELEASE          "${SHARED_LIB_STAGING_DIR}/Release")
  13.     #*******************************
  14.     # VIVOX - *NOTE: no debug version
  15.     set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-win32")
  16.     set(vivox_files
  17.         SLVoice.exe
  18.         libsndfile-1.dll
  19.         vivoxplatform.dll
  20.         vivoxsdk.dll
  21.         ortp.dll
  22.         zlib1.dll
  23.         vivoxoal.dll
  24.         )
  25.     #*******************************
  26.     # Misc shared libs 
  27.     # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
  28.     # or ARCH_PREBUILT_DIRS
  29.     set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/debug")
  30.     set(debug_files
  31.         openjpegd.dll
  32.         libapr-1.dll
  33.         libaprutil-1.dll
  34.         libapriconv-1.dll
  35.         )
  36.     # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
  37.     # or ARCH_PREBUILT_DIRS
  38.     set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-win32/lib/release")
  39.     set(release_files
  40.         openjpeg.dll
  41.         libapr-1.dll
  42.         libaprutil-1.dll
  43.         libapriconv-1.dll
  44.         )
  45.     if(USE_GOOGLE_PERFTOOLS)
  46.       set(debug_files ${debug_files} libtcmalloc_minimal-debug.dll)
  47.       set(release_files ${release_files} libtcmalloc_minimal.dll)
  48.     endif(USE_GOOGLE_PERFTOOLS)
  49.     if (FMOD_SDK_DIR)
  50.         set(fmod_files fmod.dll)
  51.     endif (FMOD_SDK_DIR)
  52.     #*******************************
  53.     # LLKDU
  54.     set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
  55.     if(NOT EXISTS ${internal_llkdu_path})
  56.         if (EXISTS "${debug_src_dir}/llkdu.dll")
  57.             set(debug_llkdu_src "${debug_src_dir}/llkdu.dll")
  58.             set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/llkdu.dll")
  59.         endif (EXISTS "${debug_src_dir}/llkdu.dll")
  60.         if (EXISTS "${release_src_dir}/llkdu.dll")
  61.             set(release_llkdu_src "${release_src_dir}/llkdu.dll")
  62.             set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/llkdu.dll")
  63.             set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/llkdu.dll")
  64.         endif (EXISTS "${release_src_dir}/llkdu.dll")
  65.     endif (NOT EXISTS ${internal_llkdu_path})
  66. #*******************************
  67. # Copy MS C runtime dlls, required for packaging.
  68. # *TODO - Adapt this to support VC9
  69. if (MSVC80)
  70.     FIND_PATH(debug_msvc8_redist_path msvcr80d.dll
  71.         PATHS
  72.          [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VC;ProductDir]/redist/Debug_NonRedist/x86/Microsoft.VC80.DebugCRT
  73.         NO_DEFAULT_PATH
  74.         NO_DEFAULT_PATH
  75.         )
  76.     if(EXISTS ${debug_msvc8_redist_path})
  77.         set(debug_msvc8_files
  78.             msvcr80d.dll
  79.             msvcp80d.dll
  80.             Microsoft.VC80.DebugCRT.manifest
  81.             )
  82.         copy_if_different(
  83.             ${debug_msvc8_redist_path}
  84.             "${SHARED_LIB_STAGING_DIR_DEBUG}"
  85.             out_targets
  86.             ${debug_msvc8_files}
  87.             )
  88.         set(third_party_targets ${third_party_targets} ${out_targets})
  89.     endif (EXISTS ${debug_msvc8_redist_path})
  90.     FIND_PATH(release_msvc8_redist_path msvcr80.dll
  91.         PATHS
  92.          [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VC;ProductDir]/redist/x86/Microsoft.VC80.CRT
  93.         NO_DEFAULT_PATH
  94.         NO_DEFAULT_PATH
  95.         )
  96.     if(EXISTS ${release_msvc8_redist_path})
  97.         set(release_msvc8_files
  98.             msvcr80.dll
  99.             msvcp80.dll
  100.             Microsoft.VC80.CRT.manifest
  101.             )
  102.         copy_if_different(
  103.             ${release_msvc8_redist_path}
  104.             "${SHARED_LIB_STAGING_DIR_RELEASE}"
  105.             out_targets
  106.             ${release_msvc8_files}
  107.             )
  108.         set(third_party_targets ${third_party_targets} ${out_targets})
  109.         copy_if_different(
  110.             ${release_msvc8_redist_path}
  111.             "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
  112.             out_targets
  113.             ${release_msvc8_files}
  114.             )
  115.         set(third_party_targets ${third_party_targets} ${out_targets})
  116.           
  117.     endif (EXISTS ${release_msvc8_redist_path})
  118. endif (MSVC80)
  119. elseif(DARWIN)
  120.     set(SHARED_LIB_STAGING_DIR_DEBUG            "${SHARED_LIB_STAGING_DIR}/Debug/Resources")
  121.     set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO   "${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/Resources")
  122.     set(SHARED_LIB_STAGING_DIR_RELEASE          "${SHARED_LIB_STAGING_DIR}/Release/Resources")
  123.     set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/universal-darwin")
  124.     set(vivox_files
  125.         SLVoice
  126.         libsndfile.dylib
  127.         libvivoxoal.dylib
  128.         libortp.dylib
  129.         libvivoxplatform.dylib
  130.         libvivoxsdk.dylib
  131.        )
  132.     # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
  133.     # or ARCH_PREBUILT_DIRS
  134.     set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_debug")
  135.     set(debug_files
  136.        )
  137.     # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
  138.     # or ARCH_PREBUILT_DIRS
  139.     set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release")
  140.     set(release_files
  141.         libapr-1.0.3.7.dylib
  142.         libapr-1.dylib
  143.         libaprutil-1.0.3.8.dylib
  144.         libaprutil-1.dylib
  145.         libexpat.0.5.0.dylib
  146.         libexpat.dylib
  147.         libllqtwebkit.dylib
  148.         libndofdev.dylib
  149.        )
  150.     # fmod is statically linked on darwin
  151.     set(fmod_files "")
  152.     #*******************************
  153.     # LLKDU
  154.     set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
  155.     if(NOT EXISTS ${internal_llkdu_path})
  156.         if (EXISTS "${debug_src_dir}/libllkdu.dylib")
  157.             set(debug_llkdu_src "${debug_src_dir}/libllkdu.dylib")
  158.             set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/libllkdu.dylib")
  159.         endif (EXISTS "${debug_src_dir}/libllkdu.dylib")
  160.         if (EXISTS "${release_src_dir}/libllkdu.dylib")
  161.             set(release_llkdu_src "${release_src_dir}/libllkdu.dylib")
  162.             set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/libllkdu.dylib")
  163.             set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/libllkdu.dylib")
  164.         endif (EXISTS "${release_src_dir}/libllkdu.dylib")
  165.     endif (NOT EXISTS ${internal_llkdu_path})
  166. elseif(LINUX)
  167.     # linux is weird, multiple side by side configurations aren't supported
  168.     # and we don't seem to have any debug shared libs built yet anyways...
  169.     set(SHARED_LIB_STAGING_DIR_DEBUG            "${SHARED_LIB_STAGING_DIR}")
  170.     set(SHARED_LIB_STAGING_DIR_RELWITHDEBINFO   "${SHARED_LIB_STAGING_DIR}")
  171.     set(SHARED_LIB_STAGING_DIR_RELEASE          "${SHARED_LIB_STAGING_DIR}")
  172.     set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
  173.     set(vivox_files
  174.         libsndfile.so.1
  175.         libortp.so
  176.         libvivoxoal.so.1
  177.         libvivoxplatform.so
  178.         libvivoxsdk.so
  179.         SLVoice
  180.        )
  181.     # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
  182.     # or ARCH_PREBUILT_DIRS
  183.     set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib_debug")
  184.     set(debug_files
  185.        )
  186.     # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
  187.     # or ARCH_PREBUILT_DIRS
  188.     set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib_release_client")
  189.     # *FIX - figure out what to do with duplicate libalut.so here -brad
  190.     set(release_files
  191.         libapr-1.so.0
  192.         libaprutil-1.so.0
  193.         libatk-1.0.so
  194.         libcrypto.so.0.9.7
  195.         libdb-4.2.so
  196.         libexpat.so
  197.         libgmock_main.so
  198.         libgmock.so.0
  199.         libgmodule-2.0.so
  200.         libgobject-2.0.so
  201.         libgtest_main.so
  202.         libgtest.so.0
  203.         libopenal.so
  204.         libopenjpeg.so
  205.         libssl.so
  206.         libstacktrace.so
  207.         libtcmalloc.so
  208.         libuuid.so.1
  209.         libssl.so.0.9.7
  210.        )
  211.     if (FMOD_SDK_DIR)
  212.         set(fmod_files "libfmod-3.75.so")
  213.     endif (FMOD_SDK_DIR)
  214.     #*******************************
  215.     # LLKDU
  216.     set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
  217.     if(NOT EXISTS ${internal_llkdu_path})
  218.         if (EXISTS "${debug_src_dir}/libllkdu.so")
  219.             set(debug_llkdu_src "${debug_src_dir}/libllkdu.so")
  220.             set(debug_llkdu_dst "${SHARED_LIB_STAGING_DIR_DEBUG}/libllkdu.so")
  221.         endif (EXISTS "${debug_src_dir}/libllkdu.so")
  222.         if (EXISTS "${release_src_dir}/libllkdu.so")
  223.             set(release_llkdu_src "${release_src_dir}/libllkdu.so")
  224.             set(release_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELEASE}/libllkdu.so")
  225.             set(relwithdebinfo_llkdu_dst "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}/libllkdu.so")
  226.         endif (EXISTS "${release_src_dir}/libllkdu.so")
  227.     endif(NOT EXISTS ${internal_llkdu_path})
  228. else(WINDOWS)
  229.     message(STATUS "WARNING: unrecognized platform for staging 3rd party libs, skipping...")
  230.     set(vivox_src_dir "${CMAKE_SOURCE_DIR}/newview/vivox-runtime/i686-linux")
  231.     set(vivox_files "")
  232.     # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
  233.     # or ARCH_PREBUILT_DIRS
  234.     set(debug_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/debug")
  235.     set(debug_files "")
  236.     # *TODO - update this to use LIBS_PREBUILT_DIR and LL_ARCH_DIR variables
  237.     # or ARCH_PREBUILT_DIRS
  238.     set(release_src_dir "${CMAKE_SOURCE_DIR}/../libraries/i686-linux/lib/release")
  239.     set(release_files "")
  240.     set(fmod_files "")
  241.     set(debug_llkdu_src "")
  242.     set(debug_llkdu_dst "")
  243.     set(release_llkdu_src "")
  244.     set(release_llkdu_dst "")
  245.     set(relwithdebinfo_llkdu_dst "")
  246. endif(WINDOWS)
  247. ################################################################
  248. # Done building the file lists, now set up the copy commands.
  249. ################################################################
  250. copy_if_different(
  251.     ${vivox_src_dir}
  252.     "${SHARED_LIB_STAGING_DIR_DEBUG}"
  253.     out_targets 
  254.    ${vivox_files}
  255.     )
  256. set(third_party_targets ${third_party_targets} ${out_targets})
  257. copy_if_different(
  258.     ${vivox_src_dir}
  259.     "${SHARED_LIB_STAGING_DIR_RELEASE}"
  260.     out_targets
  261.     ${vivox_files}
  262.     )
  263. set(third_party_targets ${third_party_targets} ${out_targets})
  264. copy_if_different(
  265.     ${vivox_src_dir}
  266.     "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
  267.     out_targets
  268.     ${vivox_files}
  269.     )
  270. set(third_party_targets ${third_party_targets} ${out_targets})
  271. copy_if_different(
  272.     ${debug_src_dir}
  273.     "${SHARED_LIB_STAGING_DIR_DEBUG}"
  274.     out_targets
  275.     ${debug_files}
  276.     )
  277. set(third_party_targets ${third_party_targets} ${out_targets})
  278. copy_if_different(
  279.     ${release_src_dir}
  280.     "${SHARED_LIB_STAGING_DIR_RELEASE}"
  281.     out_targets
  282.     ${release_files}
  283.     )
  284. set(third_party_targets ${third_party_targets} ${out_targets})
  285. copy_if_different(
  286.     ${release_src_dir}
  287.     "${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
  288.     out_targets
  289.     ${release_files}
  290.     )
  291. set(third_party_targets ${third_party_targets} ${out_targets})
  292. if (FMOD_SDK_DIR)
  293.     copy_if_different(
  294.         ${FMOD_SDK_DIR} 
  295.         "${CMAKE_CURRENT_BINARY_DIR}/Debug"
  296.         out_targets 
  297.         ${fmod_files}
  298.         )
  299.     set(all_targets ${all_targets} ${out_targets})
  300.     copy_if_different(
  301.         ${FMOD_SDK_DIR} 
  302.         "${CMAKE_CURRENT_BINARY_DIR}/Release"
  303.         out_targets 
  304.         ${fmod_files}
  305.         )
  306.     set(all_targets ${all_targets} ${out_targets})
  307.     copy_if_different(
  308.         ${FMOD_SDK_DIR} 
  309.         "${CMAKE_CURRENT_BINARY_DIR}/RelWithDbgInfo"
  310.         out_targets 
  311.         ${fmod_files}
  312.         )
  313.     set(all_targets ${all_targets} ${out_targets})
  314. endif (FMOD_SDK_DIR)
  315. #*******************************
  316. # LLKDU
  317. set(internal_llkdu_path "${CMAKE_SOURCE_DIR}/llkdu")
  318. if(NOT EXISTS ${internal_llkdu_path})
  319.     if (EXISTS "${debug_llkdu_src}")
  320.         ADD_CUSTOM_COMMAND(
  321.             OUTPUT  ${debug_llkdu_dst}
  322.             COMMAND ${CMAKE_COMMAND} -E copy_if_different ${debug_llkdu_src} ${debug_llkdu_dst}
  323.             DEPENDS ${debug_llkdu_src}
  324.             COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_DEBUG}"
  325.             )
  326.         set(third_party_targets ${third_party_targets} $} ${debug_llkdu_dst})
  327.     endif (EXISTS "${debug_llkdu_src}")
  328.     if (EXISTS "${release_llkdu_src}")
  329.         ADD_CUSTOM_COMMAND(
  330.             OUTPUT  ${release_llkdu_dst}
  331.             COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${release_llkdu_dst}
  332.             DEPENDS ${release_llkdu_src}
  333.             COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_RELEASE}"
  334.             )
  335.         set(third_party_targets ${third_party_targets} ${release_llkdu_dst})
  336.         ADD_CUSTOM_COMMAND(
  337.             OUTPUT  ${relwithdebinfo_llkdu_dst}
  338.             COMMAND ${CMAKE_COMMAND} -E copy_if_different ${release_llkdu_src} ${relwithdebinfo_llkdu_dst}
  339.             DEPENDS ${release_llkdu_src}
  340.             COMMENT "Copying llkdu.dll ${SHARED_LIB_STAGING_DIR_RELWITHDEBINFO}"
  341.             )
  342.         set(third_party_targets ${third_party_targets} ${relwithdebinfo_llkdu_dst})
  343.     endif (EXISTS "${release_llkdu_src}")
  344. endif (NOT EXISTS ${internal_llkdu_path})
  345. add_custom_target(stage_third_party_libs ALL
  346.   DEPENDS 
  347.     ${third_party_targets}
  348.   )