aboutsummaryrefslogtreecommitdiffstats
path: root/qface/builtin/qtcpp/templates/CMakeLists.txt
blob: bb7fdb9d42cf0609f321994bfd1eae8f90035f68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{% set module_name = module.name.lower().replace(".", "_") %}
{% set module_path = module.name_parts|join('/') %}

project({{module_name}})

cmake_minimum_required(VERSION 3.1)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_AUTOMOC ON)

set(INSTALL_PATH "${CMAKE_BINARY_DIR}/imports" CACHE STRING "Path where the plugins are deployed")

find_package(Qt5Core REQUIRED)
find_package(Qt5Qml REQUIRED)

set (SOURCES
    generated/qml{{module.module_name|lower}}module.cpp
{% for interface in module.interfaces %}
    generated/qmlabstract{{interface|lower}}.cpp
{% endfor %}
{% for struct in module.structs %}
    generated/qml{{struct|lower}}.cpp
    generated/qml{{struct|lower}}model.cpp
{% endfor %}
    generated/qmlvariantmodel.cpp
{% for interface in module.interfaces %}
    qml{{interface|lower}}.cpp
{% endfor %}
    plugin.cpp
)

add_library({{module_name}}_plugin SHARED ${SOURCES})

set(OUTPUT_PATH ${INSTALL_PATH}/{{module_path}})

set_target_properties({{module_name}}_plugin PROPERTIES
    LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_PATH}
    RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_PATH}
)

target_link_libraries({{module_name}}_plugin PUBLIC Qt5::Core Qt5::Qml)
configure_file(${CMAKE_SOURCE_DIR}/qmldir ${OUTPUT_PATH}/qmldir COPYONLY)