diff --git a/CMakeLists.txt b/CMakeLists.txt index 3af0bd074..5ce626045 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ option(ENABLE_MEMLEAK "Enable memory-leaks detector (only for developers)" option(ENABLE_NEWS "Enable the news in Home tab" on) option(ENABLE_UPDATER "Enable automatic check for updates" on) option(ENABLE_SCRIPTING "Compile with scripting support" on) +option(ENABLE_WEBSOCKET "Compile with websocket support" on) option(ENABLE_TESTS "Compile unit tests" off) option(ENABLE_BENCHMARKS "Compile benchmarks" off) option(ENABLE_TRIAL_MODE "Compile the trial version" off) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dfc2fefbd..cb25aeac6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -74,6 +74,11 @@ if(ENABLE_SCRIPTING) add_definitions(-DENABLE_SCRIPTING) endif() +if(ENABLE_WEBSOCKET) + # Needed for "app" and "main" + add_definitions(-DENABLE_WEBSOCKET) +endif() + ###################################################################### # Aseprite Libraries (in preferred order to be built) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index de55dae70..9f2e07549 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -147,6 +147,10 @@ if(ENABLE_SCRIPTING) commands/cmd_open_script_folder.cpp ui/devconsole_view.cpp) endif() + if(ENABLE_WEBSOCKET) + set(scripting_files_ws + script/websocket_class.cpp) + endif() set(scripting_files commands/cmd_run_script.cpp script/app_command_object.cpp @@ -189,8 +193,8 @@ if(ENABLE_SCRIPTING) script/tool_class.cpp script/values.cpp script/version_class.cpp - script/websocket_class.cpp shell.cpp + ${scripting_files_ws} ${scripting_files_ui}) endif() @@ -674,7 +678,11 @@ if(REQUIRE_CURL) endif() if(ENABLE_SCRIPTING) - target_link_libraries(app-lib lua lauxlib lualib ixwebsocket) + target_link_libraries(app-lib lua lauxlib lualib) + + if(ENABLE_WEBSOCKET) + target_link_libraries(app-lib ixwebsocket) + endif() endif() if(ENABLE_UPDATER) diff --git a/src/app/script/engine.cpp b/src/app/script/engine.cpp index 5417bb435..cf6c7f7b5 100644 --- a/src/app/script/engine.cpp +++ b/src/app/script/engine.cpp @@ -412,7 +412,9 @@ Engine::Engine() register_tags_class(L); register_tool_class(L); register_version_class(L); +#if ENABLE_WEBSOCKET register_websocket_class(L); + #endif // Check that we have a clean start (without dirty in the stack) ASSERT(lua_gettop(L) == top); diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 4592f5518..8e5428f1c 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -160,7 +160,10 @@ if(ENABLE_SCRIPTING) target_include_directories(lualib PUBLIC lua) target_link_libraries(lauxlib lua) -# ixwebsocket -add_subdirectory(ixwebsocket) -target_include_directories(ixwebsocket PUBLIC) + # ixwebsocket + if(ENABLE_WEBSOCKET) + add_subdirectory(IXWebSocket) + target_include_directories(ixwebsocket PUBLIC) + endif() + endif()