refactor(eventsub): Allow for skipping generation of json implementations (#5904)
This can be done using the `SKIP_JSON_GENERATION` flag (off by default) The FreeBSD builder uses this flag since its python stuff is slow
This commit is contained in:
@@ -20,6 +20,7 @@ task:
|
|||||||
-DUSE_SYSTEM_QTKEYCHAIN="ON" \
|
-DUSE_SYSTEM_QTKEYCHAIN="ON" \
|
||||||
-DCMAKE_BUILD_TYPE="release" \
|
-DCMAKE_BUILD_TYPE="release" \
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS="ON" \
|
-DCMAKE_EXPORT_COMPILE_COMMANDS="ON" \
|
||||||
|
-DSKIP_JSON_GENERATION="ON" \
|
||||||
..
|
..
|
||||||
cat compile_commands.json
|
cat compile_commands.json
|
||||||
make -j $(getconf _NPROCESSORS_ONLN)
|
make -j $(getconf _NPROCESSORS_ONLN)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ FreeBSD 15.0-SNAP.
|
|||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
```
|
```
|
||||||
1. Generate build files. To enable Lua plugins in your build add `-DCHATTERINO_PLUGINS=ON` to this command.
|
1. Generate build files. To enable Lua plugins in your build add `-DCHATTERINO_PLUGINS=ON` to this command. Generating JSON implementation of EventSub blobs is slow (something to do with Python), if you're impatient you can enable the `-DSKIP_JSON_GENERATION=On` option.
|
||||||
```sh
|
```sh
|
||||||
cmake ..
|
cmake ..
|
||||||
```
|
```
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
- Bugfix: Fixed the reply button showing for inline whispers and announcements. (#5863)
|
- Bugfix: Fixed the reply button showing for inline whispers and announcements. (#5863)
|
||||||
- Bugfix: Fixed suspicious user treatment update messages not being searchable. (#5865)
|
- Bugfix: Fixed suspicious user treatment update messages not being searchable. (#5865)
|
||||||
- Bugfix: Ensure miniaudio backend exits even if it doesn't exit cleanly. (#5896)
|
- Bugfix: Ensure miniaudio backend exits even if it doesn't exit cleanly. (#5896)
|
||||||
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897)
|
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904)
|
||||||
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
||||||
- Dev: Removed unused PubSub whisper code. (#5898)
|
- Dev: Removed unused PubSub whisper code. (#5898)
|
||||||
- Dev: Updated Conan dependencies. (#5776)
|
- Dev: Updated Conan dependencies. (#5776)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ find_package(OpenSSL REQUIRED)
|
|||||||
|
|
||||||
option(BUILD_WITH_QT6 "Build with Qt6" On)
|
option(BUILD_WITH_QT6 "Build with Qt6" On)
|
||||||
option(FORCE_JSON_GENERATION "Make sure JSON implementations are generated at build time" Off)
|
option(FORCE_JSON_GENERATION "Make sure JSON implementations are generated at build time" Off)
|
||||||
|
option(SKIP_JSON_GENERATION "Skip JSON implementations generation at build time" Off)
|
||||||
|
|
||||||
if (BUILD_WITH_QT6)
|
if (BUILD_WITH_QT6)
|
||||||
set(MAJOR_QT_VERSION "6")
|
set(MAJOR_QT_VERSION "6")
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ endfunction()
|
|||||||
# [OUTPUT_SOURCES <out-var>]
|
# [OUTPUT_SOURCES <out-var>]
|
||||||
# [BASE_DIRECTORY <path>]
|
# [BASE_DIRECTORY <path>]
|
||||||
# [FORCE <force>]
|
# [FORCE <force>]
|
||||||
|
# [SKIP <skip>]
|
||||||
# HEADERS <header>...
|
# HEADERS <header>...
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
@@ -101,11 +102,13 @@ endfunction()
|
|||||||
# they're relative to the directory of the calling file.
|
# they're relative to the directory of the calling file.
|
||||||
# `FORCE`
|
# `FORCE`
|
||||||
# Always generate sources and error if it's not possible.
|
# Always generate sources and error if it's not possible.
|
||||||
|
# `SKIP`
|
||||||
|
# Never try to generate sources.
|
||||||
# `HEADERS`
|
# `HEADERS`
|
||||||
# A list of header files for which implmenetations will be generated.
|
# A list of header files for which implmenetations will be generated.
|
||||||
function(generate_json_impls)
|
function(generate_json_impls)
|
||||||
cmake_parse_arguments(PARSE_ARGV 0 arg
|
cmake_parse_arguments(PARSE_ARGV 0 arg
|
||||||
"" "OUTPUT_SOURCES;BASE_DIRECTORY;FORCE" "HEADERS"
|
"" "OUTPUT_SOURCES;BASE_DIRECTORY;FORCE;SKIP" "HEADERS"
|
||||||
)
|
)
|
||||||
_validate_all_args_are_parsed(arg HEADERS)
|
_validate_all_args_are_parsed(arg HEADERS)
|
||||||
if(NOT DEFINED arg_BASE_DIRECTORY)
|
if(NOT DEFINED arg_BASE_DIRECTORY)
|
||||||
@@ -114,10 +117,6 @@ function(generate_json_impls)
|
|||||||
|
|
||||||
cmake_path(SET _gen_script NORMALIZE "${_eventsub_lib_root}/ast/generate.py")
|
cmake_path(SET _gen_script NORMALIZE "${_eventsub_lib_root}/ast/generate.py")
|
||||||
|
|
||||||
if(arg_FORCE AND NOT Python3_EXECUTABLE)
|
|
||||||
message(FATAL_ERROR "Missing python3")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# get includes
|
# get includes
|
||||||
get_target_property(_qt_inc_dirs Qt${MAJOR_QT_VERSION}::Core INCLUDE_DIRECTORIES)
|
get_target_property(_qt_inc_dirs Qt${MAJOR_QT_VERSION}::Core INCLUDE_DIRECTORIES)
|
||||||
get_target_property(_qt_iinc_dirs Qt${MAJOR_QT_VERSION}::Core INTERFACE_INCLUDE_DIRECTORIES)
|
get_target_property(_qt_iinc_dirs Qt${MAJOR_QT_VERSION}::Core INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
@@ -128,32 +127,41 @@ function(generate_json_impls)
|
|||||||
list(APPEND _inc_dirs ${OPENSSL_INCLUDE_DIR})
|
list(APPEND _inc_dirs ${OPENSSL_INCLUDE_DIR})
|
||||||
list(JOIN _inc_dirs ";" _inc_dir)
|
list(JOIN _inc_dirs ";" _inc_dir)
|
||||||
|
|
||||||
# setup venv (<build>/lib/twitch-eventsub-ws/eventsub-venv)
|
if(NOT arg_SKIP)
|
||||||
if(Python3_EXECUTABLE)
|
if(arg_FORCE AND NOT Python3_EXECUTABLE)
|
||||||
_setup_and_check_venv(
|
message(FATAL_ERROR "Missing python3")
|
||||||
INCLUDES "${_inc_dirs}"
|
endif()
|
||||||
OUT_PYTHON_EXE _python3_path
|
|
||||||
OUT_CHECK _check_output
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT _check_output AND _python3_path)
|
# setup venv (<build>/lib/twitch-eventsub-ws/eventsub-venv)
|
||||||
set(_generation_supported On)
|
if(Python3_EXECUTABLE)
|
||||||
|
_setup_and_check_venv(
|
||||||
|
INCLUDES "${_inc_dirs}"
|
||||||
|
OUT_PYTHON_EXE _python3_path
|
||||||
|
OUT_CHECK _check_output
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT _check_output AND _python3_path)
|
||||||
|
set(_generation_supported On)
|
||||||
|
else()
|
||||||
|
set(_generation_supported Off)
|
||||||
|
if (arg_FORCE)
|
||||||
|
message(FATAL_ERROR "Generation of JSON implementation not supported, because the parser can't parse a simple TU:\n${_check_output}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(_generation_supported Off)
|
set(_generation_supported Off)
|
||||||
if (arg_FORCE)
|
endif()
|
||||||
message(FATAL_ERROR "Generation of JSON implementation not supported, because the parser can't parse a simple TU:\n${_check_output}")
|
|
||||||
endif()
|
if(_generation_supported)
|
||||||
|
message(STATUS "Generation of JSON implementation is supported")
|
||||||
|
else()
|
||||||
|
message(STATUS "Generation of JSON implementation is not supported (use FORCE_JSON_GENERATION=On to get more information)")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
message(STATUS "Generation of JSON implementation is skipped because the SKIP_JSON_GENERATION option is On")
|
||||||
set(_generation_supported Off)
|
set(_generation_supported Off)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(_generation_supported)
|
|
||||||
message(STATUS "Generation of JSON implementation is supported")
|
|
||||||
else()
|
|
||||||
message(STATUS "Generation of JSON implementation is not supported (use FORCE_JSON_GENERATION=On to get more information)")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# get all dependencies
|
# get all dependencies
|
||||||
file(GLOB _gen_deps "${_eventsub_lib_root}/ast/lib/*.py")
|
file(GLOB _gen_deps "${_eventsub_lib_root}/ast/lib/*.py")
|
||||||
file(GLOB _ast_templates "${_eventsub_lib_root}/ast/lib/templates/*.tmpl")
|
file(GLOB _ast_templates "${_eventsub_lib_root}/ast/lib/templates/*.tmpl")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ generate_json_impls(
|
|||||||
OUTPUT_SOURCES eventsub_generated_sources
|
OUTPUT_SOURCES eventsub_generated_sources
|
||||||
BASE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/.."
|
BASE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/.."
|
||||||
FORCE ${FORCE_JSON_GENERATION}
|
FORCE ${FORCE_JSON_GENERATION}
|
||||||
|
SKIP ${SKIP_JSON_GENERATION}
|
||||||
HEADERS
|
HEADERS
|
||||||
include/twitch-eventsub-ws/messages/metadata.hpp
|
include/twitch-eventsub-ws/messages/metadata.hpp
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user