-- -- Premake5 script for creating a Visual Studio, XCode or CodeLite workspace for the LudumDare40 project. -- Requires Premake5 from: http://industriousone.com/ -- -- ----------------------------------------------------------------------------------------------------------------------- ---------------------------------------- newoption { trigger = "build-version", description = "Version being built, expecting major.minor.patch; --build-version=1.2.3", value = "0.0.0", } BUILD_VERSION = "0.0.0" if _OPTIONS["build-version"] ~= nil and _OPTIONS["build-version"] ~= '' then BUILD_VERSION = _OPTIONS["build-version"] end BUILD_VERSION_MAJOR, BUILD_VERSION_MINOR, BUILD_VERSION_PATCH = string.match(BUILD_VERSION, "(%d+).(%d+).(%d+)") ------------------------------------------ newoption { trigger = "web", description = "Chosen build system to override for web.", value = "", } --Documented at: http://industriousone.com/osget local WINDOWS_SYSTEM_NAME = "windows" local LINUX_SYSTEM_NAME = "linux" local MACOSX_SYSTEM_NAME = "macosx" local WEB_SYSTEM_NAME = "web" local PROJECT_NAME = "ludumdare40" local SYSTEM_NAME = os.target() if _OPTIONS["web"] then SYSTEM_NAME = WEB_SYSTEM_NAME end if _ACTION == "clean" then os.rmdir("../build/" .. WINDOWS_SYSTEM_NAME) os.rmdir("../build/" .. LINUX_SYSTEM_NAME) os.rmdir("../build/" .. MACOSX_SYSTEM_NAME) os.rmdir("../build/" .. WEB_SYSTEM_NAME) end local SCRIPT_EXTENSION = ".sh" if (SYSTEM_NAME == WINDOWS_SYSTEM_NAME) then SCRIPT_EXTENSION = ".bat" end solution(PROJECT_NAME) location ("../build/" .. SYSTEM_NAME) configurations { "debug", "release" } project (PROJECT_NAME) location ("../build/" .. SYSTEM_NAME) language ("C++") cppdialect "C++11" kind ("WindowedApp") warnings ("Extra") files { "../source/**.h", "../source/**.hpp", "../source/**.cpp", "../source/**.mm", "../source/**.c" } excludes { "../**/doxygen/**" } defines { "tb_without_networking", "tb_without_input_devices", "tb_with_debug_set" } includedirs { "../build/tb_external_libraries/includes/", "../source/" } ----------------------------------------------------------------------- Windows Platform Specifics if (WINDOWS_SYSTEM_NAME == SYSTEM_NAME) then libdirs { "../build/tb_external_libraries/libraries/msvc/x32", "C:/Program Files (x86)/Windows Kits/10/Lib/10.0.14393.0/um/x86/" --for dxguid } --TODO: TIM: Cleanup: tb_windows define should be removed and placed in tb_configuration.h defines { "_WINDOWS", "WIN32", "tb_windows" } links { "OpenGL32", "OpenAL32", "glew32" } staticruntime "On" toolset "v143" buildoptions "/MP20" characterset ("MBCS") kind ("ConsoleApp") end ----------------------------------------------------------------------- Mac OS X Platform Specifics if (MACOSX_SYSTEM_NAME == SYSTEM_NAME) then libdirs { "../build/tb_external_libraries/libraries/macosx/" } buildoptions "-mmacosx-version-min=10.7" defines { "tb_macosx" } links { "AppKit.framework", "IOKit.framework", "OpenGL.framework", "OpenAL.framework", "glew" } end ----------------------------------------------------------------------- Linux Platform Specifics if (LINUX_SYSTEM_NAME == SYSTEM_NAME) then libdirs { "../build/tb_external_libraries/libraries/linux/", "/opt/lib/" } includedirs { "/usr/includes/GL/" } buildoptions "-std=c++11" defines { "tb_linux" } links { "GL", "GLEW", "openal", "X11", "pthread" } excludes { "../**/**.mm" } filter "files:**.cpp" buildoptions { "-std=c++11" } filter {} end ----------------------------------------------------------------------- Web (Emscripten) Platform Specifics if (WEB_SYSTEM_NAME == SYSTEM_NAME) then linkoptions "-stdlib=libc++" defines { "tb_web", "tb_without_legacy_gl", "tb_without_threading" } filter "files:**.cpp" buildoptions { "-std=c++11" } filter {} end --------------------------------------------------------------------- Build Configuration Specifics/Overrides filter "debug*" targetdir ("../build/" .. SYSTEM_NAME .. "/debug") objdir ("../build/" .. SYSTEM_NAME .. "/debug/objects" ) defines { "_DEBUG", "DEBUG" } symbols "On" debugdir "../run" if (WEB_SYSTEM_NAME ~= SYSTEM_NAME) then postbuildcommands { "../scripts/post_build_debug" .. SCRIPT_EXTENSION } end filter "release*" targetdir ("../build/" .. SYSTEM_NAME .. "/release") objdir ("../build/" .. SYSTEM_NAME .. "/release/objects" ) defines { "NDEBUG" } symbols "On" optimize "On" debugdir "../run" if (WEB_SYSTEM_NAME ~= SYSTEM_NAME) then postbuildcommands { "../scripts/post_build_release" .. SCRIPT_EXTENSION } end