Skip to content
Permalink
Browse files

OS X frameworks for qgis libs;

dev frameworks install option;
cmake cleanup
  • Loading branch information
kyngchaos committed Jul 4, 2011
1 parent 3849742 commit 405226893f5bb62e68b68222717ac642137d9737
@@ -269,16 +269,19 @@ ELSE (WIN32)

IF (APPLE)
# for Mac OS X, everything is put inside an application bundle
# save the root install prefix for the app later
SET (QGIS_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
SET (QGIS_MACAPP_PREFIX ${CMAKE_INSTALL_PREFIX}/${QGIS_APP_NAME}.app/Contents)
# common prefix for components, let cmake handle it
SET (CMAKE_INSTALL_PREFIX ${QGIS_MACAPP_PREFIX}/MacOS)
# path for library references
SET (CMAKE_INSTALL_NAME_DIR @executable_path/lib)
# 4 bundling levels, each includes previous
# 0 nothing
# 1 Qt frameworks
# 2 non-system libraries, "standard"
# 3 non-system frameworks, "standalone"
SET (QGIS_MACAPP_BUNDLE 0 CACHE STRING "What to bundle into app package")
SET (QGIS_MACAPP_BUNDLE 1 CACHE STRING "What to bundle into app package")
SET (QGIS_MACAPP_INSTALL_DEV FALSE CACHE BOOL "Install developer frameworks")
SET (QGIS_MACAPP_DEV_PREFIX "/Library/Frameworks" CACHE STRING "Path to install developer frameworks")
# if we have @loader_path, >=OSX 10.5 (darwin 9+)
IF (CMAKE_SYSTEM_VERSION VERSION_GREATER 9.0.0 OR CMAKE_SYSTEM_VERSION VERSION_EQUAL 9.0.0)
SET (OSX_HAVE_LOADERPATH 1)
@@ -303,6 +306,8 @@ ELSE (WIN32)
SET (DEFAULT_PLUGIN_SUBDIR ../PlugIns/qgis)
SET (QGIS_PLUGIN_SUBDIR_REV ../../MacOS)
SET (DEFAULT_INCLUDE_SUBDIR include/qgis)
# path for framework references
SET (CMAKE_INSTALL_NAME_DIR @executable_path/${QGIS_FW_SUBDIR})

ELSE (APPLE)
# UNIX
@@ -367,12 +372,12 @@ SET (QGIS_PLUGIN_DIR ${QGIS_PLUGIN_SUBDIR})
SET (QGIS_INCLUDE_DIR ${QGIS_INCLUDE_SUBDIR})

# manual page - makes sense only on unix systems
IF (UNIX)
IF (UNIX AND NOT APPLE)
SET (DEFAULT_MANUAL_SUBDIR man)
SET (QGIS_MANUAL_SUBDIR ${DEFAULT_MANUAL_SUBDIR} CACHE STRING "Subdirectory where manual files will be installed")
MARK_AS_ADVANCED (QGIS_MANUAL_SUBDIR)
SET (QGIS_MANUAL_DIR ${CMAKE_INSTALL_PREFIX}/${QGIS_MANUAL_SUBDIR})
ENDIF (UNIX)
ENDIF (UNIX AND NOT APPLE)

#############################################################
# Python bindings
@@ -402,9 +407,9 @@ ENDIF (WITH_BINDINGS)

#############################################################
# create qgsconfig.h
# installed with app target

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake_templates/qgsconfig.h.in ${CMAKE_BINARY_DIR}/qgsconfig.h)
INSTALL(FILES ${CMAKE_BINARY_DIR}/qgsconfig.h DESTINATION ${QGIS_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})

# Added by Jef to prevent python core and gui libs linking to other qgisCore and qgisGui libs
@@ -427,18 +432,22 @@ IF (GIT_MARKER)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ELSE(MSVC)
EXECUTE_PROCESS(COMMAND ${GIT} log -n1 --pretty=%h OUTPUT_VARIABLE REVISION)
STRING(STRIP "${REVISION}" REVISION)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h
COMMAND echo \\\#define QGSVERSION \\\"$$\( ${GIT} log -n1 --pretty=%h \)\\\" >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h
COMMAND echo \\\#define QGSVERSION \\\"${REVISION}\\\" >${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h
MAIN_DEPENDENCY ${GIT_MARKER}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
ENDIF(MSVC)
ELSE(GIT)
MESSAGE(STATUS "git marker, but no git found - version will be unknown")
SET(REVISION "unknown")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h "#define QGSVERSION \"unknown\"")
ENDIF(GIT)
ELSE (GIT_MARKER)
SET(REVISION "exported")
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/qgsversion.h "#define QGSVERSION \"exported\"")
ENDIF (GIT_MARKER)

