Compare commits
No commits in common. "master" and "ci/vcpkg-json" have entirely different histories.
master
...
ci/vcpkg-j
2381 changed files with 15851 additions and 435458 deletions
85
.github/actions/run_tests/action.yml
vendored
85
.github/actions/run_tests/action.yml
vendored
|
@ -1,85 +0,0 @@
|
|||
name: Run tests with coverage
|
||||
description: Runs all mapnik tests with coverage
|
||||
inputs:
|
||||
cmake-preset:
|
||||
description: The used CMake preset
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Set PROJ_LIB
|
||||
shell: bash
|
||||
run: |
|
||||
cmake --preset ${{ inputs.cmake-preset }} -N -L | grep -o "PROJ_LIB=.*" >> ${GITHUB_ENV}
|
||||
|
||||
- name: Set TEST_WRAPPER (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
shell: bash
|
||||
run: |-
|
||||
echo "TEST_WRAPPER=OpenCppCoverage \
|
||||
--cover_children \
|
||||
--export_type binary \
|
||||
--modules '*.input' \
|
||||
--modules '*libmapnik*' \
|
||||
--modules 'mapnik*.exe' \
|
||||
--quiet \
|
||||
--sources '${{ github.workspace }}' \
|
||||
--" >> ${GITHUB_ENV}
|
||||
|
||||
- name: Test
|
||||
shell: bash
|
||||
env:
|
||||
UPDATE: 1
|
||||
run: |
|
||||
${TEST_WRAPPER:-} ctest --preset ${{ inputs.cmake-preset }}
|
||||
|
||||
- name: Test visuals
|
||||
continue-on-error: true
|
||||
working-directory: build/out
|
||||
shell: bash
|
||||
run: |
|
||||
${TEST_WRAPPER:-} ./mapnik-test-visual -j ${CTEST_PARALLEL_LEVEL} --output-dir visual-test-result
|
||||
|
||||
- name: Pack visual test results
|
||||
working-directory: build/out
|
||||
shell: bash
|
||||
run: |
|
||||
tar -vzcf visual-test-results.tar.gz visual-test-result
|
||||
|
||||
- name: Upload visual test results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ inputs.cmake-preset }}-visual-tests-${{ github.sha }}
|
||||
path: build/out/visual-test-results.tar.gz
|
||||
|
||||
- name: Run Benchmarks (Linux & macOS)
|
||||
working-directory: build/out
|
||||
if: runner.os != 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
./run_benchmarks
|
||||
|
||||
- name: Collect coverage (Linux & macOS)
|
||||
working-directory: build
|
||||
if: runner.os != 'Windows'
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${RUNNER_OS}" == "macOS" ]; then
|
||||
LCOV_EXTRA_OPTIONS="--ignore-errors count,gcov,inconsistent,range,unused --keep-going"
|
||||
fi
|
||||
lcov ${LCOV_EXTRA_OPTIONS:-} --directory . --capture --output-file coverage.info
|
||||
lcov ${LCOV_EXTRA_OPTIONS:-} --remove coverage.info '/usr/*' '*/vcpkg_installed/*' '/.cache/*' '*/test/*' --output-file coverage.info
|
||||
lcov ${LCOV_EXTRA_OPTIONS:-} --list coverage.info
|
||||
|
||||
- name: Upload coverage to Codecov (Linux & macOS)
|
||||
if: runner.os != 'Windows'
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: build/coverage.info
|
||||
|
||||
- name: Upload coverage to Codecov (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ctest.cov,build/out/mapnik-test-visual.cov
|
136
.github/workflows/build_and_test.yml
vendored
136
.github/workflows/build_and_test.yml
vendored
|
@ -1,136 +0,0 @@
|
|||
name: Build and Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- "no-ci-*"
|
||||
|
||||
env:
|
||||
VCPKG_BINARY_SOURCES: clear;x-gha,readwrite
|
||||
VCPKG_RELEASE: 2024.06.15
|
||||
|
||||
jobs:
|
||||
checkSource:
|
||||
name: Check Source Code
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- uses: pre-commit/action@v3.0.1
|
||||
|
||||
buildAndTest:
|
||||
name: >-
|
||||
Build & Test
|
||||
(${{ matrix.os }})
|
||||
(C++ ${{ matrix.cxx-standard }})
|
||||
${{ startsWith(matrix.os, 'macos-') && (matrix.os == 'macos-14' && '(ARM64)' || '(AMD64)') || '' }}
|
||||
needs: checkSource
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- macos-14
|
||||
- ubuntu-22.04
|
||||
- windows-2022
|
||||
cxx-standard:
|
||||
- 17
|
||||
|
||||
steps:
|
||||
- name: Checkout Mapnik
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout vcpkg
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: vcpkg
|
||||
ref: ${{ env.VCPKG_RELEASE }}
|
||||
repository: microsoft/vcpkg
|
||||
|
||||
- name: Export GitHub Actions cache environment variables
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
||||
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
||||
|
||||
- name: Install required system packages
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${RUNNER_OS}" == "Linux" ]; then
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install \
|
||||
autoconf \
|
||||
autoconf-archive \
|
||||
automake \
|
||||
gperf \
|
||||
lcov \
|
||||
libxxf86vm-dev \
|
||||
ninja-build \
|
||||
postgresql-client
|
||||
elif [ "${RUNNER_OS}" == "macOS" ]; then
|
||||
brew install \
|
||||
autoconf \
|
||||
autoconf-archive \
|
||||
automake \
|
||||
lcov \
|
||||
libtool \
|
||||
ninja \
|
||||
vcpkg
|
||||
elif [ "${RUNNER_OS}" == "Windows" ]; then
|
||||
choco install \
|
||||
ninja \
|
||||
OpenCppCoverage
|
||||
echo "C:\Program Files\OpenCppCoverage" >> ${GITHUB_PATH}
|
||||
fi
|
||||
|
||||
- name: Enable Developer Command Prompt (Windows)
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
if: runner.os == 'Windows'
|
||||
|
||||
- name: Set CMAKE_BUILD_PARALLEL_LEVEL, CTEST_PARALLEL_LEVEL & PRESET
|
||||
shell: bash
|
||||
run: |
|
||||
PRESET=$(echo "${RUNNER_OS}" | perl -ne "print lc")-ci
|
||||
if [ "${RUNNER_OS}" == "Linux" ]; then
|
||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)" >> ${GITHUB_ENV}
|
||||
echo "CTEST_PARALLEL_LEVEL=$(nproc)" >> ${GITHUB_ENV}
|
||||
elif [ "${RUNNER_OS}" == "macOS" ]; then
|
||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.logicalcpu)" >> ${GITHUB_ENV}
|
||||
echo "CTEST_PARALLEL_LEVEL=$(sysctl -n hw.logicalcpu)" >> ${GITHUB_ENV}
|
||||
PRESET=${PRESET}-${{ matrix.os == 'macos-14' && 'arm64' || 'x64' }}
|
||||
elif [ "${RUNNER_OS}" == "Windows" ]; then
|
||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$(pwsh -Command '(Get-CimInstance -ClassName Win32_ComputerSystem).NumberOfLogicalProcessors')" >> ${GITHUB_ENV}
|
||||
echo "CTEST_PARALLEL_LEVEL=$(pwsh -Command '(Get-CimInstance -ClassName Win32_ComputerSystem).NumberOfLogicalProcessors')" >> ${GITHUB_ENV}
|
||||
fi
|
||||
echo "PRESET=${PRESET}" >> ${GITHUB_ENV}
|
||||
|
||||
- name: Configure CMake
|
||||
shell: bash
|
||||
run: |
|
||||
cmake \
|
||||
-DBUILD_SHARED_LIBS:BOOL=ON \
|
||||
-DCMAKE_CXX_STANDARD:STRING=${{ matrix.cxx-standard }} \
|
||||
-DUSE_MEMORY_MAPPED_FILE:BOOL=ON \
|
||||
-LA \
|
||||
--preset ${PRESET}
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
cmake \
|
||||
--build \
|
||||
--preset ${PRESET}
|
||||
|
||||
- name: Run Tests
|
||||
uses: ./.github/actions/run_tests
|
||||
with:
|
||||
cmake-preset: ${{ env.PRESET }}
|
91
.github/workflows/build_test.yml
vendored
Normal file
91
.github/workflows/build_test.yml
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
name: Build and Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- "no-ci-*"
|
||||
|
||||
jobs:
|
||||
checkSource:
|
||||
name: Check Source Code
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: pre-commit/action@v3.0.0
|
||||
|
||||
windows:
|
||||
needs: checkSource
|
||||
name: Windows memory mapped
|
||||
uses: ./.github/workflows/windows.yml
|
||||
with:
|
||||
VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b
|
||||
NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json
|
||||
NUGET_USERNAME: mapnik
|
||||
USE_MEMORY_MAPPED_FILE: "ON"
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||
|
||||
windows-mmf-off:
|
||||
needs: checkSource
|
||||
name: Windows file based
|
||||
uses: ./.github/workflows/windows.yml
|
||||
with:
|
||||
VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b
|
||||
NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json
|
||||
NUGET_USERNAME: mapnik
|
||||
USE_MEMORY_MAPPED_FILE: "OFF"
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||
|
||||
ubuntu:
|
||||
needs: checkSource
|
||||
name: Linux memory mapped
|
||||
uses: ./.github/workflows/ubuntu.yml
|
||||
with:
|
||||
VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b
|
||||
NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json
|
||||
NUGET_USERNAME: mapnik
|
||||
USE_MEMORY_MAPPED_FILE: "ON"
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||
|
||||
ubuntu-mmf-off:
|
||||
needs: checkSource
|
||||
name: Linux file based
|
||||
uses: ./.github/workflows/ubuntu.yml
|
||||
with:
|
||||
VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b
|
||||
NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json
|
||||
NUGET_USERNAME: mapnik
|
||||
USE_MEMORY_MAPPED_FILE: "OFF"
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||
|
||||
macos:
|
||||
needs: checkSource
|
||||
name: MacOS memory mapped
|
||||
uses: ./.github/workflows/macos.yml
|
||||
with:
|
||||
VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b
|
||||
NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json
|
||||
NUGET_USERNAME: mapnik
|
||||
USE_MEMORY_MAPPED_FILE: "ON"
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
||||
|
||||
macos-mmf-off:
|
||||
needs: checkSource
|
||||
name: MacOS file based
|
||||
uses: ./.github/workflows/macos.yml
|
||||
with:
|
||||
VCPKG_SHA: 34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b
|
||||
NUGET_REGISTRY: https://nuget.pkg.github.com/mapnik/index.json
|
||||
NUGET_USERNAME: mapnik
|
||||
USE_MEMORY_MAPPED_FILE: "OFF"
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT: ${{ secrets.VCPKG_CACHE_PAT }}
|
146
.github/workflows/macos.yml
vendored
Normal file
146
.github/workflows/macos.yml
vendored
Normal file
|
@ -0,0 +1,146 @@
|
|||
name: MacOS
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
VCPKG_SHA:
|
||||
required: true
|
||||
type: string
|
||||
NUGET_REGISTRY:
|
||||
required: true
|
||||
type: string
|
||||
NUGET_USERNAME:
|
||||
required: true
|
||||
type: string
|
||||
USE_MEMORY_MAPPED_FILE:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT:
|
||||
required: true
|
||||
|
||||
env:
|
||||
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite"
|
||||
VCPKG_NUGET_REPOSITORY: https://github.com/mapnik/vcpkg-cache.git
|
||||
UPDATE: 1
|
||||
preset: macos-ci
|
||||
mono: mono
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Install required system packages
|
||||
run: |
|
||||
brew install automake ninja lcov autoconf-archive
|
||||
|
||||
- name: checkout mapnik
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: checkout vcpkg
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: "microsoft/vcpkg"
|
||||
ref: ${{ inputs.VCPKG_SHA }}
|
||||
path: vcpkg
|
||||
|
||||
- name: "Setup vcpkg"
|
||||
shell: bash
|
||||
run: ./vcpkg/bootstrap-vcpkg.sh
|
||||
|
||||
- name: "Setup NuGet Credentials"
|
||||
if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
sources add
|
||||
-source "${{ inputs.NUGET_REGISTRY }}"
|
||||
-storepasswordincleartext
|
||||
-name "GitHub"
|
||||
-username "${{ inputs.NUGET_USERNAME }}"
|
||||
-password "${{ secrets.NUGET_REGISTRY_PAT }}"
|
||||
|
||||
- name: "Setup NuGet apikey"
|
||||
if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
setapikey "${{ secrets.NUGET_REGISTRY_PAT }}" -Source "${{ inputs.NUGET_REGISTRY }}"
|
||||
|
||||
- name: "Setup NuGet Credentials READONLY"
|
||||
if: ${{ github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik' }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
sources add
|
||||
-source "${{ inputs.NUGET_REGISTRY }}"
|
||||
-storepasswordincleartext
|
||||
-name "GitHub"
|
||||
-username "${{ github.actor }}"
|
||||
-password "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: "Setup NuGet apikey READONLY"
|
||||
if: ${{ github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik' }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "${{ inputs.NUGET_REGISTRY }}"
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} --preset=${{ env.preset }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build --preset ${{ env.preset }}
|
||||
|
||||
- name: Test
|
||||
run: ctest --preset ${{ env.preset }}
|
||||
|
||||
- name: Test visuals
|
||||
continue-on-error: true
|
||||
working-directory: build/${{ env.preset }}/out
|
||||
env:
|
||||
PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-osx/share/proj/data
|
||||
run: ./mapnik-test-visual -j $(sysctl -n hw.logicalcpu) --output-dir ./visual-test-result
|
||||
|
||||
- name: Pack visual test results
|
||||
working-directory: build/${{ env.preset }}/out
|
||||
run: tar cfvz visual-test-results.tar.gz ./visual-test-result
|
||||
|
||||
- name: Run Benchmark
|
||||
working-directory: build/${{ env.preset }}/out
|
||||
env:
|
||||
PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-osx/share/proj/data
|
||||
run: ./run_benchmarks
|
||||
|
||||
- name: Coverage
|
||||
working-directory: build/${{ env.preset }}
|
||||
run: |
|
||||
lcov --directory . --capture --output-file coverage.info
|
||||
lcov --remove coverage.info '/usr/*' '*/vcpkg_installed/*' '/.cache/*' '*/test/*' --output-file coverage.info
|
||||
lcov --list coverage.info
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
files: build/${{ env.preset }}/coverage.info
|
||||
|
||||
- name: Package
|
||||
if: failure()
|
||||
run: cmake --build --preset ${{ env.preset }} --target package
|
||||
|
||||
- name: Upload mapnik build artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: ${{ env.preset }}-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }}
|
||||
path: build/${{ env.preset }}/mapnik-*.tar.gz
|
||||
retention-days: 2
|
||||
|
||||
- name: Upload visual test results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.preset }}-visual-tests-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }}
|
||||
path: build/${{ env.preset }}/out/visual-test-results.tar.gz
|
||||
retention-days: 2
|
55
.github/workflows/release_linux.yml
vendored
55
.github/workflows/release_linux.yml
vendored
|
@ -1,55 +0,0 @@
|
|||
name: Release Linux
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- "no-ci-*"
|
||||
env:
|
||||
PRESET: linux-ci-release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-22.04"
|
||||
steps:
|
||||
|
||||
- name: checkout mapnik
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: "Install required system packages"
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y ninja-build\
|
||||
libicu-dev \
|
||||
libfreetype6-dev \
|
||||
libharfbuzz-dev \
|
||||
libxml2-dev \
|
||||
libjpeg-dev \
|
||||
libtiff-dev \
|
||||
libwebp-dev \
|
||||
libcairo2-dev \
|
||||
libproj-dev \
|
||||
libgdal-dev \
|
||||
libboost-filesystem-dev \
|
||||
libboost-program-options-dev \
|
||||
libboost-regex-dev
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -LA --preset ${{ env.PRESET }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build --preset ${{ env.PRESET }}
|
||||
|
||||
- name: Package
|
||||
run: cmake --build --preset ${{ env.PRESET }} --target package
|
||||
|
||||
- name: Upload mapnik debian package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.PRESET }}-deb
|
||||
path: build/mapnik-*.deb
|
162
.github/workflows/ubuntu.yml
vendored
Normal file
162
.github/workflows/ubuntu.yml
vendored
Normal file
|
@ -0,0 +1,162 @@
|
|||
name: Ubuntu
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
VCPKG_SHA:
|
||||
required: true
|
||||
type: string
|
||||
NUGET_REGISTRY:
|
||||
required: true
|
||||
type: string
|
||||
NUGET_USERNAME:
|
||||
required: true
|
||||
type: string
|
||||
USE_MEMORY_MAPPED_FILE:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT:
|
||||
required: true
|
||||
|
||||
env:
|
||||
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite"
|
||||
VCPKG_NUGET_REPOSITORY: https://github.com/mapnik/vcpkg-cache.git
|
||||
UPDATE: 1
|
||||
preset: linux-ci
|
||||
mono: mono
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgis/postgis
|
||||
env:
|
||||
POSTGRES_PASSWORD: password
|
||||
POSTGRES_DB: mapnik-tmp-postgis-test-db
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- name: Install required system packages
|
||||
shell: "bash"
|
||||
run: |
|
||||
sudo apt-get install -y gperf libxxf86vm-dev ninja-build postgresql-client lcov autoconf-archive
|
||||
|
||||
- name: checkout mapnik
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: checkout vcpkg
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: "microsoft/vcpkg"
|
||||
ref: ${{ inputs.VCPKG_SHA }}
|
||||
path: vcpkg
|
||||
|
||||
- name: "Setup vcpkg"
|
||||
shell: bash
|
||||
run: ./vcpkg/bootstrap-vcpkg.sh
|
||||
|
||||
- name: "Setup NuGet Credentials"
|
||||
if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
sources add
|
||||
-source "${{ inputs.NUGET_REGISTRY }}"
|
||||
-storepasswordincleartext
|
||||
-name "GitHub"
|
||||
-username "${{ inputs.NUGET_USERNAME }}"
|
||||
-password "${{ secrets.NUGET_REGISTRY_PAT }}"
|
||||
|
||||
- name: "Setup NuGet apikey"
|
||||
if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
setapikey "${{ secrets.NUGET_REGISTRY_PAT }}" -Source "${{ inputs.NUGET_REGISTRY }}"
|
||||
|
||||
- name: "Setup NuGet Credentials READONLY"
|
||||
if: ${{ github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik' }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
sources add
|
||||
-source "${{ inputs.NUGET_REGISTRY }}"
|
||||
-storepasswordincleartext
|
||||
-name "GitHub"
|
||||
-username "${{ github.actor }}"
|
||||
-password "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: "Setup NuGet apikey READONLY"
|
||||
if: ${{ github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik' }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
${{ env.mono }} `./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "${{ inputs.NUGET_REGISTRY }}"
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} --preset=${{ env.preset }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build --preset ${{ env.preset }}
|
||||
|
||||
- name: Test
|
||||
run: ctest --preset ${{ env.preset }}
|
||||
|
||||
- name: Test visuals
|
||||
continue-on-error: true
|
||||
working-directory: build/${{ env.preset }}/out
|
||||
env:
|
||||
PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-linux/share/proj/data
|
||||
run: ./mapnik-test-visual -j $(nproc) --output-dir ./visual-test-result
|
||||
|
||||
- name: Pack visual test results
|
||||
working-directory: build/${{ env.preset }}/out
|
||||
run: tar cfvz visual-test-results.tar.gz ./visual-test-result
|
||||
|
||||
- name: Run Benchmarks
|
||||
working-directory: build/${{ env.preset }}/out
|
||||
env:
|
||||
PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-linux/share/proj/data
|
||||
run: ./run_benchmarks
|
||||
|
||||
- name: Coverage
|
||||
working-directory: build/${{ env.preset }}
|
||||
run: |
|
||||
lcov --directory . --capture --output-file coverage.info
|
||||
lcov --remove coverage.info '/usr/*' '*/vcpkg_installed/*' '/.cache/*' '*/test/*' --output-file coverage.info
|
||||
lcov --list coverage.info
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
files: build/${{ env.preset }}/coverage.info
|
||||
|
||||
- name: Package
|
||||
if: failure()
|
||||
run: cmake --build --preset ${{ env.preset }} --target package
|
||||
|
||||
- name: Upload mapnik build artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: ${{ env.preset }}-artifact-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }}
|
||||
path: build/${{ env.preset }}/mapnik-*.tar.gz
|
||||
retention-days: 2
|
||||
|
||||
- name: Upload visual test results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.preset }}-visual-tests-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }}
|
||||
path: build/${{ env.preset }}/out/visual-test-results.tar.gz
|
||||
retention-days: 2
|
135
.github/workflows/windows.yml
vendored
Normal file
135
.github/workflows/windows.yml
vendored
Normal file
|
@ -0,0 +1,135 @@
|
|||
name: Windows
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
VCPKG_SHA:
|
||||
required: true
|
||||
type: string
|
||||
NUGET_REGISTRY:
|
||||
required: true
|
||||
type: string
|
||||
NUGET_USERNAME:
|
||||
required: true
|
||||
type: string
|
||||
USE_MEMORY_MAPPED_FILE:
|
||||
required: true
|
||||
type: string
|
||||
secrets:
|
||||
NUGET_REGISTRY_PAT:
|
||||
required: true
|
||||
|
||||
env:
|
||||
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite"
|
||||
VCPKG_NUGET_REPOSITORY: https://github.com/mapnik/vcpkg-cache.git
|
||||
UPDATE: 1
|
||||
preset: windows-ci
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Install required system packages
|
||||
run: |
|
||||
choco install ninja OpenCppCoverage
|
||||
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: checkout mapnik
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: "recursive"
|
||||
|
||||
- name: checkout vcpkg
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: "microsoft/vcpkg"
|
||||
ref: ${{ inputs.VCPKG_SHA }}
|
||||
path: vcpkg
|
||||
|
||||
- name: "Setup vcpkg"
|
||||
run: ./vcpkg/bootstrap-vcpkg.bat
|
||||
|
||||
- name: "Setup NuGet Credentials"
|
||||
if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
`./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
sources add
|
||||
-source "${{ inputs.NUGET_REGISTRY }}"
|
||||
-storepasswordincleartext
|
||||
-name "GitHub"
|
||||
-username "${{ inputs.NUGET_USERNAME }}"
|
||||
-password "${{ secrets.NUGET_REGISTRY_PAT }}"
|
||||
|
||||
- name: "Setup NuGet apikey"
|
||||
if: ${{ !(github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik') }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
`./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
setapikey "${{ secrets.NUGET_REGISTRY_PAT }}" -Source "${{ inputs.NUGET_REGISTRY }}"
|
||||
|
||||
- name: "Setup NuGet Credentials READONLY"
|
||||
if: ${{ github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik' }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
`./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
sources add
|
||||
-source "${{ inputs.NUGET_REGISTRY }}"
|
||||
-storepasswordincleartext
|
||||
-name "GitHub"
|
||||
-username "${{ github.actor }}"
|
||||
-password "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: "Setup NuGet apikey READONLY"
|
||||
if: ${{ github.event_name == 'pull_request' || github.repository != 'mapnik/mapnik' }}
|
||||
shell: "bash"
|
||||
run: >
|
||||
`./vcpkg/vcpkg fetch nuget | tail -n 1`
|
||||
setapikey "${{ secrets.GITHUB_TOKEN }}" -Source "${{ inputs.NUGET_REGISTRY }}"
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -DUSE_MEMORY_MAPPED_FILE=${{ inputs.USE_MEMORY_MAPPED_FILE }} --preset ${{env.preset}}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build --preset ${{env.preset}}
|
||||
|
||||
- name: Test
|
||||
run: OpenCppCoverage --modules *libmapnik* --modules mapnik*.exe --modules *.input --sources ${{ github.workspace }} --export_type binary --cover_children -- ctest --preset ${{env.preset}}
|
||||
|
||||
- name: Test visuals
|
||||
shell: pwsh
|
||||
continue-on-error: true
|
||||
working-directory: build/${{ env.preset }}/out
|
||||
env:
|
||||
PROJ_LIB: ${{ github.workspace }}/build/${{ env.preset }}/vcpkg_installed/x64-windows/share/proj/data
|
||||
run: OpenCppCoverage --modules *libmapnik* --modules mapnik*.exe --modules *.input --sources ${{ github.workspace }} --export_type binary --input_coverage=${{ github.workspace }}/ctest.cov --cover_children -- .\mapnik-test-visual.exe -j (Get-CimInstance -ClassName Win32_ComputerSystem).NumberOfLogicalProcessors --output-dir ./visual-test-result
|
||||
|
||||
- name: Pack visual test results
|
||||
working-directory: build/${{ env.preset }}/out
|
||||
run: tar cfvz visual-test-results.tar.gz ./visual-test-result
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
files: build/${{ env.preset }}/out/mapnik-test-visual.cov
|
||||
|
||||
- name: Package
|
||||
if: failure()
|
||||
run: cmake --build --preset ${{env.preset}} --target package
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: failure()
|
||||
with:
|
||||
name: ${{ env.preset }}-artifact-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }}
|
||||
path: build/*-ci/mapnik-*.tar.gz
|
||||
retention-days: 2
|
||||
|
||||
- name: Upload visual test results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ env.preset }}-visual-tests-mmio-${{ inputs.USE_MEMORY_MAPPED_FILE }}
|
||||
path: build/${{ env.preset }}/out/visual-test-results.tar.gz
|
||||
retention-days: 2
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,5 @@
|
|||
.DS_Store
|
||||
.vscode
|
||||
.cache
|
||||
*.gcov
|
||||
*.gcda
|
||||
*.gcno
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
rev: v4.3.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
files: ^.*\.cmake|CMakeLists\.txt$
|
||||
|
@ -10,7 +10,7 @@ repos:
|
|||
files: ^.*\.cmake|CMakeLists\.txt$
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v18.1.3
|
||||
rev: v14.0.6
|
||||
hooks:
|
||||
- id: clang-format
|
||||
types_or: [c++, c]
|
||||
|
|
98
.travis.yml
Normal file
98
.travis.yml
Normal file
|
@ -0,0 +1,98 @@
|
|||
language: cpp
|
||||
|
||||
git:
|
||||
depth: 10
|
||||
submodules: false
|
||||
|
||||
env:
|
||||
global:
|
||||
- CCACHE_TEMPDIR=/tmp/.ccache-temp
|
||||
- CCACHE_COMPRESS=1
|
||||
- PREFIX=/tmp/mapnik
|
||||
- PYTHON=python3
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.ccache
|
||||
|
||||
dist: xenial
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
name: Linux clang
|
||||
env: >-
|
||||
CXX="ccache clang++ -Qunused-arguments"
|
||||
CC="clang"
|
||||
addons:
|
||||
postgresql: "9.5"
|
||||
apt:
|
||||
sources: [ 'ubuntu-toolchain-r-test' ]
|
||||
packages: [ 'xutils-dev', 'libstdc++-6-dev', 'postgresql-9.5-postgis-2.4' ]
|
||||
- os: linux
|
||||
name: Linux clang + coverage
|
||||
env: >-
|
||||
CXX="ccache clang++ -Qunused-arguments"
|
||||
CC="clang"
|
||||
COVERAGE=true
|
||||
QUIET=true
|
||||
before_install:
|
||||
- export LLVM_COV="llvm-cov"
|
||||
addons:
|
||||
postgresql: "9.5"
|
||||
apt:
|
||||
sources: [ 'ubuntu-toolchain-r-test' ]
|
||||
packages: [ 'xutils-dev', 'libstdc++-6-dev','postgresql-9.5-postgis-2.4' ]
|
||||
- os: osx
|
||||
name: OSX clang
|
||||
#https://docs.travis-ci.com/user/reference/osx#macos-version
|
||||
osx_image: xcode12.2
|
||||
env: >-
|
||||
CXX="ccache clang++ -Qunused-arguments"
|
||||
before_install:
|
||||
|
||||
install:
|
||||
- source scripts/travis-common.sh
|
||||
# workaround travis rvm bug
|
||||
# http://superuser.com/questions/1044130/why-am-i-having-how-can-i-fix-this-error-shell-session-update-command-not-f
|
||||
- on 'osx' rvm get head || true
|
||||
- export PATH=${PREFIX}/bin:$(pwd)/mason_packages/.link/bin:${PATH}
|
||||
- export COVERAGE=${COVERAGE:-false}
|
||||
- export BENCH=${BENCH:-false}
|
||||
- on 'osx' export DATA_PATH=$(brew --prefix)/var/postgres
|
||||
- on 'osx' rm -rf ${DATA_PATH}
|
||||
- on 'osx' initdb ${DATA_PATH} -E utf8
|
||||
- on 'osx' pg_ctl -w start -l postgres.log --pgdata ${DATA_PATH};
|
||||
- on 'osx' cat postgres.log;
|
||||
- on 'osx' createuser -s postgres
|
||||
- psql -c 'create database template_postgis;' -U postgres
|
||||
- psql -c 'create extension postgis;' -d template_postgis -U postgres
|
||||
- enabled ${COVERAGE} curl -S -f https://codecov.io/bash -o codecov
|
||||
- enabled ${COVERAGE} chmod +x codecov
|
||||
|
||||
before_script:
|
||||
- export JOBS=${JOBS:-4}
|
||||
- export HEAVY_JOBS=${HEAVY_JOBS:-2}
|
||||
- export SCONSFLAGS='--debug=time'
|
||||
- source bootstrap.sh
|
||||
- ccache --version
|
||||
- ccache -p || true
|
||||
- ccache --show-stats || true
|
||||
- commit_message_parse
|
||||
|
||||
script:
|
||||
- git_submodule_update --init deps/
|
||||
- on 'osx' brew unlink $(brew list --formula)
|
||||
- on 'osx' brew link git postgresql postgis
|
||||
- configure BENCHMARK=${BENCH} ENABLE_GLIBC_WORKAROUND=${ENABLE_GLIBC_WORKAROUND:-false} QUIET=${QUIET:-false}
|
||||
#- cat config.log => comment out to reduce log size limit on travis-ci
|
||||
# we limit the `make` to 40 min
|
||||
# to ensure that slow builds still upload their
|
||||
# ccache results and therefore should be faster
|
||||
# (and might work) for the next build
|
||||
- DEADLINE=$(( $(date +%s) + 40 * 60 ))
|
||||
- scripts/travis-command-wrapper.py -s "date" -i 120 --deadline="$DEADLINE" make
|
||||
- test_ok && git_submodule_update --init --depth=50 test/
|
||||
- test_ok && make test
|
||||
- test_ok && enabled ${COVERAGE} coverage
|
||||
- test_ok && enabled ${BENCH} make bench
|
||||
- ./scripts/check_glibcxx.sh
|
38
CHANGELOG.md
38
CHANGELOG.md
|
@ -6,44 +6,12 @@ Developers: Please commit along with changes.
|
|||
|
||||
For a complete change history, see the git log.
|
||||
|
||||
## Mapnik 4.0.3
|
||||
|
||||
Released October 30th, 2024
|
||||
|
||||
(Packaged from [05389e3c7](https://github.com/mapnik/mapnik/commit/05389e3c7))
|
||||
|
||||
- Remove 'final' specifier from invalid_featureset implementation
|
||||
(issues with dynamic_cast<> when building using Apple clang version 16.0.0 on darwin-arm64)
|
||||
- Rename invalid_featureset to empty_featureset
|
||||
- Upgrade to SCons v4.8.1
|
||||
- Fix unit tests e.g #endif statement (via @bgardner-noggin)
|
||||
|
||||
## Mapnik 4.0.2
|
||||
|
||||
Released August 21st, 2024
|
||||
|
||||
- CMake build - set `SOVERSION` to `${MAPNIK_MAJOR_VERSION}.${MAPNIK_MINOR_VERSION}`
|
||||
- Upgraded SCons build system to v4.8.0
|
||||
|
||||
## Mapnik 4.0.1
|
||||
|
||||
- Use CMAKE_INSTALL_LIBDIR for libdir in pkg-config files
|
||||
- Support gcc 14
|
||||
- Improved accuracy of bounding box re-projections. Automatic spliting at (0, 0) and merging results.
|
||||
- Fixes missing features when using WGS 84 / Arctic Polar Stereographic (`epsg:4326 <-> epsg:3995`)
|
||||
- Added `area_of_use` method to `mapnik::projection`
|
||||
|
||||
## Mapnik 4.0.0
|
||||
## UNRELEASED
|
||||
|
||||
#### Notice
|
||||
|
||||
- Mapnik now requires C++17 compliant compiler (`-std=c++17`)
|
||||
- Mapnik now supports CMake as a build system. See [#4191](https://github.com/mapnik/mapnik/pull/4191) and the [docs](https://github.com/mapnik/mapnik/blob/master/docs/cmake-usage.md) for more info.
|
||||
|
||||
#### Breaking Changes
|
||||
|
||||
- Reworked datasource plugin system. Plugins now need to implement a class with the macros in `datasource_plugin.hpp` ([#4291](https://github.com/mapnik/mapnik/pull/4291))
|
||||
- mapnik now has a global `mapnik::setup()` method which have to be called before any other functions of mapnik. Defined in `mapnik.hpp`. Currently there is a auto setup functionality. It can be disabled using the cmake option `DISABLE_MAPNIK_AUTOSETUP=ON`. Note: In order not to insert this change into every code base, it is currently still called during the dynamic initialisation time. However, if mapnik is compiled statically, this function must be called. ([#4291](https://github.com/mapnik/mapnik/pull/4291))
|
||||
- Mapnik now requires C++14 compliant compiler (`-std=c++14`)
|
||||
|
||||
#### Core
|
||||
|
||||
|
@ -59,8 +27,6 @@ Released August 21st, 2024
|
|||
- Slightly improved `sql_utils::table_from_sql` ([2587bb3](https://github.com/mapnik/mapnik/commit/2587bb3a1d8db397acfa8dcc2d332da3a8a9399f))
|
||||
- Added wrappers for proper quoting in SQL query construction: `sql_utils::identifier`, `sql_utils::literal` ([7b21713](https://github.com/mapnik/mapnik/commit/7b217133e2749b82c2638551045c4edbece15086))
|
||||
- Added two-argument `sql_utils::unquote`, `sql_utils::unquote_copy` that also collapse inner quotes ([a4e8ea2](https://github.com/mapnik/mapnik/commit/a4e8ea21be297d89bbf36ba594d6c661a7a9ac81))
|
||||
- Fixed mapnik static build with static plugins ([#4291](https://github.com/mapnik/mapnik/pull/4291))
|
||||
- Reworked mapnik::enumeration<...> ([#4372](https://github.com/mapnik/mapnik/pull/4372))
|
||||
|
||||
#### Plugins
|
||||
|
||||
|
|
128
CMakeLists.txt
128
CMakeLists.txt
|
@ -16,7 +16,6 @@ message(STATUS "mapnik version: ${PROJECT_VERSION}")
|
|||
# https://cliutils.gitlab.io/modern-cmake/chapters/features/ides.html
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL ON) # with newer cmake versions put all find_package in global scope
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
include(FeatureSummary)
|
||||
include(MapnikOption)
|
||||
|
@ -28,13 +27,8 @@ include(CTest)
|
|||
add_feature_info(BUILD_TESTING BUILD_TESTING "Adds tests")
|
||||
|
||||
mapnik_option(INSTALL_DEPENDENCIES "if ON, all dependencies (eg. required dlls) will be copied into CMAKE_INSTALL_PREFIX/MAPNIK_BIN_DIR." ON)
|
||||
mapnik_option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON)
|
||||
mapnik_option(BUILD_SHARED_PLUGINS "build dynamic plugins" ${BUILD_SHARED_LIBS}) # use BUILD_SHARED_LIBS as default option
|
||||
mapnik_option(BUILD_SHARED_CRT "(only windows with msvc) use msvc shared crt" ON)
|
||||
if(WIN32 AND BUILD_SHARED_PLUGINS AND NOT BUILD_SHARED_LIBS)
|
||||
message(FATAL_ERROR "static libmapnik and dynamic plugins won't work correctly")
|
||||
endif()
|
||||
|
||||
mapnik_option(BUILD_SHARED_LIBS "build mapnik dynamic(ON) or static(OFF)" ON)
|
||||
mapnik_option(USE_EXTERNAL_MAPBOX_GEOMETRY "Use a external mapnik/geometry.hpp. If off, use the submodule" OFF)
|
||||
mapnik_option(USE_EXTERNAL_MAPBOX_POLYLABEL "Use a external mapnik/polylabel. If off, use the submodule" OFF)
|
||||
mapnik_option(USE_EXTERNAL_MAPBOX_PROTOZERO "Use a external mapnik/protozero. If off, use the submodule" OFF)
|
||||
|
@ -49,7 +43,6 @@ mapnik_option(USE_PROJ "adds proj support" ON)
|
|||
mapnik_option(USE_GRID_RENDERER "adds grid renderer" ON)
|
||||
mapnik_option(USE_SVG_RENDERER "adds svg renderer" ON)
|
||||
mapnik_option(USE_BIGINT "uses 64 bit instead of 32" ON)
|
||||
mapnik_option(USE_BOOST_FILESYSTEM "use boost::filesytem even if `std::filesystem` is available (since c++17)" OFF)
|
||||
mapnik_option(USE_MEMORY_MAPPED_FILE "uses file cache" ON)
|
||||
mapnik_option(USE_MULTITHREADED "enables the multithreaded features (threadsafe)" ON)
|
||||
mapnik_option(USE_NO_ATEXIT "disable atexit" OFF)
|
||||
|
@ -63,8 +56,6 @@ mapnik_option(USE_LOG "enables logging output. See log severity level." OFF)
|
|||
set(USE_LOG_SEVERITY "1" CACHE STRING "sets the logging severity (only applies when USE_LOG is ON")
|
||||
mapnik_option(USE_STATS "Enable statistics reporting" OFF)
|
||||
|
||||
mapnik_option(DISABLE_MAPNIK_AUTOSETUP "disables the autosetup. Need to call mapnik::setup() then" OFF)
|
||||
|
||||
mapnik_option(USE_PLUGIN_INPUT_CSV "adds plugin input csv" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_GDAL "adds plugin input gdal" ON)
|
||||
mapnik_option(USE_PLUGIN_INPUT_GEOBUF "adds plugin input geobuf" ON)
|
||||
|
@ -96,6 +87,18 @@ mapnik_option(USE_GLIBC_WORKAROUND "see https://github.com/mapnik/mapnik/pull/37
|
|||
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
|
||||
feature_summary(FILENAME "${CMAKE_CURRENT_BINARY_DIR}/features.log" WHAT ENABLED_FEATURES DISABLED_FEATURES)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14 CACHE STRING "Sets the c++ standard. c++14 is minimum.")
|
||||
message(STATUS "Using c++${CMAKE_CXX_STANDARD}")
|
||||
# https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html
|
||||
set(CXX_EXTENSIONS OFF CACHE STRING "Enables the compiler specific extensions.") # Fallsback to -std=c++<ver> if off
|
||||
message(STATUS "Using c++ extensions: ${CXX_EXTENSIONS}")
|
||||
# https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD_REQUIRED.html#prop_tgt:CXX_STANDARD_REQUIRED
|
||||
set(CXX_STANDARD_REQUIRED ON) # require the specified CMAKE_CXX_STANDARD
|
||||
|
||||
# add debug postfix to the libraries
|
||||
set(MAPNIK_DEBUG_POSTFIX "d" CACHE STRING "sets the debug library postfix on mapnik, wkt and json")
|
||||
message(STATUS "postfix for debug libraries: ${MAPNIK_DEBUG_POSTFIX}")
|
||||
|
||||
include(GNUInstallDirs)
|
||||
# See for more details: https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html
|
||||
set(MAPNIK_BIN_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "Install directory for binaries")
|
||||
|
@ -120,32 +123,9 @@ set(MAPNIK_COMPILE_DEFS "")
|
|||
set(MAPNIK_OPTIONAL_LIBS "")
|
||||
set(MAPNIK_OPTIONAL_LIBS_INCLUDE "")
|
||||
|
||||
#############################
|
||||
#############################
|
||||
# Begin project configuration
|
||||
#############################
|
||||
#############################
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17 CACHE STRING "Sets the c++ standard. c++17 is minimum.")
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) # require the specified CMAKE_CXX_STANDARD
|
||||
set(CMAKE_CXX_EXTENSIONS OFF CACHE STRING "Enables the compiler specific extensions.") # Fallsback to -std=c++<ver> if off
|
||||
message(STATUS "Using c++${CMAKE_CXX_STANDARD}")
|
||||
message(STATUS "Using c++ extensions: ${CXX_EXTENSIONS}")
|
||||
|
||||
# add debug postfix to the libraries
|
||||
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "sets the debug library postfix on mapnik, wkt and json")
|
||||
message(STATUS "postfix for debug libraries: ${CMAKE_DEBUG_POSTFIX}")
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<BOOL:${BUILD_SHARED_CRT}>:DLL>")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib")
|
||||
|
||||
# needs to be before the first call of find_boost.
|
||||
if(CMAKE_CXX_STANDARD VERSION_LESS 17)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS BOOST_SPIRIT_X3_HIDE_CXX17_WARNING)
|
||||
endif()
|
||||
|
||||
if(USE_MULTITHREADED)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_THREADSAFE)
|
||||
|
@ -154,18 +134,11 @@ else()
|
|||
endif()
|
||||
|
||||
|
||||
mapnik_find_package(PkgConfig REQUIRED)
|
||||
find_package(PkgConfig)
|
||||
mapnik_find_threads()
|
||||
mapnik_find_package(ICU REQUIRED COMPONENTS uc i18n data)
|
||||
|
||||
mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS regex)
|
||||
if(CMAKE_CXX_STANDARD VERSION_LESS 17)
|
||||
set(USE_BOOST_FILESYSTEM ON CACHE BOOL "Use boost::filesystem" FORCE)
|
||||
endif()
|
||||
if(USE_BOOST_FILESYSTEM)
|
||||
mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS filesystem system)
|
||||
endif()
|
||||
|
||||
mapnik_find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS filesystem system regex)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS BOOST_REGEX_HAS_ICU)
|
||||
if(USE_BOOST_REGEX_ICU_WORKAROUND)
|
||||
message(STATUS "using boost regex workaround")
|
||||
|
@ -190,7 +163,7 @@ else()
|
|||
# It might be possible that in future version harfbuzz could only be found via pkg-config.
|
||||
# harfbuzz related discussion: https://github.com/harfbuzz/harfbuzz/issues/2653
|
||||
message(STATUS "harfbuzz not found via cmake. Searching via pkg-config...")
|
||||
mapnik_pkg_check_modules(harfbuzz REQUIRED IMPORTED_TARGET harfbuzz>=${HARFBUZZ_MIN_VERSION})
|
||||
pkg_check_modules(harfbuzz REQUIRED IMPORTED_TARGET harfbuzz>=${HARFBUZZ_MIN_VERSION})
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::harfbuzz)
|
||||
endif()
|
||||
|
||||
|
@ -268,11 +241,6 @@ if(USE_BIGINT)
|
|||
list(APPEND MAPNIK_COMPILE_DEFS BIGINT)
|
||||
endif()
|
||||
|
||||
if(USE_BOOST_FILESYSTEM)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS USE_BOOST_FILESYSTEM)
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS Boost::filesystem)
|
||||
endif()
|
||||
|
||||
if(USE_MEMORY_MAPPED_FILE)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_MEMORY_MAPPED_FILE)
|
||||
endif()
|
||||
|
@ -322,15 +290,20 @@ if(USE_TIFF)
|
|||
endif()
|
||||
|
||||
if(USE_WEBP)
|
||||
mapnik_pkg_check_modules(WebP REQUIRED IMPORTED_TARGET libwebp)
|
||||
mapnik_find_package(WebP REQUIRED)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS HAVE_WEBP)
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::WebP)
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS WebP::WebP)
|
||||
endif()
|
||||
|
||||
if(USE_CAIRO)
|
||||
mapnik_pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo)
|
||||
if(WIN32)
|
||||
mapnik_find_package(Cairo REQUIRED)
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS Cairo::Cairo)
|
||||
else()
|
||||
pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo)
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::Cairo)
|
||||
endif()
|
||||
list(APPEND MAPNIK_COMPILE_DEFS HAVE_CAIRO)
|
||||
list(APPEND MAPNIK_OPTIONAL_LIBS PkgConfig::Cairo)
|
||||
endif()
|
||||
|
||||
if(USE_PROJ)
|
||||
|
@ -339,7 +312,7 @@ if(USE_PROJ)
|
|||
# currently the cmake files are not installed, when installing proj via apt-get. So search via pkg-config
|
||||
if(NOT PROJ_FOUND)
|
||||
message(STATUS "PROJ not found via FindPROJ. Searching via pkg-config...")
|
||||
mapnik_pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj>=${PROJ_MIN_VERSION})
|
||||
pkg_check_modules(PROJ REQUIRED IMPORTED_TARGET proj>=${PROJ_MIN_VERSION})
|
||||
string(REGEX MATCH "([0-9]+)\.([0-9]+)\.([0-9]+)" _dummy "${PROJ_VERSION}")
|
||||
set(PROJ_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
set(PROJ_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||
|
@ -371,24 +344,10 @@ if(NOT WIN32)
|
|||
list(APPEND MAPNIK_OPTIONAL_LIBS ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_SHARED_PLUGINS)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_PLUGINS)
|
||||
endif()
|
||||
# when building static, this have to be public so that all depending libs know about
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_STATIC_DEFINE)
|
||||
endif()
|
||||
|
||||
if(DISABLE_MAPNIK_AUTOSETUP)
|
||||
list(APPEND MAPNIK_COMPILE_DEFS MAPNIK_DISABLE_AUTOSETUP)
|
||||
endif()
|
||||
|
||||
# force utf-8 source code processing
|
||||
# see https://docs.microsoft.com/de-de/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170
|
||||
add_compile_options(
|
||||
"$<$<CXX_COMPILER_ID:MSVC>:/utf-8>"
|
||||
"$<$<CXX_COMPILER_ID:MSVC>:/EHsc>"
|
||||
)
|
||||
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
|
||||
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
|
||||
|
||||
add_library(core INTERFACE)
|
||||
add_library(mapnik::core ALIAS core)
|
||||
|
@ -410,28 +369,17 @@ target_link_libraries(core INTERFACE
|
|||
ICU::i18n
|
||||
Boost::headers
|
||||
Boost::regex
|
||||
Boost::filesystem
|
||||
Freetype::Freetype
|
||||
${MAPNIK_OPTIONAL_LIBS}
|
||||
)
|
||||
|
||||
target_compile_definitions(core INTERFACE ${MAPNIK_COMPILE_DEFS})
|
||||
|
||||
mapnik_install(core)
|
||||
|
||||
###
|
||||
# forward declaring libraries to consume them when building static plugins (circle deps between mapnik <-> plugin_target)
|
||||
add_library(mapnik "")
|
||||
add_library(mapnik::mapnik ALIAS mapnik)
|
||||
add_library(wkt STATIC "")
|
||||
add_library(mapnik::wkt ALIAS wkt)
|
||||
add_library(json STATIC "")
|
||||
add_library(mapnik::json ALIAS json)
|
||||
# end forward declaration
|
||||
###
|
||||
|
||||
add_subdirectory(deps)
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(plugins)
|
||||
add_subdirectory(utils)
|
||||
add_subdirectory(demo)
|
||||
if(BUILD_BENCHMARK)
|
||||
|
@ -448,23 +396,23 @@ feature_summary(FILENAME "${CMAKE_CURRENT_BINARY_DIR}/packages.log" WHAT PACKAGE
|
|||
include(MapnikExport)
|
||||
include(MapnikExportPkgConfig)
|
||||
|
||||
install(DIRECTORY include/mapnik/ DESTINATION "${MAPNIK_INCLUDE_DIR}/mapnik")
|
||||
install(DIRECTORY deps/agg/include/ DESTINATION "${MAPNIK_INCLUDE_DIR}/mapnik/agg")
|
||||
install(DIRECTORY deps/mapnik DESTINATION "${MAPNIK_INCLUDE_DIR}")
|
||||
install(DIRECTORY include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
install(DIRECTORY deps/agg/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
install(DIRECTORY deps/mapnik DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
file(GLOB TTF_FONT_FILES "fonts/*/*/*.ttf")
|
||||
install(FILES ${TTF_FONT_FILES} DESTINATION "${FONTS_INSTALL_DIR}")
|
||||
install(FILES ${TTF_FONT_FILES} DESTINATION ${FONTS_INSTALL_DIR})
|
||||
|
||||
if(NOT USE_EXTERNAL_MAPBOX_GEOMETRY)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}")
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/geometry/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
endif()
|
||||
if(NOT USE_EXTERNAL_MAPBOX_POLYLABEL)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}")
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/polylabel/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
endif()
|
||||
if(NOT USE_EXTERNAL_MAPBOX_PROTOZERO)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}")
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/protozero/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
endif()
|
||||
if(NOT USE_EXTERNAL_MAPBOX_VARIANT)
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/" DESTINATION "${MAPNIK_INCLUDE_DIR}")
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/mapbox/variant/include/ DESTINATION ${MAPNIK_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
mapnik_install_targets()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"version": 6,
|
||||
"version": 2,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 25,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
|
@ -17,7 +17,7 @@
|
|||
{
|
||||
"name": "default-build-dir",
|
||||
"hidden": true,
|
||||
"binaryDir": "${sourceDir}/build"
|
||||
"binaryDir": "${sourceDir}/build/${presetName}"
|
||||
},
|
||||
{
|
||||
"name": "debug-build",
|
||||
|
@ -180,9 +180,8 @@
|
|||
"cacheVariables": {
|
||||
"BUILD_TESTING": "ON",
|
||||
"BUILD_DEMO_VIEWER": "OFF",
|
||||
"DISABLE_MAPNIK_AUTOSETUP": "ON"
|
||||
},
|
||||
"toolchainFile": "vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
"CMAKE_TOOLCHAIN_FILE": "vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-ci",
|
||||
|
@ -193,10 +192,10 @@
|
|||
],
|
||||
"cacheVariables": {
|
||||
"INSTALL_DEPENDENCIES": "ON",
|
||||
"ADDITIONAL_LIBARIES_PATHS": "${sourceDir}/build/vcpkg_installed/x64-windows/bin"
|
||||
"ADDITIONAL_LIBARIES_PATHS": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-windows/bin"
|
||||
},
|
||||
"environment": {
|
||||
"PROJ_LIB": "${sourceDir}/build/vcpkg_installed/x64-windows/share/proj"
|
||||
"PROJ_LIB": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-windows/share/proj/data"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -211,24 +210,11 @@
|
|||
"CMAKE_CXX_FLAGS": "--coverage"
|
||||
},
|
||||
"environment": {
|
||||
"PROJ_LIB": "${sourceDir}/build/vcpkg_installed/x64-linux/share/proj"
|
||||
"PROJ_LIB": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-linux/share/proj/data"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-ci-release",
|
||||
"description": "used by the ci pipeline for releasing",
|
||||
"inherits": [
|
||||
"release-build",
|
||||
"linux-gcc-release"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"BUILD_TESTING": "OFF",
|
||||
"BUILD_DEMO_VIEWER": "OFF",
|
||||
"USE_MEMORY_MAPPED_FILE": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-ci-arm64",
|
||||
"name": "macos-ci",
|
||||
"description": "used by the ci pipeline",
|
||||
"inherits": [
|
||||
"use-ninja",
|
||||
|
@ -240,23 +226,7 @@
|
|||
"CMAKE_CXX_FLAGS": "-fprofile-arcs -ftest-coverage"
|
||||
},
|
||||
"environment": {
|
||||
"PROJ_LIB": "${sourceDir}/build/vcpkg_installed/arm64-osx/share/proj"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-ci-x64",
|
||||
"description": "used by the ci pipeline",
|
||||
"inherits": [
|
||||
"use-ninja",
|
||||
"release-with-debug-build",
|
||||
"default-build-dir",
|
||||
"ci-options"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"CMAKE_CXX_FLAGS": "-fprofile-arcs -ftest-coverage"
|
||||
},
|
||||
"environment": {
|
||||
"PROJ_LIB": "${sourceDir}/build/vcpkg_installed/x64-osx/share/proj"
|
||||
"PROJ_LIB": "${sourceDir}/build/${presetName}/vcpkg_installed/x64-osx/share/proj/data"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -294,16 +264,8 @@
|
|||
"configurePreset": "linux-ci"
|
||||
},
|
||||
{
|
||||
"name": "linux-ci-release",
|
||||
"configurePreset": "linux-ci-release"
|
||||
},
|
||||
{
|
||||
"name": "macos-ci-arm64",
|
||||
"configurePreset": "macos-ci-arm64"
|
||||
},
|
||||
{
|
||||
"name": "macos-ci-x64",
|
||||
"configurePreset": "macos-ci-x64"
|
||||
"name": "macos-ci",
|
||||
"configurePreset": "macos-ci"
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
|
@ -333,15 +295,8 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "macos-ci-arm64",
|
||||
"configurePreset": "macos-ci-arm64",
|
||||
"inherits": [
|
||||
"test-default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "macos-ci-x64",
|
||||
"configurePreset": "macos-ci-x64",
|
||||
"name": "macos-ci",
|
||||
"configurePreset": "macos-ci",
|
||||
"inherits": [
|
||||
"test-default"
|
||||
]
|
||||
|
|
12
INSTALL.md
12
INSTALL.md
|
@ -42,8 +42,8 @@ To use a Python interpreter that is not named `python` for your build, do
|
|||
something like the following instead:
|
||||
|
||||
```bash
|
||||
$ PYTHON=python3 ./configure
|
||||
$ make PYTHON=python3
|
||||
$ PYTHON=python2 ./configure
|
||||
$ make PYTHON=python2
|
||||
```
|
||||
|
||||
NOTE: the above will not work on windows, rather see https://github.com/mapnik/mapnik/wiki/WindowsInstallation
|
||||
|
@ -71,15 +71,15 @@ For troubleshooting help see https://github.com/mapnik/mapnik/wiki/InstallationT
|
|||
|
||||
Build system dependencies are:
|
||||
|
||||
* C++ compiler supporting `-std=c++17` (like >= g++ 9 or >= clang++ 5)
|
||||
* \>= 2 GB RAM (> 5 GB for g++)
|
||||
* Python 3
|
||||
* C++ compiler supporting `-std=c++14` (like >= g++ 4.8 or >= clang++ 3.4)
|
||||
* >= 2 GB RAM (> 5 GB for g++)
|
||||
* Python 2.4-2.7
|
||||
* Scons (a copy is bundled) or CMake >= 3.15 see [docs/cmake-usage.md](./docs/cmake-usage.md)
|
||||
|
||||
Mapnik Core depends on:
|
||||
|
||||
* Boost
|
||||
- \>= 1.73 is required
|
||||
- >= 1.73 is required
|
||||
- These libraries are used:
|
||||
- filesystem
|
||||
- system
|
||||
|
|
96
SConstruct
96
SConstruct
|
@ -1,6 +1,6 @@
|
|||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
#
|
||||
# Copyright (C) 2024 Artem Pavlenko
|
||||
# Copyright (C) 2021 Artem Pavlenko
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -22,7 +22,7 @@ import re
|
|||
import platform
|
||||
from glob import glob
|
||||
from copy import copy
|
||||
from subprocess import run, Popen, PIPE
|
||||
from subprocess import Popen, PIPE
|
||||
from SCons.SConf import SetCacheMode
|
||||
import pickle
|
||||
|
||||
|
@ -43,7 +43,7 @@ ICU_LIBS_DEFAULT='/usr/'
|
|||
|
||||
DEFAULT_CC = "cc"
|
||||
DEFAULT_CXX = "c++"
|
||||
DEFAULT_CXX_STD = "17"
|
||||
DEFAULT_CXX_STD = "14"
|
||||
DEFAULT_CXX_CXXFLAGS = " -DU_USING_ICU_NAMESPACE=0"
|
||||
DEFAULT_CXX_LINKFLAGS = ""
|
||||
if sys.platform == 'darwin':
|
||||
|
@ -410,8 +410,8 @@ opts.AddVariables(
|
|||
PathVariable('WEBP_INCLUDES', 'Search path for libwebp include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('WEBP_LIBS','Search path for libwebp library files','/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
BoolVariable('PROJ', 'Build Mapnik with proj support to enable transformations between many different projections', 'True'),
|
||||
PathVariable('PROJ_INCLUDES', 'Search path for libproj include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('PROJ_LIBS', 'Search path for libproj library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
PathVariable('PROJ_INCLUDES', 'Search path for PROJ.4 include files', '/usr/include', PathVariable.PathAccept),
|
||||
PathVariable('PROJ_LIBS', 'Search path for PROJ.4 library files', '/usr/' + LIBDIR_SCHEMA_DEFAULT, PathVariable.PathAccept),
|
||||
('PG_INCLUDES', 'Search path for libpq (postgres client) include files', ''),
|
||||
('PG_LIBS', 'Search path for libpq (postgres client) library files', ''),
|
||||
('FREETYPE_INCLUDES', 'Search path for Freetype include files', ''),
|
||||
|
@ -467,9 +467,8 @@ opts.AddVariables(
|
|||
BoolVariable('MAPNIK_RENDER', 'Compile and install a utility to render a map to an image', 'True'),
|
||||
BoolVariable('COLOR_PRINT', 'Print build status information in color', 'True'),
|
||||
BoolVariable('BIGINT', 'Compile support for 64-bit integers in mapnik::value', 'True'),
|
||||
BoolVariable('USE_BOOST_FILESYSTEM','Use boost::filesytem even if `std::filesystem` is available (since c++17)', 'False'),
|
||||
BoolVariable('QUIET', 'Reduce build verbosity', 'False'),
|
||||
)
|
||||
)
|
||||
|
||||
# variables to pickle after successful configure step
|
||||
# these include all scons core variables as well as custom
|
||||
|
@ -536,7 +535,6 @@ pickle_store = [# Scons internal variables
|
|||
'SQLITE_LINKFLAGS',
|
||||
'BOOST_LIB_VERSION_FROM_HEADER',
|
||||
'BIGINT',
|
||||
'USE_BOOST_FILESYSTEM',
|
||||
'HOST',
|
||||
'QUERIED_GDAL_DATA',
|
||||
'QUERIED_ICU_DATA',
|
||||
|
@ -949,17 +947,54 @@ int main()
|
|||
return ret
|
||||
|
||||
def CheckProjData(context, silent=False):
|
||||
|
||||
if not silent:
|
||||
context.Message('Checking for PROJ_LIB directory...')
|
||||
result = run(['pkg-config', 'proj', '--variable=datadir'], stdout=PIPE)
|
||||
value = result.stdout.decode('utf-8').strip()
|
||||
ret, out = context.TryRun("""
|
||||
|
||||
#include <proj.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
std::vector<std::string> split_searchpath(std::string const& paths)
|
||||
{
|
||||
std::vector<std::string> output;
|
||||
std::stringstream ss(paths);
|
||||
std::string path;
|
||||
|
||||
for( std::string path;std::getline(ss, path, ':');)
|
||||
{
|
||||
output.push_back(path);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
PJ_INFO info = proj_info();
|
||||
std::string result = info.searchpath;
|
||||
for (auto path : split_searchpath(result))
|
||||
{
|
||||
std::ifstream file(path + "/proj.db");
|
||||
if (file)
|
||||
{
|
||||
std::cout << path;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
""", '.cpp')
|
||||
value = out.strip()
|
||||
if silent:
|
||||
context.did_show_result=1
|
||||
if os.path.exists(value):
|
||||
context.Result('`pkg-config proj --variable=datadir` returned:\n%s ' % value)
|
||||
if ret:
|
||||
context.Result('proj_info.searchpath returned %s' % value)
|
||||
else:
|
||||
value = None
|
||||
context.Result('Failed to detect (mapnik-config will have null value)')
|
||||
return value
|
||||
|
||||
|
@ -1545,25 +1580,11 @@ if not preconfigured:
|
|||
env['SKIPPED_DEPS'].append('png')
|
||||
|
||||
if env['WEBP']:
|
||||
if env.get('WEBP_LIBS') or env.get('WEBP_INCLUDES'):
|
||||
OPTIONAL_LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C','-DHAVE_WEBP'])
|
||||
inc_path = env['WEBP_INCLUDES']
|
||||
lib_path = env['WEBP_LIBS']
|
||||
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||
else:
|
||||
cmd = 'pkg-config libwebp --libs --cflags'
|
||||
if env['RUNTIME_LINK'] == 'static':
|
||||
cmd += ' --static'
|
||||
temp_env = Environment(ENV=os.environ)
|
||||
try:
|
||||
temp_env.ParseConfig(cmd)
|
||||
for lib in temp_env['LIBS']:
|
||||
env.AppendUnique(LIBPATH = fix_path(lib))
|
||||
for inc in temp_env['CPPPATH']:
|
||||
env.AppendUnique(CPPPATH = fix_path(inc))
|
||||
except OSError as e:
|
||||
pass
|
||||
OPTIONAL_LIBSHEADERS.append(['webp', 'webp/decode.h', False,'C','-DHAVE_WEBP'])
|
||||
inc_path = env['%s_INCLUDES' % 'WEBP']
|
||||
lib_path = env['%s_LIBS' % 'WEBP']
|
||||
env.AppendUnique(CPPPATH = fix_path(inc_path))
|
||||
env.AppendUnique(LIBPATH = fix_path(lib_path))
|
||||
else:
|
||||
env['SKIPPED_DEPS'].append('webp')
|
||||
|
||||
|
@ -1610,12 +1631,6 @@ if not preconfigured:
|
|||
if env['BIGINT']:
|
||||
env.Append(CPPDEFINES = '-DBIGINT')
|
||||
|
||||
if int(env['CXX_STD']) < 17:
|
||||
env['USE_BOOST_FILESYSTEM'] = True
|
||||
|
||||
if env['USE_BOOST_FILESYSTEM']:
|
||||
env.Append(CPPDEFINES = '-DUSE_BOOST_FILESYSTEM')
|
||||
|
||||
if env['THREADING'] == 'multi':
|
||||
thread_flag = thread_suffix
|
||||
else:
|
||||
|
@ -1635,13 +1650,12 @@ if not preconfigured:
|
|||
|
||||
# The other required boost headers.
|
||||
BOOST_LIBSHEADERS = [
|
||||
['system', 'boost/system/system_error.hpp', True],
|
||||
['filesystem', 'boost/filesystem/operations.hpp', True],
|
||||
['regex', 'boost/regex.hpp', True],
|
||||
['program_options', 'boost/program_options.hpp', False]
|
||||
]
|
||||
|
||||
if env['USE_BOOST_FILESYSTEM']:
|
||||
BOOST_LIBSHEADERS.append(['system', 'boost/system/system_error.hpp', True])
|
||||
BOOST_LIBSHEADERS.append(['filesystem', 'boost/filesystem/operations.hpp', True])
|
||||
# if requested, sort LIBPATH and CPPPATH before running CheckLibWithHeader tests
|
||||
if env['PRIORITIZE_LINKING']:
|
||||
conf.prioritize_paths(silent=True)
|
||||
|
|
39
appveyor.yml
Normal file
39
appveyor.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
environment:
|
||||
msvs_toolset: 14
|
||||
FASTBUILD: 1
|
||||
matrix:
|
||||
- platform: x64
|
||||
configuration: Release
|
||||
|
||||
os: Visual Studio 2015
|
||||
|
||||
#shallow_clone: true
|
||||
# limit clone to latest 5 commits
|
||||
clone_depth: 5
|
||||
|
||||
services:
|
||||
- postgresql94 #if changing this, also change PATH below
|
||||
|
||||
install:
|
||||
- SET PGUSER=postgres
|
||||
- SET PGPASSWORD=Password12!
|
||||
- SET PATH=C:\Program Files\PostgreSQL\9.4\bin\;%PATH%
|
||||
|
||||
build_script:
|
||||
- scripts\build-appveyor.bat
|
||||
|
||||
after_build:
|
||||
- 7z a visual-test-results.zip C:\tmp\mapnik-visual-images\visual-test-results
|
||||
|
||||
artifacts:
|
||||
- path: mapnik-gyp\msbuild-summary.txt
|
||||
name: msbuild-summary.txt
|
||||
- path: mapnik-gyp\msbuild-errors.txt
|
||||
name: msbuild-errors.txt
|
||||
- path: mapnik-gyp\msbuild-warnings.txt
|
||||
name: msbuild-warnings.txt
|
||||
- path: visual-test-results.zip
|
||||
name: visual-test-results.zip
|
||||
|
||||
test: off
|
||||
deploy: off
|
|
@ -31,12 +31,11 @@ function(mapnik_create_benchmark)
|
|||
set(TARGET_NAME "mapnik-benchmark-${BENCHNAME}")
|
||||
add_executable(${TARGET_NAME} ${ARGV0})
|
||||
target_include_directories(${TARGET_NAME} PRIVATE include)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE
|
||||
mapnik::agg
|
||||
mapnik::mapnik
|
||||
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
|
||||
)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE mapnik::agg mapnik::mapnik)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||
OUTPUT_NAME "${BENCHNAME}"
|
||||
)
|
||||
endfunction()
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define MAPNIK_BENCH_FRAMEWORK_HPP
|
||||
|
||||
// mapnik
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/debug.hpp>
|
||||
#include <mapnik/params.hpp>
|
||||
#include <mapnik/value/types.hpp>
|
||||
|
@ -15,6 +14,8 @@
|
|||
#include <cstdio> // snprintf
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
@ -123,7 +124,6 @@ inline int handle_args(int argc, char** argv, mapnik::parameters& params)
|
|||
#define BENCHMARK(test_class, name) \
|
||||
int main(int argc, char** argv) \
|
||||
{ \
|
||||
mapnik::setup(); \
|
||||
try \
|
||||
{ \
|
||||
mapnik::parameters params; \
|
||||
|
|
|
@ -30,7 +30,6 @@ struct bench_func : benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
return benchmark::sequencer(argc, argv)
|
||||
.BENCH_FUNC1(mapnik::util::normalize_angle, +3)
|
||||
.BENCH_FUNC1(mapnik::util::normalize_angle, +6)
|
||||
|
|
|
@ -349,7 +349,6 @@ class test7 : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
return benchmark::sequencer(argc, argv)
|
||||
.run<test4>("calloc")
|
||||
.run<test1>("malloc/memcpy")
|
||||
|
|
|
@ -36,7 +36,6 @@ class test : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
mapnik::parameters params;
|
||||
benchmark::handle_args(argc, argv, params);
|
||||
test test_runner(params);
|
||||
|
|
|
@ -59,7 +59,6 @@ class test : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
mapnik::parameters params;
|
||||
benchmark::handle_args(argc, argv, params);
|
||||
bool success = mapnik::freetype_engine::register_fonts("./fonts", true);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "bench_framework.hpp"
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
class test : public benchmark::test_case
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ class test : public benchmark::test_case
|
|||
: test_case(params)
|
||||
, line_data_("this is one line\nand this is a second line\nand a third line")
|
||||
{
|
||||
auto line_data = params.get<std::string>("line");
|
||||
boost::optional<std::string> line_data = params.get<std::string>("line");
|
||||
if (line_data)
|
||||
{
|
||||
line_data_ = *line_data;
|
||||
|
@ -57,7 +57,7 @@ class test2 : public benchmark::test_case
|
|||
: test_case(params)
|
||||
, line_data_("this is one line\nand this is a second line\nand a third line")
|
||||
{
|
||||
auto line_data = params.get<std::string>("line");
|
||||
boost::optional<std::string> line_data = params.get<std::string>("line");
|
||||
if (line_data)
|
||||
{
|
||||
line_data_ = *line_data;
|
||||
|
@ -101,7 +101,6 @@ class test2 : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
int return_value = 0;
|
||||
try
|
||||
{
|
||||
|
|
|
@ -76,6 +76,5 @@ class test_numeric : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
return benchmark::sequencer(argc, argv).run<test_static>("static_cast").run<test_numeric>("numeric_cast").done();
|
||||
}
|
||||
|
|
|
@ -92,7 +92,6 @@ class test_offset : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
mapnik::parameters params;
|
||||
benchmark::handle_args(argc, argv, params);
|
||||
int return_value = 0;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "bench_framework.hpp"
|
||||
#include "compare_images.hpp"
|
||||
#include <memory>
|
||||
|
||||
class test : public benchmark::test_case
|
||||
{
|
||||
|
|
|
@ -510,7 +510,6 @@ expected_count << "\n"; valid = false;
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
mapnik::parameters params;
|
||||
benchmark::handle_args(argc, argv, params);
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ class test : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
mapnik::parameters params;
|
||||
benchmark::handle_args(argc, argv, params);
|
||||
mapnik::datasource_cache::instance().register_datasources("./plugins/input/");
|
||||
|
|
|
@ -60,7 +60,6 @@ class test : public benchmark::test_case
|
|||
// echo -180 -60 | cs2cs -f "%.10f" epsg:4326 +to epsg:3857
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
mapnik::box2d<double> from(-180, -80, 180, 80);
|
||||
mapnik::box2d<double> to(-20037508.3427892476, -15538711.0963092316, 20037508.3427892476, 15538711.0963092316);
|
||||
std::string from_str("epsg:4326");
|
||||
|
|
|
@ -26,14 +26,14 @@ class test : public benchmark::test_case
|
|||
, scale_factor_(*params.get<mapnik::value_double>("scale_factor", 1.0))
|
||||
, preview_(*params.get<std::string>("preview", ""))
|
||||
{
|
||||
const auto map = params.get<std::string>("map");
|
||||
boost::optional<std::string> map = params.get<std::string>("map");
|
||||
if (!map)
|
||||
{
|
||||
throw std::runtime_error("please provide a --map <path to xml> arg");
|
||||
}
|
||||
xml_ = *map;
|
||||
|
||||
const auto ext = params.get<std::string>("extent");
|
||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
||||
if (ext && !ext->empty())
|
||||
{
|
||||
if (!extent_.from_string(*ext))
|
||||
|
@ -95,13 +95,12 @@ class test : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
int return_value = 0;
|
||||
try
|
||||
{
|
||||
mapnik::parameters params;
|
||||
benchmark::handle_args(argc, argv, params);
|
||||
const auto name = params.get<std::string>("name");
|
||||
boost::optional<std::string> name = params.get<std::string>("name");
|
||||
if (!name)
|
||||
{
|
||||
std::clog << "please provide a name for this test\n";
|
||||
|
|
|
@ -64,14 +64,14 @@ class test : public benchmark::test_case
|
|||
, preview_(*params.get<std::string>("preview", ""))
|
||||
, im_(m_->width(), m_->height())
|
||||
{
|
||||
const auto map = params.get<std::string>("map");
|
||||
boost::optional<std::string> map = params.get<std::string>("map");
|
||||
if (!map)
|
||||
{
|
||||
throw std::runtime_error("please provide a --map=<path to xml> arg");
|
||||
}
|
||||
xml_ = *map;
|
||||
|
||||
auto ext = params.get<std::string>("extent");
|
||||
boost::optional<std::string> ext = params.get<std::string>("extent");
|
||||
mapnik::load_map(*m_, xml_, true);
|
||||
if (ext && !ext->empty())
|
||||
{
|
||||
|
@ -150,13 +150,12 @@ class test : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
int return_value = 0;
|
||||
try
|
||||
{
|
||||
mapnik::parameters params;
|
||||
benchmark::handle_args(argc, argv, params);
|
||||
const auto name = params.get<std::string>("name");
|
||||
boost::optional<std::string> name = params.get<std::string>("name");
|
||||
if (!name)
|
||||
{
|
||||
std::clog << "please provide a name for this test\n";
|
||||
|
|
|
@ -106,7 +106,6 @@ class test3 : public benchmark::test_case
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mapnik::setup();
|
||||
mapnik::parameters params;
|
||||
benchmark::handle_args(argc, argv, params);
|
||||
int return_value = 0;
|
||||
|
|
173
bootstrap.sh
Executable file
173
bootstrap.sh
Executable file
|
@ -0,0 +1,173 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
: '
|
||||
|
||||
todo
|
||||
|
||||
- docs for base setup: sudo apt-get -y install zlib1g-dev make git
|
||||
- shrink icu data
|
||||
'
|
||||
|
||||
MASON_VERSION="485514d8"
|
||||
|
||||
function setup_mason() {
|
||||
if [[ ! -d ./.mason ]]; then
|
||||
git clone https://github.com/mapbox/mason.git .mason || return
|
||||
elif ! git -C .mason rev-parse -q --verify "$MASON_VERSION" >/dev/null; then
|
||||
git -C .mason fetch --all || true # non-fatal
|
||||
fi
|
||||
git -C .mason checkout --detach "$MASON_VERSION" -- || return
|
||||
case ":$PATH:" in
|
||||
*":$PWD/.mason:"*) : already there ;;
|
||||
*) export PATH="$PWD/.mason:$PATH" ;;
|
||||
esac
|
||||
export CXX=${CXX:-clang++}
|
||||
export CC=${CC:-clang}
|
||||
}
|
||||
|
||||
function install() {
|
||||
MASON_PLATFORM_ID=$(mason env MASON_PLATFORM_ID)
|
||||
if [[ ! -d ./mason_packages/${MASON_PLATFORM_ID}/${1}/${2} ]]; then
|
||||
mason install $1 $2
|
||||
if [[ ${3:-false} != false ]]; then
|
||||
LA_FILE=$(mason prefix $1 $2)/lib/$3.la
|
||||
if [[ -f ${LA_FILE} ]]; then
|
||||
perl -i -p -e 's:\Q$ENV{HOME}/build/mapbox/mason\E:$ENV{PWD}:g' ${LA_FILE}
|
||||
else
|
||||
echo "$LA_FILE not found"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# the rm here is to workaround https://github.com/mapbox/mason/issues/230
|
||||
rm -f ./mason_packages/.link/mason.ini
|
||||
mason link $1 $2
|
||||
}
|
||||
|
||||
ICU_VERSION="58.1"
|
||||
BOOST_VERSION="1.75.0"
|
||||
|
||||
function install_mason_deps() {
|
||||
install ccache 3.3.1
|
||||
install zlib 1.2.8
|
||||
install jpeg_turbo 1.5.2 libjpeg
|
||||
install libpng 1.6.32 libpng
|
||||
install libtiff 4.0.8 libtiff
|
||||
install libpq 9.6.5
|
||||
install sqlite 3.34.0 libsqlite3
|
||||
install icu ${ICU_VERSION}
|
||||
install proj 7.2.1 libproj
|
||||
install pixman 0.34.0 libpixman-1
|
||||
install cairo 1.14.8 libcairo
|
||||
install webp 0.6.0 libwebp
|
||||
install libgdal 2.2.3 libgdal
|
||||
install boost ${BOOST_VERSION}
|
||||
install boost_libsystem ${BOOST_VERSION}
|
||||
install boost_libfilesystem ${BOOST_VERSION}
|
||||
install boost_libprogram_options ${BOOST_VERSION}
|
||||
install boost_libregex_icu58 ${BOOST_VERSION}
|
||||
# technically boost thread and python are not a core dep, but installing
|
||||
# here by default helps make python-mapnik builds easier
|
||||
install boost_libthread ${BOOST_VERSION}
|
||||
install boost_libpython ${BOOST_VERSION}
|
||||
install freetype 2.7.1 libfreetype
|
||||
install harfbuzz 1.4.4-ft libharfbuzz
|
||||
}
|
||||
|
||||
MASON_LINKED_ABS=$(pwd)/mason_packages/.link
|
||||
MASON_LINKED_REL=./mason_packages/.link
|
||||
export C_INCLUDE_PATH="${MASON_LINKED_ABS}/include"
|
||||
export CPLUS_INCLUDE_PATH="${MASON_LINKED_ABS}/include"
|
||||
export LIBRARY_PATH="${MASON_LINKED_ABS}/lib"
|
||||
|
||||
function make_config() {
|
||||
echo "
|
||||
CXX = '$CXX'
|
||||
CC = '$CC'
|
||||
CUSTOM_CXXFLAGS = '-D_GLIBCXX_USE_CXX11_ABI=0'
|
||||
RUNTIME_LINK = 'static'
|
||||
INPUT_PLUGINS = 'all'
|
||||
PATH = '${MASON_LINKED_REL}/bin'
|
||||
PKG_CONFIG_PATH = '${MASON_LINKED_REL}/lib/pkgconfig'
|
||||
PATH_REMOVE = '/usr:/usr/local'
|
||||
PATH_REPLACE = '$HOME/build/mapbox/mason/mason_packages:./mason_packages'
|
||||
BOOST_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
BOOST_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
ICU_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
ICU_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
HB_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
HB_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
PNG_INCLUDES = '${MASON_LINKED_REL}/include/libpng16'
|
||||
PNG_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
JPEG_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
JPEG_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
TIFF_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
TIFF_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
WEBP_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
WEBP_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
PROJ_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
PROJ_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
PG_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
PG_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
FREETYPE_INCLUDES = '${MASON_LINKED_REL}/include/freetype2'
|
||||
FREETYPE_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
SVG_RENDERER = True
|
||||
CAIRO_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
CAIRO_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
SQLITE_INCLUDES = '${MASON_LINKED_REL}/include'
|
||||
SQLITE_LIBS = '${MASON_LINKED_REL}/lib'
|
||||
BENCHMARK = True
|
||||
CPP_TESTS = True
|
||||
PGSQL2SQLITE = True
|
||||
XMLPARSER = 'ptree'
|
||||
SVG2PNG = True
|
||||
"
|
||||
}
|
||||
|
||||
# NOTE: the `mapnik-settings.env` is used by test/run (which is run by `make test`)
|
||||
function setup_runtime_settings() {
|
||||
echo "export PROJ_LIB=${MASON_LINKED_ABS}/share/proj" > mapnik-settings.env
|
||||
echo "export ICU_DATA=${MASON_LINKED_ABS}/share/icu/${ICU_VERSION}" >> mapnik-settings.env
|
||||
echo "export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal" >> mapnik-settings.env
|
||||
}
|
||||
|
||||
# turn arguments of the form NAME=VALUE into exported variables;
|
||||
# any other arguments are reported and cause error return status
|
||||
function export_variables() {
|
||||
local arg= ret=0
|
||||
for arg
|
||||
do
|
||||
if [[ "$arg" =~ ^[[:alpha:]][_[:alnum:]]*= ]]
|
||||
then
|
||||
export "$arg"
|
||||
else
|
||||
printf >&2 "bootstrap.sh: invalid argument: %s\n" "$arg"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
return $ret
|
||||
}
|
||||
|
||||
function main() {
|
||||
export_variables "$@" || return
|
||||
# setup_mason must not run in subshell, because it sets default
|
||||
# values of CC, CXX and adds mason to PATH, which we want to keep
|
||||
# when sourced
|
||||
setup_mason || return
|
||||
(
|
||||
# this is wrapped in subshell to allow sourcing this script
|
||||
# without having the terminal closed on error
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
install_mason_deps
|
||||
make_config > ./config.py
|
||||
setup_runtime_settings
|
||||
|
||||
printf "\n\e[1;32m%s\e[m\n" "bootstrap successful, now run:"
|
||||
echo ""
|
||||
echo " ./configure && make"
|
||||
echo ""
|
||||
)
|
||||
}
|
||||
|
||||
main "$@"
|
98
cmake/FindCairo.cmake
Normal file
98
cmake/FindCairo.cmake
Normal file
|
@ -0,0 +1,98 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindCairo
|
||||
-----------
|
||||
|
||||
Find Cairo 2D graphics library.
|
||||
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
This module defines :prop_tgt:`IMPORTED` target ``Cairo::Cairo``, if
|
||||
cairo has been found.
|
||||
|
||||
Result variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module will set the following variables in your project:
|
||||
|
||||
``CAIRO_FOUND``
|
||||
True if cairo headers and library were found.
|
||||
``CAIRO_INCLUDE_DIRS``
|
||||
Directory where cairo headers are located.
|
||||
``CAIRO_LIBRARIES``
|
||||
cairo libraries to link against.
|
||||
``CAIRO_VERSION_MAJOR``
|
||||
The major version of cairo
|
||||
``CAIRO_VERSION_MINOR``
|
||||
The minor version of cairo
|
||||
``CAIRO_VERSION_PATCH``
|
||||
The patch version of cairo
|
||||
``CAIRO_VERSION_STRING``
|
||||
version number as a string (ex: "1.16.0")
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT CAIRO_LIBRARY)
|
||||
find_path(CAIRO_INCLUDE_DIR NAMES cairo.h HINTS ${PC_CAIRO_INCLUDEDIR} ${PC_CAIRO_INCLUDE_DIR} PATH_SUFFIXES cairo)
|
||||
find_library(CAIRO_LIBRARY_RELEASE NAMES ${Cairo_NAMES} cairo HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS})
|
||||
find_library(CAIRO_LIBRARY_DEBUG NAMES ${Cairo_NAMES} cairod HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS})
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(CAIRO)
|
||||
else()
|
||||
file(TO_CMAKE_PATH "${CAIRO_LIBRARY}" CAIRO_LIBRARY)
|
||||
endif()
|
||||
|
||||
if(CAIRO_INCLUDE_DIR AND NOT CAIRO_VERSION)
|
||||
if(EXISTS "${CAIRO_INCLUDE_DIR}/cairo-version.h")
|
||||
file(READ "${CAIRO_INCLUDE_DIR}/cairo-version.h" CAIRO_VERSION_CONTENT)
|
||||
|
||||
string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
|
||||
set(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
|
||||
string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
|
||||
set(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}")
|
||||
|
||||
string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
|
||||
set(CAIRO_VERSION_PATCH "${CMAKE_MATCH_1}")
|
||||
|
||||
set(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_PATCH}")
|
||||
set(CAIRO_VERSION_STRING ${CAIRO_VERSION})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Cairo
|
||||
REQUIRED_VARS
|
||||
CAIRO_LIBRARY
|
||||
CAIRO_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
CAIRO_VERSION_STRING
|
||||
)
|
||||
mark_as_advanced(CAIRO_INCLUDE_DIR CAIRO_LIBRARY)
|
||||
|
||||
if (CAIRO_FOUND)
|
||||
set(CAIRO_LIBRARIES ${CAIRO_LIBRARY})
|
||||
set(CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR})
|
||||
if(NOT TARGET Cairo::Cairo)
|
||||
add_library(Cairo::Cairo UNKNOWN IMPORTED)
|
||||
set_target_properties(Cairo::Cairo PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${CAIRO_INCLUDE_DIR}
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES C)
|
||||
|
||||
if(CAIRO_LIBRARY_RELEASE)
|
||||
set_property(TARGET Cairo::Cairo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION_RELEASE "${CAIRO_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(CAIRO_LIBRARY_DEBUG)
|
||||
set_property(TARGET Cairo::Cairo APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION_DEBUG "${CAIRO_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT CAIRO_LIBRARY_RELEASE AND NOT CAIRO_LIBRARY_DEBUG)
|
||||
set_target_properties(Cairo::Cairo PROPERTIES IMPORTED_LOCATION "${CAIRO_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
97
cmake/FindWebP.cmake
Normal file
97
cmake/FindWebP.cmake
Normal file
|
@ -0,0 +1,97 @@
|
|||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindWebP
|
||||
-------
|
||||
|
||||
Finds the WebP library.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module provides the following imported targets, if found:
|
||||
|
||||
``WebP::WebP``
|
||||
The WebP library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables:
|
||||
|
||||
``WebP_FOUND``
|
||||
True if the system has the WebP library.
|
||||
``WebP_VERSION``
|
||||
The version of the WebP library which was found.
|
||||
``WebP_INCLUDE_DIRS``
|
||||
Include directories needed to use WebP.
|
||||
``WebP_LIBRARIES``
|
||||
Libraries needed to link to WebP.
|
||||
|
||||
Cache Variables
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
The following cache variables may also be set:
|
||||
|
||||
``WebP_INCLUDE_DIR``
|
||||
The directory containing ``decode.h``.
|
||||
``WebP_LIBRARY``
|
||||
The path to the Foo library.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT WebP_LIBRARY)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_WebP QUIET libwebp)
|
||||
set(WebP_VERSION ${PC_WebP_VERSION})
|
||||
find_path(WebP_INCLUDE_DIR NAMES decode.h HINTS ${PC_WebP_INCLUDEDIR} ${PC_WebP_INCLUDE_DIR} PATH_SUFFIXES webp)
|
||||
find_library(WebP_LIBRARY_RELEASE NAMES ${WebP_NAMES} webp HINTS ${PC_WebP_LIBDIR} ${PC_WebP_LIBRARY_DIRS})
|
||||
find_library(WebP_LIBRARY_DEBUG NAMES ${WebP_NAMES} webpd HINTS ${PC_WebP_LIBDIR} ${PC_WebP_LIBRARY_DIRS})
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(WebP)
|
||||
else()
|
||||
file(TO_CMAKE_PATH "${WebP_LIBRARY}" WebP_LIBRARY)
|
||||
endif()
|
||||
|
||||
if ("${WebP_FIND_VERSION}" VERSION_GREATER "${WebP_VERSION}")
|
||||
if (WebP_VERSION)
|
||||
message(FATAL_ERROR "Required version (" ${WebP_FIND_VERSION} ") is higher than found version (" ${PC_WebP_VERSION} ")")
|
||||
else ()
|
||||
message(WARNING "Cannot determine WebP version without pkg-config")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(WebP
|
||||
REQUIRED_VARS
|
||||
WebP_LIBRARY
|
||||
WebP_INCLUDE_DIR
|
||||
VERSION_VAR WebP_VERSION
|
||||
)
|
||||
mark_as_advanced(WebP_INCLUDE_DIR WebP_LIBRARY)
|
||||
|
||||
if (WebP_FOUND)
|
||||
set(WebP_LIBRARIES ${WebP_LIBRARY})
|
||||
set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR})
|
||||
if(NOT TARGET WebP::WebP)
|
||||
add_library(WebP::WebP UNKNOWN IMPORTED)
|
||||
set_target_properties(WebP::WebP PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${WebP_INCLUDE_DIR}
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES C)
|
||||
|
||||
if(WebP_LIBRARY_RELEASE)
|
||||
set_property(TARGET WebP::WebP APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION_RELEASE "${WebP_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(WebP_LIBRARY_DEBUG)
|
||||
set_property(TARGET WebP::WebP APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION_DEBUG "${WebP_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
|
||||
if(NOT WebP_LIBRARY_RELEASE AND NOT WebP_LIBRARY_DEBUG)
|
||||
set_target_properties(WebP::WebP PROPERTIES IMPORTED_LOCATION "${WebP_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
endif ()
|
|
@ -1,46 +1,34 @@
|
|||
include(CMakePackageConfigHelpers)
|
||||
|
||||
### exports mapnik cmake config files (mapnikConfigVersion and mapnikConfig)
|
||||
function(mapnik_export_cmake_config)
|
||||
# export mapnik configuration
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||
VERSION ${MAPNIK_VERSION}
|
||||
COMPATIBILITY ExactVersion
|
||||
)
|
||||
get_property(MAPNIK_UTILITIES GLOBAL PROPERTY MAPNIK_UTILITIES)
|
||||
# export mapnik configuration
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||
VERSION ${MAPNIK_VERSION}
|
||||
COMPATIBILITY ExactVersion
|
||||
)
|
||||
get_property(MAPNIK_UTILITIES GLOBAL PROPERTY MAPNIK_UTILITIES)
|
||||
list(JOIN MAPNIK_DEPENDENCIES "\n" MAPNIK_DEPENDENCIES)
|
||||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||
INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||
PATH_VARS MAPNIK_INCLUDE_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR MAPNIK_DEPENDENCIES MAPNIK_UTILITIES
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||
)
|
||||
|
||||
# generate all find_dependency and pkg_config calls
|
||||
set(mapnik_find_deps)
|
||||
foreach(dep IN LISTS mapnik_deps)
|
||||
set(ver_comment "# ${dep} used with version ${mapnik_${dep}_version}")
|
||||
set(mapnik_find_deps "${mapnik_find_deps}\n${ver_comment}\n")
|
||||
if(mapnik_${dep}_find_args)
|
||||
list(REMOVE_DUPLICATES mapnik_${dep}_find_args)
|
||||
list(JOIN mapnik_${dep}_find_args " " m_args_joined)
|
||||
set(mapnik_find_deps "${mapnik_find_deps}find_dependency(${dep} ${m_args_joined})")
|
||||
else()
|
||||
list(JOIN mapnik_${dep}_pkg_args " " m_args_joined)
|
||||
set(mapnik_find_deps "${mapnik_find_deps}pkg_check_modules(${dep} ${m_args_joined})")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/mapnikConfig.cmake.in"
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||
INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||
PATH_VARS MAPNIK_INCLUDE_DIR PLUGINS_INSTALL_DIR FONTS_INSTALL_DIR mapnik_find_deps MAPNIK_UTILITIES
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||
)
|
||||
endfunction()
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mapnikConfigVersion.cmake"
|
||||
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||
)
|
||||
|
||||
|
||||
mapnik_export_cmake_config()
|
||||
# install our modules, so that the expected target names are found.
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindCairo.cmake"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindWebP.cmake"
|
||||
DESTINATION ${MAPNIK_CMAKE_DIR}/Modules
|
||||
)
|
||||
|
||||
install(EXPORT MapnikTargets
|
||||
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||
|
@ -48,21 +36,21 @@ install(EXPORT MapnikTargets
|
|||
NAMESPACE mapnik::
|
||||
)
|
||||
|
||||
### install plugin cmake config files ###
|
||||
|
||||
# Create configuration dependend files for the plugin install dirs.
|
||||
# some package managers are using different paths per configuration.
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" _build_type)
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" _build_type_l)
|
||||
set(m_mapnik_plugin_file_name mapnikPlugins-${_build_type})
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${m_mapnik_plugin_file_name}.cmake.in" "set(MAPNIK_PLUGINS_DIR_${_build_type_l} \"@PACKAGE_PLUGINS_INSTALL_DIR@\" CACHE STRING \"\")\n")
|
||||
set(_mapnik_plugin_file_name "mapnikPlugins-${_build_type}")
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake.in "set(MAPNIK_PLUGINS_DIR_${_build_type_l} \"@PACKAGE_PLUGINS_INSTALL_DIR@\" CACHE STRING \"\")\n")
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_package_config_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${m_mapnik_plugin_file_name}.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${m_mapnik_plugin_file_name}.cmake"
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake
|
||||
PATH_VARS PLUGINS_INSTALL_DIR
|
||||
INSTALL_DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||
)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/${m_mapnik_plugin_file_name}.cmake"
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_mapnik_plugin_file_name}.cmake
|
||||
DESTINATION ${MAPNIK_CMAKE_DIR}
|
||||
)
|
||||
|
|
|
@ -3,13 +3,13 @@ function(create_pkg_config_file _target _lib_name _description)
|
|||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/@MAPNIK_LIB_DIR@
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
Name: @_lib_name@
|
||||
Description: @_description@
|
||||
Version: @MAPNIK_VERSION@
|
||||
Libs: -L"${libdir}" -l$<TARGET_FILE_BASE_NAME:@_target@>$<TARGET_PROPERTY:@_target@,$<CONFIG>_POSTFIX>
|
||||
Cflags: -I"${includedir}" -I"${includedir}/mapnik" ]]
|
||||
Cflags: -I"${includedir}" ]]
|
||||
_contents @ONLY)
|
||||
|
||||
file(GENERATE
|
||||
|
@ -64,16 +64,14 @@ function(create_pkg_config_file_mapnik _lib_name _description)
|
|||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/@MAPNIK_LIB_DIR@
|
||||
fonts_dir=${prefix}/@FONTS_INSTALL_DIR@
|
||||
plugins_dir=${prefix}/@PLUGINS_INSTALL_DIR@
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
Name: @_lib_name@
|
||||
Description: @_description@
|
||||
Version: @MAPNIK_VERSION@
|
||||
Requires: @m_requires@
|
||||
Libs: -L"${libdir}" -l$<TARGET_FILE_BASE_NAME:mapnik>$<TARGET_PROPERTY:mapnik,$<CONFIG>_POSTFIX>
|
||||
Cflags: -I"${includedir}" -I"${includedir}/mapnik" -I"${includedir}/mapnik/agg" @m_str_compile_defs@]]
|
||||
Cflags: -I"${includedir}" @m_str_compile_defs@]]
|
||||
_contents @ONLY)
|
||||
file(GENERATE
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_lib_name}-$<CONFIG>.pc
|
||||
|
|
|
@ -1,50 +1,28 @@
|
|||
function(mapnik_set_dep_version dep var)
|
||||
string(TOUPPER ${dep} m_package_name_upc)
|
||||
set(m_package_name ${dep})
|
||||
if(${m_package_name}_VERSION_STRING)
|
||||
set(${var} ${${m_package_name}_VERSION_STRING} PARENT_SCOPE)
|
||||
elseif(${m_package_name}_VERSION)
|
||||
set(${var} ${${m_package_name}_VERSION} PARENT_SCOPE)
|
||||
elseif(${m_package_name_upc}_VERSION_STRING)
|
||||
set(${var} ${${m_package_name_upc}_VERSION_STRING} PARENT_SCOPE)
|
||||
elseif(${m_package_name_upc}_VERSION)
|
||||
set(${var} ${${m_package_name_upc}_VERSION} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(mapnik_print_package_info dep)
|
||||
message(STATUS "Using ${dep} version: ${mapnik_${dep}_version}")
|
||||
endfunction()
|
||||
|
||||
macro(mapnik_find_package dep)
|
||||
find_package(${dep} ${ARGN})
|
||||
if(${dep}_FOUND)
|
||||
list(APPEND mapnik_deps ${dep})
|
||||
|
||||
if(mapnik_${dep}_find_args)
|
||||
list(APPEND mapnik_${dep}_find_args ${ARGN})
|
||||
else()
|
||||
set(mapnik_${dep}_find_args ${ARGN})
|
||||
endif()
|
||||
mapnik_set_dep_version(${dep} mapnik_${dep}_version)
|
||||
|
||||
mapnik_print_package_info(${dep})
|
||||
macro(mapnik_print_version)
|
||||
string(TOUPPER ${ARGV0} TLNUP)
|
||||
set(TLN ${ARGV0})
|
||||
if(${TLN}_VERSION_STRING)
|
||||
message(STATUS "Using ${ARGV0} version: ${${TLN}_VERSION_STRING}")
|
||||
elseif(${TLN}_VERSION)
|
||||
message(STATUS "Using ${ARGV0} version: ${${TLN}_VERSION}")
|
||||
elseif(${TLNUP}_VERSION_STRING)
|
||||
message(STATUS "Using ${ARGV0} version: ${${TLNUP}_VERSION_STRING}")
|
||||
elseif(${TLNUP}_VERSION)
|
||||
message(STATUS "Using ${ARGV0} version: ${${TLNUP}_VERSION}")
|
||||
else()
|
||||
message(STATUS "not found: ${dep}")
|
||||
message(STATUS "Using ${ARGV0}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(mapnik_pkg_check_modules dep)
|
||||
pkg_check_modules(${dep} ${ARGN})
|
||||
if(${dep}_FOUND)
|
||||
list(APPEND mapnik_deps ${dep})
|
||||
|
||||
set(mapnik_${dep}_pkg_args ${ARGN})
|
||||
mapnik_set_dep_version(${dep} mapnik_${dep}_version)
|
||||
|
||||
mapnik_print_package_info(${dep})
|
||||
macro(mapnik_find_package)
|
||||
find_package(${ARGN})
|
||||
if(${ARGV0}_FOUND)
|
||||
set(MAPNIK_TMP_DEP ${ARGN})
|
||||
list(JOIN MAPNIK_TMP_DEP " " MAPNIK_TMP_DEP)
|
||||
list(APPEND MAPNIK_DEPENDENCIES "find_dependency(${MAPNIK_TMP_DEP})")
|
||||
mapnik_print_version(${ARGV0})
|
||||
else()
|
||||
message(STATUS "not found: ${dep}")
|
||||
message(STATUS "not found: ${ARGV0}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ endfunction()
|
|||
# Install plugins
|
||||
#
|
||||
function(mapnik_install_plugin _target)
|
||||
if(NOT BUILD_SHARED_PLUGINS)
|
||||
return()
|
||||
endif()
|
||||
install(TARGETS ${_target}
|
||||
RUNTIME DESTINATION ${PLUGINS_INSTALL_DIR}
|
||||
COMPONENT MapnikPluginRuntime
|
||||
|
|
|
@ -8,7 +8,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/Modules/")
|
|||
include(CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency(Threads REQUIRED)
|
||||
@mapnik_find_deps@
|
||||
@MAPNIK_DEPENDENCIES@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/mapnikTargets.cmake")
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
include(InstallRequiredSystemLibraries)
|
||||
set(CPACK_PACKAGE_NAME "mapnik")
|
||||
set(CPACK_PACKAGE_CONTACT "ubuntu-mathis@outlook.com")
|
||||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://mapnik.org")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
set(CPACK_GENERATOR "DEB;TGZ")
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
\\.git/
|
||||
build/
|
||||
|
|
18
configure
vendored
18
configure
vendored
|
@ -1,32 +1,18 @@
|
|||
#! /usr/bin/env bash
|
||||
#! /bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
: ${PYTHON:=python}
|
||||
|
||||
# Only some shells (Bash and Z shell) support arrays. Therefore,
|
||||
# the following code provides an alternative for users calling the script
|
||||
# with shells other than Bash or Z shell (e.g. Debian users using Dash).
|
||||
THE_SHELL=$(basename $SHELL)
|
||||
if [ "$THE_SHELL" != "bash" ] && [ "$THE_SHELL" != "zsh" ]; then
|
||||
if [ -f mapnik-settings.env ]; then
|
||||
echo "WARNING: Reading from mapnik-settings.env is supported with Bash or Z shell only."
|
||||
fi
|
||||
$PYTHON scons/scons.py --implicit-deps-changed configure "$@"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# mapnik-settings.env is an optional file to store
|
||||
# environment variables that should be used before
|
||||
# running tests like PROJ_LIB, GDAL_DATA, and ICU_DATA
|
||||
# These do not normally need to be set except when
|
||||
# building against binary versions of dependencies like
|
||||
# done via bootstrap.sh
|
||||
|
||||
if [ -f mapnik-settings.env ]; then
|
||||
echo "Inheriting from mapnik-settings.env"
|
||||
. ./mapnik-settings.env
|
||||
VARS=( $(cat mapnik-settings.env) )
|
||||
fi
|
||||
|
||||
$PYTHON scons/scons.py --implicit-deps-changed configure ${VARS[*]:-} "$@"
|
||||
$PYTHON scons/scons.py --implicit-deps-changed configure "$@"
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
add_executable(mapnik-demo rundemo.cpp)
|
||||
target_link_libraries(mapnik-demo PRIVATE
|
||||
mapnik::agg
|
||||
mapnik::mapnik
|
||||
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
|
||||
set_target_properties(mapnik-demo PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||
)
|
||||
|
||||
target_link_libraries(mapnik-demo PRIVATE mapnik::agg mapnik::mapnik)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -20,7 +20,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include <mapnik/map.hpp>
|
||||
#include <mapnik/layer.hpp>
|
||||
#include <mapnik/rule.hpp>
|
||||
|
@ -53,7 +52,7 @@ int main(int, char**)
|
|||
"+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs";
|
||||
const std::string srs_merc = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 "
|
||||
"+units=m +nadgrids=@null +wktext +no_defs +over";
|
||||
mapnik::setup();
|
||||
|
||||
try
|
||||
{
|
||||
std::cout << " running demo ... \n";
|
||||
|
@ -132,8 +131,8 @@ int main(int, char**)
|
|||
line_symbolizer line_sym;
|
||||
put(line_sym, keys::stroke, color(171, 158, 137));
|
||||
put(line_sym, keys::stroke_width, 2.0);
|
||||
put(line_sym, keys::stroke_linecap, line_cap_enum::ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, line_join_enum::ROUND_JOIN);
|
||||
put(line_sym, keys::stroke_linecap, ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, ROUND_JOIN);
|
||||
r.append(std::move(line_sym));
|
||||
}
|
||||
roads34_style.add_rule(std::move(r));
|
||||
|
@ -149,8 +148,8 @@ int main(int, char**)
|
|||
line_symbolizer line_sym;
|
||||
put(line_sym, keys::stroke, color(171, 158, 137));
|
||||
put(line_sym, keys::stroke_width, 4.0);
|
||||
put(line_sym, keys::stroke_linecap, line_cap_enum::ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, line_join_enum::ROUND_JOIN);
|
||||
put(line_sym, keys::stroke_linecap, ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, ROUND_JOIN);
|
||||
r.append(std::move(line_sym));
|
||||
}
|
||||
roads2_style_1.add_rule(std::move(r));
|
||||
|
@ -165,8 +164,8 @@ int main(int, char**)
|
|||
line_symbolizer line_sym;
|
||||
put(line_sym, keys::stroke, color(255, 250, 115));
|
||||
put(line_sym, keys::stroke_width, 2.0);
|
||||
put(line_sym, keys::stroke_linecap, line_cap_enum::ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, line_join_enum::ROUND_JOIN);
|
||||
put(line_sym, keys::stroke_linecap, ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, ROUND_JOIN);
|
||||
r.append(std::move(line_sym));
|
||||
}
|
||||
roads2_style_2.add_rule(std::move(r));
|
||||
|
@ -182,8 +181,8 @@ int main(int, char**)
|
|||
line_symbolizer line_sym;
|
||||
put(line_sym, keys::stroke, color(188, 149, 28));
|
||||
put(line_sym, keys::stroke_width, 7.0);
|
||||
put(line_sym, keys::stroke_linecap, line_cap_enum::ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, line_join_enum::ROUND_JOIN);
|
||||
put(line_sym, keys::stroke_linecap, ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, ROUND_JOIN);
|
||||
r.append(std::move(line_sym));
|
||||
}
|
||||
roads1_style_1.add_rule(std::move(r));
|
||||
|
@ -198,8 +197,8 @@ int main(int, char**)
|
|||
line_symbolizer line_sym;
|
||||
put(line_sym, keys::stroke, color(242, 191, 36));
|
||||
put(line_sym, keys::stroke_width, 5.0);
|
||||
put(line_sym, keys::stroke_linecap, line_cap_enum::ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, line_join_enum::ROUND_JOIN);
|
||||
put(line_sym, keys::stroke_linecap, ROUND_CAP);
|
||||
put(line_sym, keys::stroke_linejoin, ROUND_JOIN);
|
||||
r.append(std::move(line_sym));
|
||||
}
|
||||
roads1_style_2.add_rule(std::move(r));
|
||||
|
|
|
@ -40,13 +40,15 @@ set_target_properties(mapnik-viewer PROPERTIES
|
|||
AUTORCC ON
|
||||
AUTOUIC ON
|
||||
AUTOMOC ON
|
||||
LIBRARY_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${MAPNIK_OUTPUT_DIR}/lib"
|
||||
)
|
||||
|
||||
target_link_libraries(mapnik-viewer PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
mapnik::agg
|
||||
mapnik::mapnik
|
||||
ICU::data ICU::i18n ICU::uc # needed for the static build (TODO: why isn't this correctly propagated from mapnik::mapnik?)
|
||||
)
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/viewer.ini
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -51,7 +51,7 @@ layer_info_dialog::layer_info_dialog(mapnik::layer& lay, QWidget* parent)
|
|||
int index = 0;
|
||||
for (pos = ps.begin(); pos != ps.end(); ++pos)
|
||||
{
|
||||
std::optional<std::string> result;
|
||||
boost::optional<std::string> result;
|
||||
mapnik::util::apply_visitor(mapnik::value_extractor_visitor<std::string>(result), pos->second);
|
||||
if (result)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,14 +23,12 @@
|
|||
#include <QSettings>
|
||||
#include <mapnik/datasource_cache.hpp>
|
||||
#include <mapnik/font_engine_freetype.hpp>
|
||||
#include <mapnik/mapnik.hpp>
|
||||
#include "mainwindow.hpp"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
using mapnik::datasource_cache;
|
||||
using mapnik::freetype_engine;
|
||||
mapnik::setup();
|
||||
try
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,7 +38,7 @@
|
|||
// mapnik
|
||||
|
||||
#ifndef Q_MOC_RUN // QT moc chokes on BOOST_JOIN
|
||||
// #include <mapnik/config_error.hpp>
|
||||
//#include <mapnik/config_error.hpp>
|
||||
#include <mapnik/load_map.hpp>
|
||||
#include <mapnik/save_map.hpp>
|
||||
#include <mapnik/projection.hpp>
|
||||
|
@ -106,7 +106,10 @@ MainWindow::MainWindow()
|
|||
// slider
|
||||
connect(slider_, SIGNAL(valueChanged(int)), mapWidget_, SLOT(zoomToLevel(int)));
|
||||
// renderer selector
|
||||
connect(renderer_selector_, SIGNAL(currentIndexChanged(int)), mapWidget_, SLOT(updateRenderer(int)));
|
||||
connect(renderer_selector_,
|
||||
SIGNAL(currentIndexChanged(QString const&)),
|
||||
mapWidget_,
|
||||
SLOT(updateRenderer(QString const&)));
|
||||
|
||||
// scale factor
|
||||
connect(scale_factor_, SIGNAL(valueChanged(double)), mapWidget_, SLOT(updateScaleFactor(double)));
|
||||
|
@ -387,7 +390,7 @@ void MainWindow::createToolBars()
|
|||
|
||||
scale_factor_ = new QDoubleSpinBox(fileToolBar);
|
||||
scale_factor_->setMinimum(0.1);
|
||||
scale_factor_->setMaximum(10.0);
|
||||
scale_factor_->setMaximum(5.0);
|
||||
scale_factor_->setSingleStep(0.1);
|
||||
scale_factor_->setValue(1.0);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -545,15 +545,15 @@ void render_cairo(mapnik::Map const& map, double scaling_factor, QPixmap& pix)
|
|||
#endif
|
||||
}
|
||||
|
||||
void MapWidget::updateRenderer(int index)
|
||||
void MapWidget::updateRenderer(QString const& txt)
|
||||
{
|
||||
std::cerr << "updateRenderer:" << index << std::endl;
|
||||
if (index == 0)
|
||||
if (txt == "AGG")
|
||||
cur_renderer_ = AGG;
|
||||
else if (index == 1)
|
||||
else if (txt == "Cairo")
|
||||
cur_renderer_ = Cairo;
|
||||
else if (index == 2)
|
||||
else if (txt == "Grid")
|
||||
cur_renderer_ = Grid;
|
||||
std::cerr << "Update renderer called" << std::endl;
|
||||
updateMap();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -82,7 +82,7 @@ class MapWidget : public QWidget
|
|||
void zoomToLevel(int level);
|
||||
void updateMap();
|
||||
void layerSelected(int);
|
||||
void updateRenderer(int);
|
||||
void updateRenderer(QString const& txt);
|
||||
void updateScaleFactor(double scale_factor);
|
||||
signals:
|
||||
void mapViewChanged();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* Mapnik is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
|
5
deps/agg/include/agg_pixfmt_rgba.h
vendored
5
deps/agg/include/agg_pixfmt_rgba.h
vendored
|
@ -24,7 +24,6 @@
|
|||
#ifndef AGG_PIXFMT_RGBA_INCLUDED
|
||||
#define AGG_PIXFMT_RGBA_INCLUDED
|
||||
|
||||
#include <mapnik/config.hpp>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include "agg_basics.h"
|
||||
|
@ -3167,10 +3166,6 @@ private:
|
|||
|
||||
|
||||
|
||||
extern template struct MAPNIK_DECL comp_op_rgba_hue<agg::rgba8, agg::order_rgba>;
|
||||
extern template struct MAPNIK_DECL comp_op_rgba_saturation<agg::rgba8, agg::order_rgba>;
|
||||
extern template struct MAPNIK_DECL comp_op_rgba_color<agg::rgba8, agg::order_rgba>;
|
||||
extern template struct MAPNIK_DECL comp_op_rgba_value<agg::rgba8, agg::order_rgba>;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
typedef blender_rgba<rgba8, order_rgba> blender_rgba32; //----blender_rgba32
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#include <mapnik/util/math.hpp>
|
||||
|
||||
#include <mapnik/warning.hpp>
|
||||
#include <mapnik/symbolizer_enumerations.hpp>
|
||||
#include <mapnik/util/variant.hpp>
|
||||
MAPNIK_DISABLE_WARNING_PUSH
|
||||
#include <mapnik/warning_ignore_agg.hpp>
|
||||
#include "agg_conv_smooth_poly1.h"
|
||||
|
@ -82,9 +80,9 @@ class smooth_converter
|
|||
{
|
||||
switch (algo)
|
||||
{
|
||||
case smooth_algorithm_enum::SMOOTH_ALGORITHM_ADAPTIVE:
|
||||
case SMOOTH_ALGORITHM_ADAPTIVE:
|
||||
return adaptive_impl_type(geom);
|
||||
case smooth_algorithm_enum::SMOOTH_ALGORITHM_BASIC:
|
||||
case SMOOTH_ALGORITHM_BASIC:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -94,7 +92,7 @@ class smooth_converter
|
|||
public:
|
||||
smooth_converter(Geometry& geom)
|
||||
: geom_(geom)
|
||||
, impl_(std::move(init_impl(smooth_algorithm_enum::SMOOTH_ALGORITHM_BASIC, geom)))
|
||||
, impl_(std::move(init_impl(SMOOTH_ALGORITHM_BASIC, geom)))
|
||||
{}
|
||||
|
||||
void algorithm(smooth_algorithm_enum algo) { impl_ = init_impl(algo, geom_); }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -39,19 +39,19 @@ void set_gamma_method(T& ras_ptr, double gamma, gamma_method_enum method)
|
|||
{
|
||||
switch (method)
|
||||
{
|
||||
case gamma_method_enum::GAMMA_POWER:
|
||||
case GAMMA_POWER:
|
||||
ras_ptr->gamma(agg::gamma_power(gamma));
|
||||
break;
|
||||
case gamma_method_enum::GAMMA_LINEAR:
|
||||
case GAMMA_LINEAR:
|
||||
ras_ptr->gamma(agg::gamma_linear(0.0, gamma));
|
||||
break;
|
||||
case gamma_method_enum::GAMMA_NONE:
|
||||
case GAMMA_NONE:
|
||||
ras_ptr->gamma(agg::gamma_none());
|
||||
break;
|
||||
case gamma_method_enum::GAMMA_THRESHOLD:
|
||||
case GAMMA_THRESHOLD:
|
||||
ras_ptr->gamma(agg::gamma_threshold(gamma));
|
||||
break;
|
||||
case gamma_method_enum::GAMMA_MULTIPLY:
|
||||
case GAMMA_MULTIPLY:
|
||||
ras_ptr->gamma(agg::gamma_multiply(gamma));
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -92,7 +92,7 @@ class buffer_stack
|
|||
|
||||
void pop()
|
||||
{
|
||||
// ^ ensure iterator is not out-of-range
|
||||
// ^ ensure irator is not out-of-range
|
||||
// prior calling this method
|
||||
++position_;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -175,14 +175,14 @@ struct symbolizer_attributes
|
|||
|
||||
void operator()(raster_symbolizer const& sym)
|
||||
{
|
||||
const auto filter_factor = get_optional<double>(sym, keys::filter_factor);
|
||||
boost::optional<double> filter_factor = get_optional<double>(sym, keys::filter_factor);
|
||||
if (filter_factor)
|
||||
{
|
||||
filter_factor_ = *filter_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto scaling_method = get_optional<scaling_method_e>(sym, keys::scaling);
|
||||
boost::optional<scaling_method_e> scaling_method = get_optional<scaling_method_e>(sym, keys::scaling);
|
||||
if (scaling_method && *scaling_method != SCALING_NEAR)
|
||||
{
|
||||
filter_factor_ = 2;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -34,7 +34,7 @@ class cairo_context;
|
|||
|
||||
void render_vector_marker(cairo_context& context,
|
||||
svg_path_adapter& svg_path,
|
||||
svg::group const& group_attr,
|
||||
svg_attribute_type const& attributes,
|
||||
box2d<double> const& bbox,
|
||||
agg::trans_affine const& tr,
|
||||
double opacity);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -56,11 +56,11 @@ struct cairo_renderer_process_visitor_p
|
|||
cairo_context context(cairo);
|
||||
|
||||
svg_storage_type& svg = *marker.get_data();
|
||||
auto const& svg_group = svg.svg_group();
|
||||
svg_attribute_type const& svg_attributes = svg.attributes();
|
||||
svg::vertex_stl_adapter<svg::svg_path_storage> stl_storage(svg.source());
|
||||
svg::svg_path_adapter svg_path(stl_storage);
|
||||
|
||||
render_vector_marker(context, svg_path, svg_group, bbox, tr, opacity_);
|
||||
render_vector_marker(context, svg_path, svg_attributes, bbox, tr, opacity_);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -24,40 +24,32 @@
|
|||
#define MAPNIK_CONFIG_HPP
|
||||
|
||||
// Windows DLL support
|
||||
// clang-format off
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef MAPNIK_STATIC_DEFINE
|
||||
# define MAPNIK_DECL
|
||||
# define MAPNIK_EXP
|
||||
#define MAPNIK_EXP __declspec(dllexport)
|
||||
#define MAPNIK_IMP __declspec(dllimport)
|
||||
#ifdef MAPNIK_EXPORTS
|
||||
#define MAPNIK_DECL __declspec(dllexport)
|
||||
#else
|
||||
# define MAPNIK_EXP __declspec(dllexport)
|
||||
# ifndef MAPNIK_DECL
|
||||
# ifdef MAPNIK_EXPORTS
|
||||
/* We are building this library */
|
||||
# define MAPNIK_DECL __declspec(dllexport)
|
||||
# else
|
||||
/* We are using this library */
|
||||
# define MAPNIK_DECL __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#define MAPNIK_DECL __declspec(dllimport)
|
||||
#endif
|
||||
#pragma warning(disable: 4251)
|
||||
#pragma warning(disable: 4275)
|
||||
#if (_MSC_VER >= 1400) // vc8
|
||||
#pragma warning(disable: 4996) //_CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
# pragma warning( disable: 4251 )
|
||||
# pragma warning( disable: 4275 )
|
||||
# if (_MSC_VER >= 1400) // vc8
|
||||
# pragma warning(disable : 4996) //_CRT_SECURE_NO_DEPRECATE
|
||||
# endif
|
||||
#else
|
||||
# if __GNUC__ >= 4
|
||||
# define MAPNIK_EXP __attribute__ ((visibility ("default")))
|
||||
# define MAPNIK_DECL __attribute__ ((visibility ("default")))
|
||||
# define MAPNIK_IMP __attribute__ ((visibility ("default")))
|
||||
# else
|
||||
# define MAPNIK_EXP
|
||||
# define MAPNIK_DECL
|
||||
# define MAPNIK_IMP
|
||||
# endif
|
||||
#if __GNUC__ >= 4
|
||||
#define MAPNIK_EXP __attribute__((visibility("default")))
|
||||
#define MAPNIK_DECL __attribute__((visibility("default")))
|
||||
#define MAPNIK_IMP __attribute__((visibility("default")))
|
||||
#else
|
||||
#define MAPNIK_EXP
|
||||
#define MAPNIK_DECL
|
||||
#define MAPNIK_IMP
|
||||
#endif
|
||||
// clang-format on
|
||||
#endif
|
||||
|
||||
#define PROJ_ENVELOPE_POINTS 20
|
||||
|
||||
#endif // MAPNIK_CONFIG_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -94,7 +94,7 @@ struct coord<T, 2>
|
|||
}
|
||||
|
||||
template<typename T2>
|
||||
bool operator==(coord<T2, 2> const& rhs) const
|
||||
bool operator==(coord<T2, 2> const& rhs)
|
||||
{
|
||||
return x == rhs.x && y == rhs.y;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -48,9 +48,11 @@ namespace css_color_grammar {
|
|||
|
||||
using x3::attr;
|
||||
using x3::double_;
|
||||
using x3::hex;
|
||||
using x3::lit;
|
||||
using x3::no_case;
|
||||
using x3::no_skip;
|
||||
using x3::omit;
|
||||
using x3::symbols;
|
||||
using x3::uint_parser;
|
||||
|
||||
|
@ -212,11 +214,11 @@ struct named_colors_ : x3::symbols<color>
|
|||
;
|
||||
// clang-format on
|
||||
}
|
||||
} const named_colors;
|
||||
} named_colors;
|
||||
|
||||
const x3::uint_parser<std::uint8_t, 16, 2, 2> hex2;
|
||||
const x3::uint_parser<std::uint8_t, 16, 1, 1> hex1;
|
||||
const x3::uint_parser<std::uint16_t, 10, 1, 3> dec3;
|
||||
x3::uint_parser<std::uint8_t, 16, 2, 2> hex2;
|
||||
x3::uint_parser<std::uint8_t, 16, 1, 1> hex1;
|
||||
x3::uint_parser<std::uint16_t, 10, 1, 3> dec3;
|
||||
|
||||
// rules
|
||||
x3::rule<class hex2_color, color> const hex2_color("hex2_color");
|
||||
|
@ -243,67 +245,67 @@ struct percent_converter
|
|||
static std::uint8_t call(double val) { return safe_cast<std::uint8_t>(std::lround((255.0 * val) / 100.0)); }
|
||||
};
|
||||
|
||||
const auto dec_red = [](auto& ctx) {
|
||||
auto dec_red = [](auto& ctx) {
|
||||
_val(ctx).red_ = _attr(ctx);
|
||||
};
|
||||
|
||||
const auto dec_green = [](auto& ctx) {
|
||||
auto dec_green = [](auto& ctx) {
|
||||
_val(ctx).green_ = _attr(ctx);
|
||||
};
|
||||
|
||||
const auto dec_blue = [](auto& ctx) {
|
||||
auto dec_blue = [](auto& ctx) {
|
||||
_val(ctx).blue_ = _attr(ctx);
|
||||
};
|
||||
|
||||
const auto opacity = [](auto& ctx) {
|
||||
auto opacity = [](auto& ctx) {
|
||||
_val(ctx).alpha_ = uint8_t((255.0 * clip_opacity::call(_attr(ctx))) + 0.5);
|
||||
};
|
||||
|
||||
const auto percent_red = [](auto& ctx) {
|
||||
auto percent_red = [](auto& ctx) {
|
||||
_val(ctx).red_ = percent_converter::call(_attr(ctx));
|
||||
};
|
||||
|
||||
const auto percent_green = [](auto& ctx) {
|
||||
auto percent_green = [](auto& ctx) {
|
||||
_val(ctx).green_ = percent_converter::call(_attr(ctx));
|
||||
};
|
||||
|
||||
const auto percent_blue = [](auto& ctx) {
|
||||
auto percent_blue = [](auto& ctx) {
|
||||
_val(ctx).blue_ = percent_converter::call(_attr(ctx));
|
||||
};
|
||||
|
||||
const auto hex1_red = [](auto& ctx) {
|
||||
auto hex1_red = [](auto& ctx) {
|
||||
_val(ctx).red_ = _attr(ctx) | _attr(ctx) << 4;
|
||||
};
|
||||
|
||||
const auto hex1_green = [](auto& ctx) {
|
||||
auto hex1_green = [](auto& ctx) {
|
||||
_val(ctx).green_ = _attr(ctx) | _attr(ctx) << 4;
|
||||
};
|
||||
|
||||
const auto hex1_blue = [](auto& ctx) {
|
||||
auto hex1_blue = [](auto& ctx) {
|
||||
_val(ctx).blue_ = _attr(ctx) | _attr(ctx) << 4;
|
||||
};
|
||||
|
||||
const auto hex1_opacity = [](auto& ctx) {
|
||||
auto hex1_opacity = [](auto& ctx) {
|
||||
_val(ctx).alpha_ = _attr(ctx) | _attr(ctx) << 4;
|
||||
};
|
||||
|
||||
const auto hex2_red = [](auto& ctx) {
|
||||
auto hex2_red = [](auto& ctx) {
|
||||
_val(ctx).red_ = _attr(ctx);
|
||||
};
|
||||
|
||||
const auto hex2_green = [](auto& ctx) {
|
||||
auto hex2_green = [](auto& ctx) {
|
||||
_val(ctx).green_ = _attr(ctx);
|
||||
};
|
||||
|
||||
const auto hex2_blue = [](auto& ctx) {
|
||||
auto hex2_blue = [](auto& ctx) {
|
||||
_val(ctx).blue_ = _attr(ctx);
|
||||
};
|
||||
|
||||
const auto hex2_opacity = [](auto& ctx) {
|
||||
auto hex2_opacity = [](auto& ctx) {
|
||||
_val(ctx).alpha_ = _attr(ctx);
|
||||
};
|
||||
|
||||
const auto hsl_to_rgba = [](auto& ctx) {
|
||||
auto hsl_to_rgba = [](auto& ctx) {
|
||||
double h = std::get<0>(_attr(ctx));
|
||||
double s = std::get<1>(_attr(ctx));
|
||||
double l = std::get<2>(_attr(ctx));
|
||||
|
@ -323,10 +325,10 @@ const auto hsl_to_rgba = [](auto& ctx) {
|
|||
}
|
||||
m1 = l * 2 - m2;
|
||||
|
||||
const double r = hue_to_rgb(m1, m2, h + 1.0 / 3.0);
|
||||
const double g = hue_to_rgb(m1, m2, h);
|
||||
const double b = hue_to_rgb(m1, m2, h - 1.0 / 3.0);
|
||||
const uint8_t alpha = uint8_t((255.0 * clip_opacity::call(std::get<3>(_attr(ctx)))) + 0.5);
|
||||
double r = hue_to_rgb(m1, m2, h + 1.0 / 3.0);
|
||||
double g = hue_to_rgb(m1, m2, h);
|
||||
double b = hue_to_rgb(m1, m2, h - 1.0 / 3.0);
|
||||
uint8_t alpha = uint8_t((255.0 * clip_opacity::call(std::get<3>(_attr(ctx)))) + 0.5);
|
||||
_val(ctx) = color(safe_cast<uint8_t>(std::lround(255.0 * r)),
|
||||
safe_cast<uint8_t>(std::lround(255.0 * g)),
|
||||
safe_cast<uint8_t>(std::lround(255.0 * b)),
|
||||
|
@ -352,9 +354,9 @@ auto const rgb_color_def = lit("rgb")
|
|||
>> attr(255) >> lit(')');
|
||||
|
||||
auto const rgb_color_percent_def = lit("rgb")
|
||||
>> lit('(') >> double_[percent_red] >> lit('%')
|
||||
>> lit(',') >> double_[percent_green] >> lit('%')
|
||||
>> lit(',') >> double_[percent_blue] >> lit('%')
|
||||
>> lit('(') >> dec3[percent_red] >> lit('%')
|
||||
>> lit(',') >> dec3[percent_green] >> lit('%')
|
||||
>> lit(',') >> dec3[percent_blue] >> lit('%')
|
||||
>> attr(255) >> lit(')');
|
||||
|
||||
auto const rgba_color_def = lit("rgba")
|
||||
|
@ -364,24 +366,24 @@ auto const rgba_color_def = lit("rgba")
|
|||
>> lit(',') >> double_[opacity] >> lit(')');
|
||||
|
||||
auto const rgba_color_percent_def = lit("rgba")
|
||||
>> lit('(') >> double_[percent_red] >> lit('%')
|
||||
>> lit(',') >> double_[percent_green] >> lit('%')
|
||||
>> lit(',') >> double_[percent_blue] >> lit('%')
|
||||
>> lit('(') >> dec3[percent_red] >> lit('%')
|
||||
>> lit(',') >> dec3[percent_green] >> lit('%')
|
||||
>> lit(',') >> dec3[percent_blue] >> lit('%')
|
||||
>> lit(',') >> double_[opacity] >> lit(')');
|
||||
|
||||
auto const hsl_values = x3::rule<class hsl_values, std::tuple<std::uint16_t, double, double, double >> {} =
|
||||
auto const hsl_values = x3::rule<class hsl_values, std::tuple<std::uint16_t,std::uint8_t,std::uint8_t, double >> {} =
|
||||
lit("hsl")
|
||||
>> lit('(') >> dec3
|
||||
>> lit(',') >> double_ >> lit('%')
|
||||
>> lit(',') >> double_ >> lit('%')
|
||||
>> lit(',') >> dec3 >> lit('%')
|
||||
>> lit(',') >> dec3 >> lit('%')
|
||||
>> attr(1.0) >> lit(')')
|
||||
;
|
||||
|
||||
auto const hsla_values = x3::rule<class hsla_values, std::tuple<std::uint16_t, double, double, double >> {} =
|
||||
auto const hsla_values = x3::rule<class hsla_values, std::tuple<std::uint16_t,std::uint8_t,std::uint8_t, double >> {} =
|
||||
lit("hsla")
|
||||
>> lit('(') >> dec3
|
||||
>> lit(',') >> double_ >> lit('%')
|
||||
>> lit(',') >> double_ >> lit('%')
|
||||
>> lit(',') >> dec3 >> lit('%')
|
||||
>> lit(',') >> dec3 >> lit('%')
|
||||
>> lit(',') >> double_ >> lit(')')
|
||||
;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -150,27 +150,32 @@ namespace css_grammar {
|
|||
|
||||
using x3::alnum;
|
||||
using x3::alpha;
|
||||
using x3::attr;
|
||||
using x3::char_;
|
||||
using x3::lexeme;
|
||||
using x3::lit;
|
||||
using x3::no_case;
|
||||
using x3::no_skip;
|
||||
using x3::raw;
|
||||
using x3::standard::space;
|
||||
|
||||
// import unicode string rule
|
||||
const auto css_string = mapnik::json::grammar::unicode_string;
|
||||
namespace {
|
||||
auto const& css_string = mapnik::json::grammar::unicode_string;
|
||||
}
|
||||
|
||||
const auto assign_def = [](auto const& ctx) {
|
||||
auto assign_def = [](auto const& ctx) {
|
||||
for (auto const& k : std::get<0>(_attr(ctx)))
|
||||
{
|
||||
_val(ctx).emplace(k, std::get<1>(_attr(ctx)));
|
||||
}
|
||||
};
|
||||
|
||||
const auto assign_key = [](auto const& ctx) {
|
||||
auto assign_key = [](auto const& ctx) {
|
||||
_val(ctx).first = std::move(_attr(ctx));
|
||||
};
|
||||
|
||||
const auto assign_value = [](auto const& ctx) {
|
||||
auto assign_value = [](auto const& ctx) {
|
||||
_val(ctx).second = std::move(_attr(ctx));
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -39,9 +39,9 @@ using standard::char_;
|
|||
using x3::lexeme;
|
||||
using x3::lit;
|
||||
|
||||
struct unesc_char_csv_ : x3::symbols<char>
|
||||
struct unesc_char_ : x3::symbols<char>
|
||||
{
|
||||
unesc_char_csv_()
|
||||
unesc_char_()
|
||||
{
|
||||
add("\\a", '\a') //
|
||||
("\\b", '\b') //
|
||||
|
@ -56,7 +56,7 @@ struct unesc_char_csv_ : x3::symbols<char>
|
|||
("\"\"", '\"') // double quote
|
||||
;
|
||||
}
|
||||
} const unesc_char_csv;
|
||||
} unesc_char;
|
||||
|
||||
template<typename T>
|
||||
struct literal : x3::parser<literal<T>>
|
||||
|
@ -93,7 +93,7 @@ auto const column_def = quoted_text | *(char_ - separator);
|
|||
auto const quoted_text_def = quote > text > quote // support unmatched quotes or not (??)
|
||||
;
|
||||
|
||||
auto const text_def = *(unesc_char_csv | (char_ - quote));
|
||||
auto const text_def = *(unesc_char | (char_ - quote));
|
||||
|
||||
BOOST_SPIRIT_DEFINE(line, column, quoted_text, text);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -38,7 +38,6 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace mapnik {
|
||||
|
||||
|
@ -92,7 +91,7 @@ class MAPNIK_DECL datasource : private util::noncopyable
|
|||
// default implementation without context use features method
|
||||
return features(q);
|
||||
}
|
||||
virtual std::optional<datasource_geometry_t> get_geometry_type() const = 0;
|
||||
virtual boost::optional<datasource_geometry_t> get_geometry_type() const = 0;
|
||||
virtual featureset_ptr features(query const& q) const = 0;
|
||||
virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const = 0;
|
||||
virtual box2d<double> envelope() const = 0;
|
||||
|
@ -114,6 +113,25 @@ class datasource_deleter
|
|||
};
|
||||
|
||||
using datasource_ptr = std::shared_ptr<datasource>;
|
||||
|
||||
#ifdef MAPNIK_STATIC_PLUGINS
|
||||
#define DATASOURCE_PLUGIN(classname)
|
||||
#else
|
||||
#define DATASOURCE_PLUGIN(classname) \
|
||||
extern "C" MAPNIK_EXP const char* datasource_name() \
|
||||
{ \
|
||||
return classname::name(); \
|
||||
} \
|
||||
extern "C" MAPNIK_EXP datasource* create(parameters const& params) \
|
||||
{ \
|
||||
return new classname(params); \
|
||||
} \
|
||||
extern "C" MAPNIK_EXP void destroy(datasource* ds) \
|
||||
{ \
|
||||
delete ds; \
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mapnik
|
||||
|
||||
#endif // MAPNIK_DATASOURCE_HPP
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -47,8 +47,7 @@ class MAPNIK_DECL datasource_cache : public singleton<datasource_cache, CreateSt
|
|||
friend class CreateStatic<datasource_cache>;
|
||||
|
||||
public:
|
||||
bool plugin_registered(const std::string& plugin_name) const;
|
||||
std::vector<std::string> plugin_names() const;
|
||||
std::vector<std::string> plugin_names();
|
||||
std::string plugin_directories();
|
||||
bool register_datasources(std::string const& path, bool recurse = false);
|
||||
bool register_datasource(std::string const& path);
|
||||
|
@ -63,7 +62,7 @@ class MAPNIK_DECL datasource_cache : public singleton<datasource_cache, CreateSt
|
|||
// but the instance also needs its own mutex to protect the
|
||||
// plugins_ and plugin_directories_ members which are potentially
|
||||
// modified recusrively by register_datasources(path, true);
|
||||
mutable std::recursive_mutex instance_mutex_;
|
||||
std::recursive_mutex instance_mutex_;
|
||||
};
|
||||
|
||||
extern template class MAPNIK_DECL singleton<datasource_cache, CreateStatic>;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
*
|
||||
* This file is part of Mapnik (c++ mapping toolkit)
|
||||
*
|
||||
* Copyright (C) 2024 Artem Pavlenko
|
||||
* Copyright (C) 2021 Artem Pavlenko
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue