Skip to content

Commit

Permalink
Separated foundation layer from engine
Browse files Browse the repository at this point in the history
Re-organized some includes and grouped foundation headers together

Introduced foundation.h, which has the engine-agnostic things from lumix.h

Replaced LUMIX_ENGINE_API with LUMIX_FOUNDATION_API in new foundation lib.

Moved HashFunc specializations for EntityPtr and ComponentType to lumix.h

Moved EntityPtr toCString and fromCString to lumix.h

Link foundation to everything that was linking engine
  • Loading branch information
jayrulez authored and nem0 committed Mar 10, 2024
1 parent 773536f commit 2d1bc0f
Show file tree
Hide file tree
Showing 197 changed files with 1,614 additions and 1,498 deletions.
4 changes: 2 additions & 2 deletions external/imgui/imgui_user.inl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "engine/math.h"
#include "engine/string.h"
#include "foundation/math.h"
#include "foundation/string.h"
#include "imgui.h"
#include "imgui_internal.h"
#include <math.h>
Expand Down
41 changes: 30 additions & 11 deletions projects/genie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,24 @@ solution "LumixEngine"
defines {"STATIC_PLUGINS"}
end

project "foundation"
libType()

files { "../src/foundation/**.h",
"../src/foundation/**.c",
"../src/foundation/**.cpp",
"../src/foundation/**.inl",
"genie.lua",
"../external/wyhash/**.*"
}


defines { "BUILDING_ENGINE" }

configuration {}

defaultConfigurations()

project "engine"
libType()

Expand All @@ -502,7 +520,7 @@ project "engine"
"../external/imgui/**.inl",
"../external/lz4/**.c",
"../external/lz4/**.h",
"../external/wyhash/**.*"
-- "../external/wyhash/**.*"
}
excludes {
"../external/imgui/imgui_demo.cpp",
Expand All @@ -515,12 +533,13 @@ project "engine"


defines { "BUILDING_ENGINE" }
links { "foundation" }

if _OPTIONS["dynamic-plugins"] then
defines { "LZ4_DLL_EXPORT" }
end

includedirs { "../external/luau/include", "../external/freetype/include" }
includedirs { "../src", "../external/luau/include", "../external/freetype/include" }

configuration { "linux" }
buildoptions { "`pkg-config --cflags gtk+-3.0`" }
Expand Down Expand Up @@ -558,7 +577,7 @@ if has_plugin("physics") then

includedirs { "../external/physx/include/" }
defines { "BUILDING_PHYSICS" }
links { "engine", "editor", "renderer" }
links { "foundation", "engine", "editor", "renderer" }
useLua()
linkPhysX()

Expand Down Expand Up @@ -606,7 +625,7 @@ if has_plugin("renderer") then
includedirs { "../src", "../external/freetype/include", "../external/" }

defines { "BUILDING_RENDERER" }
links { "engine" }
links { "foundation", "engine" }

if build_studio then
links { "editor" }
Expand Down Expand Up @@ -634,7 +653,7 @@ if has_plugin("animation") then
files { "../src/animation/**.h", "../src/animation/**.cpp" }
includedirs { "../src" }
defines { "BUILDING_ANIMATION" }
links { "engine", "renderer" }
links { "foundation", "engine", "renderer" }

if build_studio then
links { "editor" }
Expand Down Expand Up @@ -671,7 +690,7 @@ if has_plugin("audio") then
}
includedirs { "../src", "../src/audio" }
defines { "BUILDING_AUDIO" }
links { "engine" }
links { "foundation", "engine" }

if build_studio then
links { "editor" }
Expand Down Expand Up @@ -711,7 +730,7 @@ if has_plugin("navigation") then

files { "../src/navigation/**.h", "../src/navigation/**.cpp", "../external/recast/src/**.cpp" }
includedirs { "../src", "../src/navigation", "../external/recast/include" }
links { "engine", "renderer" }
links { "foundation", "engine", "renderer" }