@@ -4,6 +4,7 @@
##
## QGIS_CORE_LIBRARY = full path to the CORE library
## QGIS_GUI_LIBRARY = full path to the GUI library
## QGIS_ANALYSIS_LIBRARY = full path to the ANALYSIS library
## QGIS_PLUGIN_DIR = full path to where QGIS plugins are installed
## QGIS_INCLUDE_DIR = where to find headers
##
@@ -66,21 +67,34 @@ IF(WIN32)
"$ENV{OSGEO4W_ROOT}/lib"
"$ENV{PROGRAMFILES}/Quantum GIS/lib"
)
FIND_LIBRARY(QGIS_ANALYSIS_LIBRARY
NAMES qgis_analysis
PATHS
"$ENV{LIB_DIR}"
"$ENV{LIB}"
"$ENV{OSGEO4W_ROOT}/lib"
"$ENV{PROGRAMFILES}/Quantum GIS/lib"
)
ENDIF (MSVC)
ELSE(WIN32)
IF(UNIX)
# try to use bundle on mac
IF (APPLE)
#MESSAGE("Searching for QGIS in /Applications/QGIS.app/Contents/MacOS")
#SET (QGIS_MAC_PATH /Applications/qgis1.0.0.app/Contents/MacOS)
SET (QGIS_MAC_PATH /Applications/qgis1.1.0.app/Contents/MacOS)
SET (QGIS_MAC_PATH /Applications/QGIS.app/Contents/MacOS)
SET (QGIS_LIB_DIR ${QGIS_MAC_PATH}/lib)
SET (QGIS_PLUGIN_DIR ${QGIS_MAC_PATH}/lib/qgis CACHE STRING INTERNAL)
# set INCLUDE_DIR to prefix+include
SET(QGIS_INCLUDE_DIR ${QGIS_MAC_PATH}/include/qgis CACHE STRING INTERNAL)
## extract link dirs
SET(QGIS_CORE_LIBRARY ${QGIS_LIB_DIR}/libqgis_core.dylib CACHE STRING INTERNAL)
SET(QGIS_GUI_LIBRARY ${QGIS_LIB_DIR}/libqgis_gui.dylib CACHE STRING INTERNAL)
SET (QGIS_FW_DIR ${QGIS_MAC_PATH}/../Frameworks)
SET (QGIS_PLUGIN_DIR ${QGIS_MAC_PATH}/../PlugIns/qgis CACHE STRING INTERNAL)
# set INCLUDE_DIR to frameworks
SET(QGIS_INCLUDE_DIR
${QGIS_FW_DIR}/qgis_core.framework/Headers
${QGIS_FW_DIR}/qgis_gui.framework/Headers
${QGIS_FW_DIR}/qgis_analysis.framework/Headers
CACHE STRING INTERNAL)
# extract link dirs
SET(QGIS_CORE_LIBRARY ${QGIS_FW_DIR}/qgis_core.framework/qgis_core CACHE STRING INTERNAL)
SET(QGIS_GUI_LIBRARY ${QGIS_FW_DIR}/qgis_gui.framework/qgis_gui CACHE STRING INTERNAL)
SET(QGIS_ANALYSIS_LIBRARY ${QGIS_FW_DIR}/qgis_analysis.framework/qgis_analysis CACHE STRING INTERNAL)
ELSE (APPLE)
#MESSAGE("Searching for QGIS in /usr/bin; /usr/local/bin")
FIND_PATH(QGIS_PLUGIN_DIR
@@ -115,18 +129,27 @@ ELSE(WIN32)
/usr/local/lib
"$ENV{LIB_DIR}/lib/"
)
FIND_LIBRARY(QGIS_ANALYSIS_LIBRARY
NAMES qgis_analysis
PATHS
/usr/lib64
/usr/lib
/usr/local/lib
"$ENV{LIB_DIR}/lib/"
)
ENDIF (APPLE)
ENDIF(UNIX)
ENDIF(WIN32)

