diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-05-21 19:54:37 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-05-21 19:54:37 +0000 |
commit | f489a22860c04c382bbc14e0cd09cd41c5b5399c (patch) | |
tree | 60484b2c7d177823fc474b49a13f64b0f2eb427a /cmake/dists | |
parent | ed6dcc48197b566d2588d4cd17c7c3feb207685b (diff) | |
download | usdx-f489a22860c04c382bbc14e0cd09cd41c5b5399c.tar.gz usdx-f489a22860c04c382bbc14e0cd09cd41c5b5399c.tar.xz usdx-f489a22860c04c382bbc14e0cd09cd41c5b5399c.zip |
CMake update
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1754 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'cmake/dists')
-rwxr-xr-x | cmake/dists/bundle-startup.sh | 9 | ||||
-rwxr-xr-x | cmake/dists/cmake/Modules/AnalyzeDylibDeps.cmake | 54 | ||||
-rw-r--r-- | cmake/dists/cmake/Modules/FileUtils.cmake | 28 |
3 files changed, 90 insertions, 1 deletions
diff --git a/cmake/dists/bundle-startup.sh b/cmake/dists/bundle-startup.sh new file mode 100755 index 00000000..11fcea2e --- /dev/null +++ b/cmake/dists/bundle-startup.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# +# Author: UltraStar Deluxe Team + +USDX_BUNDLE="`echo "$0" | sed -e 's/\/Contents\/MacOS\/UltraStarDeluxe//'`" +USDX_RESOURCES="$USDX_BUNDLE/Contents/Resources" + +export "DYLD_LIBRARY_PATH=$USDX_RESOURCES/dylib" +exec "$USDX_RESOURCES/bin/ultrastardx" diff --git a/cmake/dists/cmake/Modules/AnalyzeDylibDeps.cmake b/cmake/dists/cmake/Modules/AnalyzeDylibDeps.cmake new file mode 100755 index 00000000..004879da --- /dev/null +++ b/cmake/dists/cmake/Modules/AnalyzeDylibDeps.cmake @@ -0,0 +1,54 @@ +# otool: Mac OS X object file displaying tool +find_program(OTOOL otool) + +function(extract_dylib_deps dylib deplist_name) + execute_process( + COMMAND ${OTOOL} -L ${dylib} + OUTPUT_VARIABLE otool_out + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REPLACE "\n" ";" otool_out ${otool_out}) + set(deplist "") + foreach(line ${otool_out}) + if(line MATCHES version) + # extract dylib-name + string(REGEX REPLACE "^[\t ]*([^ ]+) .*" "\\1" libname "${line}") + # filter out system libs + if(NOT libname MATCHES ^/usr/lib AND + NOT libname MATCHES ^/System/Library) + list(APPEND deplist ${libname}) + endif() + endif() + endforeach() + set(${deplist_name} "${deplist}" PARENT_SCOPE) +endfunction(extract_dylib_deps) + +function(ANALYZE_DYLIB_DEPS module deplist_name) + # init queue (contains libs to analyze) + set(queue "") + # add module as first "lib" to analyze + list(APPEND queue ${module}) + + # init dep_list + set(deps "") + + # analyze each lib enqueued until queue is empty + while(queue) + # dequeue front element + list(GET queue 0 current_lib) + list(REMOVE_AT queue 0) + + # get dependencies of current dylib + extract_dylib_deps(${current_lib} current_deps) + # extract dependencies not already in the deps list + foreach(lib ${current_deps}) + list(FIND deps ${lib} lib_in_deps) + if(lib_in_deps EQUAL -1) + list(APPEND queue ${lib}) + list(APPEND deps ${lib}) + endif() + endforeach() + endwhile() + + set(${deplist_name} "${deps}" PARENT_SCOPE) +endfunction(ANALYZE_DYLIB_DEPS) diff --git a/cmake/dists/cmake/Modules/FileUtils.cmake b/cmake/dists/cmake/Modules/FileUtils.cmake index 51707d5a..856bb2e1 100644 --- a/cmake/dists/cmake/Modules/FileUtils.cmake +++ b/cmake/dists/cmake/Modules/FileUtils.cmake @@ -17,7 +17,7 @@ endfunction(FILE_SYMLINK) function(FILE_COPY_DIR src dst) if(NOT EXISTS ${src}) - message(FATAL_ERROR "File \"${src}\" does not exist!") + message(FATAL_ERROR "Directory \"${src}\" does not exist!") endif(NOT EXISTS ${src}) execute_process( COMMAND ${CMAKE_COMMAND} -E copy_directory "${src}" "${dst}" @@ -27,3 +27,29 @@ function(FILE_COPY_DIR src dst) message(FATAL_ERROR "Copy \"${src}\" to \"${dst}\" failed!") endif(result) endfunction(FILE_COPY_DIR) + +function(FILE_COPY src dst) + if(NOT EXISTS ${src}) + message(FATAL_ERROR "File \"${src}\" does not exist!") + endif(NOT EXISTS ${src}) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${src}" "${dst}" + RESULT_VARIABLE result + ) + if(result) + message(FATAL_ERROR "Copy \"${src}\" to \"${dst}\" failed!") + endif(result) +endfunction(FILE_COPY) + +function(FILE_COPY_IF_DIFFERENT src dst) + if(NOT EXISTS ${src}) + message(FATAL_ERROR "File \"${src}\" does not exist!") + endif(NOT EXISTS ${src}) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${src}" "${dst}" + RESULT_VARIABLE result + ) + if(result) + message(FATAL_ERROR "Copy \"${src}\" to \"${dst}\" failed!") + endif(result) +endfunction(FILE_COPY_IF_DIFFERENT) |