aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cli
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2020-01-30 01:27:15 +0100
committerRenaud G <renaud@rolisteam.org>2020-03-28 02:05:05 +0100
commit653ba9395a36cc20ec1d68c9a9cae78973fa334c (patch)
tree72753ed3bdca117baf001cdf8251b1fb22276eeb /cli
parent22d71d0032e2f44a8f267895aea3bd87864791b3 (diff)
downloadOneRoll-653ba9395a36cc20ec1d68c9a9cae78973fa334c.tar.gz
OneRoll-653ba9395a36cc20ec1d68c9a9cae78973fa334c.zip
add unicity and repeat function part2
Diffstat (limited to 'cli')
-rw-r--r--cli/CMakeLists.txt78
-rw-r--r--cli/main.cpp1
2 files changed, 18 insertions, 61 deletions
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
index 7fe65a4..6828d09 100644
--- a/cli/CMakeLists.txt
+++ b/cli/CMakeLists.txt
@@ -1,56 +1,11 @@
cmake_minimum_required(VERSION 3.5)
option(UPDATE_TRANSLATIONS "update Translation" OFF)
+option(NO_PAINTER_OPERATOR "No PAINTING" OFF)
MESSAGE(STATUS "UPDATE TRANSLATIONS: ${UPDATE_TRANSLATIONS}")
project(dice)
-SET( dice_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/allsamenode.cpp
- ../node/listsetrollnode.cpp
- ../node/numbernode.cpp
- ../node/parenthesesnode.cpp
- # ../ node/forloopnode.cpp
- ../node/paintnode.cpp
- ../node/rerolldicenode.cpp
- ../node/scalaroperatornode.cpp
- ../node/sortresult.cpp
- ../node/startingnode.cpp
- ../node/filternode.cpp
- ../node/stringnode.cpp
- ../node/ifnode.cpp
- ../node/splitnode.cpp
- ../node/groupnode.cpp
- ../node/bind.cpp
- ../node/occurencecountnode.cpp
- ../node/uniquenode.cpp
- ../highlightdice.cpp
- ../node/variablenode.cpp
- ../node/valueslistnode.cpp
-)
-
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
@@ -58,23 +13,23 @@ set(CMAKE_AUTOMOC ON)
set(EXECUTABLE_OUTPUT_PATH bin/)
# Find the QtWidgets library
-find_package(Qt5Core)
-include_directories(${Qt5Core_INCLUDES} ../)
-add_definitions(${Qt5Core_DEFINITIONS})
+set(QT_REQUIRED_VERSION "5.12.0")
+
+
-IF(NOT DEFINED NO_PAINTER_OPERATOR)
+IF(NO_PAINTER_OPERATOR)
+ find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core Svg LinguistTools)
+else()
MESSAGE(STATUS "Compilation of operator Paint")
- find_package(Qt5Gui)
- include_directories(${Qt5Gui_INCLUDES} ../)
- add_definitions(${Qt5Gui_DEFINITIONS})
+ find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Svg LinguistTools)
add_definitions(-DPAINTER_OP)
endif()
+
set(MODE "cli")
ADD_DEFINITIONS(
- -std=c++11 # Or -std=c++0x
- # Other flags
+ -std=c++11
)
set(dice_RESOURCES diceparser.qrc)
@@ -106,9 +61,12 @@ SET( cli_sources
set(documentation_files ../HelpMe.md ../README.md)
-add_executable( dice ${cli_sources} ${dice_QM} ${dice_sources} ${documentation_files})
-target_include_directories(dice PRIVATE ../include)
-
-
-target_link_libraries(dice ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES})
+add_executable( dice ${cli_sources} ${dice_QM} ${documentation_files})
+set(diceparser_shared_INCLUDE_DIRS "../diceparser")
+target_include_directories(dice PRIVATE ../include ../ ../result ../node)
+IF(NO_PAINTER_OPERATOR)
+ target_link_libraries(dice PUBLIC Qt5::Core Qt5::Svg PRIVATE diceparser_shared)
+ELSE()
+ target_link_libraries(dice PUBLIC Qt5::Core Qt5::Gui Qt5::Svg PRIVATE diceparser_shared)
+ENDIF()
INSTALL_TARGETS(/bin dice)
diff --git a/cli/main.cpp b/cli/main.cpp
index e09a1de..0008cba 100644
--- a/cli/main.cpp
+++ b/cli/main.cpp
@@ -443,7 +443,6 @@ int startDiceParsing(QStringList& cmds, QString& treeFile, bool withColor, EXPOR
rt= 1;
}
}
- parser.cleanAll();
return rt;
}
#include <QTextCodec>