IF (QGIS_INCLUDE_DIR AND QGIS_CORE_LIBRARY AND QGIS_GUI_LIBRARY)
IF (QGIS_INCLUDE_DIR AND QGIS_CORE_LIBRARY AND QGIS_GUI_LIBRARY AND QGIS_ANALYSIS_LIBRARY)
SET(QGIS_FOUND TRUE)
ENDIF (QGIS_INCLUDE_DIR AND QGIS_CORE_LIBRARY AND QGIS_GUI_LIBRARY)
ENDIF (QGIS_INCLUDE_DIR AND QGIS_CORE_LIBRARY AND QGIS_GUI_LIBRARY AND QGIS_ANALYSIS_LIBRARY)

IF (QGIS_FOUND)
IF (NOT QGIS_FIND_QUIETLY)
MESSAGE(STATUS "Found QGIS core: ${QGIS_CORE_LIBRARY}")
MESSAGE(STATUS "Found QGIS gui: ${QGIS_GUI_LIBRARY}")
MESSAGE(STATUS "Found QGIS analysis: ${QGIS_ANALYSIS_LIBRARY}")
MESSAGE(STATUS "Found QGIS plugins directory: ${QGIS_PLUGIN_DIR}")
ENDIF (NOT QGIS_FIND_QUIETLY)
ELSE (QGIS_FOUND)
@@ -20,17 +20,8 @@ FUNCTION (GET_INSTALL_NAME LIBFILE LIBNAME OUTVAR)
SET (${OUTVAR} ${iname} PARENT_SCOPE)
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)
@@ -2,3 +2,12 @@
FILE (GLOB IMAGES *.png)
INSTALL (FILES ${IMAGES}
DESTINATION ${QGIS_DATA_DIR}/images/icons)

IF(MSVC)
INSTALL(FILES qgis.ico DESTINATION ${CMAKE_INSTALL_PREFIX}/icons)
ENDIF(MSVC)

# OS X app/doc icons
IF (APPLE)
ADD_SUBDIRECTORY(mac)
ENDIF (APPLE)
@@ -16,6 +16,7 @@ SET (QLIBXDIR "${QAPPDIR}/@QGIS_LIBEXEC_SUBDIR@")
SET (QDATADIR "${QAPPDIR}/@QGIS_DATA_SUBDIR@")
SET (QPLUGDIR "${QAPPDIR}/@QGIS_PLUGIN_SUBDIR@")
SET (QGISPYDIR "${QAPPDIR}/@QGIS_DATA_SUBDIR@/python")
SET (Q_FWVER @CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@)
# Qt framework version is major version
SET (QT_FWVER @QT_VERSION_MAJOR@)

@@ -25,7 +26,16 @@ SET (ATLOADER "@loader_path")

INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake)

FILE (GLOB QGLIBLIST RELATIVE ${QLIBDIR} ${QLIBDIR}/libqgis*.dylib)
# message only if verbose makefiles
FUNCTION (MYMESSAGE MSG)
IF (@CMAKE_VERBOSE_MAKEFILE@)
MESSAGE (STATUS "${MSG}")
ENDIF (@CMAKE_VERBOSE_MAKEFILE@)
ENDFUNCTION (MYMESSAGE)

