Skip to content

Commit

Permalink
Use qgis_grass_lib.h import for GRASS_LIB_EXPORT macro
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jan 4, 2017
1 parent 6c1677d commit 8b98570
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/plugins/grass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ADD_SUBDIRECTORY(scripts)
if (HAVE_OPENPTY)
ADD_DEFINITIONS(-DHAVE_OPENPTY)
ENDIF (HAVE_OPENPTY)
ADD_DEFINITIONS("-DGRASS_EXPORT=${DLLIMPORT} -DGRASS_LIB_EXPORT=${DLLIMPORT}")

IF (WIN32)
ADD_DEFINITIONS(-DHAVE_GETPT)
Expand Down Expand Up @@ -165,6 +164,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}/../../ui
${CMAKE_BINARY_DIR}/src/core
${CMAKE_BINARY_DIR}/src/gui
${CMAKE_BINARY_DIR}/src/app
)
INCLUDE_DIRECTORIES(SYSTEM
${GDAL_INCLUDE_DIR}
Expand All @@ -184,6 +184,10 @@ MACRO(ADD_GRASSPLUGIN GRASS_BUILD_VERSION)
QT5_WRAP_CPP (GRASS_PLUGIN_MOC_SRCS ${GRASS_PLUGIN_MOC_HDRS})
QT5_ADD_RESOURCES(GRASS_PLUGIN_RCC_SRCS ${GRASS_PLUGIN_RCCS})

INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}/src/providers/grass/${GRASS_BUILD_VERSION}
)

