Skip to content

Commit 4d11584

Browse files
committedMar 18, 2013
Merge pull request #464 from dakcarto/nmake-with-jom_1
Fix for #7289, add CMake option to enable building with Qt jom (nmake) on Windows
2 parents 5d62af3 + d7d1ece commit 4d11584

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed
 

‎CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ SET (ENABLE_TESTS TRUE CACHE BOOL "Build unit tests?")
125125
# if set to other directory than expected
126126
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH)
127127

128+
IF (MSVC AND CMAKE_GENERATOR MATCHES "NMake")
129+
# following variable is also used in qgsconfig.h
130+
SET (USING_NMAKE TRUE)
131+
ENDIF (MSVC AND CMAKE_GENERATOR MATCHES "NMake")
132+
128133
#############################################################
129134
# check if lexer and parser are not missing
130135
# http://www.mail-archive.com/cmake@cmake.org/msg02861.html
@@ -295,7 +300,9 @@ FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
295300
IF (PEDANTIC)
296301
MESSAGE (STATUS "Pedantic compiler settings enabled")
297302
IF(MSVC)
298-
ADD_DEFINITIONS( /W4 )
303+
IF (NOT USING_NMAKE)
304+
ADD_DEFINITIONS( /W4 )
305+
ENDIF (NOT USING_NMAKE)
299306

300307
# disable warnings
301308
ADD_DEFINITIONS( /wd4100 ) # unused formal parameters
@@ -372,8 +379,10 @@ IF (WIN32)
372379
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)
373380

374381
IF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
375-
MESSAGE (STATUS "Generating browse files")
376-
ADD_DEFINITIONS( /FR )
382+
IF (NOT USING_NMAKE)
383+
MESSAGE (STATUS "Generating browse files")
384+
ADD_DEFINITIONS( /FR )
385+
ENDIF (NOT USING_NMAKE)
377386
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
378387

379388
IF (INSTALL_DEPS)

‎cmake_templates/qgsconfig.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
//used by Mac to find system Qt plugins when bundle is run from build directory
3333
#define QTPLUGINSDIR "${QT_PLUGINS_DIR}"
3434

35+
#cmakedefine USING_NMAKE
36+
3537
#cmakedefine HAVE_POSTGRESQL
3638

3739
#cmakedefine HAVE_SPATIALITE

‎src/core/qgsapplication.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void QgsApplication::init( QString customConfigPath )
118118
{
119119
// we run from source directory - not installed to destination (specified prefix)
120120
ABISYM( mPrefixPath ) = QString(); // set invalid path
121-
#ifdef _MSC_VER
121+
#if defined(_MSC_VER) && ! defined(USING_NMAKE)
122122
setPluginPath( ABISYM( mBuildOutputPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) + "/" + ABISYM( mCfgIntDir ) );
123123
#else
124124
setPluginPath( ABISYM( mBuildOutputPath ) + "/" + QString( QGIS_PLUGIN_SUBDIR ) );

‎src/crssync/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ TARGET_LINK_LIBRARIES(crssync
1212
${GDAL_LIBRARY}
1313
)
1414

15-
IF(MSVC)
15+
IF(MSVC AND NOT USING_NMAKE)
1616
ADD_CUSTOM_TARGET(synccrsdb
1717
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/crssync.exe
1818
DEPENDS crssync
1919
)
20-
ELSE(MSVC)
20+
ELSE(MSVC AND NOT USING_NMAKE)
2121
ADD_CUSTOM_TARGET(synccrsdb
2222
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crssync
2323
DEPENDS crssync
2424
)
25-
ENDIF(MSVC)
25+
ENDIF(MSVC AND NOT USING_NMAKE)
2626

2727
INSTALL(CODE "MESSAGE(\"Installing crssync ...\")")
2828
INSTALL(TARGETS crssync RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR})

‎src/helpviewer/main.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ int main( int argc, char ** argv )
4141
{
4242
context = argv[1];
4343
}
44+
45+
if ( !QgsApplication::isRunningFromBuildDir() )
46+
{
4447
#if defined(Q_WS_MACX)
45-
// If we're on Mac, we have the resource library way above us...
46-
a.setPkgDataPath( QgsApplication::prefixPath() + "/../../../../" + QString( QGIS_DATA_SUBDIR ) );
48+
// If we're on Mac, we have the resource library way above us...
49+
a.setPkgDataPath( QgsApplication::prefixPath() + "/../../../../" + QString( QGIS_DATA_SUBDIR ) );
4750
#elif defined(Q_WS_WIN)
48-
a.setPkgDataPath( QgsApplication::prefixPath() + "/" QGIS_DATA_SUBDIR );
51+
a.setPkgDataPath( QgsApplication::prefixPath() + "/" QGIS_DATA_SUBDIR );
4952
#else
50-
a.setPkgDataPath( QgsApplication::prefixPath() + "/../" QGIS_DATA_SUBDIR );
53+
a.setPkgDataPath( QgsApplication::prefixPath() + "/../" QGIS_DATA_SUBDIR );
5154
#endif
55+
}
5256

5357
QString i18nPath = QgsApplication::i18nPath();
5458
if ( myTranslationCode.isEmpty() )

0 commit comments

Comments
 (0)
Please sign in to comment.