FILE (GLOB QGFWLIST RELATIVE ${QFWDIR} ${QFWDIR}/qgis*.framework)
# for some reason, REPLACE is stripping list seps
STRING(REPLACE ".framework" ";" QGFWLIST ${QGFWLIST})
FILE (GLOB QGPLUGLIST ${QPLUGDIR}/*.so)
FILE (GLOB QGPYLIST ${QGISPYDIR}/qgis/*.so)

@@ -36,27 +46,29 @@ FILE (GLOB QGPYLIST ${QGISPYDIR}/qgis/*.so)
IF (@OSX_HAVE_LOADERPATH@)
MESSAGE (STATUS "Updating QGIS library paths...")
# inter-library links - do all combos, many will be noops
FOREACH (QL ${QGLIBLIST})
FOREACH (QLL ${QGLIBLIST})
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QLL} ${ATLOADER}/${QLL} "${QLIBDIR}/${QL}")
FOREACH (QL ${QGFWLIST})
FOREACH (QLL ${QGFWLIST})
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QLL}.framework/Versions/${Q_FWVER}/${QLL} ${ATLOADER}/../../../${QLL}.framework/Versions/${Q_FWVER}/${QLL} "${QFWDIR}/${QL}.framework/${QL}")
ENDFOREACH (QLL)
# libqgispython is not a framework
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QL}.framework/Versions/${Q_FWVER}/${QL} ${ATLOADER}/@QGIS_LIB_SUBDIR_REV@/@QGIS_FW_SUBDIR@/${QL}.framework/Versions/${Q_FWVER}/${QL} "${QLIBDIR}/libqgispython.dylib")
ENDFOREACH (QL)
# plugins
FOREACH (QP ${QGPLUGLIST})
FOREACH (QLL ${QGLIBLIST})
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QLL} ${ATLOADER}/@QGIS_PLUGIN_SUBDIR_REV@/@QGIS_LIB_SUBDIR@/${QLL} "${QP}")
FOREACH (QLL ${QGFWLIST})
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QLL}.framework/Versions/${Q_FWVER}/${QLL} ${ATLOADER}/@QGIS_PLUGIN_SUBDIR_REV@/@QGIS_FW_SUBDIR@/${QLL}.framework/Versions/${Q_FWVER}/${QLL} "${QP}")
ENDFOREACH (QLL)
ENDFOREACH (QP)
# qgis python
FOREACH (PG ${QGPYLIST})
FOREACH (QLL ${QGLIBLIST})
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QLL} ${ATLOADER}/../../@QGIS_DATA_SUBDIR_REV@/@QGIS_LIB_SUBDIR@/${QLL} "${PG}")
FOREACH (QLL ${QGFWLIST})
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QLL}.framework/Versions/${Q_FWVER}/${QLL} ${ATLOADER}/../../@QGIS_DATA_SUBDIR_REV@/@QGIS_FW_SUBDIR@/${QLL}.framework/Versions/${Q_FWVER}/${QLL} "${PG}")
ENDFOREACH (QLL)
ENDFOREACH (PG)
# qgis-mapserver
IF (@WITH_MAPSERVER@)
FOREACH (QLL ${QGLIBLIST})
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QLL} ${ATEXECUTABLE}/@QGIS_CGIBIN_SUBDIR_REV@/@QGIS_LIB_SUBDIR@/${QLL} "${QCGIDIR}/qgis_mapserv.fcgi")
FOREACH (QLL ${QGFWLIST})
INSTALLNAMETOOL_CHANGE (@CMAKE_INSTALL_NAME_DIR@/${QLL}.framework/Versions/${Q_FWVER}/${QLL} ${ATLOADER}/@QGIS_CGIBIN_SUBDIR_REV@/@QGIS_FW_SUBDIR@/${QLL}.framework/Versions/${Q_FWVER}/${QLL} "${QCGIDIR}/qgis_mapserv.fcgi")
ENDFOREACH (QLL)
ENDIF ()
ENDIF (@OSX_HAVE_LOADERPATH@)
@@ -25,6 +25,13 @@ SET (ATLOADER "@loader_path")

INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake)

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

# build list of Qt frameworks to bundle

SET (QTLISTQG QtCore QtGui phonon)
@@ -128,14 +135,11 @@ ENDFOREACH (QTC)
MESSAGE (STATUS "Copying Qwt and updating library paths...")
IF (NOT EXISTS "${QLIBDIR}/libqwt.dylib")
EXECUTE_PROCESS (COMMAND ditto ${QARCHS} "@QWT_LIBRARY@" "${QLIBDIR}/libqwt.dylib")
GET_INSTALL_NAME ("@QWT_LIBRARY@" "libqwt" QLIB)
IF (QLIB)
SET (QWT_CHG "${QLIB}")
# default for Qgis and no loader_path
SET (QWT_CHG_TO "${ATEXECUTABLE}/@QGIS_LIB_SUBDIR@/libqwt.dylib")
INSTALLNAMETOOL_CHANGE (${QWT_CHG} ${QWT_CHG_TO} "${QAPPDIR}/Qgis")
ENDIF (QLIB)
ENDIF ()
GET_INSTALL_NAME ("@QWT_LIBRARY@" "libqwt" QLIB)
IF (QLIB)
INSTALLNAMETOOL_CHANGE ("${QLIB}" "${ATEXECUTABLE}/@QGIS_LIB_SUBDIR@/libqwt.dylib" "${QAPPDIR}/@QGIS_APP_NAME@")
ENDIF (QLIB)

# PyQt

@@ -199,8 +203,11 @@ ENDIF (QWT_CHG)
# don't load plugins from system-installed Qt
FILE (WRITE "${QAPPDIRC}/Resources/qt.conf" "")
FILE (WRITE "${QBINDIR}/qgis_help.app/Contents/Resources/qt.conf" "")
FILE (WRITE "${QBINDIR}/qbrowser.app/Contents/Resources/qt.conf" "")

FILE (GLOB QGLIBLIST ${QLIBDIR}/libqgis*.dylib)
FILE (GLOB QGFWLIST RELATIVE ${QFWDIR} ${QFWDIR}/qgis*.framework)
# for some reason, REPLACE is stripping list seps
STRING(REPLACE ".framework" ";" QGFWLIST ${QGFWLIST})
FILE (GLOB QGPLUGLIST ${QPLUGDIR}/*.so)
FILE (GLOB QGPYLIST ${QGISPYDIR}/qgis/*.so)

@@ -215,10 +222,11 @@ FOREACH (QFW ${QTLISTQG})
SET (QFW_CHG "${QQ}")
SET (QFW_CHG_TO "${ATEXECUTABLE}/@QGIS_FW_SUBDIR@/${QFW}.framework/${QFW}")
# app - always @executable_path
INSTALLNAMETOOL_CHANGE (${QFW_CHG} ${QFW_CHG_TO} "${QAPPDIR}/Qgis")
# qgis_help - use symlink, even when have loader_path,
INSTALLNAMETOOL_CHANGE (${QFW_CHG} ${QFW_CHG_TO} "${QAPPDIR}/@QGIS_APP_NAME@")
# qgis_help, qbrowser - use symlink, even when have loader_path,
# applications behave better that way
INSTALLNAMETOOL_CHANGE (${QFW_CHG} ${QFW_CHG_TO} "${QBINDIR}/qgis_help.app/Contents/MacOS/qgis_help")
INSTALLNAMETOOL_CHANGE (${QFW_CHG} ${QFW_CHG_TO} "${QBINDIR}/qbrowser.app/Contents/MacOS/qbrowser")
# qgis-mapserver
IF (@WITH_MAPSERVER@)
IF (@OSX_HAVE_LOADERPATH@)
@@ -228,11 +236,19 @@ FOREACH (QFW ${QTLISTQG})
ENDIF ()
# libs
IF (@OSX_HAVE_LOADERPATH@)
SET (QFW_CHG_TO "${ATLOADER}/@QGIS_LIB_SUBDIR_REV@/@QGIS_FW_SUBDIR@/${QFW}.framework/${QFW}")
SET (QFW_CHG_TO "${ATLOADER}/../../../${QFW}.framework/${QFW}")
ENDIF (@OSX_HAVE_LOADERPATH@)
FOREACH (QL ${QGLIBLIST})
INSTALLNAMETOOL_CHANGE (${QFW_CHG} ${QFW_CHG_TO} "${QL}")
FOREACH (QL ${QGFWLIST})
INSTALLNAMETOOL_CHANGE (${QFW_CHG} ${QFW_CHG_TO} "${QFWDIR}/${QL}.framework/${QL}")
ENDFOREACH (QL)
# libqgispython is not a framework
IF (@OSX_HAVE_LOADERPATH@)
SET (QFW_CHG_TO "${ATLOADER}/@QGIS_LIB_SUBDIR_REV@/@QGIS_FW_SUBDIR@/${QFW}.framework/${QFW}")
ENDIF (@OSX_HAVE_LOADERPATH@)
INSTALLNAMETOOL_CHANGE (${QFW_CHG} ${QFW_CHG_TO} "${QLIBDIR}/libqgispython.dylib")
IF (@OSX_HAVE_LOADERPATH@)
SET (QFW_CHG_TO "${ATLOADER}/@QGIS_LIB_SUBDIR_REV@/@QGIS_FW_SUBDIR@/${QFW}.framework/${QFW}")
ENDIF (@OSX_HAVE_LOADERPATH@)
# Qwt
INSTALLNAMETOOL_CHANGE (${QFW_CHG} ${QFW_CHG_TO} "${QLIBDIR}/libqwt.dylib")
# GRASS libexec stuff

0 comments on commit 4052268

Please sign in to comment.
You can’t perform that action at this time.