Skip to content

Commit aca333f

Browse files
author
timlinux
committedNov 5, 2007
Applied Jürgens patch with improvements for MSVC build and initial attempts at GRASS under MSVC
git-svn-id: http://svn.osgeo.org/qgis/trunk@7322 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 0c57520 commit aca333f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+274
-238
lines changed
 

‎python/CMakeLists.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
21
IF (WIN32)
32
SET(BINDINGS_CORE_LIB ${CMAKE_CURRENT_BINARY_DIR}/core/core.pyd)
43
SET(BINDINGS_GUI_LIB ${CMAKE_CURRENT_BINARY_DIR}/gui/gui.pyd)
5-
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.dll)
6-
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.dll)
4+
IF (NOT MSVC)
5+
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.dll)
6+
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.dll)
7+
ELSE (NOT MSVC)
8+
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/${CMAKE_CFG_INTDIR}/qgis_core.lib)
9+
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/${CMAKE_CFG_INTDIR}/qgis_gui.lib)
10+
GET_FILENAME_COMPONENT(GDAL_LIB_PATH ${GDAL_LIBRARY} PATH)
11+
GET_FILENAME_COMPONENT(GDAL_LIB_NAME ${GDAL_LIBRARY} NAME_WE)
12+
SET(GDAL_LIB_PATHNAME ${GDAL_LIB_PATH}/${GDAL_LIB_NAME})
13+
ENDIF (NOT MSVC)
714
ELSE (WIN32)
815
SET(BINDINGS_CORE_LIB ${CMAKE_CURRENT_BINARY_DIR}/core/core.so)
916
SET(BINDINGS_GUI_LIB ${CMAKE_CURRENT_BINARY_DIR}/gui/gui.so)
@@ -35,14 +42,20 @@ FILE(GLOB GUI_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/gui/*.sip")
3542
# create file configure.py from configure.py.in
3643
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/configure.py.in
3744
${CMAKE_CURRENT_BINARY_DIR}/configure.py)
45+
46+
IF (MSVC)
47+
SET(EXPORT "__declspec(dllimport)")
48+
ELSE (MSVC)
49+
SET(EXPORT "")
50+
ENDIF (MSVC)
3851

3952
# Step 2: during make
4053
# run python configure.py
4154
# it will run SIP utility to generate sources and will prepare makefiles
4255
# should be run everytime core or gui library has been changed
4356
ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_CORE_MAKEFILE} ${BINDINGS_GUI_MAKEFILE} PRE_BUILD
4457
COMMAND ${PYTHON_EXECUTABLE}
45-
ARGS ${CMAKE_CURRENT_BINARY_DIR}/configure.py
58+
ARGS ${CMAKE_CURRENT_BINARY_DIR}/configure.py ${CMAKE_CFG_INTDIR} ${EXPORT}
4659
DEPENDS ${QGIS_CORE_LIB} ${QGIS_GUI_LIB}
4760
${CMAKE_CURRENT_BINARY_DIR}/configure.py
4861
${CORE_SIP_FILES} ${GUI_SIP_FILES})

‎python/configure.py.in

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@ build_path = '@CMAKE_BINARY_DIR@'
99
python_path = src_path + '/python'
1010
gdal_inc_dir = '@GDAL_INCLUDE_DIR@'
1111
geos_inc_dir = '@GEOS_INCLUDE_DIR@'
12+
gdal_library = '@GDAL_LIB_PATHNAME@'
1213

1314
qt_libs = ["QtCore","QtGui","QtNetwork","QtSvg","QtXml"]
1415
if sys.platform == 'darwin':
1516
qt_libs.append("Qt3Support")
1617
qt_libs.append("QtSql")
1718

19+
if len(sys.argv)>1:
20+
intdir = "/" + sys.argv[1]
21+
else:
22+
intdir = ""
23+
24+
if len(sys.argv)>2:
25+
export = sys.argv[2]
26+
else:
27+
export = ""
28+
1829
# create paths for temporary files if don't exist
1930
if not os.path.isdir("./core"):
2031
os.mkdir("./core")
@@ -99,7 +110,9 @@ makefile_gui = sipconfig.ModuleMakefile(
99110
# common settings for both core and gui libs
100111
for mk in [ makefile_core, makefile_gui ]:
101112
mk.extra_libs = ["qgis_core"]
102-
mk.extra_lib_dirs = [build_path+"/src/core"]
113+
if gdal_library!="":
114+
mk.extra_libs.append(gdal_library)
115+
mk.extra_lib_dirs = [build_path+"/src/core"+intdir]
103116
mk.extra_include_dirs = [src_path+"/src/core",
104117
src_path+"/src/core/raster",
105118
src_path+"/src/core/renderer",
@@ -108,16 +121,16 @@ for mk in [ makefile_core, makefile_gui ]:
108121
build_path, # qgsconfig.h, qgssvnversion.h
109122
gdal_inc_dir,
110123
geos_inc_dir]
111-
mk.extra_cxxflags = ["-DCORE_EXPORT="]
124+
mk.extra_cxxflags = ["-DCORE_EXPORT="+export]
112125

113126
# more settings for gui lib
114127
makefile_gui.extra_libs.append("qgis_gui")
115-
makefile_gui.extra_lib_dirs.append(build_path+"/src/gui")
128+
makefile_gui.extra_lib_dirs.append(build_path+"/src/gui"+intdir)
116129
makefile_gui.extra_include_dirs.append(src_path+"/src/gui")
117130
makefile_gui.extra_include_dirs.append(build_path+"/src/gui")
118131
makefile_gui.extra_include_dirs.append(build_path+"/src/ui")
119132
makefile_gui.extra_include_dirs.append(src_path+"/src/plugins") # because of qgisplugin.h TODO: sort out
120-
makefile_gui.extra_cxxflags.append("-DGUI_EXPORT=")
133+
makefile_gui.extra_cxxflags.append("-DGUI_EXPORT="+export)
121134

122135
# Generate the Makefile itself.
123136
makefile_core.generate()

0 commit comments

Comments
 (0)
Please sign in to comment.