2012-04-03 23:30:07 -04:00
--
2015-01-02 17:43:11 -05:00
-- Copyright 2010-2015 Branimir Karadzic. All rights reserved.
2012-04-03 23:30:07 -04:00
-- License: http://www.opensource.org/licenses/BSD-2-Clause
--
2014-05-04 18:43:14 -04:00
newoption {
2015-03-21 20:42:46 -04:00
trigger = " with-amalgamated " ,
description = " Enable amalgamated build. " ,
2014-05-04 18:43:14 -04:00
}
2014-08-22 22:29:54 -04:00
newoption {
2015-03-21 20:42:46 -04:00
trigger = " with-ovr " ,
description = " Enable OculusVR integration. " ,
2014-08-22 22:29:54 -04:00
}
2014-10-12 00:55:24 -04:00
newoption {
trigger = " with-sdl " ,
description = " Enable SDL entry. " ,
}
2015-03-25 01:19:21 -04:00
newoption {
trigger = " with-glfw " ,
description = " Enable GLFW entry. " ,
}
2014-10-20 00:29:27 -04:00
newoption {
2015-03-21 20:42:46 -04:00
trigger = " with-shared-lib " ,
description = " Enable building shared library. " ,
}
newoption {
trigger = " with-tools " ,
description = " Enable building tools. " ,
2014-10-20 00:29:27 -04:00
}
2012-04-03 23:30:07 -04:00
solution " bgfx "
configurations {
" Debug " ,
" Release " ,
}
2015-01-14 13:50:45 -05:00
if _ACTION == " xcode4 " then
platforms {
" Universal " ,
2015-03-21 20:42:46 -04:00
}
2015-01-14 13:50:45 -05:00
else
platforms {
" x32 " ,
" x64 " ,
-- "Xbox360",
" Native " , -- for targets where bitness is not specified
2015-03-21 20:42:46 -04:00
}
2015-01-14 13:50:45 -05:00
end
2012-04-03 23:30:07 -04:00
language " C++ "
2014-09-15 23:50:35 -04:00
startproject " example-00-helloworld "
2012-04-03 23:30:07 -04:00
2015-02-27 18:44:24 -05:00
BGFX_DIR = path.getabsolute ( " .. " )
local BGFX_BUILD_DIR = path.join ( BGFX_DIR , " .build " )
local BGFX_THIRD_PARTY_DIR = path.join ( BGFX_DIR , " 3rdparty " )
BX_DIR = path.getabsolute ( path.join ( BGFX_DIR , " ../bx " ) )
2012-09-16 20:36:08 -04:00
2013-02-27 00:27:31 -05:00
defines {
" BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1 "
}
2015-02-27 18:44:24 -05:00
dofile ( path.join ( BX_DIR , " scripts/toolchain.lua " ) )
2014-11-15 20:00:51 -05:00
if not toolchain ( BGFX_BUILD_DIR , BGFX_THIRD_PARTY_DIR ) then
return -- no action specified
end
2012-04-03 23:30:07 -04:00
2012-06-02 00:56:20 -04:00
function copyLib ( )
end
2014-10-14 11:52:58 -04:00
if _OPTIONS [ " with-sdl " ] then
if os.is ( " windows " ) then
if not os.getenv ( " SDL2_DIR " ) then
print ( " Set SDL2_DIR enviroment variable. " )
end
end
end
2014-09-11 02:01:22 -04:00
function exampleProject ( _name )
2013-01-26 19:30:02 -05:00
project ( " example- " .. _name )
2014-09-11 02:01:22 -04:00
uuid ( os.uuid ( " example- " .. _name ) )
2013-01-26 19:30:02 -05:00
kind " WindowedApp "
configuration { }
2014-11-10 20:39:21 -05:00
-- don't output debugdir for winphone builds
2014-11-15 15:09:38 -05:00
if " winphone81 " ~= _OPTIONS [ " vs " ] then
2015-02-27 18:44:24 -05:00
debugdir ( path.join ( BGFX_DIR , " examples/runtime " ) )
2014-11-10 20:39:21 -05:00
end
2013-01-26 19:30:02 -05:00
includedirs {
2015-03-18 19:23:38 -04:00
path.join ( BX_DIR , " include " ) ,
2015-02-27 18:44:24 -05:00
path.join ( BGFX_DIR , " include " ) ,
path.join ( BGFX_DIR , " 3rdparty " ) ,
path.join ( BGFX_DIR , " examples/common " ) ,
2013-01-26 19:30:02 -05:00
}
files {
2015-03-18 19:23:38 -04:00
path.join ( BGFX_DIR , " examples " , _name , " **.c " ) ,
2015-02-27 18:44:24 -05:00
path.join ( BGFX_DIR , " examples " , _name , " **.cpp " ) ,
path.join ( BGFX_DIR , " examples " , _name , " **.h " ) ,
2013-01-26 19:30:02 -05:00
}
2015-03-21 20:42:46 -04:00
removefiles {
path.join ( BGFX_DIR , " examples " , _name , " **.bin.h " ) ,
}
2013-01-26 19:30:02 -05:00
links {
" bgfx " ,
2013-06-05 00:43:43 -04:00
" example-common " ,
2013-01-26 19:30:02 -05:00
}
2014-10-12 00:55:24 -04:00
if _OPTIONS [ " with-sdl " ] then
defines { " ENTRY_CONFIG_USE_SDL=1 " }
links { " SDL2 " }
2014-10-12 12:58:06 -04:00
configuration { " x32 " , " windows " }
libdirs { " $(SDL2_DIR)/lib/x86 " }
configuration { " x64 " , " windows " }
libdirs { " $(SDL2_DIR)/lib/x64 " }
configuration { }
2014-10-12 00:55:24 -04:00
end
2015-03-25 01:19:21 -04:00
if _OPTIONS [ " with-glfw " ] then
defines { " ENTRY_CONFIG_USE_GLFW=1 " }
links {
" glfw3 "
}
2015-03-25 02:21:32 -04:00
configuration { " linux " }
links {
" Xrandr " ,
" Xinerama " ,
" Xi " ,
" Xxf86vm " ,
" Xcursor " ,
}
2015-03-25 01:19:21 -04:00
configuration { " osx " }
linkoptions {
" -framework CoreVideo " ,
" -framework IOKit " ,
}
configuration { }
end
2014-10-20 00:29:27 -04:00
if _OPTIONS [ " with-ovr " ] then
links {
" winmm " ,
" ws2_32 " ,
}
2015-03-28 20:34:47 -04:00
-- Check for LibOVR 5.0+
if os.isdir ( path.join ( os.getenv ( " OVR_DIR " ) , " LibOVR/Lib/Windows/Win32/Debug/VS2012 " ) ) then
2014-10-20 00:29:27 -04:00
2015-03-28 20:34:47 -04:00
configuration { " x32 " , " Debug " }
libdirs { path.join ( " $(OVR_DIR)/LibOVR/Lib/Windows/Win32/Debug " , _ACTION ) }
2014-10-20 00:29:27 -04:00
2015-03-28 20:34:47 -04:00
configuration { " x32 " , " Release " }
libdirs { path.join ( " $(OVR_DIR)/LibOVR/Lib/Windows/Win32/Release " , _ACTION ) }
2014-10-20 00:29:27 -04:00
2015-03-28 20:34:47 -04:00
configuration { " x64 " , " Debug " }
libdirs { path.join ( " $(OVR_DIR)/LibOVR/Lib/Windows/x64/Debug " , _ACTION ) }
2014-10-20 00:29:27 -04:00
2015-03-28 20:34:47 -04:00
configuration { " x64 " , " Release " }
libdirs { path.join ( " $(OVR_DIR)/LibOVR/Lib/Windows/x64/Release " , _ACTION ) }
2014-10-20 00:29:27 -04:00
2015-03-28 20:34:47 -04:00
configuration { " x32 or x64 " }
links { " libovr " }
else
configuration { " x32 " }
libdirs { path.join ( " $(OVR_DIR)/LibOVR/Lib/Win32 " , _ACTION ) }
configuration { " x64 " }
libdirs { path.join ( " $(OVR_DIR)/LibOVR/Lib/x64 " , _ACTION ) }
configuration { " x32 " , " Debug " }
links { " libovrd " }
configuration { " x32 " , " Release " }
links { " libovr " }
configuration { " x64 " , " Debug " }
links { " libovr64d " }
configuration { " x64 " , " Release " }
links { " libovr64 " }
end
2014-10-20 00:29:27 -04:00
configuration { }
end
2013-10-11 01:57:42 -04:00
configuration { " vs* " }
2013-10-11 23:38:47 -04:00
linkoptions {
" /ignore:4199 " , -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll
}
2013-10-11 01:57:42 -04:00
links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
" DelayImp " ,
}
2014-09-09 15:24:17 -04:00
configuration { " vs201* " }
2013-10-11 01:57:42 -04:00
linkoptions { -- this is needed only for testing with GLES2/3 on Windows with VS201x
" /DELAYLOAD: \" libEGL.dll \" " ,
" /DELAYLOAD: \" libGLESv2.dll \" " ,
}
2015-01-05 23:59:58 -05:00
configuration { " mingw* " }
targetextension " .exe "
2014-10-18 18:44:45 -04:00
configuration { " vs20* or mingw* " }
2014-10-16 02:21:46 -04:00
links {
" gdi32 " ,
" psapi " ,
}
2014-11-09 18:24:22 -05:00
configuration { " winphone8* " }
removelinks {
" DelayImp " ,
" gdi32 " ,
" psapi "
}
2014-11-14 08:23:07 -05:00
links {
" d3d11 " ,
" dxgi "
}
2014-11-09 18:24:22 -05:00
linkoptions {
" /ignore:4264 " -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
}
2014-11-10 17:58:51 -05:00
-- WinRT targets need their own output directories are build files stomp over each other
2015-02-27 18:44:24 -05:00
targetdir ( path.join ( BGFX_BUILD_DIR , " arm_ " .. _ACTION , " bin " , _name ) )
objdir ( path.join ( BGFX_BUILD_DIR , " arm_ " .. _ACTION , " obj " , _name ) )
2014-11-09 18:24:22 -05:00
2014-10-18 02:17:29 -04:00
configuration { " mingw-clang " }
kind " ConsoleApp "
2013-04-17 02:12:03 -04:00
configuration { " android* " }
2013-12-02 22:46:25 -05:00
kind " ConsoleApp "
2013-04-17 02:12:03 -04:00
targetextension " .so "
2013-12-02 22:46:25 -05:00
linkoptions {
" -shared " ,
}
2013-04-17 02:12:03 -04:00
links {
" EGL " ,
" GLESv2 " ,
}
2014-10-20 00:29:27 -04:00
configuration { " nacl* " }
2013-05-18 18:28:35 -04:00
kind " ConsoleApp "
2013-01-26 19:30:02 -05:00
targetextension " .nexe "
links {
" ppapi " ,
" ppapi_gles2 " ,
" pthread " ,
}
2013-05-18 18:28:35 -04:00
configuration { " pnacl " }
kind " ConsoleApp "
targetextension " .pexe "
links {
" ppapi " ,
" ppapi_gles2 " ,
" pthread " ,
}
2014-03-16 15:38:43 -04:00
configuration { " asmjs " }
kind " ConsoleApp "
targetextension " .bc "
2013-11-20 00:38:06 -05:00
configuration { " linux-* " }
2013-01-26 19:30:02 -05:00
links {
2013-04-29 22:35:33 -04:00
" X11 " ,
2013-01-26 19:30:02 -05:00
" GL " ,
" pthread " ,
}
2014-08-24 20:41:41 -04:00
configuration { " rpi " }
links {
" X11 " ,
" GLESv2 " ,
" EGL " ,
" bcm_host " ,
2014-08-24 23:39:35 -04:00
" vcos " ,
" vchiq_arm " ,
2014-08-24 20:41:41 -04:00
" pthread " ,
}
2013-04-13 02:43:46 -04:00
configuration { " osx " }
2013-01-26 19:30:02 -05:00
files {
2015-02-27 18:44:24 -05:00
path.join ( BGFX_DIR , " examples/common/**.mm " ) ,
2013-01-26 19:30:02 -05:00
}
links {
" Cocoa.framework " ,
" OpenGL.framework " ,
}
2013-04-13 04:47:30 -04:00
2013-07-21 17:44:53 -04:00
configuration { " ios* " }
kind " ConsoleApp "
2013-07-14 16:14:48 -04:00
files {
2015-02-27 18:44:24 -05:00
path.join ( BGFX_DIR , " examples/common/**.mm " ) ,
2013-07-14 16:14:48 -04:00
}
2013-07-13 01:27:46 -04:00
linkoptions {
" -framework CoreFoundation " ,
" -framework Foundation " ,
" -framework OpenGLES " ,
2013-07-21 17:44:53 -04:00
" -framework UIKit " ,
" -framework QuartzCore " ,
2013-07-13 01:27:46 -04:00
}
2015-01-14 13:50:45 -05:00
configuration { " xcode4 " , " ios " }
kind " WindowedApp "
files {
2015-02-27 18:44:24 -05:00
path.join ( BGFX_DIR , " examples/runtime/iOS-Info.plist " ) ,
2015-01-14 13:50:45 -05:00
}
2013-04-13 04:47:30 -04:00
configuration { " qnx* " }
targetextension " "
links {
" EGL " ,
" GLESv2 " ,
}
2013-04-21 02:13:44 -04:00
configuration { }
strip ( )
2013-01-26 19:30:02 -05:00
end
2012-06-01 22:55:56 -04:00
dofile " bgfx.lua "
2014-12-06 15:52:14 -05:00
group " examples "
2013-06-05 00:43:43 -04:00
dofile " example-common.lua "
2014-12-06 15:52:14 -05:00
group " libs "
2014-09-11 02:01:22 -04:00
bgfxProject ( " " , " StaticLib " , { } )
2014-12-06 15:52:14 -05:00
group " examples "
2014-09-11 02:01:22 -04:00
exampleProject ( " 00-helloworld " )
exampleProject ( " 01-cubes " )
exampleProject ( " 02-metaballs " )
exampleProject ( " 03-raymarch " )
exampleProject ( " 04-mesh " )
exampleProject ( " 05-instancing " )
exampleProject ( " 06-bump " )
exampleProject ( " 07-callback " )
exampleProject ( " 08-update " )
exampleProject ( " 09-hdr " )
exampleProject ( " 10-font " )
exampleProject ( " 11-fontsdf " )
exampleProject ( " 12-lod " )
exampleProject ( " 13-stencil " )
exampleProject ( " 14-shadowvolumes " )
exampleProject ( " 15-shadowmaps-simple " )
exampleProject ( " 16-shadowmaps " )
exampleProject ( " 17-drawstress " )
exampleProject ( " 18-ibl " )
exampleProject ( " 19-oit " )
exampleProject ( " 20-nanovg " )
exampleProject ( " 21-deferred " )
2014-09-25 00:05:48 -04:00
exampleProject ( " 22-windows " )
2014-11-15 19:19:43 -05:00
exampleProject ( " 23-vectordisplay " )
2014-12-20 00:09:58 -05:00
exampleProject ( " 24-nbody " )
2015-03-18 19:23:38 -04:00
exampleProject ( " 25-c99 " )
2013-12-10 22:37:51 -05:00
2014-08-22 22:29:54 -04:00
if _OPTIONS [ " with-shared-lib " ] then
2014-12-06 15:52:14 -05:00
group " libs "
2014-09-11 02:01:22 -04:00
bgfxProject ( " -shared-lib " , " SharedLib " , { } )
2014-08-22 22:29:54 -04:00
end
2014-05-04 18:43:14 -04:00
if _OPTIONS [ " with-tools " ] then
2014-12-06 15:52:14 -05:00
group " tools "
2014-05-04 18:43:14 -04:00
dofile " makedisttex.lua "
dofile " shaderc.lua "
dofile " texturec.lua "
dofile " geometryc.lua "
end