diff --git a/tools/merger/join.sh b/tools/merger/join.sh index da43cc0..314dc19 100755 --- a/tools/merger/join.sh +++ b/tools/merger/join.sh @@ -6,4 +6,5 @@ cd .. python tools/merger/join.py --template tools/merger/sfw.h.inl --path . --output tools/merger/out/sfw.h python tools/merger/join.py --template tools/merger/sfw.cpp.inl --path . --output tools/merger/out/sfw.cpp +python tools/merger/join.py --template tools/merger/sfw.x.inl --path . --output tools/merger/out/sfw diff --git a/tools/merger/sfw.cpp.inl b/tools/merger/sfw.cpp.inl index 313e105..13d9a91 100644 --- a/tools/merger/sfw.cpp.inl +++ b/tools/merger/sfw.cpp.inl @@ -4,87 +4,290 @@ #include "sfw.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -{{FILE:sfw/render_core/3rd_stb_truetype.h}} -{{FILE:sfw/render_core/3rd_stb_image.h}} -{{FILE:sfw/render_core/3rd_glfw3.h}} -//{//{//FILE:sfw/render_core/stb_image_write.h}} {{FILE:sfw/core/ucaps.h}} -{{FILE:sfw/core/aabb.cpp}} -{{FILE:sfw/core/vector3i.cpp}} -{{FILE:sfw/core/transform_2d.cpp}} -{{FILE:sfw/core/stime.cpp}} -{{FILE:sfw/core/projection.cpp}} -{{FILE:sfw/core/pool_vector.cpp}} -{{FILE:sfw/core/vector3.cpp}} -{{FILE:sfw/core/pcg.cpp}} -{{FILE:sfw/core/vector2.cpp}} +#include "core/mutex.h" {{FILE:sfw/core/mutex.cpp}} -{{FILE:sfw/core/basis.cpp}} +//#if defined(DEBUG_ENABLED) && !defined(NO_THREADS) +#include "core/safe_refcount.h" +#include "core/error/error_macros.h" +{{FILE:sfw/core/safe_refcount.cpp}} + +#include "core/stime.h" +{{FILE:sfw/core/stime.cpp}} + +#include "core/memory.h" +#include "core/error_macros.h" +#include "core/safe_refcount.h" {{FILE:sfw/core/memory.cpp}} //{//{//FILE:sfw/core/old/directory.cpp}} -{{FILE:sfw/core/face3.cpp}} -{{FILE:sfw/core/safe_refcount.cpp}} -{{FILE:sfw/core/string_name.cpp}} -{{FILE:sfw/core/vector4i.cpp}} -{{FILE:sfw/core/transform.cpp}} -{{FILE:sfw/core/ustring.cpp}} -{{FILE:sfw/core/logger.cpp}} -{{FILE:sfw/core/color.cpp}} + +#include "core/pool_vector.h" +{{FILE:sfw/core/pool_vector.cpp}} +#include "pool_allocator.h" +#include "core/error_macros.h" +#include "core/memory.h" {{FILE:sfw/core/pool_allocator.cpp}} -{{FILE:sfw/core/quaternion.cpp}} -{{FILE:sfw/core/plane.cpp}} -{{FILE:sfw/core/vector2i.cpp}} -{{FILE:sfw/core/rect2.cpp}} -{{FILE:sfw/core/rect2i.cpp}} -{{FILE:sfw/core/random_pcg.cpp}} -{{FILE:sfw/core/vector4.cpp}} + +#include "core/math_funcs.h" +#include "core/error_macros.h" {{FILE:sfw/core/math_funcs.cpp}} +#include "core/ustring.h" + +#include "core/color.h" +#include "core/math_funcs.h" +#include "core/memory.h" +#include "ucaps.h" +{{FILE:sfw/core/ustring.cpp}} +#include "core/logger.h" +#include "core/ustring.h" +{{FILE:sfw/core/logger.cpp}} +#include "core/string_name.h" +{{FILE:sfw/core/string_name.cpp}} + +//#include "core/aabb.h" +{{FILE:sfw/core/aabb.cpp}} +#include "core/vector3i.h" +#include "core/vector3.h" +#include "core/ustring.h" +{{FILE:sfw/core/vector3i.cpp}} +#include "core/transform_2d.h" +{{FILE:sfw/core/transform_2d.cpp}} +#include "core/projection.h" +#include "core/aabb.h" +#include "core/math_funcs.h" +#include "core/plane.h" +#include "core/rect2.h" +#include "core/transform.h" +{{FILE:sfw/core/projection.cpp}} +#include "core/vector3.h" +#include "core/basis.h" +{{FILE:sfw/core/vector3.cpp}} +#include "core/pcg.h" +{{FILE:sfw/core/pcg.cpp}} +#include "core/vector2.h" +#include "core/ustring.h" +{{FILE:sfw/core/vector2.cpp}} +#include "core/basis.h" +#include "core/math_funcs.h" +{{FILE:sfw/core/basis.cpp}} +#include "face3.h" +{{FILE:sfw/core/face3.cpp}} +#include "core/vector4i.h" +#include "core/vector4.h" +#include "core/ustring.h" +{{FILE:sfw/core/vector4i.cpp}} +#include "core/transform.h" +#include "core/math_funcs.h" +{{FILE:sfw/core/transform.cpp}} +#include "core/color.h" +#include "core/math_funcs.h" +{{FILE:sfw/core/color.cpp}} +#include "core/quaternion.h" +#include "core/basis.h" +{{FILE:sfw/core/quaternion.cpp}} +#include "core/plane.h" +#include "core/math_funcs.h" +{{FILE:sfw/core/plane.cpp}} +#include "core/vector2i.h" +#include "core/ustring.h" +{{FILE:sfw/core/vector2i.cpp}} +#include "core/transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D +#include "core/rect2i.h" +{{FILE:sfw/core/rect2.cpp}} +#include "core/transform_2d.h" // Includes rect2.h but Rect2 needs Transform2D +{{FILE:sfw/core/rect2i.cpp}} +#include "core/random_pcg.h" +#include "core/stime.h" +#include "core/error_macros.h" +{{FILE:sfw/core/random_pcg.cpp}} +#include "core/vector4.h" +#include "core/basis.h" +{{FILE:sfw/core/vector4.cpp}} + +#include "resource.h" {{FILE:sfw/object/resource.cpp}} +#include "object/reference.h" {{FILE:sfw/object/reference.cpp}} +#include "object/object.h" +#include "core/error_macros.h" +#include "core/logger.h" +#include "object/core_string_names.h" +#include "object/object_rc.h" {{FILE:sfw/object/object.cpp}} -{{FILE:sfw/object/variant.cpp}} +#include "ref_ptr.h" +#include "object/reference.h" +#include "object/resource.h" {{FILE:sfw/object/ref_ptr.cpp}} +#include "core_string_names.h" {{FILE:sfw/object/core_string_names.cpp}} +#include "dictionary.h" +#include "core/ordered_hash_map.h" +#include "core/safe_refcount.h" +#include "object/variant.h" {{FILE:sfw/object/dictionary.cpp}} +#include "array.h" +#include "core/hashfuncs.h" +#include "core/vector.h" +#include "object/object.h" +#include "object/variant.h" +#include "core/ustring.h" {{FILE:sfw/object/array.cpp}} +#include "psignal.h" {{FILE:sfw/object/psignal.cpp}} +#include "variant.h" +#include "core/math_funcs.h" +#include "object/core_string_names.h" +#include "object/object.h" +#include "object/object_rc.h" +#include "object/resource.h" +{{FILE:sfw/object/variant.cpp}} +#include "variant.h" +#include "object/core_string_names.h" +#include "object/object.h" +#include "object/object_rc.h" +#include "object/resource.h" {{FILE:sfw/object/variant_op.cpp}} {{FILE:sfw/render_core/font_data_bm_mini.inc.h}} {{FILE:sfw/render_core/font_data_tables.inc.h}} +#include "render_core/texture.h" +#include "core/memory.h" +#include "render_core/window.h" {{FILE:sfw/render_core/texture.cpp}} +#include "render_core/application.h" +#include "core/math_defs.h" +#include "core/stime.h" +#include "render_core/input.h" +#include "render_core/input_map.h" +#include "render_core/window.h" +#include "core/pool_vector.h" +#include "core/string_name.h" +#include "object/core_string_names.h" {{FILE:sfw/render_core/application.cpp}} +#include "render_core/shader.h" {{FILE:sfw/render_core/shader.cpp}} +#include "input_event.h" +#include "render_core/input_map.h" +#include "render_core/keyboard.h" +#include "render_core/shortcut.h" {{FILE:sfw/render_core/input_event.cpp}} +#include "render_core/mesh.h" +#include "render_core/shader.h" {{FILE:sfw/render_core/mesh.cpp}} +#include "font.h" +#include "window.h" +#include "3rd_glad.h" +#include "3rd_stb_truetype.h" +#include "font_data_bm_mini.inc.h" +#include "font_data_tables.inc.h" +#include "render_core/image.h" +#include "render_core/mesh.h" +#include "render_core/texture.h" {{FILE:sfw/render_core/font.cpp}} +#include "render_core/render_state.h" {{FILE:sfw/render_core/render_state.cpp}} +#include "render_core/mesh_utils.h" {{FILE:sfw/render_core/mesh_utils.cpp}} +#include "shortcut.h" +#include "render_core/input_event.h" {{FILE:sfw/render_core/shortcut.cpp}} +#include "render_core/material.h" {{FILE:sfw/render_core/material.cpp}} -{{FILE:sfw/render_core/primitive_meshes.cpp}} +//{//{FILE:sfw/render_core/primitive_meshes.cpp}} +#include "render_core/image.h" +#include "core/error_macros.h" +#include "core/hash_map.h" +#include "math.h" +#include "core/memory.h" +#include "core/vector3.h" +#include "3rd_stb_image.h" {{FILE:sfw/render_core/image.cpp}} +#include "render_core/window.h" +#include "render_core/3rd_glad.h" +#include "3rd_glfw3.h" +#include "core/error_macros.h" +#include "core/stime.h" +#include "core/ustring.h" +#include "core/vector4.h" +#include "render_core/application.h" +#include "render_core/input.h" {{FILE:sfw/render_core/window.cpp}} +#include "keyboard.h" {{FILE:sfw/render_core/keyboard.cpp}} +#include "input_map.h" +#include "render_core/input.h" +#include "render_core/keyboard.h" {{FILE:sfw/render_core/input_map.cpp}} +#include "render_core/scene.h" +#include "render_core/input_event.h" {{FILE:sfw/render_core/scene.cpp}} +#include "input.h" +#include "core/logger.h" +#include "core/stime.h" +#include "render_core/application.h" +#include "render_core/input_map.h" +#include "render_core/keyboard.h" +#include "render_core/texture.h" +#include "render_core/window.h" +#include "render_core/3rd_glfw3.h" {{FILE:sfw/render_core/input.cpp}} +#include "renderer.h" +#include "render_core/color_material_2d.h" +#include "render_core/font.h" +#include "render_core/font_material.h" +#include "render_core/material.h" +#include "render_core/mesh.h" +#include "render_core/texture.h" +#include "render_core/texture_material_2d.h" +#include "render_core/window.h" +#include "render_core/render_state.h" {{FILE:sfw/render_immediate/renderer.cpp}} +#include "render_objects/camera_3d.h" +#include "core/math_funcs.h" +#include "render_core/render_state.h" {{FILE:sfw/render_objects/camera_3d.cpp}} +#include "render_objects/sprite.h" {{FILE:sfw/render_objects/sprite.cpp}} +#include "render_objects/camera_2d.h" +#include "core/math_funcs.h" +#include "render_core/render_state.h" {{FILE:sfw/render_objects/camera_2d.cpp}} +#include "render_objects/mesh_instance_3d.h" +#include "render_objects/camera_3d.h" {{FILE:sfw/render_objects/mesh_instance_3d.cpp}} +#include "render_objects/object_3d.h" {{FILE:sfw/render_objects/object_3d.cpp}} +#include "render_objects/tile_map.h" +#include "render_objects/camera_2d.h" {{FILE:sfw/render_objects/tile_map.cpp}} +#include "render_objects/text_2d.h" +#include "render_core/font.h" +#include "render_core/font_material.h" +#include "render_core/mesh.h" +#include "render_objects/camera_2d.h" {{FILE:sfw/render_objects/text_2d.cpp}} +#include "render_objects/object_2d.h" {{FILE:sfw/render_objects/object_2d.cpp}} +#include "render_objects/mesh_instance_2d.h" +#include "render_objects/camera_2d.h" {{FILE:sfw/render_objects/mesh_instance_2d.cpp}} diff --git a/tools/merger/sfw.h.inl b/tools/merger/sfw.h.inl index df4604b..9d25699 100644 --- a/tools/merger/sfw.h.inl +++ b/tools/merger/sfw.h.inl @@ -327,14 +327,6 @@ SOFTWARE. {{FILE:sfw/object/array.h}} -//TODO -//we only need a few types from this here, maybe those should be just moved to a common header -//Or just use normal types in their place -//GLint, GLChar, GLuint, GLfloat, GLenum -//also materials need to be split. -//{//{FILE:sfw/render_core/3rd_glad.h}} - - //#include "core/projection.h" //#include "core/transform.h" //#include "core/vector3.h" @@ -493,4 +485,25 @@ SOFTWARE. //#include "core/transform.h" {{FILE:sfw/render_objects/mesh_instance_2d.h}} + + +// expose glfw/glad apis +#if __EMSCRIPTEN__ + #include + #include + #include + #include + #define gladLoadGL(func) (glewExperimental = true, glewInit() == GLEW_OK) ///- +#else + #if is(win32) /*&& is(tcc)*/ // && ENABLE_DLL + #ifdef GLAD_API_CALL + #undef GLAD_API_CALL + #endif + #define GLAD_API_CALL extern API ///- + #endif + #ifndef GLAD_GL_H_ + #include "sfw" + #endif +#endif + #endif diff --git a/tools/merger/sfw.x.inl b/tools/merger/sfw.x.inl new file mode 100644 index 0000000..cdf9c9d --- /dev/null +++ b/tools/merger/sfw.x.inl @@ -0,0 +1,75 @@ + +// https://github.com/Relintai/sfw + +/* +Copyright (c) 2023-present Péter Magyar. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +// TODO gather all licenses to here + + + +#ifdef SFW_3RD_H +#endif + +//Add implementation defines + + +#define GLAD_GL_IMPLEMENTATION // glad +{{FILE:sfw/render_core/3rd_glad.h}} + +#define STB_TRUETYPE_IMPLEMENTATION +{{FILE:sfw/render_core/3rd_stb_truetype.h}} + + + +#define STB_IMAGE_IMPLEMENTATION // stbi +#define STB_IMAGE_WRITE_IMPLEMENTATION // stbi_write +#define STB_SPRINTF_IMPLEMENTATION // stb_sprintf +#define STB_SPRINTF_NOUNALIGNED // stb_sprintf + +{{FILE:sfw/render_core/3rd_stb_image.h}} + +//{//{//FILE:sfw/render_core/stb_image_write.h}} +//--- +#undef freelist +//#define STBTT_malloc(x, u) ((void)(u), MALLOC(x)) +//#define STBTT_free(x, u) ((void)(u), FREE(x)) +//#define NK_ASSERT ASSERT +//#define NK_DTOA(s, n) strcpy(s, va("%f", n)) // override cos built-in nk_dtoa() will freeze while parsing UINT_MAX otherwise + + +#define _GLFW_IMPLEMENTATION // glfw337 +#define GLFW_INCLUDE_NONE // glfw337 +#ifdef __APPLE__ +#define _GLFW_COCOA // glfw osx +#elif defined(_WIN32) || defined(_WIN64) +#define _GLFW_WIN32 // glfw win32 +#else +#define _GLFW_X11 // glfw linux, also _GLFW_OSMESA or _GLFW_WAYLAND +#endif + +#undef _GNU_SOURCE + +{{FILE:sfw/render_core/3rd_glfw3.h}} + +#undef timeGetTime +#undef Time