Skip to content
Permalink
Browse files

windows: browser and helpviewer are gui applications

  • Loading branch information
jef-n committed May 28, 2011
1 parent 91b4a0d commit 85e119c44b964eb4c7a5212e98491e00740b618a
Showing with 55 additions and 77 deletions.
  1. +6 −23 CMakeLists.txt
  2. +1 −10 src/app/CMakeLists.txt
  3. +27 −25 src/browser/CMakeLists.txt
  4. +0 −1 src/browser/main.cpp
  5. +21 −18 src/helpviewer/CMakeLists.txt
@@ -15,15 +15,6 @@ ENDIF (APPLE)
MATH(EXPR QGIS_VERSION_INT "${CPACK_PACKAGE_VERSION_MAJOR}*10000+${CPACK_PACKAGE_VERSION_MINOR}*100+${CPACK_PACKAGE_VERSION_PATCH}")
MESSAGE(STATUS "Quantum GIS version: ${COMPLETE_VERSION} ${RELEASE_NAME} (${QGIS_VERSION_INT})")

# TODO:
# - install includes for libs
# - nice output when configured
# - rename *.ui files to have the same filename as their implementation
# e.g. instead of blahblahbase.ui use blahblah.ui
# because it's more common in Qt4
# Note on last point above by Tim Sutton - I prefer to have the base suffix
# as it indicates the ui generated class will be a base class for the widget.

#############################################################
# CMake settings

@@ -37,16 +28,10 @@ SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

# in generated makefiles use relative paths so the project dir is moveable
# Note commented out since it cause problems but it would be nice to resolve these and enable
#
# issue is caused by INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) near the end of this file generating incorrect path
#
# issue is caused by INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) near the end of this file generating incorrect path
#SET (CMAKE_USE_RELATIVE_PATHS ON)

# it's possible to set PLUGINS_ALSO_BINARIES to TRUE
# then some plugins that can run as standalone apps will be built
# also as standalone apps
SET (PLUGINS_ALSO_BINARIES FALSE)


# try to configure and build GRASS plugin by default
SET (WITH_GRASS TRUE CACHE BOOL "Determines whether GRASS plugin should be built")
IF (WITH_GRASS)
@@ -253,23 +238,21 @@ IF (WIN32)
SET (DEFAULT_DATA_SUBDIR .)
SET (DEFAULT_PLUGIN_SUBDIR plugins)
SET (DEFAULT_INCLUDE_SUBDIR include)

IF (MSVC)
SET (DEFAULT_BIN_SUBDIR bin)
SET (DEFAULT_CGIBIN_SUBDIR bin)
# put all the build products into a single directory
# under build (doesnt affect install target) to make for
# easier debugging.
#tell msvc compiler to use main instead of winmain as the
#application entry point
#SET(QT_USE_QTMAIN TRUE)

# Turn on defines for non standard maths stuff
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)

# Turn off deprecation warnings
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)

IF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
MESSAGE (STATUS "Generating browse files")
ADD_DEFINITIONS( /FR )
@@ -337,7 +320,7 @@ ENDIF (WIN32)

#assume we have escaped compiler directives
#eventually we want to change this to new
#since we don't need to jump through so many
#since we don't need to jump through so many
#hoops to escape compiler directives then
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
@@ -379,12 +379,7 @@ ENDIF (POSTGRES_FOUND)
#############

IF (WIN32)
# 'WIN32' removes console, which is Bad when debugging
IF (CMAKE_BUILD_TYPE MATCHES Debug)
ADD_EXECUTABLE(${QGIS_APP_NAME} ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS})
ELSE (CMAKE_BUILD_TYPE MATCHES Debug)
ADD_EXECUTABLE(${QGIS_APP_NAME} WIN32 ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS})
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)
ADD_EXECUTABLE(${QGIS_APP_NAME} WIN32 ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS})
ELSE (WIN32)
ADD_EXECUTABLE(${QGIS_APP_NAME} ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} ${IMAGE_RCC_SRCS})
ENDIF (WIN32)
@@ -409,10 +404,6 @@ IF(NOT WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${SQLITE_LIBRARY})
ENDIF(NOT WITH_INTERNAL_SPATIALITE)

