diff --git a/.bam/functions.lua b/.bam/functions.lua index 1312770..5a796da 100644 --- a/.bam/functions.lua +++ b/.bam/functions.lua @@ -1,7 +1,7 @@ local _systems = { "Win32", - -- "Linux" + "Unix" } @@ -14,12 +14,19 @@ end -- Detect what system we currently are on. function system() - local win = os.getenv('OS') - - if win:lower():match('windows') then - return _systems[1] + if family ~= nil then + if family == "windows" then + return _systems[1] + end + if family == "unix" then + return _systems[2] + end end + local win = os.getenv('OS') + if win ~= nil and win:lower():match('windows') then + return _systems[1] + end return nil end diff --git a/.gitignore b/.gitignore index bcd7a8c..6977329 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ +# Build system related files build/ .bam/* !.bam/*.lua diff --git a/engine.build.lua b/engine.build.lua index 9d3f97b..817560b 100644 --- a/engine.build.lua +++ b/engine.build.lua @@ -18,7 +18,14 @@ if global_settings.debug then end -- FreeType2 -settings.cc.includes:Add("vendor/FreeType2/include") +if TARGET_OS == "Win32" then + settings.cc.includes:Add("vendor/FreeType2/include") + + -- Staticly link freetype on windows. + settings.link.libpath:Add("vendor/FreeType2/lib/x86") +else + settings.cc.includes:Add("/usr/include/freetype2") +end -- STB settings.cc.includes:Add("vendor/stb/include") @@ -41,22 +48,33 @@ 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", - "Win32EventQueue.cpp", - "Win32System.cpp", - "glad_wgl.c" -}) ---end +if TARGET_OS == "Win32" then + local platform_spec_module = Module("source/Platform/Win32", { + "Win32Application.cpp", + "Win32Display.cpp", + "Win32GLContext.cpp", + "Win32Input.cpp", + "Win32Internal.cpp", + "Win32Keyboard.cpp", + "Win32Misc.cpp", + "Win32Mouse.cpp", + "Win32EventQueue.cpp", + "Win32System.cpp", + "glad_wgl.c" + }) +elseif TARGET_OS == "Unix" then + platform_spec_module = Module("source/Platform/Unix", { + "UnixApplication.cpp", + "X11Display.cpp", + "GLXContext.cpp", + "X11Input.cpp", + "X11Keyboard.cpp", + "X11Mouse.cpp", + "X11EventQueue.cpp", + "UnixMisc.cpp", + "UnixSystem.cpp" + }) +end local input_module = Module("source/Input", { "InputDevice.cpp", @@ -132,7 +150,9 @@ local scene_module = Module("source/Scene", { ----------------------------------------------------------- -- Dependancies -Import("vendor/FreeType2/build.lua") +if TARGET_OS == "Win32" then + Import("vendor/FreeType2/build.lua") +end -- engine local obj = Compile(settings, { diff --git a/examples/build.lua b/examples/build.lua index 552dea1..2445a86 100644 --- a/examples/build.lua +++ b/examples/build.lua @@ -16,6 +16,10 @@ if TARGET_OS == "Win32" then -- Windows needs to link against these. example_settings.link.libs:Add("opengl32", "gdi32", "user32") +elseif TARGET_OS == "Unix" then + + -- Unix nees dl and X11 libs. + example_settings.link.libs:Add("dl", 'X11', 'freetype') end -- For now, to get examples working