diff --git a/core/src/kmx/kmx_file.h b/common/include/kmx_file.h similarity index 98% rename from core/src/kmx/kmx_file.h rename to common/include/kmx_file.h index bc32a4acc2..91df31c3b2 100644 --- a/core/src/kmx/kmx_file.h +++ b/common/include/kmx_file.h @@ -5,11 +5,14 @@ #pragma once -#include "kmx_base.h" +#include +#ifdef KMN_KBP +// TODO: move this to a common namespace keyman::common::kmx_file or similar in the future namespace km { namespace kbp { namespace kmx { +#endif /* */ @@ -352,6 +355,8 @@ static_assert(sizeof(COMP_KEY) == KEYBOARDFILEKEY_SIZE, "COMP_KEY must be KEYBOA static_assert(sizeof(COMP_GROUP) == KEYBOARDFILEGROUP_SIZE, "COMP_GROUP must be KEYBOARDFILEGROUP_SIZE bytes"); static_assert(sizeof(COMP_KEYBOARD) == KEYBOARDFILEHEADER_SIZE, "COMP_KEYBOARD must be KEYBOARDFILEHEADER_SIZE bytes"); +#ifdef KMN_KBP } // namespace kmx } // namespace kbp } // namespace km +#endif \ No newline at end of file diff --git a/core/meson.build b/core/meson.build index ed5e33bdbb..cad35decec 100644 --- a/core/meson.build +++ b/core/meson.build @@ -37,6 +37,10 @@ message('compiler.get_id(): ' + compiler.get_id()) cc = meson.get_compiler('c') +# TODO: Shared includes may use namespaces, etc which need future tidyup. +# For now, we use KMN_KBP to inject the km::kbp::kmx namespace +defns = ['-DKMN_KBP'] + subdir('doc') subdir('include') subdir('src') diff --git a/core/src/meson.build b/core/src/meson.build index 1e3b6e82fc..ebca69b599 100644 --- a/core/src/meson.build +++ b/core/src/meson.build @@ -4,7 +4,7 @@ # Authors: Tim Eves (TSE) # -defns = ['-DKMN_KBP_EXPORTING'] +defns += ['-DKMN_KBP_EXPORTING'] version_res = [] if compiler.get_id() == 'gcc' or compiler.get_id() == 'clang' @@ -54,7 +54,7 @@ endif if compiler.get_id() == 'emscripten' warns = [] flags = [] - defns = [] + defns = ['-DKMN_KBP'] links = [] endif diff --git a/core/tests/unit/kmnkbd/meson.build b/core/tests/unit/kmnkbd/meson.build index 2a794ec1cb..4cdaa91186 100644 --- a/core/tests/unit/kmnkbd/meson.build +++ b/core/tests/unit/kmnkbd/meson.build @@ -13,7 +13,7 @@ else warns = [] endif -defns=['-DKMN_KBP_STATIC'] +defns+=['-DKMN_KBP_STATIC'] tests = [ ['context-api', 'context_api.cpp'], ['keyboard-api', 'keyboard_api.cpp'], diff --git a/core/tests/unit/kmnkbd/test_kmx_xstring.cpp b/core/tests/unit/kmnkbd/test_kmx_xstring.cpp index 3b944028c3..eec1894c0a 100644 --- a/core/tests/unit/kmnkbd/test_kmx_xstring.cpp +++ b/core/tests/unit/kmnkbd/test_kmx_xstring.cpp @@ -11,7 +11,7 @@ #include #include #include "../../../src/kmx/kmx_xstring.h" -#include "../../../src/kmx/kmx_file.h" +#include #include "../test_assert.h" using namespace km::kbp::kmx;