From 9e69702fe74f8107e6ac2ee800f234f8a956a781 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Thu, 5 Nov 2009 08:52:07 -0800 Subject: Added calls to ll_deploy_sharedlibs_command Using viewer_manifest.py for windows dependency deployment during build. Added SHARED_LIBS_REL_PATH var to cmake cache. --- indra/cmake/DeploySharedLibs.cmake | 42 ++++++++++++++++++++++---------------- indra/cmake/LLSharedLibs.cmake | 24 +++++++++++++++++++--- 2 files changed, 45 insertions(+), 21 deletions(-) (limited to 'indra/cmake') diff --git a/indra/cmake/DeploySharedLibs.cmake b/indra/cmake/DeploySharedLibs.cmake index a7e772bd75..663c272e50 100644 --- a/indra/cmake/DeploySharedLibs.cmake +++ b/indra/cmake/DeploySharedLibs.cmake @@ -6,8 +6,14 @@ # BIN_NAME= The full path the the binary to search for dependecies. # SEARCH_DIRS= The full paths to dirs to search for dependencies. # DST_PATH= The full path where the dependecies will be copied. -include(GetPrerequisites) + +# *FIX:Mani - I pulled in the CMake 2.8 GetPrerequisites.cmake script here, because it works on windows where 2.6 did not. +# Once we have officially upgraded to 2.8 we can just use that version of GetPrerequisites.cmake. +get_filename_component(current_dir ${CMAKE_CURRENT_LIST_FILE} PATH) +include(${current_dir}/GetPrerequisites_2_8.cmake) + message("Getting recursive dependencies for file: ${BIN_NAME}") + set(EXCLUDE_SYSTEM 1) set(RECURSE 1) get_filename_component(EXE_PATH ${BIN_NAME} PATH) @@ -26,42 +32,42 @@ endif(DEP_FILES) foreach(DEP_FILE ${DEP_FILES}) if(FOUND_FILES) - list(FIND FOUND_FILES ${DEP_FILE} FOUND) + list(FIND FOUND_FILES ${DEP_FILE} FOUND) else(FOUND_FILES) - set(FOUND -1) + set(FOUND -1) endif(FOUND_FILES) if(FOUND EQUAL -1) - find_path(DEP_PATH ${DEP_FILE} PATHS ${SEARCH_DIRS} NO_DEFAULT_PATH) - if(DEP_PATH) - set(FOUND_FILES ${FOUND_FILES} "${DEP_PATH}/${DEP_FILE}") - set(DEP_PATH NOTFOUND) #reset DEP_PATH for the next find_path call. - else(DEP_PATH) - set(MISSING_FILES ${MISSING_FILES} ${DEP_FILE}) - endif(DEP_PATH) + find_path(DEP_PATH ${DEP_FILE} PATHS ${SEARCH_DIRS} NO_DEFAULT_PATH) + if(DEP_PATH) + set(FOUND_FILES ${FOUND_FILES} "${DEP_PATH}/${DEP_FILE}") + set(DEP_PATH NOTFOUND) #reset DEP_PATH for the next find_path call. + else(DEP_PATH) + set(MISSING_FILES ${MISSING_FILES} ${DEP_FILE}) + endif(DEP_PATH) endif(FOUND EQUAL -1) endforeach(DEP_FILE) if(MISSING_FILES) message("Missing:") foreach(FILE ${MISSING_FILES}) - message(" ${FILE}") + message(" ${FILE}") endforeach(FILE) message("Searched in:") foreach(SEARCH_DIR ${SEARCH_DIRS}) - message(" ${SEARCH_DIR}") + message(" ${SEARCH_DIR}") endforeach(SEARCH_DIR) message(FATAL_ERROR "Failed") endif(MISSING_FILES) if(FOUND_FILES) foreach(FILE ${FOUND_FILES}) - get_filename_component(DST_FILE ${FILE} NAME) - set(DST_FILE "${DST_PATH}/${DST_FILE}") - message("Copying ${FILE} to ${DST_FILE}") - execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST_FILE} - ) + get_filename_component(DST_FILE ${FILE} NAME) + set(DST_FILE "${DST_PATH}/${DST_FILE}") + message("Copying ${FILE} to ${DST_FILE}") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILE} ${DST_FILE} + ) endforeach(FILE ${FOUND_FILES}) endif(FOUND_FILES) message("Success!") diff --git a/indra/cmake/LLSharedLibs.cmake b/indra/cmake/LLSharedLibs.cmake index a8c81609bb..28f0e7ad12 100644 --- a/indra/cmake/LLSharedLibs.cmake +++ b/indra/cmake/LLSharedLibs.cmake @@ -1,9 +1,21 @@ + +if(DARWIN) + set(TMP_PATH "../Resource") +elseif(LINUX) + set(TMP_PATH "../lib") +else(DARWIN) + set(TMP_PATH ".") +endif(DARWIN) + + set(SHARED_LIB_REL_PATH ${TMP_PATH} CACHE STRING "Relative path from executable to shared libs") + # ll_deploy_sharedlibs_command # target_exe: the cmake target of the executable for which the shared libs will be deployed. # search_dirs: a list of dirs to search for the dependencies # dst_path: path to copy deps to, relative to the output location of the target_exe macro(ll_deploy_sharedlibs_command target_exe search_dirs dst_path) get_target_property(OUTPUT_LOCATION ${target_exe} LOCATION) + get_filename_component(OUTPUT_PATH ${OUTPUT_LOCATION} PATH) if(DARWIN) get_target_property(IS_BUNDLE ${target_exe} MACOSX_BUNDLE) @@ -12,16 +24,22 @@ macro(ll_deploy_sharedlibs_command target_exe search_dirs dst_path) set(OUTPUT_PATH ${OUTPUT_LOCATION}.app/Contents/MacOS) set(OUTPUT_LOCATION ${OUTPUT_PATH}/${TARGET_FILE}) endif(IS_BUNDLE) - else(DARWIN) - message(FATAL_ERROR "Only darwin currently supported!") endif(DARWIN) + + if(WINDOWS) + set(REAL_SEARCH_DIRS ${search_dirs} "$ENV{SystemRoot}/system32") + endif(WINDOWS) + + if(LINUX) + message(FATAL_ERROR "LINUX Unsupported!?!") + endif(LINUX) add_custom_command( TARGET ${target_exe} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS "-DBIN_NAME=\"${OUTPUT_LOCATION}\"" - "-DSEARCH_DIRS=\"${search_dirs}\"" + "-DSEARCH_DIRS=\"${REAL_SEARCH_DIRS}\"" "-DDST_PATH=\"${OUTPUT_PATH}/${dst_path}\"" "-P" "${CMAKE_SOURCE_DIR}/cmake/DeploySharedLibs.cmake" -- cgit v1.2.3