diff --git a/CMakeLists.txt b/CMakeLists.txt index d0e9063..2a166be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,14 +199,18 @@ print(f'Stripped test blocks from {count} files') src/engine_init.cc ) - # Combine all C++ sources - set(ALL_CXX_SRC + # Pure Javelin sources (no ZMK deps) → separate library for C++23 + set(JAVELIN_LIB_SRC ${JAVELIN_CORE_SRC} ${JAVELIN_DICT_SRC} ${JAVELIN_PROC_SRC} ${JAVELIN_HAL_SRC} ${JAVELIN_FONT_SRC} ${JAVELIN_SPLIT_SRC} + ) + + # Shims + init (need ZMK headers) → compiled into app target + set(ZMK_BRIDGE_SRC ${ZMK_SHIM_SRC} ${ZMK_INIT_SRC} ) @@ -214,7 +218,7 @@ print(f'Stripped test blocks from {count} files') # Build Javelin as a separate static library so we can control # C++ standard without Zephyr's -std=c++11 interfering. zephyr_library_named(javelin_steno) - zephyr_library_sources(${ALL_CXX_SRC}) + zephyr_library_sources(${JAVELIN_LIB_SRC}) zephyr_library_compile_options( -std=gnu++23 -fno-exceptions @@ -233,8 +237,14 @@ print(f'Stripped test blocks from {count} files') # Test suppression handled by include/javelin_overrides/unit_test.h # which shadows Javelin's unit_test.h via include path ordering. + # Bridge sources (C++ with ZMK headers) compiled into app target + set_source_files_properties(${ZMK_BRIDGE_SRC} PROPERTIES + COMPILE_FLAGS "-std=gnu++23 -fno-exceptions -fno-rtti -fno-threadsafe-statics -fpermissive" + ) + target_sources(app PRIVATE ${ZMK_BEHAVIOR_SRC} + ${ZMK_BRIDGE_SRC} ) # Dictionary binary embedding. diff --git a/include/zmk_javelin_steno/zmk_platform_shim.h b/include/zmk_javelin_steno/zmk_platform_shim.h index 8adf0b0..414d52c 100644 --- a/include/zmk_javelin_steno/zmk_platform_shim.h +++ b/include/zmk_javelin_steno/zmk_platform_shim.h @@ -1,5 +1,7 @@ #pragma once +#include + #ifdef __cplusplus extern "C" { #endif @@ -7,7 +9,6 @@ extern "C" { void zmk_javelin_steno_init(void); void zmk_javelin_steno_process_key(int steno_key_index, bool is_press); -// Linker symbols for the embedded dictionary binary extern const uint8_t _javelin_dict_start[]; extern const uint8_t _javelin_dict_end[]; diff --git a/src/platform/zmk_key_shim.cc b/src/platform/zmk_key_shim.cc index 79e18f7..93a7e9d 100644 --- a/src/platform/zmk_key_shim.cc +++ b/src/platform/zmk_key_shim.cc @@ -1,8 +1,9 @@ #include "key.h" #include "key_code.h" -extern "C" { #include + +extern "C" { #include #include }