Fix: use sed instead of git patches for javelin source modifications
This commit is contained in:
parent
ab8cad5439
commit
9cfaca3aca
1 changed files with 15 additions and 19 deletions
|
|
@ -3,26 +3,22 @@ if(CONFIG_ZMK_JAVELIN_STENO)
|
||||||
# Only compile on central side of split keyboards (or non-split)
|
# Only compile on central side of split keyboards (or non-split)
|
||||||
if((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
if((NOT CONFIG_ZMK_SPLIT) OR CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
|
||||||
|
|
||||||
# Apply patches to javelin source (removes constexpr from reinterpret_cast sites)
|
# Patch javelin source for Zephyr compatibility
|
||||||
set(JAVELIN_PATCH_DIR "${CMAKE_CURRENT_LIST_DIR}/patches")
|
|
||||||
set(JAVELIN_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/javelin")
|
set(JAVELIN_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/javelin")
|
||||||
if(EXISTS "${JAVELIN_PATCH_DIR}" AND EXISTS "${JAVELIN_SRC_DIR}")
|
if(EXISTS "${JAVELIN_SRC_DIR}/dictionary/user_dictionary.h")
|
||||||
file(GLOB JAVELIN_PATCHES "${JAVELIN_PATCH_DIR}/*.patch")
|
# Remove constexpr from StenoUserDictionaryData constructor
|
||||||
foreach(PATCH ${JAVELIN_PATCHES})
|
# (reinterpret_cast not allowed in constexpr on GCC)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git apply --check ${PATCH}
|
COMMAND sed -i "s/constexpr StenoUserDictionaryData(const uint8_t/StenoUserDictionaryData(const uint8_t/"
|
||||||
WORKING_DIRECTORY ${JAVELIN_SRC_DIR}
|
"${JAVELIN_SRC_DIR}/dictionary/user_dictionary.h"
|
||||||
RESULT_VARIABLE PATCH_CHECK_RESULT
|
)
|
||||||
ERROR_QUIET
|
# Make TEST_BEGIN use template to dead-code test bodies
|
||||||
)
|
# (test code references RUN_TESTS-only APIs)
|
||||||
if(PATCH_CHECK_RESULT EQUAL 0)
|
execute_process(
|
||||||
execute_process(
|
COMMAND sed -i "s/static void Test() {/template<bool _d=false> static void Test() {/"
|
||||||
COMMAND git apply ${PATCH}
|
"${JAVELIN_SRC_DIR}/unit_test.h"
|
||||||
WORKING_DIRECTORY ${JAVELIN_SRC_DIR}
|
)
|
||||||
)
|
message(STATUS "Javelin steno: source patches applied")
|
||||||
message(STATUS "Javelin steno: applied patch ${PATCH}")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Override dir MUST come before javelin/ so our unit_test.h is found first
|
# Override dir MUST come before javelin/ so our unit_test.h is found first
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue