adjust rpath on osx too for libengine
authorkoda
Mon, 24 Dec 2012 03:00:18 +0100
changeset 8322 50369fa5053b
parent 8320 3913a7f7245d
child 8323 ab0b618bdf13
adjust rpath on osx too for libengine
hedgewars/CMakeLists.txt
tools/CMakeLists.txt
tools/CreateMacBundle.cmake.in
--- a/hedgewars/CMakeLists.txt	Sat Dec 22 21:43:39 2012 -0500
+++ b/hedgewars/CMakeLists.txt	Mon Dec 24 03:00:18 2012 +0100
@@ -224,6 +224,11 @@
             DEPENDS ${engine_sources}
             )
         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
+        add_custom_command(TARGET hwengine.${build_arch} POST_BUILD
+            COMMAND "install_name_tool"
+            ARGS -id @executable_path/../Frameworks/${engine_output_name}
+                ${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}
+            )
     endforeach()
 
     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}"
--- a/tools/CMakeLists.txt	Sat Dec 22 21:43:39 2012 -0500
+++ b/tools/CMakeLists.txt	Mon Dec 24 03:00:18 2012 +0100
@@ -37,6 +37,11 @@
     endif()
 
     set(frameworks_dir ${CMAKE_INSTALL_PREFIX}/${target_library_install_dir})
+    if(${BUILD_ENGINE_LIBRARY})
+        set(engine_full_path "${frameworks_dir}/${CMAKE_SHARED_LIBRARY_PREFIX}hwengine${CMAKE_SHARED_LIBRARY_SUFFIX}")
+    else()
+        set(engine_full_path "${CMAKE_INSTALL_PREFIX}/hwengine${CMAKE_EXECUTABLE_SUFFIX}")
+    endif()
 
     #this tool is present in qt 4.5 but only if you compile from sources
     #from qt 4.6 is present also in the binary version
--- a/tools/CreateMacBundle.cmake.in	Sat Dec 22 21:43:39 2012 -0500
+++ b/tools/CreateMacBundle.cmake.in	Mon Dec 24 03:00:18 2012 +0100
@@ -7,15 +7,15 @@
 
 if(NOT ${NOVIDEOREC})
     # but macdeployqt will not work for 'hwengine'; luckily the dylibs were already updated before
-    execute_process(COMMAND install_name_tool -change ${FFMPEG_LIBAVCODEC} @executable_path/../Frameworks/libavcodec.dylib ${CMAKE_INSTALL_PREFIX}/hwengine)
-    execute_process(COMMAND install_name_tool -change ${FFMPEG_LIBAVFORMAT} @executable_path/../Frameworks/libavformat.dylib ${CMAKE_INSTALL_PREFIX}/hwengine)
-    execute_process(COMMAND install_name_tool -change ${FFMPEG_LIBAVUTIL} @executable_path/../Frameworks/libavutil.dylib ${CMAKE_INSTALL_PREFIX}/hwengine)
+    execute_process(COMMAND install_name_tool -change ${FFMPEG_LIBAVCODEC} @executable_path/../Frameworks/libavcodec.dylib ${engine_full_path})
+    execute_process(COMMAND install_name_tool -change ${FFMPEG_LIBAVFORMAT} @executable_path/../Frameworks/libavformat.dylib ${engine_full_path})
+    execute_process(COMMAND install_name_tool -change ${FFMPEG_LIBAVUTIL} @executable_path/../Frameworks/libavutil.dylib ${engine_full_path})
 endif()
 
 if(NOT ${NOPNG})
     #same here, for libpng and hwengine, let's assume the version pulled by macdeployqt is the same
     #(yes libpng is pulled by macdeployqt even when NOVIDEOREC is active)
-    execute_process(COMMAND install_name_tool -change ${PNG_LIBRARY} @executable_path/../Frameworks/${PNG_LIBNAME} ${CMAKE_INSTALL_PREFIX}/hwengine)
+    execute_process(COMMAND install_name_tool -change ${PNG_LIBRARY} @executable_path/../Frameworks/${PNG_LIBNAME} ${engine_full_path})
 endif()
 
 if(doBundle EQUAL 1)