IF (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${QT_QT3SUPPORT_LIBRARY} )
ENDIF (${QTVERSION} STRLESS "4.3.0")

IF (APPLE)
TARGET_LINK_LIBRARIES(${QGIS_APP_NAME} ${APP_SERVICES_LIBRARY} )
ENDIF (APPLE)
@@ -36,7 +36,7 @@ IF (WIN32)
# application icon
# resource compilation for MinGW
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon.o
COMMAND ${WINDRES} -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc
COMMAND ${WINDRES} -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o )
SET(QGIS_APP_SRCS ${QGIS_APP_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
ENDIF (MSVC)
@@ -54,16 +54,24 @@ QT4_WRAP_CPP (BROWSER_MOC_SRCS ${BROWSER_MOC_HDRS})
QT4_ADD_RESOURCES(IMAGE_RCC_SRCS ${IMAGE_RCCS})
#QT4_ADD_RESOURCES(BROWSER_RCC_SRCS ${BROWSER_RCCS})

ADD_EXECUTABLE (qbrowser MACOSX_BUNDLE ${BROWSER_SRCS} ${BROWSER_MOC_SRCS} ${BROWSER_UIS_H} ${IMAGE_RCC_SRCS})
IF(WIN32)
ADD_EXECUTABLE(qbrowser WIN32 ${BROWSER_SRCS} ${BROWSER_MOC_SRCS} ${BROWSER_UIS_H} ${IMAGE_RCC_SRCS})
ELSE(WIN32)
IF(APPLE)
ADD_EXECUTABLE (qbrowser MACOSX_BUNDLE ${BROWSER_SRCS} ${BROWSER_MOC_SRCS} ${BROWSER_UIS_H} ${IMAGE_RCC_SRCS})
ELSE(APPLE)
ADD_EXECUTABLE (qbrowser ${BROWSER_SRCS} ${BROWSER_MOC_SRCS} ${BROWSER_UIS_H} ${IMAGE_RCC_SRCS})
ENDIF(APPLE)
ENDIF(WIN32)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../core
${CMAKE_CURRENT_SOURCE_DIR}/../core/raster
${CMAKE_CURRENT_SOURCE_DIR}/../gui
${CMAKE_CURRENT_SOURCE_DIR}/../gui/attributetable
${CMAKE_CURRENT_BINARY_DIR}/../ui
${CMAKE_CURRENT_BINARY_DIR}
${GDAL_INCLUDE_DIR} # remove once raster layer is cleaned up
${CMAKE_CURRENT_SOURCE_DIR}/../core
${CMAKE_CURRENT_SOURCE_DIR}/../core/raster
${CMAKE_CURRENT_SOURCE_DIR}/../gui
${CMAKE_CURRENT_SOURCE_DIR}/../gui/attributetable
${CMAKE_CURRENT_BINARY_DIR}/../ui
${CMAKE_CURRENT_BINARY_DIR}
${GDAL_INCLUDE_DIR} # remove once raster layer is cleaned up
)

IF (WITH_INTERNAL_SPATIALITE)
@@ -78,35 +86,29 @@ IF (NOT WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(qbrowser ${SQLITE3_LIBRARY})
ENDIF (NOT WITH_INTERNAL_SPATIALITE)

IF (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(qbrowser
${QT_LIBRARIES}
)
ELSE (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(qbrowser
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTSVG_LIBRARY}
${QT_QTXML_LIBRARY}
${QT_QTWEBKIT_LIBRARY}
)
ENDIF (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(qbrowser
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTSVG_LIBRARY}
${QT_QTXML_LIBRARY}
${QT_QTWEBKIT_LIBRARY}
${QT_QTMAIN_LIBRARY}
)

SET_TARGET_PROPERTIES(qbrowser PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}
INSTALL_RPATH_USE_LINK_PATH true
)


########################################################
# Install

IF (APPLE)
INSTALL (TARGETS qbrowser BUNDLE DESTINATION ${QGIS_BIN_DIR})
# needed because global install_name prefix is for main qgis app
INSTALL (CODE "EXECUTE_PROCESS(COMMAND install_name_tool -change ${CMAKE_INSTALL_NAME_DIR}/libqgis_core.${COMPLETE_VERSION}.dylib @executable_path/../../../../lib/libqgis_core.${COMPLETE_VERSION}.dylib \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${QGIS_BIN_DIR}/qbrowser.app/Contents/MacOS/qbrowser\")")
INSTALL (CODE "EXECUTE_PROCESS (COMMAND ln -sfh ../../../${QGIS_FW_SUBDIR} \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${QGIS_BIN_DIR}/qbrowser.app/Contents/Frameworks\")")
INSTALL (CODE "EXECUTE_PROCESS(COMMAND ln -sfh ../../../${QGIS_FW_SUBDIR} \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${QGIS_BIN_DIR}/qbrowser.app/Contents/Frameworks\")")
ELSE (APPLE)
INSTALL (TARGETS qbrowser RUNTIME DESTINATION ${QGIS_BIN_DIR})
ENDIF (APPLE)
@@ -33,7 +33,6 @@ int main( int argc, char ** argv )
{
QSettings settings;


QgsApplication a( argc, argv, true );
a.setThemeName( settings.value( "/Themes", "default" ).toString() );

@@ -38,7 +38,7 @@ IF (WIN32)
# application icon
# resource compilation for MinGW
ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon.o
COMMAND ${WINDRES} -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc
COMMAND ${WINDRES} -I${CMAKE_CURRENT_SOURCE_DIR} -i${CMAKE_CURRENT_SOURCE_DIR}/../app/qgis_win32.rc
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o )
SET(QGIS_APP_SRCS ${QGIS_APP_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
ENDIF (MSVC)
@@ -54,11 +54,19 @@ QT4_WRAP_CPP (HELP_MOC_SRCS ${HELP_MOC_HDRS})

#QT4_ADD_RESOURCES(HELP_RCC_SRCS ${HELP_RCCS})

ADD_EXECUTABLE (qgis_help MACOSX_BUNDLE ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H})
IF(WIN32)
ADD_EXECUTABLE (qgis_help WIN32 ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H})
ELSE(WIN32)
IF(APPLE)
ADD_EXECUTABLE (qgis_help MACOSX_BUNDLE ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H})
ELSE(APPLE)
ADD_EXECUTABLE (qgis_help ${HELP_SRCS} ${HELP_MOC_SRCS} ${HELP_UIS_H})
ENDIF(APPLE)
ENDIF(WIN32)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../core
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../core
${CMAKE_CURRENT_BINARY_DIR}
)

IF (WITH_INTERNAL_SPATIALITE)
@@ -73,20 +81,15 @@ IF (NOT WITH_INTERNAL_SPATIALITE)
TARGET_LINK_LIBRARIES(qgis_help ${SQLITE3_LIBRARY})
ENDIF (NOT WITH_INTERNAL_SPATIALITE)

IF (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(qgis_help
${QT_LIBRARIES}
)
ELSE (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(qgis_help
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTSVG_LIBRARY}
${QT_QTXML_LIBRARY}
${QT_QTWEBKIT_LIBRARY}
)
ENDIF (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(qgis_help
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${QT_QTSVG_LIBRARY}
${QT_QTXML_LIBRARY}
${QT_QTWEBKIT_LIBRARY}
${QT_QTMAIN_LIBRARY}
)

SET_TARGET_PROPERTIES(qgis_help PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${QGIS_LIB_DIR}

0 comments on commit 85e119c

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