From 66f3bb30d91679262e2a6b8cbd7c7432365dce61 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 7 Jan 2020 07:11:02 +0100 Subject: [PATCH] bam: Move library build to engine.build.lua file. --- bam.lua | 148 ++--------------------------------------------- engine.build.lua | 148 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+), 143 deletions(-) create mode 100644 engine.build.lua diff --git a/bam.lua b/bam.lua index c077eec..8dbb3c0 100644 --- a/bam.lua +++ b/bam.lua @@ -70,150 +70,12 @@ end -------------------------------- -- -- --- Engine configuration -- +-- Build Targets -- -- -- -------------------------------- -local settings = CopySettings(global_settings, "Engine") - -settings.cc.includes:Add("include/") -settings.cc.includes:Add("source/") - --- FreeType2 -settings.cc.includes:Add("vendor/FreeType2/include") - --- STB -settings.cc.includes:Add("vendor/stb/include") - --- Source files --------------------------------- - -local system_module = Module("source/System", { - "File.cpp", - "MessageHandler.cpp", - "MessageQueue.cpp", - "SystemEvent.cpp", - "Log.cpp" -}) - -local platform_common_module = Module("source/Platform", { - "PlatformDisplay.cpp" -}) - - --- if TARGET_OS == "Win32" then -- Needed later for unix. -platform_spec_module = Module("source/Platform/Win32", { - "Win32Application.cpp", - "Win32Display.cpp", - "Win32GLContext.cpp", - "Win32Input.cpp", - "Win32Internal.cpp", - "Win32Keyboard.cpp", - "Win32Misc.cpp", - "Win32Mouse.cpp", - "Win32MsgBuffer.cpp", - "Win32System.cpp", - "glad_wgl.c" -}) ---end - -local input_module = Module("source/Input", { - "InputDevice.cpp", - "InputEvent.cpp", - "InputListener.cpp", - "InputModule.cpp", - "Keyboard.cpp", - "Mouse.cpp" -}) - -local display_module = Module("source/Display", { - "Display.cpp", - "DisplayDescription.cpp", - "DisplayMode.cpp", - "GLContext.cpp" -}) - -local graphics_module = Module("source/Graphics", { - -- Primitives - "Vertex2D.cpp", - "Transformable.cpp", - "Sprite.cpp", - - -- Rendering - "BatchRenderer2D.cpp", - "DefaultRenderer2D.cpp", - "Renderable2D.cpp", - "Renderer2D.cpp", - "RenderState.cpp", - "Shader.cpp", - "ShaderProgram.cpp", - "Texture.cpp", - - -- Text - "Font/Engine/FreeTypeEngine.cpp", - "Font/Engine/FreeTypeError.cpp", - "Font/Engine/FreeTypeLib.cpp", - "Font/FontDescription.cpp", - "Font.cpp", - "Text.cpp", - - -- Image - "Image.cpp", - "ImageLoader.cpp", - - "OpenGL.cpp", - "GL/glad.c", - "GL/CheckError.cpp", -}) - -local core_module = Module("source/Core", { - "String.cpp" -}) - -local math_module = Module("source/Math", { - "Color.cpp", - "Logarithm.cpp", - "Math.cpp", - "Transform.cpp" -}) - -local game_module = Module("source", { - "Game/FPSCounter.cpp", - "Game/GameTime.cpp", - "Game.cpp", -}) - -local scene_module = Module("source/Scene", { - "Camera2D.cpp" -}) - --- Build target --------------------------------- - --- Dependancies -Import("vendor/FreeType2/build.lua") - --- engine -local obj = Compile(settings, { - system_module, - platform_common_module, - platform_spec_module, - input_module, - display_module, - graphics_module, - core_module, - math_module, - game_module, - scene_module -}) - -libspectre = StaticLibrary(settings, - "spectre", - obj, - ft2_obj -) - -DefaultTarget(libspectre) - --- Examples +Import("engine.build.lua") Import("examples/build.lua") + +-- Set engine library as default target +DefaultTarget(libspectre) diff --git a/engine.build.lua b/engine.build.lua new file mode 100644 index 0000000..b3e3f7c --- /dev/null +++ b/engine.build.lua @@ -0,0 +1,148 @@ +----------------------------------------------------------- +-- -- +-- Engine configuration -- +-- -- +-- Builds Spectre engine as static library. -- +-- -- +-- Output variables: -- +-- libspectre = path to .lib file -- +----------------------------------------------------------- + +local settings = CopySettings(global_settings, "Engine") + +settings.cc.includes:Add("include/") +settings.cc.includes:Add("source/") + +-- FreeType2 +settings.cc.includes:Add("vendor/FreeType2/include") + +-- STB +settings.cc.includes:Add("vendor/stb/include") + +-- Source files +----------------------------------------------------------- + +local system_module = Module("source/System", { + "File.cpp", + "MessageHandler.cpp", + "MessageQueue.cpp", + "SystemEvent.cpp", + "Log.cpp" +}) + +local platform_common_module = Module("source/Platform", { + "PlatformDisplay.cpp" +}) + + +-- if TARGET_OS == "Win32" then -- Needed later for unix. +local platform_spec_module = Module("source/Platform/Win32", { + "Win32Application.cpp", + "Win32Display.cpp", + "Win32GLContext.cpp", + "Win32Input.cpp", + "Win32Internal.cpp", + "Win32Keyboard.cpp", + "Win32Misc.cpp", + "Win32Mouse.cpp", + "Win32MsgBuffer.cpp", + "Win32System.cpp", + "glad_wgl.c" +}) +--end + +local input_module = Module("source/Input", { + "InputDevice.cpp", + "InputEvent.cpp", + "InputListener.cpp", + "InputModule.cpp", + "Keyboard.cpp", + "Mouse.cpp" +}) + +local display_module = Module("source/Display", { + "Display.cpp", + "DisplayDescription.cpp", + "DisplayMode.cpp", + "GLContext.cpp" +}) + +local graphics_module = Module("source/Graphics", { + -- Primitives + "Vertex2D.cpp", + "Transformable.cpp", + "Sprite.cpp", + + -- Rendering + "BatchRenderer2D.cpp", + "DefaultRenderer2D.cpp", + "Renderable2D.cpp", + "Renderer2D.cpp", + "RenderState.cpp", + "Shader.cpp", + "ShaderProgram.cpp", + "Texture.cpp", + + -- Text + "Font/Engine/FreeTypeEngine.cpp", + "Font/Engine/FreeTypeError.cpp", + "Font/Engine/FreeTypeLib.cpp", + "Font/FontDescription.cpp", + "Font.cpp", + "Text.cpp", + + -- Image + "Image.cpp", + "ImageLoader.cpp", + + "OpenGL.cpp", + "GL/glad.c", + "GL/CheckError.cpp", +}) + +local core_module = Module("source/Core", { + "String.cpp" +}) + +local math_module = Module("source/Math", { + "Color.cpp", + "Logarithm.cpp", + "Math.cpp", + "Transform.cpp" +}) + +local game_module = Module("source", { + "Game/FPSCounter.cpp", + "Game/GameTime.cpp", + "Game.cpp", +}) + +local scene_module = Module("source/Scene", { + "Camera2D.cpp" +}) + +-- Build target +----------------------------------------------------------- + +-- Dependancies +Import("vendor/FreeType2/build.lua") + +-- engine +local obj = Compile(settings, { + system_module, + platform_common_module, + platform_spec_module, + input_module, + display_module, + graphics_module, + core_module, + math_module, + game_module, + scene_module +}) + +libspectre = StaticLibrary(settings, + "spectre", + obj, + ft2_obj +)