aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mobile/CMakeLists.txt
blob: 7cfc9c4fd8936cb976e634457c68c0b4db9a8003 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
cmake_minimum_required(VERSION 3.16)

option(UPDATE_TRANSLATIONS "update Translation" OFF)
MESSAGE(STATUS "UPDATE TRANSLATIONS: ${UPDATE_TRANSLATIONS}")


project(diceGui)


# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)

# Find the QtWidgets library
find_package(Qt5 COMPONENTS Quick Qml Core Widgets Gui)
#find_package(Qt5QuickCompiler)

set(EXECUTABLE_OUTPUT_PATH bin/)

include_directories(${Qt5Core_INCLUDES} ${Qt5Widgets_INCLUDES} ${Qt5Gui_INCLUDES} ${Qt5Qml_INCLUDES} ${Qt5Quick_INCLUDES}../)
add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Qml_DEFINITIONS} ${Qt5Quick_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Gui_DEFINITIONS} )

ADD_DEFINITIONS(
    -std=c++11
)

set(diceGui_RESOURCES diceparser.qrc)
FIND_PACKAGE(Qt5LinguistTools)


IF(UPDATE_TRANSLATIONS)
        MESSAGE( update Translation )
    FILE(GLOB_RECURSE translate_diceGui_SRCS ../*.cpp ../*.h)
    SET(translate_SRCS ${translate_dice_SRCS})
    SET(diceGui_TS "${CMAKE_CURRENT_SOURCE_DIR}/i18n/diceGui_en.ts" "${CMAKE_CURRENT_SOURCE_DIR}/i18n/diceGui_fr.ts")
ELSE()
        MESSAGE( NO updates for translations)
    FILE(GLOB diceGui_TS "${CMAKE_CURRENT_SOURCE_DIR}/i18n/*.ts")
ENDIF(UPDATE_TRANSLATIONS)

if(Qt5Core_FOUND)

    IF(UPDATE_TRANSLATIONS)
                MESSAGE(status  "find" ${diceGui_TS} ${translate_SRCS} )
        QT5_CREATE_TRANSLATION(diceGui_QM ${translate_SRCS} ${diceGui_TS})
    ELSE()
        QT5_ADD_TRANSLATION(diceGui_QM ${diceGui_TS})
    ENDIF()

    QT5_ADD_RESOURCES(diceGui_RESOURCES_RCC ${diceGui_RESOURCES})

    # guess plugins and libraries directory
    set(QT_PLUGINS_DIR "${Qt5Core_DIR}/../../../plugins")
    get_target_property(QT_LIBRARY_DIR Qt6::Core LOCATION)
    get_filename_component(QT_LIBRARY_DIR ${QT_LIBRARY_DIR} PATH)
endif()

SET( diceGui_sources
   ../diceparser.cpp
   ../range.cpp
   ../booleancondition.cpp
   ../validator.cpp
   ../compositevalidator.cpp
   ../operationcondition.cpp
   ../die.cpp
   ../parsingtoolbox.cpp
   ../dicealias.cpp
   ../result/result.cpp
   ../result/scalarresult.cpp
   ../result/stringresult.cpp
   ../result/diceresult.cpp
   ../node/countexecutenode.cpp
   ../node/dicerollernode.cpp
   ../node/executionnode.cpp
   ../node/explodedicenode.cpp
   ../node/helpnode.cpp
   ../node/mergenode.cpp
   ../node/jumpbackwardnode.cpp
   ../node/keepdiceexecnode.cpp
   ../node/listaliasnode.cpp
   ../node/listsetrollnode.cpp
   ../node/numbernode.cpp
   ../node/parenthesesnode.cpp
   ../node/paintnode.cpp
   ../node/rerolldicenode.cpp
   ../node/scalaroperatornode.cpp
   ../node/sortresult.cpp
   ../node/startingnode.cpp
   ../node/ifnode.cpp
   ../node/filternode.cpp
   ../node/stringnode.cpp
   ../node/splitnode.cpp
   ../node/groupnode.cpp
   ../node/variablenode.cpp
   ../node/bind.cpp
    main.cpp
    maincontroller.cpp
    commandmodel.cpp
    ../highlightdice.cpp
)
qt5_add_resources(RESOURCE_ADDED mobile.qrc)

add_executable( diceGui ${diceGui_sources} ${diceGui_QM} ${RESOURCE_ADDED} )

target_link_libraries(diceGui ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Qml_LIBRARIES} ${Qt5Quick_LIBRARIES})
INSTALL_TARGETS(/bin diceGui)

#qt5_use_modules()