diff options
| -rw-r--r-- | src/bin/cli/CMakeLists.txt | 13 | ||||
| -rw-r--r-- | src/bin/mobile/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/bin/webserver/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/libparser/CMakeLists.txt | 16 | ||||
| -rw-r--r-- | src/libparser/diceroller.cpp | 27 | ||||
| -rw-r--r-- | src/libparser/include/diceparser_qobject/diceroller.h | 1 | ||||
| -rw-r--r-- | src/libparser/node/explodedicenode.cpp | 7 |
7 files changed, 32 insertions, 34 deletions
diff --git a/src/bin/cli/CMakeLists.txt b/src/bin/cli/CMakeLists.txt index 07d080f..e1d2b4b 100644 --- a/src/bin/cli/CMakeLists.txt +++ b/src/bin/cli/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.16) +#project(dice) option(UPDATE_TRANSLATIONS "update Translation" OFF) option(NO_PAINTER_OPERATOR "No PAINTING" OFF) MESSAGE(STATUS "UPDATE TRANSLATIONS: ${UPDATE_TRANSLATIONS}") -project(dice) # Find includes in corresponding build directories set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -60,4 +60,13 @@ IF(NO_PAINTER_OPERATOR) ELSE() target_link_libraries(dice PUBLIC Qt6::Core Qt6::Gui Qt6::Svg PRIVATE diceparser_shared) ENDIF() -INSTALL_TARGETS(/bin dice) + +include(install_helper OPTIONAL RESULT_VARIABLE=installFound) + + +if(installFound STREQUAL "NOTFOUND") + install(TARGETS dice RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT diceComp) +else() + set(CPACK_OUTPUT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackConfigDice.cmake") + rinstallRT(dice "diceComp") +endif() diff --git a/src/bin/mobile/CMakeLists.txt b/src/bin/mobile/CMakeLists.txt index ddc0543..8c9627a 100644 --- a/src/bin/mobile/CMakeLists.txt +++ b/src/bin/mobile/CMakeLists.txt @@ -104,6 +104,5 @@ 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() diff --git a/src/bin/webserver/CMakeLists.txt b/src/bin/webserver/CMakeLists.txt index 3fa9b56..49d0d74 100644 --- a/src/bin/webserver/CMakeLists.txt +++ b/src/bin/webserver/CMakeLists.txt @@ -73,6 +73,5 @@ SET( diceserver_sources add_executable( diceserver ${diceserver_sources} ) target_link_libraries(diceserver ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} /home/renaud/application/mine/DiceParser/webserver/qhttp/xbin/libqhttp.so) -INSTALL_TARGETS(/bin diceserver) #qt5_use_modules() diff --git a/src/libparser/CMakeLists.txt b/src/libparser/CMakeLists.txt index 05faa19..91fb550 100644 --- a/src/libparser/CMakeLists.txt +++ b/src/libparser/CMakeLists.txt @@ -71,9 +71,7 @@ IF(STATIC_BUILD) add_library(diceparser_static STATIC ${dice_sources} ) target_include_directories(diceparser_static PRIVATE include) target_link_libraries(diceparser_static PUBLIC Qt6::Core Qt6::Gui Qt6::Svg) - # install(TARGETS diceparser_static - # ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - rinstallLib(diceparser_static rolisteam) + rinstallLib(diceparser_static libraries) endif() @@ -99,10 +97,7 @@ include(GNUInstallDirs) configure_file(diceparser.pc.in diceparser.pc @ONLY) -#install(TARGETS diceparser_shared -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -rinstallLib(diceparser_shared rolisteam) +rinstallLib(diceparser_shared libraries) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/diceparser.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) if(Qt${QT_VERSION_MAJOR}Qml_FOUND) @@ -116,18 +111,13 @@ if(Qt${QT_VERSION_MAJOR}Qml_FOUND) set_target_properties(diceparser_qobject PROPERTIES PUBLIC_HEADER "${dice_header_qobject}") target_compile_definitions(diceparser_qobject PRIVATE DICEPARSER_QOBJECT_LIBRARY) target_link_libraries(diceparser_qobject PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Qml Qt${QT_VERSION_MAJOR}::Concurrent PRIVATE diceparser_shared) - message("Messages diceparser ${CMAKE_CURRENT_SOURCE_DIR}/include") target_include_directories(diceparser_qobject PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) - - #install(TARGETS diceparser_qobject - #LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - # PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - rinstallLib(diceparser_qobject rolisteam) + rinstallLib(diceparser_qobject libraries) endif() diff --git a/src/libparser/diceroller.cpp b/src/libparser/diceroller.cpp index e1c8ded..3c315f6 100644 --- a/src/libparser/diceroller.cpp +++ b/src/libparser/diceroller.cpp @@ -24,6 +24,8 @@ DiceRoller::DiceRoller(QObject* parent) : QObject(parent) {} +DiceRoller::~DiceRoller()= default; + QString DiceRoller::diceList() const { return m_diceList; @@ -61,21 +63,18 @@ void DiceRoller::readErrorAndWarning() void DiceRoller::start() { - auto future= QtConcurrent::run( - [this]() + auto future= QtConcurrent::run([this]() { + if(m_diceparser.parseLine(m_command)) { - if(m_diceparser.parseLine(m_command)) - { - m_diceparser.start(); - readErrorAndWarning(); - auto jsonstr - = m_diceparser.resultAsJSon([](const QString& value, const QString&, bool) { return value; }); - QJsonDocument doc= QJsonDocument::fromJson(jsonstr.toLocal8Bit()); - auto json= doc.object(); - m_result= json["scalar"].toString().toDouble(); - emit resultChanged(); - } - }); + m_diceparser.start(); + readErrorAndWarning(); + auto jsonstr= m_diceparser.resultAsJSon([](const QString& value, const QString&, bool) { return value; }); + QJsonDocument doc= QJsonDocument::fromJson(jsonstr.toLocal8Bit()); + auto json= doc.object(); + m_result= json["scalar"].toString().toDouble(); + emit resultChanged(); + } + }); } QString DiceRoller::error() const diff --git a/src/libparser/include/diceparser_qobject/diceroller.h b/src/libparser/include/diceparser_qobject/diceroller.h index 72c4e10..f389323 100644 --- a/src/libparser/include/diceparser_qobject/diceroller.h +++ b/src/libparser/include/diceparser_qobject/diceroller.h @@ -36,6 +36,7 @@ class DICEPARSER_QOBJECT_EXPORT DiceRoller : public QObject public: DiceRoller(QObject* parent= nullptr); + virtual ~DiceRoller(); QString diceList() const; QString resultStr() const; diff --git a/src/libparser/node/explodedicenode.cpp b/src/libparser/node/explodedicenode.cpp index 7c9708b..5f51f95 100644 --- a/src/libparser/node/explodedicenode.cpp +++ b/src/libparser/node/explodedicenode.cpp @@ -28,7 +28,7 @@ void ExplodeDiceNode::run(ExecutionNode* previous) die->displayed(); } - quint64 limit= -1; + qint64 limit= -1; if(m_limit) { m_limit->run(this); @@ -39,8 +39,9 @@ void ExplodeDiceNode::run(ExecutionNode* previous) } bool hasExploded= false; - std::function<void(Die*, qint64)> f= [&hasExploded, this, limit](Die* die, qint64) { - static QHash<Die*, quint64> explodePerDice; + std::function<void(Die*, qint64)> f= [&hasExploded, this, limit](Die* die, qint64) + { + static QHash<Die*, qint64> explodePerDice; if(Dice::CONDITION_STATE::ALWAYSTRUE == m_validatorList->isValidRangeSize(std::make_pair<qint64, qint64>(die->getBase(), die->getMaxValue()))) { |