File: CMakeLists.txt

package info (click to toggle)
mapnik 4.1.4%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 18,580 kB
  • sloc: cpp: 163,826; python: 1,265; sh: 690; xml: 161; makefile: 123; perl: 28; lisp: 13
file content (98 lines) | stat: -rw-r--r-- 3,195 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
set(_plugin_prefix "")
set(_plugin_suffix ".input")
set(_plugin_library_output "${MAPNIK_OUTPUT_DIR}/plugins/input")
set(_plugin_fpic ON)
set(_plugin_linkage MODULE)
set(_plugin_visibility PRIVATE)
if(NOT BUILD_SHARED_PLUGINS)
    set(_plugin_linkage INTERFACE)
    set(_plugin_visibility INTERFACE)
endif()

macro(add_plugin_target plugin_target output_name)
    add_library(${plugin_target} ${_plugin_linkage})
    set_target_properties(${plugin_target} PROPERTIES
        OUTPUT_NAME "${output_name}"
        POSITION_INDEPENDENT_CODE ${_plugin_fpic}
        PREFIX "${_plugin_prefix}"
        SUFFIX "${_plugin_suffix}"
        LIBRARY_OUTPUT_DIRECTORY "${_plugin_library_output}"
    )
    mapnik_install_plugin(${plugin_target})
endmacro()

# add a list with all build plugins so the copy dependencies command can wait for all build events
set(m_build_plugins "")
if(USE_PLUGIN_INPUT_CSV)
    add_subdirectory(csv)
    list(APPEND m_build_plugins input-csv)
endif()
if(USE_PLUGIN_INPUT_GDAL)
    add_subdirectory(gdal)
    list(APPEND m_build_plugins input-gdal)
endif()
if(USE_PLUGIN_INPUT_GEOBUF)
    add_subdirectory(geobuf)
    list(APPEND m_build_plugins input-geobuf)
endif()
if(USE_PLUGIN_INPUT_GEOJSON)
    add_subdirectory(geojson)
    list(APPEND m_build_plugins input-geojson)
endif()
if(USE_PLUGIN_INPUT_OGR)
    add_subdirectory(ogr)
    list(APPEND m_build_plugins input-ogr)
endif()
if(USE_PLUGIN_INPUT_PGRASTER)
    add_subdirectory(pgraster)
    list(APPEND m_build_plugins input-pgraster)
endif()
if(USE_PLUGIN_INPUT_POSTGIS)
    add_subdirectory(postgis)
    list(APPEND m_build_plugins input-postgis)
endif()
if(USE_PLUGIN_INPUT_RASTER)
    add_subdirectory(raster)
    list(APPEND m_build_plugins input-raster)
endif()
if(USE_PLUGIN_INPUT_SHAPE)
    add_subdirectory(shape)
    list(APPEND m_build_plugins input-shape)
endif()
if(USE_PLUGIN_INPUT_SQLITE)
    add_subdirectory(sqlite)
    list(APPEND m_build_plugins input-sqlite)
endif()
if(USE_PLUGIN_INPUT_TOPOJSON)
    add_subdirectory(topojson)
    list(APPEND m_build_plugins input-topojson)
endif()
if(USE_PLUGIN_INPUT_TILES)
    add_subdirectory(tiles)
    list(APPEND m_build_plugins input-tiles)
endif()

#
# Copy all plugin dlls, so that these are in the main output dir, since cmake copies those into ${MAPNIK_OUTPUT_DIR}/plugins/input, too.
#
if(BUILD_SHARED_PLUGINS AND WIN32)
    list(LENGTH m_build_plugins m_number_plugins)
    if(m_number_plugins GREATER 0)
        string(CONFIGURE
            [[
                file(GLOB m_deps "./*.dll")
                message(STATUS "plugin deps: ${m_deps}")
                file(COPY ${m_deps} DESTINATION "@MAPNIK_OUTPUT_DIR@")
            ]] m_copy_dlls_str @ONLY
        )
        file (GENERATE OUTPUT "copy_dlls_$<CONFIG>.cmake"
            CONTENT "${m_copy_dlls_str}"
        )
        add_custom_target(copy_plugin_dependencies ALL
            COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/copy_dlls_$<CONFIG>.cmake"
            WORKING_DIRECTORY "${MAPNIK_OUTPUT_DIR}/plugins/input"
            COMMENT "copying plugin dlls into build dir"
        )
        add_dependencies(copy_plugin_dependencies ${m_build_plugins})
    endif()
endif()