Skip to content

magiclane/magiclane-maps-sdk-examples-for-cpp

Repository files navigation

MagicLane - Maps SDK for C++ demo applications

This repository holds a series of example projects using the MagicLane - Maps SDK for C++. More information about the API can be found on the Documentation page.

This set of individual, use-case based projects is designed to be cloned by developers for their own use.

Note: As the very first step, we highly recommend that you get a token from Magic Lane Portal. If no token is set, you can still test your apps, but a watermark will be displayed, and all the online services including mapping, searching, routing, etc. will slow down after a few minutes.

Build instructions

Step 1. Download the SDK

Step 2. Extract SDK to the predefined folder (SDK)

Prerequires

Step a. On Debian/Ubuntu, make sure that you have installed the following packages

$ apt install cmake ninja-build xorg-dev libglu1-mesa-dev libegl1-mesa-dev

Step b. Set up vcpkg package manager:

The first step is to clone the vcpkg repository from GitHub:

$ git clone https://github.com/microsoft/vcpkg.git

SDL2 port of vcpkg package manager under Linux currently requires the following libraries from the system package manager: python3-jinja2

Navigate to the vcpkg directory and execute the bootstrap script:

Linux:

$ cd vcpkg && ./bootstrap-vcpkg.sh -disableMetrics

Windows:

cd vcpkg && bootstrap-vcpkg.bat -disableMetrics

Configure the VCPKG_ROOT environment variable:

Linux:

$ export VCPKG_ROOT=<path/to/vcpkg>
$ export PATH=$VCPKG_ROOT:$PATH

Windows:

set VCPKG_ROOT=<C:\path\to\vcpkg>
set PATH=%VCPKG_ROOT%;%PATH%

Configure and build with CMake

Linux

Note: The Maps SDK for Linux is available upon request. Please contact Magic Lane at info@magiclane.com to obtain the Linux SDK package.

Configure:

$ cmake --preset=linux-<glfw|sdl>-ninja-<debug|release|relwithdebinfo>

Build:

$ cmake --build --preset=linux-<glfw|sdl>-ninja-<debug|release|relwithdebinfo>-all

Windows

Visual Studio (Multi-Config Generator)

For Visual Studio 2022:

cmake --preset=windows-<glfw|sdl>-vs2022
cmake --build --preset=windows-<glfw|sdl>-vs2022-<debug|release|relwithdebinfo>-all

For Visual Studio 2019 (requires full VS2019 installation):

cmake --preset=windows-<glfw|sdl>-vs2019
cmake --build --preset=windows-<glfw|sdl>-vs2019-<debug|release|relwithdebinfo>-all

For Visual Studio 2019 toolset via VS2022 (requires VS2022 + v142 build tools):

cmake --preset=windows-<glfw|sdl>-vs2019-toolset
cmake --build --preset=windows-<glfw|sdl>-vs2019-toolset-<debug|release|relwithdebinfo>-all

Ninja (Single-Config Generator)

Configure:

cmake --preset=windows-<glfw|sdl>-ninja-<debug|release|relwithdebinfo>

Build:

cmake --build --preset=windows-<glfw|sdl>-ninja-<debug|release|relwithdebinfo>-all

Configuring API Keys

An API Key is required to unlock the full functionality of these example applications. Follow our guide to generate your API Key.

If no API Key is set, you can still test your apps, but a watermark will be displayed, and all the online services including mapping, searching, routing, etc. will slow down after a few minutes.

Linux:

export API_TOKEN=<your_token>

Windows:

set API_TOKEN=<your_token>

or directly in the CMake command by providing the option: -DAPI_TOKEN="<your_token>"

The preset is configured to read API_TOKEN from the environment variable $env{API_TOKEN}.

Troubleshoot

Windows:

  • Make sure that you have installed >= Visual Studio 2019

  • If you have VS2022 installed but only VS2019 Build Tools (v142), use the windows-<glfw|sdl>-vs2019-toolset presets

  • If you have full VS2019 installed, use the windows-<glfw|sdl>-vs2019 presets

  • Preset windows-glfw-vs2022-address-sanitizer requires Visual Studio 2022 due to the following issue link

  • May encounter the following warning:

The object file directory

    <long/path>

  has XXX characters.  The maximum full path to an object file is 250
  characters (see CMAKE_OBJECT_PATH_MAX).  Object file

    <file>.cpp.obj

  cannot be safely placed under this directory.  The build may not work
  correctly.

Follow the link to remove the path length limit and restart PC.

License

Copyright (C) 2021-2026 Magic Lane International B.V.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

A copy of the license is available in the repository's LICENSE file.

Contact Magic Lane at info@magiclane.com for SDK licensing options.

About

This repository holds a series of example projects using the MagicLane - Maps SDK for C++

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors