Skip to content

Commit

Permalink
windows: browser and helpviewer are gui applications
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 28, 2011
1 parent 91b4a0d commit 85e119c
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 77 deletions.
29 changes: 6 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 1 addition & 10 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
52 changes: 27 additions & 25 deletions src/browser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
1 change: 0 additions & 1 deletion src/browser/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ int main( int argc, char ** argv )
{
QSettings settings;


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

Expand Down
39 changes: 21 additions & 18 deletions src/helpviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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}
Expand Down

0 comments on commit 85e119c

Please sign in to comment.