ADD_LIBRARY (grassplugin${GRASS_BUILD_VERSION} MODULE
${GRASS_PLUGIN_SRCS}
${GRASS_PLUGIN_MOC_SRCS}
Expand Down
20 changes: 14 additions & 6 deletions src/providers/grass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/src/core
${CMAKE_BINARY_DIR}/src/gui
${CMAKE_BINARY_DIR}/src/providers/grass
)
INCLUDE_DIRECTORIES (SYSTEM
${GDAL_INCLUDE_DIR}
Expand Down Expand Up @@ -96,7 +97,7 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/mac/framework.info.plist.in"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${COMPLETE_VERSION}
MACOSX_FRAMEWORK_IDENTIFIER org.qgis.qgis3_grass
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_LIB_EXPORT=${DLLEXPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\" ${GRASS_OFF_T_SIZE_DEF}"
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" ${GRASS_OFF_T_SIZE_DEF}"
)

IF (APPLE)
Expand Down Expand Up @@ -144,14 +145,20 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
SET_TARGET_PROPERTIES(qgisgrass${GRASS_BUILD_VERSION} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
ENDIF (APPLE)

GENERATE_EXPORT_HEADER(
qgisgrass${GRASS_BUILD_VERSION}
BASE_NAME GRASS_LIB
EXPORT_FILE_NAME qgis_grass_lib.h
)

#
# GRASS vector provider
#
SET (GRASS_VECTOR_PROVIDER_SRCS ../qgsgrassprovidermodule.cpp)
QT5_WRAP_CPP(GRASS_VECTOR_PROVIDER_MOC_SRCS ../qgsgrassprovidermodule.h)
ADD_LIBRARY(grassprovider${GRASS_BUILD_VERSION} MODULE ${GRASS_VECTOR_PROVIDER_SRCS} ${GRASS_VECTOR_PROVIDER_MOC_SRCS})
SET_TARGET_PROPERTIES(grassprovider${GRASS_BUILD_VERSION} PROPERTIES
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\""
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
)
TARGET_LINK_LIBRARIES(grassprovider${GRASS_BUILD_VERSION}
qgisgrass${GRASS_BUILD_VERSION}
Expand All @@ -166,7 +173,7 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
)
ADD_LIBRARY(grassrasterprovider${GRASS_BUILD_VERSION} MODULE ${GRASS_RASTER_PROVIDER_SRCS})
SET_TARGET_PROPERTIES(grassrasterprovider${GRASS_BUILD_VERSION} PROPERTIES
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\""
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
)
TARGET_LINK_LIBRARIES(grassrasterprovider${GRASS_BUILD_VERSION}
qgisgrass${GRASS_BUILD_VERSION}
Expand Down Expand Up @@ -225,7 +232,7 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
#
ADD_EXECUTABLE(qgis.r.in${GRASS_BUILD_VERSION} ../qgis.r.in.cpp)
SET_TARGET_PROPERTIES(qgis.r.in${GRASS_BUILD_VERSION} PROPERTIES
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\""
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
)
IF (GRASS_MAJOR_VERSION LESS 7 )
TARGET_LINK_LIBRARIES(qgis.r.in${GRASS_BUILD_VERSION}
Expand All @@ -251,7 +258,7 @@ MACRO(ADD_GRASSLIB GRASS_BUILD_VERSION)
#
ADD_EXECUTABLE(qgis.v.in${GRASS_BUILD_VERSION} ../qgis.v.in.cpp)
SET_TARGET_PROPERTIES(qgis.v.in${GRASS_BUILD_VERSION} PROPERTIES
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\""
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\""
)
TARGET_LINK_LIBRARIES(qgis.v.in${GRASS_BUILD_VERSION}
qgisgrass${GRASS_BUILD_VERSION}
Expand Down Expand Up @@ -760,7 +767,7 @@ IF(WITH_GRASS_DIRECT)
# in different directory
SET_TARGET_PROPERTIES(${FAKE_LIB_GRASS_GIS} PROPERTIES
CLEAN_DIRECT_OUTPUT 1
COMPILE_FLAGS "\"-DGRASS_LIB_EXPORT=${DLLEXPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\" -DGRASS_VERSION=\\\"${GRASS_VERSION}\\\" -DGRASS_LIBRARY_GIS=\\\"${GRASS_LIBRARY_gis}\\\" \"-I${CMAKE_CURRENT_SOURCE_DIR}\" ")
COMPILE_FLAGS "-DGRASS_VERSION=\\\"${GRASS_VERSION}\\\" -DGRASS_LIBRARY_GIS=\\\"${GRASS_LIBRARY_gis}\\\" \"-I${CMAKE_CURRENT_SOURCE_DIR}\" ")

IF (NOT APPLE)
SET_TARGET_PROPERTIES(${FAKE_LIB_GRASS_GIS} PROPERTIES
Expand All @@ -773,6 +780,7 @@ IF(WITH_GRASS_DIRECT)
qgis_core
)


INSTALL(TARGETS ${FAKE_LIB_GRASS_GIS}
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
Expand Down
1 change: 1 addition & 0 deletions src/providers/grass/qgsgrass.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extern "C"
#include <QHash>
#include <QRegExp>
#include <QTemporaryFile>
#include "qgis_grass_lib.h"
class QgsCoordinateReferenceSystem;
class QgsRectangle;

Expand Down
1 change: 1 addition & 0 deletions src/providers/grass/qgsgrassdatafile.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define QGSGRASSDATAFILE_H

#include <QFile>
#include "qgis_grass_lib.h"

/*
* This class does blocking reading which is necessary for QgsDataFile.
Expand Down
1 change: 1 addition & 0 deletions src/providers/grass/qgsgrassoptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "qgsoptionsdialogbase.h"

#include "ui_qgsgrassoptionsbase.h"
#include "qgis_grass_lib.h"

class GRASS_LIB_EXPORT QgsGrassOptions : public QgsOptionsDialogBase, private Ui::QgsGrassOptionsBase
{
Expand Down
1 change: 1 addition & 0 deletions src/providers/grass/qgsgrassrasterprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "qgsrasterdataprovider.h"
#include "qgsrectangle.h"
#include "qgscolorrampshader.h"
#include "qgis_grass_lib.h"

extern "C"
{
Expand Down
2 changes: 2 additions & 0 deletions src/providers/grass/qgsgrassundocommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#ifndef QGSGRASSUNDOCOMMAND_H
#define QGSGRASSUNDOCOMMAND_H

#include "qgis_grass_lib.h"

class QgsGrassProvider;

class GRASS_LIB_EXPORT QgsGrassUndoCommand
Expand Down
1 change: 1 addition & 0 deletions src/providers/grass/qgsgrassvectormaplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "qgsfields.h"
#include "qgsfeature.h"
#include "qgis_grass_lib.h"

extern "C"
{
Expand Down
2 changes: 2 additions & 0 deletions src/providers/grass/qgsgrasswin.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef QGSGRASSWIN_H
#define QGSGRASSWIN_H

#include "qgis_grass_lib.h"

// Windows utils
class GRASS_LIB_EXPORT QgsGrassWin
{
Expand Down
4 changes: 4 additions & 0 deletions tests/src/providers/grass/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ MACRO (ADD_QGIS_GRASS_TEST grass_build_version testname testsrc)
ADD_CUSTOM_TARGET(qgis_${testname}${grass_build_version}moc ALL DEPENDS ${qgis_${testname}${grass_build_version}_MOC_SRCS})
ADD_EXECUTABLE(qgis_${testname}${grass_build_version} ${qgis_${testname}${grass_build_version}_SRCS})

INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}/src/providers/grass/${grass_build_version}
)

SET_TARGET_PROPERTIES(qgis_${testname}${grass_build_version} PROPERTIES
AUTOMOC TRUE
COMPILE_FLAGS "-DGRASS_BASE=\\\"${GRASS_PREFIX${grass_build_version}}\\\" \"-DGRASS_BUILD_VERSION=${grass_build_version}\""
Expand Down

0 comments on commit 8b98570

Please sign in to comment.