if build_studio then
links { "editor" }
Expand All @@ -727,7 +746,7 @@ if has_plugin("gui") then

files { "../src/gui/**.h", "../src/gui/**.cpp" }
includedirs { "../src", "../src/gui" }
links { "engine", "renderer" }
links { "foundation", "engine", "renderer" }

defines { "BUILDING_GUI" }

Expand All @@ -754,7 +773,7 @@ if has_plugin("lua_script") then
files { "../src/lua_script/**.h", "../src/lua_script/**.cpp" }
includedirs { "../src", "../src/lua_script" }
defines { "BUILDING_LUA_SCRIPT" }
links { "engine", "renderer" }
links { "foundation", "engine", "renderer" }

if build_studio then
links { "editor" }
Expand Down Expand Up @@ -802,7 +821,7 @@ if build_app then
end
if build_studio then links {"editor"} end

links { "engine" }
links { "foundation", "engine" }
if use_basisu then
linkLib "basisu"
end
Expand Down Expand Up @@ -904,7 +923,7 @@ if build_studio then
"../src/editor/**.cpp"
}
defines { "BUILDING_EDITOR" }
links { "engine" }
links { "foundation", "engine" }
includedirs {
"../src",
"../src/editor",
Expand Down
10 changes: 5 additions & 5 deletions src/animation/animation.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "foundation/log.h"
#include "foundation/math.h"
#include "foundation/profiler.h"
#include "foundation/stream.h"
#include "foundation/math.h"
#include "animation/animation.h"
#include "engine/log.h"
#include "engine/math.h"
#include "engine/profiler.h"
#include "engine/resource_manager.h"
#include "engine/stream.h"
#include "engine/math.h"
#include "renderer/model.h"
#include "renderer/pose.h"

Expand Down
10 changes: 5 additions & 5 deletions src/animation/animation.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include "engine/allocators.h"
#include "engine/hash.h"
#include "engine/hash_map.h"
#include "engine/math.h"
#include "foundation/allocators.h"
#include "foundation/hash.h"
#include "foundation/hash_map.h"
#include "foundation/math.h"
#include "foundation/string.h"
#include "engine/resource.h"
#include "engine/string.h"

namespace Lumix
{
Expand Down
15 changes: 8 additions & 7 deletions src/animation/animation_module.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#include "animation_module.h"

#include "foundation/associative_array.h"
#include "foundation/atomic.h"
#include "foundation/hash.h"
#include "foundation/job_system.h"
#include "foundation/log.h"
#include "foundation/profiler.h"
#include "foundation/stream.h"

#include "animation/animation.h"
#include "animation/controller.h"
#include "animation/events.h"
#include "animation/property_animation.h"
#include "engine/associative_array.h"
#include "engine/atomic.h"
#include "engine/engine.h"
#include "engine/hash.h"
#include "engine/job_system.h"
#include "engine/log.h"
#include "engine/profiler.h"
#include "engine/reflection.h"
#include "engine/resource_manager.h"
#include "engine/stream.h"
#include "engine/world.h"
#include "nodes.h"
#include "renderer/model.h"
Expand Down
6 changes: 4 additions & 2 deletions src/animation/animation_module.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#pragma once

#include "animation/animation.h"
#include "engine/allocator.h"
#include "engine/lumix.h"

#include "foundation/allocator.h"

#include "animation/animation.h"
#include "engine/plugin.h"

struct lua_State;
Expand Down
4 changes: 3 additions & 1 deletion src/animation/animation_system.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

#include "foundation/profiler.h"

#include "animation_module.h"

#include "animation/animation.h"
#include "animation/property_animation.h"
#include "animation/controller.h"
#include "engine/engine.h"
#include "engine/profiler.h"
#include "engine/resource_manager.h"
#include "engine/world.h"

Expand Down
6 changes: 3 additions & 3 deletions src/animation/controller.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "foundation/hash.h"
#include "foundation/log.h"
#include "foundation/stack_array.h"
#include "animation.h"
#include "controller.h"
#include "nodes.h"
#include "engine/hash.h"
#include "engine/log.h"
#include "engine/resource_manager.h"
#include "engine/stack_array.h"
#include "renderer/model.h"
#include "renderer/pose.h"

Expand Down
4 changes: 2 additions & 2 deletions src/animation/controller.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "foundation/hash.h"
#include "foundation/stream.h"
#include "animation.h"
#include "engine/hash.h"
#include "engine/resource.h"
#include "engine/stream.h"

namespace Lumix {

Expand Down
9 changes: 5 additions & 4 deletions src/animation/editor/animation_plugins.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include <imgui/imgui.h>

#include "foundation/hash_map.h"
#include "foundation/log.h"
#include "foundation/os.h"
#include "foundation/profiler.h"

#include "animation/animation.h"
#include "animation/animation_module.h"
#include "animation/controller.h"
Expand All @@ -12,10 +17,6 @@
#include "editor/studio_app.h"
#include "editor/world_editor.h"
#include "engine/engine.h"
#include "engine/hash_map.h"
#include "engine/log.h"
#include "engine/os.h"
#include "engine/profiler.h"
#include "engine/resource_manager.h"
#include "controller_editor.h"
#include "engine/reflection.h"
Expand Down
7 changes: 4 additions & 3 deletions src/animation/editor/controller_editor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include <imgui/imgui.h>

#include "foundation/hash.h"
#include "foundation/log.h"
#include "foundation/os.h"

#include "animation/animation_module.h"
#include "animation/controller.h"
#include "controller_editor.h"
Expand All @@ -11,10 +15,7 @@
#include "editor/utils.h"
#include "editor/world_editor.h"
#include "engine/engine.h"
#include "engine/hash.h"
#include "engine/input_system.h"
#include "engine/log.h"
#include "engine/os.h"
#include "engine/resource_manager.h"
#include "engine/world.h"
#include "renderer/editor/model_meta.h"
Expand Down
7 changes: 4 additions & 3 deletions src/animation/editor/editor_nodes.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include "foundation/log.h"
#include "foundation/crt.h"
#include "foundation/stack_array.h"

#include "animation/animation.h"
#include "animation/controller.h"
#include "engine/log.h"
#include "editor_nodes.h"
#include "renderer/model.h"
#include "renderer/pose.h"
#include "engine/crt.h"
#include "engine/stack_array.h"

namespace Lumix::anim_editor {

Expand Down
9 changes: 5 additions & 4 deletions src/animation/editor/editor_nodes.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#pragma once

#include "foundation/array.h"
#include "foundation/math.h"
#include "foundation/stream.h"
#include "foundation/string.h"

#include "animation/animation.h"
#include "animation/nodes.h"
#include "controller_editor.h"
#include "engine/array.h"
#include "engine/math.h"
#include "engine/stream.h"
#include "engine/string.h"
#include "editor/utils.h"


Expand Down
3 changes: 1 addition & 2 deletions src/animation/events.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once


#include "engine/lumix.h"
#include "engine/array.h"

#include "foundation/array.h"

namespace Lumix
{
Expand Down
9 changes: 5 additions & 4 deletions src/animation/nodes.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#pragma once

#include "foundation/array.h"
#include "foundation/math.h"
#include "foundation/stream.h"
#include "foundation/string.h"

#include "animation/animation.h"
#include "engine/array.h"
#include "engine/math.h"
#include "engine/stream.h"
#include "engine/string.h"

// Runtime part of animation nodes
// For editor part of animation nodes see editor_nodes.h
Expand Down
7 changes: 4 additions & 3 deletions src/animation/property_animation.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#include "foundation/allocator.h"
#include "foundation/log.h"
#include "foundation/stream.h"

#include "animation/property_animation.h"
#include "engine/allocator.h"
#include "engine/log.h"
#include "engine/lua_wrapper.h"
#include "engine/reflection.h"
#include "engine/stream.h"


namespace Lumix {
Expand Down
Loading

0 comments on commit 2d1bc0f

Please sign in to comment.