ChatON+: Cleanup integration with CMake
Rename chaton-meta hpp to cpp and include this cpp file which brings in the compile time built-in global chaton configurable template data into the common library, and avoid the nop hpp file references. Update chaton.hpp to not include the meta-cpp, instead just make a reference to the global ChatTemplates instance, so that the hpp can be used as a header file proper. Avoid pragma once in the chaton-meta.cpp, including the script, which helps create it.
This commit is contained in:
parent
7a3ac0cc15
commit
239b5be219
4 changed files with 5 additions and 8 deletions
|
@ -65,8 +65,7 @@ add_library(${TARGET} STATIC
|
||||||
train.cpp
|
train.cpp
|
||||||
ngram-cache.h
|
ngram-cache.h
|
||||||
ngram-cache.cpp
|
ngram-cache.cpp
|
||||||
chaton.hpp
|
chaton_meta.cpp
|
||||||
groupkv.hpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
if (BUILD_SHARED_LIBS)
|
||||||
|
|
|
@ -537,9 +537,8 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The compiled-in configurable template data (the meta)
|
// The compiled-in configurable template data (the meta) from chaton_meta.cpp
|
||||||
#include "chaton_meta.hpp"
|
extern ChatTemplates gCT;
|
||||||
//ChatTemplates gCT = {{}};
|
|
||||||
|
|
||||||
|
|
||||||
inline bool chaton_tmpl_exists(const std::string &tmpl) {
|
inline bool chaton_tmpl_exists(const std::string &tmpl) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
//This is auto created/converted from chaton-meta-json file
|
//This is auto created/converted from chaton-meta-json file
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "chaton.hpp"
|
#include "chaton.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Convert chaton meta json file to c++ hpp file
|
# Convert chaton meta json file to equivalent c++ cpp format
|
||||||
# by Humans for All
|
# by Humans for All
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -19,7 +19,7 @@ def kv_bool(j, tmpl, k1, comma):
|
||||||
fp=open(sys.argv[1])
|
fp=open(sys.argv[1])
|
||||||
j=json.load(fp)
|
j=json.load(fp)
|
||||||
print("//This is auto created/converted from chaton-meta-json file")
|
print("//This is auto created/converted from chaton-meta-json file")
|
||||||
print("#pragma once\n\n#include \"chaton.hpp\"\n\nChatTemplates gCT = {{")
|
print("\n\n#include \"chaton.hpp\"\n\nChatTemplates gCT = {{")
|
||||||
|
|
||||||
for tmpl in j:
|
for tmpl in j:
|
||||||
print("\t{{ \"{}\", {{".format(tmpl))
|
print("\t{{ \"{}\", {{".format(tmpl))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue