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 | |
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
-rw-r--r-- | cmake/CMakeLists.txt | 43 | ||||
-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 | ||||
-rw-r--r-- | cmake/src/config-darwin.inc | 50 |
5 files changed, 128 insertions, 56 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 57cb89a9..ddd76c6f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -46,6 +46,7 @@ set(PACKAGE_IRC "#ultrastardx at quakenet.org") find_package(PPC 2.2.0 REQUIRED) include(UsePascal) include(ExpandVersion) +include(FileUtils) ## # LIBRARIES @@ -192,6 +193,30 @@ install( COPYING.txt DESTINATION ${USDX_INSTALL_DATA_DIR} ) +# install fink libs +if(APPLE) + if(EXISTS ${usdx_exe}) + include(AnalyzeDylibDeps) + analyze_dylib_deps(${usdx_exe} libdeps) + set(USDX_DYLIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/dylib) + + # install() does not follow symlinks so we have to copy the libs at cmake time + file(MAKE_DIRECTORY ${USDX_DYLIB_DIR}) + foreach(dylib ${libdeps}) + get_filename_component(dylib_name ${dylib} NAME) + file_copy_if_different(${dylib} ${USDX_DYLIB_DIR}/${dylib_name}) + endforeach() + + install(DIRECTORY ${USDX_DYLIB_DIR}/ DESTINATION dylib USE_SOURCE_PERMISSIONS) + else() + message(" +!! To create a Mac OS X bundle, first compile with +!! \"make\" then +!! reconfigure with cmake (e.g. \"cmake ..\") and finally call +!! \"cpack -G Bundle\" +") + endif() +endif(APPLE) # add "uninstall" target # See: http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F @@ -219,12 +244,20 @@ ADD_CUSTOM_TARGET(uninstall set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Karaoke program that evaluates your performance") set(CPACK_PACKAGE_VENDOR "UltraStar Deluxe Team") -set(CPACK_PACKAGE_FILE_NAME "ultrastardx-${CMAKE_PACKAGE_VERSION}") -set(CPACK_SOURCE_PACKAGE_FILE_NAME "ultrastardx-src-${CMAKE_PACKAGE_VERSION}") +set(CPACK_PACKAGE_FILE_NAME "ultrastardx-${CPACK_PACKAGE_VERSION}") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "ultrastardx-src-${CPACK_PACKAGE_VERSION}") set(CPACK_SOURCE_GENERATOR "TBZ2") set(CPACK_PACKAGE_EXECUTABLES "ultrastardx" "ultrastardx") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.txt") -set(CPACK_PACKAGE_INSTALL_DIRECTORY "ultrastardx ${CMAKE_PACKAGE_VERSION}") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "ultrastardx ${CPACK_PACKAGE_VERSION}") + +if(APPLE) + set(CPACK_BUNDLE_NAME UltraStarDeluxe) + set(CPACK_BUNDLE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/icons/ultrastardx.icns) + set(CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/src/macosx/Info.plist) + set(CPACK_BUNDLE_STARTUP_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/dists/bundle-startup.sh) + #CPACK_PACKAGE_ICON +endif(APPLE) if(WIN32 AND NOT UNIX) set(CPACK_NSIS_DISPLAY_NAME "Ultrastar Deluxe") @@ -266,13 +299,13 @@ set(CPACK_SOURCE_IGNORE_FILES "^${PROJECT_SOURCE_DIR}/ultrastardx\\\\." ) -#include(CPack) +include(CPack) ## # SUMMARY ## -message(STATUS " +message(" !! Configuration of ${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION} done! !! !! Type \"make\" to compile and 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) diff --git a/cmake/src/config-darwin.inc b/cmake/src/config-darwin.inc deleted file mode 100644 index b0ad79e7..00000000 --- a/cmake/src/config-darwin.inc +++ /dev/null @@ -1,50 +0,0 @@ -{***************************************************************** - * Configuration file for ultrastardx 1.1-alpha - * src/config-darwin.inc. Generated from config.inc.in by configure. - *****************************************************************} - -{* Libraries *} - -{$DEFINE HaveFFmpeg} -{$IF Defined(HaveFFmpeg) and Defined(IncludeConstants)} - av__codec = 'libavcodec'; - LIBAVCODEC_VERSION_MAJOR = 51; - LIBAVCODEC_VERSION_MINOR = 49; - LIBAVCODEC_VERSION_RELEASE = 0; - - av__format = 'libavformat'; - LIBAVFORMAT_VERSION_MAJOR = 52; - LIBAVFORMAT_VERSION_MINOR = 2; - LIBAVFORMAT_VERSION_RELEASE = 0; - - av__util = 'libavutil'; - LIBAVUTIL_VERSION_MAJOR = 49; - LIBAVUTIL_VERSION_MINOR = 6; - LIBAVUTIL_VERSION_RELEASE = 0; -{$IFEND} - -{$DEFINE HaveSWScale} -{$IF Defined(HaveSWScale) and Defined(IncludeConstants)} - sw__scale = 'libswscale'; - LIBSWSCALE_VERSION_MAJOR = 0; - LIBSWSCALE_VERSION_MINOR = 5; - LIBSWSCALE_VERSION_RELEASE = 0; -{$IFEND} - -{$UNDEF HaveProjectM} -{$IF Defined(HaveProjectM) and Defined(IncludeConstants)} - ProjectM_DataDir = ''; - PROJECTM_VERSION_MAJOR = 0; - PROJECTM_VERSION_MINOR = 0; - PROJECTM_VERSION_RELEASE = 0; -{$IFEND} - -{$DEFINE HavePortaudio} -{$IF Defined(HavePortaudio) and Defined(IncludeConstants)} - PORTAUDIO_VERSION_MAJOR = 19; - PORTAUDIO_VERSION_MINOR = 0; - PORTAUDIO_VERSION_RELEASE = 0; -{$IFEND} - -{$UNDEF HavePortmixer} - |