Skip to content

Commit

Permalink
Merge pull request #464 from dakcarto/nmake-with-jom_1
Browse files Browse the repository at this point in the history
Fix for #7289, add CMake option to enable building with Qt jom (nmake) on Windows
  • Loading branch information
dakcarto committed Mar 18, 2013
2 parents 5d62af3 + d7d1ece commit 4d11584
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
15 changes: 12 additions & 3 deletions CMakeLists.txt
Expand Up @@ -125,6 +125,11 @@ SET (ENABLE_TESTS TRUE CACHE BOOL "Build unit tests?")
# if set to other directory than expected
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH)

IF (MSVC AND CMAKE_GENERATOR MATCHES "NMake")
# following variable is also used in qgsconfig.h
SET (USING_NMAKE TRUE)
ENDIF (MSVC AND CMAKE_GENERATOR MATCHES "NMake")

#############################################################
# check if lexer and parser are not missing
# http://www.mail-archive.com/cmake@cmake.org/msg02861.html
Expand Down Expand Up @@ -295,7 +300,9 @@ FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
IF (PEDANTIC)
MESSAGE (STATUS "Pedantic compiler settings enabled")
IF(MSVC)
ADD_DEFINITIONS( /W4 )
IF (NOT USING_NMAKE)
ADD_DEFINITIONS( /W4 )
ENDIF (NOT USING_NMAKE)

# disable warnings
ADD_DEFINITIONS( /wd4100 ) # unused formal parameters
Expand Down Expand Up @@ -372,8 +379,10 @@ IF (WIN32)
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 )
IF (NOT USING_NMAKE)
MESSAGE (STATUS "Generating browse files")
ADD_DEFINITIONS( /FR )
ENDIF (NOT USING_NMAKE)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)

IF (INSTALL_DEPS)
Expand Down
2 changes: 2 additions & 0 deletions cmake_templates/qgsconfig.h.in
Expand Up @@ -32,6 +32,8 @@
//used by Mac to find system Qt plugins when bundle is run from build directory
#define QTPLUGINSDIR "${QT_PLUGINS_DIR}"

#cmakedefine USING_NMAKE

#cmakedefine HAVE_POSTGRESQL

#cmakedefine HAVE_SPATIALITE
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsapplication.cpp
Expand Up @@ -118,7 +118,7 @@ void QgsApplication::init( QString customConfigPath )
{
// we run from source directory - not installed to destination (specified prefix)
ABISYM( mPrefixPath ) = QString(); // set invalid path
#ifdef _MSC_VER
#if defined(_MSC_VER) && ! defined(USING_NMAKE)
setPluginPath( ABISYM( mBuildOutputPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) + "/" + ABISYM( mCfgIntDir ) );
#else
setPluginPath( ABISYM( mBuildOutputPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) );
Expand Down
6 changes: 3 additions & 3 deletions src/crssync/CMakeLists.txt
Expand Up @@ -12,17 +12,17 @@ TARGET_LINK_LIBRARIES(crssync
${GDAL_LIBRARY}
)

IF(MSVC)
IF(MSVC AND NOT USING_NMAKE)
ADD_CUSTOM_TARGET(synccrsdb
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/crssync.exe
DEPENDS crssync
)
ELSE(MSVC)
ELSE(MSVC AND NOT USING_NMAKE)
ADD_CUSTOM_TARGET(synccrsdb
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crssync
DEPENDS crssync
)
ENDIF(MSVC)
ENDIF(MSVC AND NOT USING_NMAKE)

INSTALL(CODE "MESSAGE(\"Installing crssync ...\")")
INSTALL(TARGETS crssync RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR})
12 changes: 8 additions & 4 deletions src/helpviewer/main.cpp
Expand Up @@ -41,14 +41,18 @@ int main( int argc, char ** argv )
{
context = argv[1];
}

if ( !QgsApplication::isRunningFromBuildDir() )
{
#if defined(Q_WS_MACX)
// If we're on Mac, we have the resource library way above us...
a.setPkgDataPath( QgsApplication::prefixPath() + "/../../../../" + QString( QGIS_DATA_SUBDIR ) );
// If we're on Mac, we have the resource library way above us...
a.setPkgDataPath( QgsApplication::prefixPath() + "/../../../../" + QString( QGIS_DATA_SUBDIR ) );
#elif defined(Q_WS_WIN)
a.setPkgDataPath( QgsApplication::prefixPath() + "/" QGIS_DATA_SUBDIR );
a.setPkgDataPath( QgsApplication::prefixPath() + "/" QGIS_DATA_SUBDIR );
#else
a.setPkgDataPath( QgsApplication::prefixPath() + "/../" QGIS_DATA_SUBDIR );
a.setPkgDataPath( QgsApplication::prefixPath() + "/../" QGIS_DATA_SUBDIR );
#endif
}

QString i18nPath = QgsApplication::i18nPath();
if ( myTranslationCode.isEmpty() )
Expand Down

0 comments on commit 4d11584

Please sign in to comment.