-----------------------------------------------------------------------------------------------------------------------------
-- Maratis premake build
-----------------------------------------------------------------------------------------------------------------------------
-------------------------------------- SETUP the PATHS ----------------------------------------
rootDir = "./"
sourcesDir = rootDir .. "trunk/dev/"
thirdPartyDir = rootDir .. "3rdparty/"
-- zlib & freetype includes are set aside because they are conflicting with each other -- TODO: try "-Wl,--allow-multiple-definition" instead
zlib_includes = thirdPartyDir .. "zlib/"
freetype_includes = { thirdPartyDir .. "freetype/", thirdPartyDir .. "freetype/include/", thirdPartyDir .. "freetype/include/freetype/", thirdPartyDir .. "freetype/depend/" }
------------------------------------- SETUP THE SOLUTION -------------------------------------
solution "Maratis"
-- Get arguments passed to the command line
for i=1, #_ARGS do
if _ARGS[i] == "cygwin" then cygwin = true print("***** Build using cygwin *****") end
if _ARGS[i] == "minGW" then minGW = true print("***** Build using minGW *****") end
end
-- Setup configurations and platforms
configurations { "Debug", "Release" }
platforms { "x32", "x64" }
if os.is("windows") then
defines { "_WIN32", "WIN32" }
if minGW then defines { "__MINGW32__" } end
if cygwin then defines { "__CYGWIN__" } end
elseif os.is("macosx") then defines { "__APPLE__", "MACOSX" }
elseif os.is("linux") then defines { "LINUX", "linux" } end
configuration "Debug"
defines { "DEBUG" }
configuration "Release"
defines { "NDEBUG" }
flags { "OptimizeSpeed", "EnableSSE2" }
------------------------------------ INCLUDES DIRECTORIES ------------------------------------
includedirs {
thirdPartyDir .. "lua",
thirdPartyDir .. "libpng", --+ zlib
thirdPartyDir .. "libjpeg",
thirdPartyDir .. "devil", thirdPartyDir .. "devil/src-IL/include", thirdPartyDir .. "devil/src-ILU/include", -- + png, jpeg, zlib
thirdPartyDir .. "glee",
thirdPartyDir .. "tinyxml",
thirdPartyDir .. "bullet",
thirdPartyDir .. "npk/include", -- + zlib
thirdPartyDir .. "assimp", thirdPartyDir .. "assimp/include", thirdPartyDir .. "assimp/code/BoostWorkaround", -- + zlib
thirdPartyDir .. "openal/include",
sourcesDir .. "MSDK/MCore/Includes",
sourcesDir .. "MSDK/MEngine/Includes",
sourcesDir .. "MSDK/MGui/Includes",
sourcesDir .. "Maratis/Common"
}
if not os.is("linux") then includedirs { thirdPartyDir .. "libsndfile/include" } end -- if you get no sound, comment this line
if os.is("macosx") then includedirs { thirdPartyDir .. "freetype/mac" }
elseif os.is("windows") then includedirs { thirdPartyDir .. "dirent/include" } end
--------------------------- PREBUILT External libraries (lib, dll, a, so, dylib) ----------------------------
if os.is("windows") then libdirs { thirdPartyDir .. "libsndfile/win32", thirdPartyDir .. "openal/win32" }
elseif os.is("macosx") then libdirs { thirdPartyDir .. "libsndfile/osx" }
elseif os.is("linux") then libdirs { thirdPartyDir .. "libsndfile/linux", thirdPartyDir .. "openal/linux" } end
----------------------------- BUILD EXTERNAL LIBRARIES FROM SOURCES -----------------------------------
-- lua
project "lua"
kind "StaticLib"
language "C"
files { thirdPartyDir .. "lua/*.h",
thirdPartyDir .. "lua/*.c" }
-- zlib
project "zlib"
kind "StaticLib"
language "C"
files { thirdPartyDir .. "zlib/*.h",
thirdPartyDir .. "zlib/*.c" }
-- libpng
project "png"
kind "StaticLib"
language "C"
includedirs { zlib_includes }
files { thirdPartyDir .. "libpng/*.h",
thirdPartyDir .. "libpng/*.c" }
-- libjpeg
project "jpeg"
kind "StaticLib"
language "C"
files { thirdPartyDir .. "libjpeg/*.h",
thirdPartyDir .. "libjpeg/*.c" }
-- devil
project "il"
kind "StaticLib"
language "C"
includedirs { zlib_includes }
files { thirdPartyDir .. "devil/**.h",
thirdPartyDir .. "devil/**.c" }
defines { "IL_STATIC_LIB", "IL_NO_UTX" }
--links { "jpeg", "png", "zlib" } -- for SharedLib builds
-- Glee
project "glee"
kind "StaticLib"
language "C"
files { thirdPartyDir .. "glee/**.h",
thirdPartyDir .. "glee/**.c" }
if os.is("macosx") then links { "OpenGL.framework" } end
-- freetype
project "freetype"
kind "StaticLib"
language "C"
includedirs { freetype_includes }
files { thirdPartyDir .. "freetype/**.h",
thirdPartyDir .. "freetype/*.c" }
defines { "FT2_BUILD_LIBRARY" }
if os.is("macosx") then links { "Cocoa.framework" } end
-- tinyxml
project "tinyxml"
kind "StaticLib"
language "C++"
files { thirdPartyDir .. "tinyxml/*.h",
thirdPartyDir .. "tinyxml/*.cpp" }
-- bullet
project "bullet"
kind "StaticLib"
language "C++"
files { thirdPartyDir .. "bullet/**.h",
thirdPartyDir .. "bullet/**.c*" }
if os.is("linux") then buildoptions { "-fpermissive" } end -- CFLAGS
-- npk
project "npk_dev"
kind "StaticLib"
language "C"
includedirs { zlib_includes }
files { thirdPartyDir .. "npk/**.h",
thirdPartyDir .. "npk/**.c" }
--links { "zlib" } -- for SharedLib builds
-- assimp
project "assimp"
kind "StaticLib"
language "C++"
includedirs { zlib_includes }
files {thirdPartyDir .. "assimp/**.h",
thirdPartyDir .. "assimp/**.c*" }
defines { "ASSIMP_BUILD_BOOST_WORKAROUND", "ASSIMP_BUILD_NO_OWN_ZLIB" }
--links { "zlib" } -- for SharedLib builds
----------------------------------- BUILD MARATIS LIBRARIES -----------------------------------------
-- MCore
project "MCore"
kind "SharedLib"
language "C++"
files { sourcesDir .. "MSDK/MCore/**" }
defines { "MCORE_DLL" }
--linkoptions { "-Wl,--as-needed", "-Wl,--allow-multiple-definition", "-Wl,-rpath,." }
-- MEngine
project "MEngine"
kind "SharedLib"
language "C++"
files { sourcesDir .. "MSDK/MEngine/**" }
defines { "MENGINE_DLL" }
if os.is("windows") then links { "MCore" } end
-- MGui
project "MGui"
kind "StaticLib"
language "C++"
files { sourcesDir .. "MSDK/MGui/Sources/*" }
if os.is("macosx") then files { sourcesDir .. "MSDK/MGui/Sources/COCOA/**", sourcesDir .. "MSDK/MGui/Includes/COCOA/**" }
elseif os.is("linux") then files { sourcesDir .. "MSDK/MGui/Sources/X11/**", sourcesDir .. "MSDK/MGui/Includes/X11/**" }
elseif os.is("windows") then files { sourcesDir .. "MSDK/MGui/Sources/WIN32/**", sourcesDir .. "MSDK/MGui/Includes/WIN32/**" } end
project "MaratisCommon"
kind "StaticLib"
language "C++"
includedirs { freetype_includes }
files { sourcesDir .. "Maratis/Common/**" }
defines { "M_PACKAGE_WRITABLE", "IL_STATIC_LIB" }
--links { "npk_dev", "bullet", "tinyxml", "freetype", "glee", "il", "lua", "sndfile", "openal" } -- for SharedLib builds
---------------------------- BUILD MARATIS BINARIES (Editor & Player) ---------------------------
-- MaratisEditor
project "MaratisEditor"
kind "ConsoleApp"
language "C++"
files { sourcesDir .. "Maratis/Editor/**" }
links { "MaratisCommon", "MGui", "MEngine", "MCore", "assimp", "npk_dev", "bullet", "tinyxml", "freetype", "glee", "il", "jpeg", "png", "zlib", "lua" }
if os.is("macosx") then
links { "Cocoa.framework", "OpenGL.framework", "CoreServices.framework", "Foundation.framework", "IOKit.framework", "OpenAL.framework", "Sndfile" }
elseif os.is("windows") then
links { "User32", "Shell32", "Gdi32", "Comdlg32", "Winmm", "libsndfile-1" }
if cygwin then links { "opengl32", "openal" } else links { "Opengl32", "OpenAL32" } end
elseif os.is("linux") then
links { "sndfile", "openal", "X11", "Xxf86vm", "GL", "dl" }
linkoptions { "-Wl,-rpath=." }
end
-- MaratisPlayer
project "MaratisPlayer"
kind "ConsoleApp"
language "C++"
files { sourcesDir .. "Maratis/Player/**" }
links {
"MaratisCommon", "MGui", "MEngine", "MCore",
"npk_dev", "bullet", "tinyxml", "freetype", "glee", "il", "jpeg", "png", "zlib", "lua"
}
if os.is("macosx") then
links {
"Cocoa.framework", "OpenGL.framework", "CoreServices.framework",
"Foundation.framework", "IOKit.framework", "OpenAL.framework", "Sndfile"
}
elseif os.is("windows") then
links { "User32", "Shell32", "Gdi32", "Comdlg32", "Winmm", "libsndfile-1" }
if cygwin then links { "opengl32", "openal" } else links { "Opengl32", "OpenAL32" } end
elseif os.is("linux") then
links { "sndfile", "openal", "X11", "Xxf86vm", "GL", "dl" }
linkoptions { "-Wl,-rpath=." }
end
------------------------------------------------ THE END ------------------------------------------------