|
|
@@ -23,26 +23,31 @@ def get_sources():
|
|
|
sources = get_sources()
|
|
|
|
|
|
# use LF line endings instead of CRLF
|
|
|
-with open("include/pocketpy/common/_generated.hpp", "wt", encoding='utf-8', newline='\n') as f:
|
|
|
+with open("include/pocketpy/common/_generated.h", "wt", encoding='utf-8', newline='\n') as f:
|
|
|
data = '''#pragma once
|
|
|
// generated by prebuild.py
|
|
|
|
|
|
-namespace pkpy{
|
|
|
+#ifdef __cplusplus
|
|
|
+extern "C" {
|
|
|
+#endif
|
|
|
+
|
|
|
'''
|
|
|
for key in sorted(sources.keys()):
|
|
|
value = sources[key]
|
|
|
- data += f' extern const char kPythonLibs_{key}[];\n'
|
|
|
- data += '} // namespace pkpy\n'
|
|
|
+ data += f'extern const char kPythonLibs_{key}[];\n'
|
|
|
+ data += '''
|
|
|
+#ifdef __cplusplus
|
|
|
+} // extern "C"
|
|
|
+#endif
|
|
|
+'''
|
|
|
f.write(data)
|
|
|
|
|
|
-with open("src/common/_generated.cpp", "wt", encoding='utf-8', newline='\n') as f:
|
|
|
+with open("src/common/_generated.c", "wt", encoding='utf-8', newline='\n') as f:
|
|
|
data = '''// generated by prebuild.py
|
|
|
-#include "pocketpy/common/_generated.hpp"
|
|
|
+#include "pocketpy/common/_generated.h"
|
|
|
|
|
|
-namespace pkpy{
|
|
|
'''
|
|
|
for key in sorted(sources.keys()):
|
|
|
value = sources[key]
|
|
|
- data += f' const char kPythonLibs_{key}[] = {value};\n'
|
|
|
- data += '} // namespace pkpy\n'
|
|
|
+ data += f'const char kPythonLibs_{key}[] = {value};\n'
|
|
|
f.write(data)
|