Select to view content in your preferred language

Is there any ArcGIS Runtime for Qt Quick CMake sample project available?

1609
2
Jump to solution
08-10-2021 08:13 AM
Jan-Tschada
Esri Contributor

We are integrating a bunch of C++ utility libraries into our ArcGIS Runtime for Qt Quick based sample viewer. Usually these C++ utility libraries are compiled using CMake. The Qt company offers some samples using Qt Quick with CMake. 

cmake_minimum_required(VERSION 3.14)

project(QPyApp LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check https://doc.qt.io/qt/deployment-android.html for more information.
# They need to be set before the find_package(...) calls below.

#if(ANDROID)
#    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
#    if (ANDROID_ABI STREQUAL "armeabi-v7a")
#        set(ANDROID_EXTRA_LIBS
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
#            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
#    endif()
#endif()

find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick REQUIRED)

set(PROJECT_SOURCES
        main.cpp
        qml.qrc
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
    qt_add_executable(QPyApp
        ${PROJECT_SOURCES}
    )
else()
    if(ANDROID)
        add_library(QPyApp SHARED
            ${PROJECT_SOURCES}
        )
    else()
        add_executable(QPyApp
          ${PROJECT_SOURCES}
        )
    endif()
endif()

target_compile_definitions(QPyApp
  PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(QPyApp
  PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick)

 

Would you be so kind and provide a sample using CMake and share it using arcgis-runtime-samples-qt 

Product Manager
Developers and Location Services
Germany and Switzerland
Tags (4)
0 Kudos
1 Solution

Accepted Solutions
JamesBallard1
Esri Regular Contributor

Hi @Jan-Tschada ,

We do have CMake support with the ArcGIS Runtime SDK for Qt. If you create a new ArcGIS template app with Qt Creator, it will give you the option to use QMake or CMake. I've configured a 100.11.2 CMake template to share with you.

There's an included CMakeLists.txt, FindArcGISRuntime.cmake and the SDK installation includes a ArcGISRuntime.cmake file that does the rest (included in sdk/ideintegration folder).

I hope this works for you.

 

View solution in original post

2 Replies
JamesBallard1
Esri Regular Contributor

Hi @Jan-Tschada ,

We do have CMake support with the ArcGIS Runtime SDK for Qt. If you create a new ArcGIS template app with Qt Creator, it will give you the option to use QMake or CMake. I've configured a 100.11.2 CMake template to share with you.

There's an included CMakeLists.txt, FindArcGISRuntime.cmake and the SDK installation includes a ArcGISRuntime.cmake file that does the rest (included in sdk/ideintegration folder).

I hope this works for you.

 

Jan-Tschada
Esri Contributor

Very nice. We usually just upgrade existing projects and were not aware of this great enhancement. I just started to get my hands dirty and saw some linker warnings regarding the EsriRuntimeQtd.pdb not being linked with EsriRuntimeQtd.lib(LicenseResult.obj) and the other related *.obj's  on Windows.

But anyway, this CMake support helps us a lot and should make it to the official website. Otherwise we would not be able to deliver our DevOps release pipeline by integrating our CMake based vcpkg packages.

Product Manager
Developers and Location Services
Germany and Switzerland
0 Kudos