Skip to content

Commit

Permalink
fix bundling for latest cmake
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14612 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
kyngchaos committed Nov 13, 2010
1 parent d702bfc commit ad5362e
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 93 deletions.
35 changes: 35 additions & 0 deletions cmake/MacBundleMacros.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Mac Bundle Macros

# BundleUtilities has functions to bundle and fixup libraries into an
# application package, but it's all-or-nothing and is missing some features:
#
# - @loader_path
# - helper functions can't get install_name, just dependencies

# get the install_name of a library or framework
# regex stuff taken from GetPrerequisites

FUNCTION (GET_INSTALL_NAME LIBFILE LIBNAME OUTVAR)
EXECUTE_PROCESS (COMMAND otool -D "${LIBFILE}" OUTPUT_VARIABLE iname_out)
STRING (REGEX REPLACE ".*:\n" "" iname "${iname_out}")
IF (iname)
# trim it
STRING (REGEX MATCH "[^\n ].*[^\n ]" iname "${iname}")
SET (${OUTVAR} ${iname} PARENT_SCOPE)
ENDIF (iname)
ENDFUNCTION (GET_INSTALL_NAME)

# message only if verbose makefiles

FUNCTION (MYMESSAGE MSG)
IF (@CMAKE_VERBOSE_MAKEFILE@)
MESSAGE (STATUS "${MSG}")
ENDIF (@CMAKE_VERBOSE_MAKEFILE@)
ENDFUNCTION (MYMESSAGE)

# install_name_tool -change CHANGE CHANGETO CHANGEBIN

FUNCTION (INSTALLNAMETOOL_CHANGE CHANGE CHANGETO CHANGEBIN)
MYMESSAGE ("install_name_tool -change ${CHANGE} ${CHANGETO} \"${CHANGEBIN}\"")
EXECUTE_PROCESS (COMMAND install_name_tool -change ${CHANGE} ${CHANGETO} "${CHANGEBIN}")
ENDFUNCTION (INSTALLNAMETOOL_CHANGE)
13 changes: 1 addition & 12 deletions mac/cmake/0qgis.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,7 @@ SET (QT_FWVER @QT_VERSION_MAJOR@)
SET (ATEXECUTABLE "@executable_path")
SET (ATLOADER "@loader_path")

# message only if verbose makefiles (use for install_name_tool echos)
FUNCTION (MYMESSAGE MSG)
IF (@CMAKE_VERBOSE_MAKEFILE@)
MESSAGE (STATUS "${MSG}")
ENDIF (@CMAKE_VERBOSE_MAKEFILE@)
ENDFUNCTION (MYMESSAGE)

# isntall_name_tool -change CHANGE CHANGETO CHANGEBIN
FUNCTION (INSTALLNAMETOOL_CHANGE CHANGE CHANGETO CHANGEBIN)
MYMESSAGE ("install_name_tool -change ${CHANGE} ${CHANGETO} \"${CHANGEBIN}\"")
EXECUTE_PROCESS (COMMAND install_name_tool -change ${CHANGE} ${CHANGETO} "${CHANGEBIN}")
ENDFUNCTION (INSTALLNAMETOOL_CHANGE)
INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake)

FILE (GLOB QGLIBLIST RELATIVE ${QLIBDIR} ${QLIBDIR}/libqgis*.dylib)
FILE (GLOB QGPLUGLIST ${QPLUGDIR}/*.so)
Expand Down
28 changes: 1 addition & 27 deletions mac/cmake/1qt.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
# so we configure it first to do substitutions
# make sure to use @varname@

# need part of BundleUtilities
INCLUDE (GetPrerequisites)

# kill boolean warnings
CMAKE_POLICY (SET CMP0012 NEW)

Expand All @@ -26,30 +23,7 @@ SET (QT_FWVER @QT_VERSION_MAJOR@)
SET (ATEXECUTABLE "@executable_path")
SET (ATLOADER "@loader_path")

# helper functions

FUNCTION (GET_INSTALL_NAME LIBFILE LIBNAME OUTVAR)
get_prerequisites ("${LIBFILE}" LIBLIST 1 0 "" "")
FOREACH (L ${LIBLIST})
STRING (REGEX MATCH ".*${LIBNAME}.+" LL ${L})
IF (LL)
SET (${OUTVAR} ${LL} PARENT_SCOPE)
ENDIF (LL)
ENDFOREACH ()
ENDFUNCTION (GET_INSTALL_NAME)

# message only if verbose makefiles
FUNCTION (MYMESSAGE MSG)
IF (@CMAKE_VERBOSE_MAKEFILE@)
MESSAGE (STATUS "${MSG}")
ENDIF (@CMAKE_VERBOSE_MAKEFILE@)
ENDFUNCTION (MYMESSAGE)

# install_name_tool -change CHANGE CHANGETO CHANGEBIN
FUNCTION (INSTALLNAMETOOL_CHANGE CHANGE CHANGETO CHANGEBIN)
MYMESSAGE ("install_name_tool -change ${CHANGE} ${CHANGETO} \"${CHANGEBIN}\"")
EXECUTE_PROCESS (COMMAND install_name_tool -change ${CHANGE} ${CHANGETO} "${CHANGEBIN}")
ENDFUNCTION (INSTALLNAMETOOL_CHANGE)
INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake)

# build list of Qt frameworks to bundle

Expand Down
28 changes: 1 addition & 27 deletions mac/cmake/2lib.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# libpq
# libfcgi (non-system)

# need part of BundleUtilities
INCLUDE (GetPrerequisites)

# kill boolean warnings
CMAKE_POLICY (SET CMP0012 NEW)

Expand All @@ -30,30 +27,7 @@ SET (QT_FWVER @QT_VERSION_MAJOR@)
SET (ATEXECUTABLE "@executable_path")
SET (ATLOADER "@loader_path")

# helper functions

FUNCTION (GET_INSTALL_NAME LIBFILE LIBNAME OUTVAR)
get_prerequisites ("${LIBFILE}" LIBLIST 1 0 "" "")
FOREACH (L ${LIBLIST})
STRING (REGEX MATCH ".*${LIBNAME}.+" LL ${L})
IF (LL)
SET (${OUTVAR} ${LL} PARENT_SCOPE)
ENDIF (LL)
ENDFOREACH ()
ENDFUNCTION (GET_INSTALL_NAME)

# message only if verbose makefiles (use for install_name_tool echos)
FUNCTION (MYMESSAGE MSG)
IF (@CMAKE_VERBOSE_MAKEFILE@)
MESSAGE (STATUS "${MSG}")
ENDIF (@CMAKE_VERBOSE_MAKEFILE@)
ENDFUNCTION (MYMESSAGE)

# install_name_tool -change CHANGE CHANGETO CHANGEBIN
FUNCTION (INSTALLNAMETOOL_CHANGE CHANGE CHANGETO CHANGEBIN)
MYMESSAGE ("install_name_tool -change ${CHANGE} ${CHANGETO} \"${CHANGEBIN}\"")
EXECUTE_PROCESS (COMMAND install_name_tool -change ${CHANGE} ${CHANGETO} "${CHANGEBIN}")
ENDFUNCTION (INSTALLNAMETOOL_CHANGE)
INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake)

FUNCTION (UPDATEQGISPATHS LIBFROM LIBTO)
IF (LIBFROM)
Expand Down
28 changes: 1 addition & 27 deletions mac/cmake/3fw.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

MESSAGE (STATUS "Bundling frameworks is not functional yet, skipping...")

# need part of BundleUtilities
INCLUDE (GetPrerequisites)

# kill boolean warnings
CMAKE_POLICY (SET CMP0012 NEW)

Expand All @@ -28,30 +25,7 @@ SET (QT_FWVER @QT_VERSION_MAJOR@)
SET (ATEXECUTABLE "@executable_path")
SET (ATLOADER "@loader_path")

# helper functions

FUNCTION (GET_INSTALL_NAME LIBFILE LIBNAME OUTVAR)
get_prerequisites ("${LIBFILE}" LIBLIST 1 0 "" "")
FOREACH (L ${LIBLIST})
STRING (REGEX MATCH ".*${LIBNAME}.+" LL ${L})
IF (LL)
SET (${OUTVAR} ${LL} PARENT_SCOPE)
ENDIF (LL)
ENDFOREACH ()
ENDFUNCTION (GET_INSTALL_NAME)

# message only if verbose makefiles (use for install_name_tool echos)
FUNCTION (MYMESSAGE MSG)
IF (@CMAKE_VERBOSE_MAKEFILE@)
MESSAGE (STATUS "${MSG}")
ENDIF (@CMAKE_VERBOSE_MAKEFILE@)
ENDFUNCTION (MYMESSAGE)

# install_name_tool -change CHANGE CHANGETO CHANGEBIN
FUNCTION (INSTALLNAMETOOL_CHANGE CHANGE CHANGETO CHANGEBIN)
MYMESSAGE ("install_name_tool -change ${CHANGE} ${CHANGETO} \"${CHANGEBIN}\"")
EXECUTE_PROCESS (COMMAND install_name_tool -change ${CHANGE} ${CHANGETO} "${CHANGEBIN}")
ENDFUNCTION (INSTALLNAMETOOL_CHANGE)
INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake)

FUNCTION (UPDATEQGISPATHS LIBFROM LIBTO)
IF (LIBFROM)
Expand Down

0 comments on commit ad5362e

Please sign in to comment.