Add CMake option to disable websockets

This commit is contained in:
lampysprites 2021-10-03 12:40:29 +07:00
parent 711741a358
commit 4354be1d7a
5 changed files with 24 additions and 5 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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);

View File

@ -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()