Skip to content

Commit 8b98570

Browse files
committed
Use qgis_grass_lib.h import for GRASS_LIB_EXPORT macro
1 parent 6c1677d commit 8b98570

10 files changed

Lines changed: 32 additions & 7 deletions

File tree

‎src/plugins/grass/CMakeLists.txt‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ ADD_SUBDIRECTORY(scripts)
55
if (HAVE_OPENPTY)
66
ADD_DEFINITIONS(-DHAVE_OPENPTY)
77
ENDIF (HAVE_OPENPTY)
8-
ADD_DEFINITIONS("-DGRASS_EXPORT=${DLLIMPORT} -DGRASS_LIB_EXPORT=${DLLIMPORT}")
98

109
IF (WIN32)
1110
ADD_DEFINITIONS(-DHAVE_GETPT)
@@ -165,6 +164,7 @@ INCLUDE_DIRECTORIES(
165164
${CMAKE_CURRENT_BINARY_DIR}/../../ui
166165
${CMAKE_BINARY_DIR}/src/core
167166
${CMAKE_BINARY_DIR}/src/gui
167+
${CMAKE_BINARY_DIR}/src/app
168168
)
169169
INCLUDE_DIRECTORIES(SYSTEM
170170
${GDAL_INCLUDE_DIR}
@@ -184,6 +184,10 @@ MACRO(ADD_GRASSPLUGIN GRASS_BUILD_VERSION)
184184
QT5_WRAP_CPP (GRASS_PLUGIN_MOC_SRCS ${GRASS_PLUGIN_MOC_HDRS})
185185
QT5_ADD_RESOURCES(GRASS_PLUGIN_RCC_SRCS ${GRASS_PLUGIN_RCCS})
186186
187+
INCLUDE_DIRECTORIES(
188+
${CMAKE_BINARY_DIR}/src/providers/grass/${GRASS_BUILD_VERSION}
189+
)
190+
187191
ADD_LIBRARY (grassplugin${GRASS_BUILD_VERSION} MODULE
188192
${GRASS_PLUGIN_SRCS}
189193
${GRASS_PLUGIN_MOC_SRCS}

‎src/providers/grass/CMakeLists.txt‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ INCLUDE_DIRECTORIES(
1010
${CMAKE_CURRENT_BINARY_DIR}
1111
${CMAKE_BINARY_DIR}/src/core
1212
${CMAKE_BINARY_DIR}/src/gui
13+
${CMAKE_BINARY_DIR}/src/providers/grass
1314
)
1415
INCLUDE_DIRECTORIES (SYSTEM
1516
${GDAL_INCLUDE_DIR}
@@ -96,7 +97,7 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
9697
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
9798
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
9899
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis3_grass
99-
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_LIB_EXPORT=${DLLEXPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\" ${GRASS_OFF_T_SIZE_DEF}"
100+
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" ${GRASS_OFF_T_SIZE_DEF}"
100101
)
101102

102103
IF (APPLE)
@@ -144,14 +145,20 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
144145
SET_TARGET_PROPERTIES(qgisgrass${GRASS_BUILD_VERSION} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
145146
ENDIF (APPLE)
146147

148+
GENERATE_EXPORT_HEADER(
149+
qgisgrass${GRASS_BUILD_VERSION}
150+
BASE_NAME GRASS_LIB
151+
EXPORT_FILE_NAME qgis_grass_lib.h
152+
)
153+
147154
#
148155
# GRASS vector provider
149156
#
150157
SET (GRASS_VECTOR_PROVIDER_SRCS ../qgsgrassprovidermodule.cpp)
151158
QT5_WRAP_CPP(GRASS_VECTOR_PROVIDER_MOC_SRCS ../qgsgrassprovidermodule.h)
152159
ADD_LIBRARY(grassprovider${GRASS_BUILD_VERSION} MODULE ${GRASS_VECTOR_PROVIDER_SRCS} ${GRASS_VECTOR_PROVIDER_MOC_SRCS})
153160
SET_TARGET_PROPERTIES(grassprovider${GRASS_BUILD_VERSION} PROPERTIES
154-
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\""
161+
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
155162
)
156163
TARGET_LINK_LIBRARIES(grassprovider${GRASS_BUILD_VERSION}
157164
qgisgrass${GRASS_BUILD_VERSION}
@@ -166,7 +173,7 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
166173
)
167174
ADD_LIBRARY(grassrasterprovider${GRASS_BUILD_VERSION} MODULE ${GRASS_RASTER_PROVIDER_SRCS})
168175
SET_TARGET_PROPERTIES(grassrasterprovider${GRASS_BUILD_VERSION} PROPERTIES
169-
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\""
176+
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
170177
)
171178
TARGET_LINK_LIBRARIES(grassrasterprovider${GRASS_BUILD_VERSION}
172179
qgisgrass${GRASS_BUILD_VERSION}
@@ -225,7 +232,7 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
225232
#
226233
ADD_EXECUTABLE(qgis.r.in${GRASS_BUILD_VERSION} ../qgis.r.in.cpp)
227234
SET_TARGET_PROPERTIES(qgis.r.in${GRASS_BUILD_VERSION} PROPERTIES
228-
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\""
235+
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
229236
)
230237
IF (GRASS_MAJOR_VERSION LESS 7 )
231238
TARGET_LINK_LIBRARIES(qgis.r.in${GRASS_BUILD_VERSION}
@@ -251,7 +258,7 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
251258
#
252259
ADD_EXECUTABLE(qgis.v.in${GRASS_BUILD_VERSION} ../qgis.v.in.cpp)
253260
SET_TARGET_PROPERTIES(qgis.v.in${GRASS_BUILD_VERSION} PROPERTIES
254-
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\""
261+
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
255262
)
256263
TARGET_LINK_LIBRARIES(qgis.v.in${GRASS_BUILD_VERSION}
257264
qgisgrass${GRASS_BUILD_VERSION}
@@ -760,7 +767,7 @@ IF(WITH_GRASS_DIRECT)
760767
# in different directory
761768
SET_TARGET_PROPERTIES(${FAKE_LIB_GRASS_GIS} PROPERTIES
762769
CLEAN_DIRECT_OUTPUT 1
763-
COMPILE_FLAGS "\"-DGRASS_LIB_EXPORT=${DLLEXPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\" -DGRASS_VERSION=\\\"${GRASS_VERSION}\\\" -DGRASS_LIBRARY_GIS=\\\"${GRASS_LIBRARY_gis}\\\" \"-I${CMAKE_CURRENT_SOURCE_DIR}\" ")
770+
COMPILE_FLAGS "-DGRASS_VERSION=\\\"${GRASS_VERSION}\\\" -DGRASS_LIBRARY_GIS=\\\"${GRASS_LIBRARY_gis}\\\" \"-I${CMAKE_CURRENT_SOURCE_DIR}\" ")
764771

765772
IF (NOT APPLE)
766773
SET_TARGET_PROPERTIES(${FAKE_LIB_GRASS_GIS} PROPERTIES
@@ -773,6 +780,7 @@ IF(WITH_GRASS_DIRECT)
773780
qgis_core
774781
)
775782

783+
776784
INSTALL(TARGETS ${FAKE_LIB_GRASS_GIS}
777785
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
778786
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})

‎src/providers/grass/qgsgrass.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ extern "C"
4343
#include <QHash>
4444
#include <QRegExp>
4545
#include <QTemporaryFile>
46+
#include "qgis_grass_lib.h"
4647
class QgsCoordinateReferenceSystem;
4748
class QgsRectangle;
4849

‎src/providers/grass/qgsgrassdatafile.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define QGSGRASSDATAFILE_H
1919

2020
#include <QFile>
21+
#include "qgis_grass_lib.h"
2122

2223
/*
2324
* This class does blocking reading which is necessary for QgsDataFile.

‎src/providers/grass/qgsgrassoptions.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "qgsoptionsdialogbase.h"
2222

2323
#include "ui_qgsgrassoptionsbase.h"
24+
#include "qgis_grass_lib.h"
2425

2526
class GRASS_LIB_EXPORT QgsGrassOptions : public QgsOptionsDialogBase, private Ui::QgsGrassOptionsBase
2627
{

‎src/providers/grass/qgsgrassrasterprovider.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "qgsrasterdataprovider.h"
2525
#include "qgsrectangle.h"
2626
#include "qgscolorrampshader.h"
27+
#include "qgis_grass_lib.h"
2728

2829
extern "C"
2930
{

‎src/providers/grass/qgsgrassundocommand.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef QGSGRASSUNDOCOMMAND_H
1717
#define QGSGRASSUNDOCOMMAND_H
1818

19+
#include "qgis_grass_lib.h"
20+
1921
class QgsGrassProvider;
2022

2123
class GRASS_LIB_EXPORT QgsGrassUndoCommand

‎src/providers/grass/qgsgrassvectormaplayer.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "qgsfields.h"
2626
#include "qgsfeature.h"
27+
#include "qgis_grass_lib.h"
2728

2829
extern "C"
2930
{

‎src/providers/grass/qgsgrasswin.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef QGSGRASSWIN_H
1818
#define QGSGRASSWIN_H
1919

20+
#include "qgis_grass_lib.h"
21+
2022
// Windows utils
2123
class GRASS_LIB_EXPORT QgsGrassWin
2224
{

‎tests/src/providers/grass/CMakeLists.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ MACRO (ADD_QGIS_GRASS_TEST grass_build_version testname testsrc)
1616
ADD_CUSTOM_TARGET(qgis_${testname}${grass_build_version}moc ALL DEPENDS ${qgis_${testname}${grass_build_version}_MOC_SRCS})
1717
ADD_EXECUTABLE(qgis_${testname}${grass_build_version} ${qgis_${testname}${grass_build_version}_SRCS})
1818

19+
INCLUDE_DIRECTORIES(
20+
${CMAKE_BINARY_DIR}/src/providers/grass/${grass_build_version}
21+
)
22+
1923
SET_TARGET_PROPERTIES(qgis_${testname}${grass_build_version} PROPERTIES
2024
AUTOMOC TRUE
2125
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX${grass_build_version}}\\\" \"-DGRASS_BUILD_VERSION=${grass_build_version}\""

0 commit comments

Comments
 (0)