From cbedfbeaa82d3bfd23ff58347456c062e3f5e0f2 Mon Sep 17 00:00:00 2001 From: Alex Zhornyak Date: Tue, 15 Jun 2021 17:50:23 +0300 Subject: [PATCH] Fixes #184 on Ubuntu --- .gitignore | 2 ++ CMakeLists.txt | 28 +++++++++++++------ .../interpreter/BasicDelayedEventQueue.cpp | 2 +- src/uscxml/interpreter/BasicEventQueue.cpp | 2 +- src/uscxml/plugins/datamodel/CMakeLists.txt | 6 +++- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 72f7ca9b9..914dfc69f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ package/linux* package/darwin* package/windows* +settings.json + *.tgz *.class diff --git a/CMakeLists.txt b/CMakeLists.txt index 97a4d01b0..c0cbd4e52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -344,7 +344,7 @@ endif() # endif() # endif() -set(Boost_USE_STATIC_LIBS ON) # only find static libs +# set(Boost_USE_STATIC_LIBS OFF) # only find static libs set(Boost_USE_MULTITHREADED ON) find_package(Boost 1.64.0 REQUIRED @@ -382,6 +382,7 @@ find_package(SWIG) # JavaScriptCore # https://github.com/Lichtso/JSC-Standalone +# sudo apt-get install libjavascriptcoregtk-4.0-dev OPTION(WITH_DM_ECMA_JSC "Do search for JavaScriptCore" ON) if (WITH_DM_ECMA_JSC) find_package(JSC) @@ -416,17 +417,18 @@ endif() # Lua OPTION(WITH_DM_LUA "Do search for the Lua libraries" ON) if (WITH_DM_LUA) - if (WIN32) - # LuaForWindows https://code.google.com/archive/p/luaforwindows/downloads - set(ENV{LUA_DIR} "C:/Program Files (x86)/Lua/5.1/") - endif() - find_package(Lua51) - if (LUA51_FOUND) + find_package(Lua) + if (LUA_FOUND) include_directories (${LUA_INCLUDE_DIR}) include_directories(${PROJECT_SOURCE_DIR}/contrib/src/LuaBridge) list (APPEND USCXML_OPT_LIBS ${LUA_LIBRARIES}) + message(STATUS "Lua - include = ${LUA_INCLUDE_DIR}") + message(STATUS "Lua - lib = ${LUA_LIBRARIES}") else() set(WITH_DM_LUA OFF) + message(WARNING "Lua is not found! It is intended to be the MAIN DATAMODEL!") + # Ubuntu 20 + # sudo apt-get install -y liblua5.3-dev endif() endif() @@ -460,7 +462,10 @@ OPTION(WITH_DM_PROMELA "Do build with promela datamodel support" OFF) if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) SET_SOURCE_FILES_PROPERTIES(src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated-register ) endif() - +if (WIN32) +# LuaForWindows https://code.google.com/archive/p/luaforwindows/downloads +set(ENV{LUA_DIR} "C:/Program Files (x86)/Lua/5.1/") +endif() add_subdirectory(src/uscxml) add_subdirectory(src/bindings) @@ -511,7 +516,12 @@ add_executable(uscxml-browser apps/uscxml-browser.cpp ${GETOPT_FILES}) set_property(TARGET uscxml-browser PROPERTY CXX_STANDARD 11) set_property(TARGET uscxml-browser PROPERTY CXX_STANDARD_REQUIRED ON) install_executable(TARGETS uscxml-browser COMPONENT tools) -target_link_libraries(uscxml-browser uscxml) + +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_link_libraries(uscxml-browser uscxml "-lz") +else() + target_link_libraries(uscxml-browser uscxml) +endif() add_executable(uscxml-transform apps/uscxml-transform.cpp ${GETOPT_FILES}) set_property(TARGET uscxml-transform PROPERTY CXX_STANDARD 11) diff --git a/src/uscxml/interpreter/BasicDelayedEventQueue.cpp b/src/uscxml/interpreter/BasicDelayedEventQueue.cpp index 7c319577c..fdf65786e 100644 --- a/src/uscxml/interpreter/BasicDelayedEventQueue.cpp +++ b/src/uscxml/interpreter/BasicDelayedEventQueue.cpp @@ -210,7 +210,7 @@ Data BasicDelayedEventQueue::serialize() { delayedEvent["event"] = event; delayedEvent["delay"] = Data(delayMs, Data::INTERPRETED); - serialized["BasicDelayedEventQueue"].array.insert(std::make_pair(index++,event)); + serialized["BasicDelayedEventQueue"].array.insert(std::make_pair(index++,event.data)); } start(); diff --git a/src/uscxml/interpreter/BasicEventQueue.cpp b/src/uscxml/interpreter/BasicEventQueue.cpp index 3bd185b2f..5e5e2d75e 100644 --- a/src/uscxml/interpreter/BasicEventQueue.cpp +++ b/src/uscxml/interpreter/BasicEventQueue.cpp @@ -96,7 +96,7 @@ Data BasicEventQueue::serialize() { int index = 0; for (auto event : _queue) { - serialized["BasicEventQueue"].array.insert(std::make_pair(index++,event)); + serialized["BasicEventQueue"].array.insert(std::make_pair(index++,event.data)); } return serialized; } diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt index e70598ed5..f57fd3b4e 100644 --- a/src/uscxml/plugins/datamodel/CMakeLists.txt +++ b/src/uscxml/plugins/datamodel/CMakeLists.txt @@ -42,6 +42,8 @@ if (JSC_FOUND) list (APPEND USCXML_FILES ${JSC_DATAMODEL}) list (APPEND USCXML_OPT_LIBS ${JSC_LIBRARY}) endif() +else() + message(WARNING "EcmaScript (JSC) datamodel is not set!") endif() @@ -72,7 +74,7 @@ if (V8_FOUND) endif() -if (LUA51_FOUND AND WITH_DM_LUA) +if (LUA_FOUND AND WITH_DM_LUA) set(USCXML_DATAMODELS "lua ${USCXML_DATAMODELS}") # Lua ecmascript datamodel file(GLOB LUA_DATAMODEL @@ -93,6 +95,8 @@ if (LUA51_FOUND AND WITH_DM_LUA) list (APPEND USCXML_FILES ${LUA_DATAMODEL}) list (APPEND USCXML_OPT_LIBS ${LUA_LIBRARY}) endif() +else() + message(WARNING "Lua datamodel is not set!") endif() if (WITH_DM_C89)