Skip to content

Commit

Permalink
[cmake] fix build and use target_incude in server + python
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jan 13, 2021
1 parent a8345c0 commit 3dae651
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 45 deletions.
7 changes: 7 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -1738,6 +1738,7 @@ target_include_directories(qgis_core PUBLIC
auth
callouts
classification
diagram
dxf
editform
effects
Expand All @@ -1747,6 +1748,7 @@ target_include_directories(qgis_core PUBLIC
geocms
geocms/geonode
geocoding
gps
labeling
layertree
layout
Expand Down Expand Up @@ -1782,6 +1784,11 @@ target_include_directories(qgis_core PUBLIC
${CMAKE_SOURCE_DIR}/external/meshOptimizer
)

if (WITH_EPT)
target_include_directories(qgis_core PUBLIC
${CMAKE_SOURCE_DIR}/src/core/providers/ept)
endif()

GENERATE_EXPORT_HEADER(
qgis_core
BASE_NAME CORE
Expand Down
4 changes: 0 additions & 4 deletions src/customwidgets/CMakeLists.txt
Expand Up @@ -91,10 +91,6 @@ endif()
# )

include_directories(

${CMAKE_BINARY_DIR}/src/core
${CMAKE_BINARY_DIR}/src/core/raster
${CMAKE_BINARY_DIR}/src/gui
${CMAKE_BINARY_DIR}/src/customwidgets
${CMAKE_SOURCE_DIR}/external
${CMAKE_SOURCE_DIR}/external/nlohmann
Expand Down
17 changes: 9 additions & 8 deletions src/gui/CMakeLists.txt
Expand Up @@ -1330,10 +1330,6 @@ if(ENABLE_MODELTEST)
endif()

if (WITH_EPT)
include_directories(
${CMAKE_SOURCE_DIR}/src/gui/providers/ept
)

set(QGIS_GUI_SRCS ${QGIS_GUI_SRCS}
providers/ept/qgseptdataitemguiprovider.cpp
providers/ept/qgseptproviderguimetadata.cpp
Expand Down Expand Up @@ -1382,6 +1378,7 @@ target_include_directories(qgis_gui PUBLIC
${CMAKE_SOURCE_DIR}/src/gui/symbology
${CMAKE_SOURCE_DIR}/src/gui/attributetable
${CMAKE_SOURCE_DIR}/src/gui/auth
${CMAKE_SOURCE_DIR}/src/gui/callouts
${CMAKE_SOURCE_DIR}/src/gui/codeeditors
${CMAKE_SOURCE_DIR}/src/gui/devtools
${CMAKE_SOURCE_DIR}/src/gui/editorwidgets
Expand All @@ -1390,6 +1387,7 @@ target_include_directories(qgis_gui PUBLIC
${CMAKE_SOURCE_DIR}/src/gui/labeling
${CMAKE_SOURCE_DIR}/src/gui/layertree
${CMAKE_SOURCE_DIR}/src/gui/layout
${CMAKE_SOURCE_DIR}/src/gui/locator
${CMAKE_SOURCE_DIR}/src/gui/mesh
${CMAKE_SOURCE_DIR}/src/gui/numericformats
${CMAKE_SOURCE_DIR}/src/gui/ogr
Expand All @@ -1408,6 +1406,13 @@ target_include_directories(qgis_gui PUBLIC
${CMAKE_BINARY_DIR}/src/ui
)

if (WITH_EPT)
target_include_directories(qgis_gui PUBLIC
${CMAKE_SOURCE_DIR}/src/gui/providers/ept
)
endif()


GENERATE_EXPORT_HEADER(
qgis_gui
BASE_NAME GUI
Expand Down Expand Up @@ -1468,10 +1473,6 @@ target_link_libraries(qgis_gui
)

if (FORCE_STATIC_PROVIDERS)
include_directories(
${CMAKE_SOURCE_DIR}/src/providers/wms
${CMAKE_SOURCE_DIR}/src/providers/postgres
)
target_link_libraries(qgis_gui
wmsprovider_gui_a
postgresprovider_gui_a
Expand Down
20 changes: 9 additions & 11 deletions src/providers/wms/CMakeLists.txt
Expand Up @@ -19,16 +19,17 @@ if (WITH_GUI)
)
endif()

include_directories(
${CMAKE_SOURCE_DIR}/external
${CMAKE_SOURCE_DIR}/external/nlohmann

${CMAKE_BINARY_DIR}/src/ui
${CMAKE_BINARY_DIR}/src/gui
)

# static library
add_library(wmsprovider_a STATIC ${WMS_SRCS})

if (WITH_GUI)
add_library(wmsprovider_gui_a STATIC ${WMS_GUI_SRCS})

add_dependencies(wmsprovider_a ui)
add_dependencies(wmsprovider_gui_a ui)
endif()

target_link_libraries(wmsprovider_a
qgis_core
${Qt5Xml_LIBRARIES}
Expand All @@ -41,10 +42,9 @@ target_link_libraries(wmsprovider_a
target_compile_definitions(wmsprovider_a PRIVATE "-DQT_NO_FOREACH")

if (WITH_GUI)
add_library(wmsprovider_gui_a STATIC ${WMS_GUI_SRCS})
target_link_libraries(wmsprovider_gui_a
wmsprovider_a
qgis_gui
wmsprovider_a
${Qt5Xml_LIBRARIES}
${Qt5Core_LIBRARIES}
${Qt5Svg_LIBRARIES}
Expand All @@ -55,8 +55,6 @@ if (WITH_GUI)
${Qt5Widgets_LIBRARIES}
)
target_compile_definitions(wmsprovider_gui_a PRIVATE "-DQT_NO_FOREACH")
add_dependencies(wmsprovider_gui_a ui)
add_dependencies(wmsprovider_a ui)
endif()

if (FORCE_STATIC_PROVIDERS)
Expand Down
3 changes: 0 additions & 3 deletions src/providers/wms/qgswmsdataitems.cpp
Expand Up @@ -22,9 +22,6 @@
#include "qgswmsconnection.h"
#include "qgsxyzconnection.h"

#ifdef HAVE_GUI
#include "qgswmssourceselect.h"
#endif
#include "qgsgeonodeconnection.h"
#include "qgsgeonoderequest.h"
#include "qgssettings.h"
Expand Down
9 changes: 4 additions & 5 deletions src/python/CMakeLists.txt
@@ -1,16 +1,15 @@
set(QGISPYTHON_SRCS qgispython.cpp qgspythonutilsimpl.cpp)

include_directories(
add_library (qgispython SHARED ${QGISPYTHON_SRCS})

${CMAKE_BINARY_DIR}/src/core
target_include_directories(qgispython PUBLIC
${CMAKE_SOURCE_DIR}/src/python
${CMAKE_BINARY_DIR}/src/python
)
include_directories(SYSTEM
target_include_directories(qgispython SYSTEM PRIVATE
${PYTHON_INCLUDE_PATH}
)

add_library (qgispython SHARED ${QGISPYTHON_SRCS})

set_target_properties(qgispython PROPERTIES
CLEAN_DIRECT_OUTPUT 1
)
Expand Down
22 changes: 8 additions & 14 deletions src/server/CMakeLists.txt
Expand Up @@ -82,27 +82,21 @@ if (WITH_SERVER_PLUGINS)
)
endif()

include_directories(SYSTEM
${FCGI_INCLUDE_DIR}
${POSTGRES_INCLUDE_DIR}
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)

include_directories(
${CMAKE_SOURCE_DIR}/external
${CMAKE_SOURCE_DIR}/src/python
${CMAKE_SOURCE_DIR}/external
${CMAKE_SOURCE_DIR}/external/nlohmann

${CMAKE_BINARY_DIR}/src/python
${CMAKE_BINARY_DIR}/src/analysis
${CMAKE_BINARY_DIR}/src/server
)

add_library(qgis_server SHARED ${QGIS_SERVER_SRCS} ${QGIS_SERVER_HDRS})

target_include_directories(qgis_server SYSTEM PRIVATE
${FCGI_INCLUDE_DIR}
)

target_include_directories(qgis_server PUBLIC
${CMAKE_BINARY_DIR}/src/server
)

GENERATE_EXPORT_HEADER(
qgis_server
BASE_NAME SERVER
Expand Down

0 comments on commit 3dae651

Please sign in to comment.