Skip to content

Commit

Permalink
Simpler handling of DLL_EXPORT defines
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 11, 2016
1 parent bd75fec commit d3fd818
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -612,6 +612,7 @@ ENDIF (ANDROID)
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0005 OLD)
cmake_policy(SET CMP0063 NEW)
ENDIF(COMMAND cmake_policy)

IF (WIN32)
Expand Down Expand Up @@ -640,6 +641,8 @@ ADD_DEFINITIONS("-DAPP_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DCUSTOMWIDGETS_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DSERVER_EXPORT=${DLLIMPORT}")

SET(CMAKE_CXX_VISIBILITY_PRESET hidden)

#############################################################
# user-changeable settings which can be used to customize
# layout of QGIS installation
Expand Down
7 changes: 1 addition & 6 deletions src/analysis/CMakeLists.txt
Expand Up @@ -149,12 +149,7 @@ INCLUDE_DIRECTORIES(SYSTEM
${SQLITE3_INCLUDE_DIR}
)

IF (NOT MSVC)
ADD_DEFINITIONS("-UANALYSIS_EXPORT")
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
ENDIF()
ENDIF (NOT MSVC)
REMOVE_DEFINITIONS("-DANALYSIS_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DANALYSIS_EXPORT=${DLLEXPORT}\"")

#############################################################
Expand Down
7 changes: 1 addition & 6 deletions src/app/CMakeLists.txt
Expand Up @@ -584,12 +584,7 @@ ELSE (ANDROID)
ADD_EXECUTABLE(${QGIS_APP_NAME} MACOSX_BUNDLE WIN32 ${QGIS_APPMAIN_SRCS} ${IMAGE_RCC_SRCS} ${TEST_RCC_SRCS})
ENDIF (ANDROID)

IF (NOT MSVC)
ADD_DEFINITIONS("-UAPP_EXPORT")
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
ENDIF()
ENDIF (NOT MSVC)
REMOVE_DEFINITIONS("-DAPP_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DAPP_EXPORT=${DLLEXPORT}\"")

# Putting IMAGE_RCC_SRCS into qgis_app lib is cousing problems when the lib is loaded (by plugin for example) in test unit (qgis_composerpicturetest).
Expand Down
7 changes: 1 addition & 6 deletions src/core/CMakeLists.txt
Expand Up @@ -877,12 +877,7 @@ INCLUDE_DIRECTORIES(SYSTEM
${QCA_INCLUDE_DIR}
)

IF (NOT MSVC)
ADD_DEFINITIONS("-UCORE_EXPORT")
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
ENDIF()
ENDIF (NOT MSVC)
REMOVE_DEFINITIONS("-DCORE_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DCORE_EXPORT=${DLLEXPORT}\"")


Expand Down
7 changes: 1 addition & 6 deletions src/customwidgets/CMakeLists.txt
Expand Up @@ -10,12 +10,7 @@ ENDIF (QT5_BUILD)
SET(QT_USE_QTDESIGNER ON)


IF (NOT MSVC)
ADD_DEFINITIONS("-UCUSTOMWIDGETS_EXPORT")
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
ENDIF()
ENDIF (NOT MSVC)
REMOVE_DEFINITIONS("-DCUSTOMWIDGETS_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DCUSTOMWIDGETS_EXPORT=${DLLEXPORT}\"")

########################################################
Expand Down
7 changes: 1 addition & 6 deletions src/gui/CMakeLists.txt
Expand Up @@ -758,12 +758,7 @@ INCLUDE_DIRECTORIES(SYSTEM
${GDAL_INCLUDE_DIR}
)

IF (NOT MSVC)
ADD_DEFINITIONS("-UGUI_EXPORT")
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
ENDIF()
ENDIF (NOT MSVC)
REMOVE_DEFINITIONS("-DGUI_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DGUI_EXPORT=${DLLEXPORT}\"")

# disable deprecation warnings for classes re-exporting deprecated methods
Expand Down
7 changes: 1 addition & 6 deletions src/python/CMakeLists.txt
@@ -1,9 +1,4 @@
IF (NOT MSVC)
ADD_DEFINITIONS("-UPYTHON_EXPORT")
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
ENDIF()
ENDIF (NOT MSVC)
REMOVE_DEFINITIONS("-DPYTHON_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DPYTHON_EXPORT=${DLLEXPORT}\"")

SET(QGISPYTHON_SRCS qgispython.cpp qgspythonutilsimpl.cpp)
Expand Down
7 changes: 1 addition & 6 deletions src/server/CMakeLists.txt
Expand Up @@ -100,12 +100,7 @@ SET(qgis_mapserv_SRCS ${qgis_mapserv_SRCS}
)
ENDIF (WITH_SERVER_PLUGINS)

IF (NOT MSVC)
ADD_DEFINITIONS("-USERVER_EXPORT")
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
ENDIF()
ENDIF (NOT MSVC)
REMOVE_DEFINITIONS("-DSERVER_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("\"-DSERVER_EXPORT=${DLLEXPORT}\"")


Expand Down

5 comments on commit d3fd818

@m-kuhn
Copy link
Member Author

@m-kuhn m-kuhn commented on d3fd818 Jun 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this breaks Windows builds, feel free to revert

CC @jef-n @NathanW2

@jef-n
Copy link
Member

@jef-n jef-n commented on d3fd818 Jun 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about windows - but it does break builds on trusty, wily and jessie

@m-kuhn
Copy link
Member Author

@m-kuhn m-kuhn commented on d3fd818 Jun 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also with the followup commits?

@jef-n
Copy link
Member

@jef-n jef-n commented on d3fd818 Jun 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with 1877bcd:
CMake Error at CMakeLists.txt:615 (cmake_policy): Policy "CMP0063" is not known to this version of CMake.
trusty has CMake 2.8.12.2

@m-kuhn
Copy link
Member Author

@m-kuhn m-kuhn commented on d3fd818 Jun 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know this policy stuff good enough... If it's set to old, does it also complain? I just inserted the statement to shut up the warning, I don't think it makes a difference for us.

Please sign in to comment.