diff --git a/compile_linux.sh b/compile_linux.sh index 3fb265e..a40296b 100755 --- a/compile_linux.sh +++ b/compile_linux.sh @@ -43,6 +43,8 @@ ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/pool_allocator.cpp -o sfw/cor ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/mutex.cpp -o sfw/core/mutex.o ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/stime.cpp -o sfw/core/stime.o +ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/core/sfw_core.cpp -o sfw/core/sfw_core.o + ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/object.cpp -o sfw/object/object.o ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/reference.cpp -o sfw/object/reference.o ccache g++ -Wall -D_REENTRANT -g -Isfw -c sfw/object/core_string_names.cpp -o sfw/object/core_string_names.o @@ -105,7 +107,8 @@ ccache g++ -Wall -lm -ldl -lpthread -lX11 -D_REENTRANT -g sfw/core/aabb.o sfw/c sfw/core/vector2.o sfw/core/vector2i.o sfw/core/vector3.o \ sfw/core/vector3i.o sfw/core/vector4.o sfw/core/vector4i.o \ sfw/core/pool_vector.o sfw/core/pool_allocator.o sfw/core/mutex.o sfw/core/stime.o \ - sfw/core/dir_access.o sfw/core/file_access.o\ + sfw/core/dir_access.o sfw/core/file_access.o \ + sfw/core/sfw_core.o \ sfw/object/object.o sfw/object/reference.o sfw/object/core_string_names.o \ sfw/object/variant.o sfw/object/variant_op.o sfw/object/psignal.o \ sfw/object/array.o sfw/object/dictionary.o sfw/object/ref_ptr.o \ diff --git a/sfw/core/sfw_core.cpp b/sfw/core/sfw_core.cpp new file mode 100644 index 0000000..021ba95 --- /dev/null +++ b/sfw/core/sfw_core.cpp @@ -0,0 +1,31 @@ + +#include "sfw_core.h" + +//--STRIP +#include "core/pool_vector.h" +#include "core/string_name.h" +//--STRIP + +void SFWCore::setup() { + if (_initialized) { + return; + } + + _initialized = true; + + StringName::setup(); + MemoryPool::setup(); +} + +void SFWCore::cleanup() { + if (!_initialized) { + return; + } + + _initialized = false; + + StringName::cleanup(); + MemoryPool::cleanup(); +} + +bool SFWCore::_initialized = false; diff --git a/sfw/core/sfw_core.h b/sfw/core/sfw_core.h new file mode 100644 index 0000000..92585a4 --- /dev/null +++ b/sfw/core/sfw_core.h @@ -0,0 +1,14 @@ + +#ifndef SFW_CORE_H +#define SFW_CORE_H + +class SFWCore { +public: + static void setup(); + static void cleanup(); + +protected: + static bool _initialized; +}; + +#endif diff --git a/sfw/render_core/application.cpp b/sfw/render_core/application.cpp index 2c03259..4379e9b 100644 --- a/sfw/render_core/application.cpp +++ b/sfw/render_core/application.cpp @@ -8,8 +8,7 @@ #include "render_core/input_map.h" #include "render_core/window.h" -#include "core/pool_vector.h" -#include "core/string_name.h" +#include "core/sfw_core.h" #include "object/core_string_names.h" //--STRIP @@ -89,9 +88,10 @@ Application::Application() { _time_scale = 1; + SFWCore::setup(); + // TODO Move these to a central place in core! - StringName::setup(); - MemoryPool::setup(); + CoreStringNames::create(); // TODO add a helper static method @@ -106,14 +106,15 @@ Application::~Application() { _instance = NULL; // TODO Move these to a central place in core! - StringName::cleanup(); - MemoryPool::cleanup(); + CoreStringNames::free(); // TODO add a helper static method memdelete(AppWindow::get_singleton()); memdelete(Input::get_singleton()); memdelete(InputMap::get_singleton()); + + SFWCore::cleanup(); } Application *Application::get_singleton() { diff --git a/tools/merger/sfw_full.h.inl b/tools/merger/sfw_full.h.inl index 299919d..1c04036 100644 --- a/tools/merger/sfw_full.h.inl +++ b/tools/merger/sfw_full.h.inl @@ -400,6 +400,11 @@ //--STRIP {{FILE:sfw/core/dir_access.h}} +//--STRIP +//no includes +//--STRIP +{{FILE:sfw/core/sfw_core.h}} + //--STRIP //=================== OBJECT SECTION =================== //--STRIP