2016-08-26 09:22:29 +03:00
-- Special trick to load the parent path of the current script.
local parent_path = string.match ( arg [ 0 ] , " (.-)([^ \\ /]-%.?([^%. \\ /]*))$ " )
-- Add that path to the list of places where lua will load packages
package.path = package.path .. " ; " .. parent_path .. " ?.lua "
-- Load the driver package which will take care of the command line arguments and other settings
-- as here we just focus on the code necessary to build our supported platforms
require " np-build-driver "
2016-05-28 03:49:48 +03:00
local debug_flags = " -O0 -g "
2016-06-21 06:57:56 +03:00
local debug_ms_flags = " -Od "
2016-05-28 03:49:48 +03:00
local release_flags = " -O3 "
2016-06-21 06:57:56 +03:00
local release_ms_flags = " -O2 "
2016-05-28 03:49:48 +03:00
--Win dll for checking
2017-05-14 08:16:12 +03:00
function BuildWindows32DLL ( cfile , isCpp )
2016-05-28 03:49:48 +03:00
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-14 08:16:12 +03:00
if isCpp then flags = flags .. " -std=c++1z " end
2017-05-16 05:21:57 +03:00
local cmd = " clang -v -m32 -DNP_WIN32 -Wall -gcodeview -fno-ms-extensions -target i686-pc-windows-msvc " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkWindows32DLL ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " clang -v -m32 -shared -o Windows \\ x86 \\ " .. outputName .. " .dll -Wl, \" -libpath:C: \\ Program Files (x86) \\ Windows Kits \\ 10 \\ Lib \\ 10.0.10586.0 \\ ucrt \\ x86 \" , \" -libpath:C: \\ Program Files (x86) \\ Windows Kits \\ 10 \\ Lib \\ 10.0.10586.0 \\ um \\ x86 \" ,-nodefaultlib:libcmt,-dll,-libpath:.. \\ Libs \\ Windows \\ x86 \\ -llibNativePath " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
2017-05-15 04:55:41 +03:00
--LLVM bytecode
2017-05-15 14:04:49 +03:00
function BuildLLVM32 ( cfile , isCpp )
2017-05-15 04:55:41 +03:00
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-15 14:04:49 +03:00
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
2017-05-17 13:19:26 +03:00
local cmd = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target i386-unknown-none " .. cfile
local cmdLL = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .ll " .. " -S -c -emit-llvm -target i386-unknown-none " .. cfile
local cmdPP = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -E " .. cfile .. " > " .. cfile .. " .pp "
2017-05-15 04:55:41 +03:00
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
2017-05-15 14:04:49 +03:00
os.execute ( cmdLL )
os.execute ( cmdPP )
2017-05-15 04:55:41 +03:00
end
function LinkLLVM32 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2017-05-15 14:04:49 +03:00
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -i386.bc " .. objs_str
2017-05-15 04:55:41 +03:00
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
2017-05-15 14:04:49 +03:00
function BuildLLVMarmv7 ( cfile , isCpp )
2017-05-15 04:55:41 +03:00
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-15 14:04:49 +03:00
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
2017-05-17 13:19:26 +03:00
local cmd = " clang -DNP_LLVM_BC -mfpu=neon -mfloat-abi=hard " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target armv7-unknown-none " .. cfile
2017-05-15 14:04:49 +03:00
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVMarmv7 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -armv7.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
function BuildLLVMarmv7s ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
2017-05-17 13:19:26 +03:00
local cmd = " clang -DNP_LLVM_BC -mfpu=neon -mfloat-abi=hard " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target armv7s-unknown-none " .. cfile
2017-05-15 14:04:49 +03:00
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVMarmv7s ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -armv7s.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
function BuildLLVMAArch64 ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
2017-05-17 13:19:26 +03:00
local cmd = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target aarch64-unknown-none " .. cfile
2017-05-15 14:04:49 +03:00
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVMAArch64 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -aarch64.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
function BuildLLVMarmv6 ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
2017-05-17 13:19:26 +03:00
local cmd = " clang -DNP_LLVM_BC -mfloat-abi=hard -mfpu=vfp " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target armv6-unknown-none " .. cfile
2017-05-15 14:04:49 +03:00
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVMarmv6 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -armv6.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
function BuildLLVM64 ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
2017-05-17 13:19:26 +03:00
local cmd = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target x86_64-unknown-none " .. cfile
2017-05-15 04:55:41 +03:00
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVM64 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2017-05-15 14:04:49 +03:00
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -x86_64.bc " .. objs_str
2017-05-15 04:55:41 +03:00
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
2017-05-17 13:19:26 +03:00
--apple llvm
function BuildLLVMarmv7Appl ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
local cmd = " clang -DNP_LLVM_BC -mfpu=neon -mfloat-abi=hard " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target armv7-apple-macho " .. cfile
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVMarmv7Appl ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -armv7-apple.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
function BuildLLVMarmv7sAppl ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
local cmd = " clang -DNP_LLVM_BC -mfpu=neon -mfloat-abi=hard " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target armv7s-apple-macho " .. cfile
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVMarmv7sAppl ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -armv7s-apple.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
function BuildLLVMAArch64Appl ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
local cmd = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target arm64-apple-macho " .. cfile
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVMAArch64Appl ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -aarch64-apple.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
function BuildLLVM32Appl ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
local cmd = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target i386-apple-darwin " .. cfile
local cmdLL = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -o " .. cfile .. " -apple.ll " .. " -S -c -emit-llvm -target i386-apple-darwin " .. cfile
local cmdPP = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -E " .. cfile .. " > " .. cfile .. " .pp "
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
os.execute ( cmdLL )
os.execute ( cmdPP )
end
function LinkLLVM32Appl ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -i386-apple.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
function BuildLLVM64Appl ( cfile , isCpp )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
if isCpp then flags = flags .. " -std=c++1z -fno-rtti -fno-exceptions " end
local cmd = " clang -DNP_LLVM_BC " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .bc " .. " -c -emit-llvm -target x86_64-apple-macho " .. cfile
if is_verbose == true then
print ( cmd )
end
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .bc " ) end
end
function LinkLLVM64Appl ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-link -o LLVM \\ " .. outputName .. " -x86_64-apple.bc " .. objs_str
if is_verbose == true then
print ( cmd )
end
os.execute ( cmd )
end
2016-05-28 03:49:48 +03:00
--Win
function BuildWindows32 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -m32 -DNP_WIN32 -gcodeview -fno-ms-extensions -target i686-pc-windows-msvc " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkWindows32 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 09:22:29 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 14.0 \\ VC \\ vcvarsall \" x86 && lib /NOLOGO /OUT:Windows \\ x86 \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
function BuildWindows64 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -m64 -DNP_WIN32 -gcodeview -fno-ms-extensions -target i686-pc-windows-msvc " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkWindows64 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 09:22:29 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 14.0 \\ VC \\ vcvarsall \" x64 && lib /NOLOGO /OUT:Windows \\ x64 \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
--Win UWP
function BuildWindowsUWP32 ( cfile )
local flags = " "
2016-06-19 12:25:58 +03:00
if debug then flags = debug_ms_flags else flags = release_ms_flags end
2016-11-05 00:02:55 +03:00
local cmd = " clang-cl -DNP_WIN32 -WX -EHsc -GS- -MD -DWIN_EXPORT -m32 " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile ;
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkWindowsUWP32 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-11-05 00:31:32 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 14.0 \\ VC \\ vcvarsall \" x86 store 10.0.10240 && lib /NOLOGO /OUT:WindowsUWP \\ x86 \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
function BuildWindowsUWP64 ( cfile )
local flags = " "
2016-06-19 12:25:58 +03:00
if debug then flags = debug_ms_flags else flags = release_ms_flags end
2017-05-15 14:04:49 +03:00
local cmd = " clang-cl -DNP_WIN32 -WX -EHsc -GS- -MD -DWIN_EXPORT -m64 " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkWindowsUWP64 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-11-05 00:31:32 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 14.0 \\ VC \\ vcvarsall \" x64 store 10.0.10240 && lib /NOLOGO /OUT:WindowsUWP \\ x64 \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
function BuildWindowsUWPARM ( cfile )
local flags = " "
2016-06-19 12:25:58 +03:00
if debug then flags = debug_ms_flags else flags = release_ms_flags end
2017-05-15 14:04:49 +03:00
local cmd = " clang-cl -DNP_WIN32 -WX -EHsc -GS- -MD -DWIN_EXPORT -m32 --target=thumbv7-windows-msvc " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkWindowsUWPARM ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-11-05 00:31:32 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 14.0 \\ VC \\ vcvarsall \" x86_arm store 10.0.10240 && lib /NOLOGO /OUT:WindowsUWP \\ ARM \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
--Win 8.1
function LinkWindows8132 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 09:22:29 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 14.0 \\ VC \\ vcvarsall \" x86 8.1 store && lib /NOLOGO /OUT:Windows8.1 \\ x86 \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
function LinkWindows8164 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 09:22:29 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 14.0 \\ VC \\ vcvarsall \" x64 8.1 store && lib /NOLOGO /OUT:Windows8.1 \\ x64 \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
function LinkWindows81ARM ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 09:22:29 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 14.0 \\ VC \\ vcvarsall \" x86_arm 8.1 store && lib /NOLOGO /OUT:Windows8.1 \\ ARM \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
2016-06-21 06:57:56 +03:00
--Win Phone 8.1
function LinkWindowsWP32 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 09:22:29 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 11.0 \\ VC \\ WPSDK \\ WP80 \\ vcvarsphoneall \" x86 && lib /NOLOGO /OUT:WindowsPhone \\ x86 \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 06:57:56 +03:00
os.execute ( cmd )
end
function LinkWindowsWPARM ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 09:22:29 +03:00
local cmd = " \" C: \\ Program Files (x86) \\ Microsoft Visual Studio 11.0 \\ VC \\ WPSDK \\ WP80 \\ vcvarsphoneall \" x86_arm && lib /NOLOGO /OUT:WindowsPhone \\ ARM \\ " .. outputName .. " .lib " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 06:57:56 +03:00
os.execute ( cmd )
end
2016-05-28 03:49:48 +03:00
--iOS
2017-05-14 08:16:12 +03:00
function BuildIOSArm7 ( cfile , isCpp )
2016-05-28 03:49:48 +03:00
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-14 08:16:12 +03:00
if isCpp then flags = flags .. " -std=c++1z " end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_IOS -mios-version-min=6.0 -target armv7-apple-ios " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
2016-06-21 15:12:53 +03:00
function LinkIOSArm7 ( )
2016-05-28 03:49:48 +03:00
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 11:13:11 +03:00
local cmd = " llvm-ar rcs -format=bsd iOS \\ " .. outputName .. " _armv7.a " .. objs_str
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
2016-06-21 15:12:53 +03:00
function BuildIOSArm7s ( cfile )
2016-05-28 03:49:48 +03:00
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_IOS -mios-version-min=6.0 -target armv7s-apple-ios " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
2016-06-21 15:12:53 +03:00
function LinkIOSArm7s ( )
2016-05-28 03:49:48 +03:00
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 11:13:11 +03:00
local cmd = " llvm-ar rcs -format=bsd iOS \\ " .. outputName .. " _armv7s.a " .. objs_str
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
2016-06-21 15:12:53 +03:00
function BuildIOSArm64 ( cfile )
2016-05-28 03:49:48 +03:00
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_IOS -mios-version-min=6.0 -target arm64-apple-ios " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
2016-06-21 15:12:53 +03:00
function LinkIOSArm64 ( )
2016-05-28 03:49:48 +03:00
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 11:13:11 +03:00
local cmd = " llvm-ar rcs -format=bsd iOS \\ " .. outputName .. " _arm64.a " .. objs_str
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
2016-06-21 15:12:53 +03:00
function BuildIOSx86 ( cfile )
2016-05-28 03:49:48 +03:00
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_IOS -mios-version-min=6.0 -target i386-apple-ios " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
2016-06-21 15:12:53 +03:00
function LinkIOSx86 ( )
2016-05-28 03:49:48 +03:00
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 11:13:11 +03:00
local cmd = " llvm-ar rcs -format=bsd iOS \\ " .. outputName .. " _i386.a " .. objs_str
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
2016-06-21 15:12:53 +03:00
function BuildIOSx64 ( cfile )
2016-05-28 03:49:48 +03:00
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_IOS -mios-version-min=6.0 -target x86_64-apple-ios " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
2016-06-21 15:12:53 +03:00
function LinkIOSx64 ( )
2016-05-28 03:49:48 +03:00
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 11:13:11 +03:00
local cmd = " llvm-ar rcs -format=bsd iOS \\ " .. outputName .. " _x86_64.a " .. objs_str
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
2016-07-04 13:11:06 +03:00
--macOS
function BuildMacOSx86 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_MACOS -mmacosx-version-min=10.5 -target i386-apple-macosx " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-07-04 13:11:06 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkMacOSx86 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 11:13:11 +03:00
local cmd = " llvm-ar rcs -format=bsd macOS \\ " .. outputName .. " _i386.a " .. objs_str
if is_verbose == true then
print ( cmd )
end
2016-07-04 13:11:06 +03:00
os.execute ( cmd )
end
function BuildMacOSx64 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_MACOS -mmacosx-version-min=10.5 -target x86_64-apple-macosx " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-07-04 13:11:06 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkMacOSx64 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 11:13:11 +03:00
local cmd = " llvm-ar rcs -format=bsd macOS \\ " .. outputName .. " _x86_64.a " .. objs_str
if is_verbose == true then
print ( cmd )
end
2016-07-04 13:11:06 +03:00
os.execute ( cmd )
end
2016-06-21 15:12:53 +03:00
--Android
function BuildAndroidArm ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_ANDROID -target arm-none-android " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkAndroidArm ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-ar rcs -format=gnu Android \\ armeabi \\ " .. outputName .. " .a " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
os.execute ( cmd )
end
function BuildAndroidArm7 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_ANDROID -target armv7-none-android " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkAndroidArm7 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-ar rcs -format=gnu Android \\ armeabi-v7a \\ " .. outputName .. " .a " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
os.execute ( cmd )
end
function BuildAndroidArm64 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_ANDROID -target aarch64-none-android " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkAndroidArm64 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-ar rcs -format=gnu Android \\ arm64-v8a \\ " .. outputName .. " .a " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
os.execute ( cmd )
end
function BuildAndroidx86 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_ANDROID -target i386-none-android " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkAndroidx86 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-ar rcs -format=gnu Android \\ x86 \\ " .. outputName .. " .a " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
os.execute ( cmd )
end
function BuildAndroidx64 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_ANDROID -target x86_64-none-android " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkAndroidx64 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-ar rcs -format=gnu Android \\ x86_64 \\ " .. outputName .. " .a " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-06-21 15:12:53 +03:00
os.execute ( cmd )
end
2016-05-28 03:49:48 +03:00
--linux
function BuildLinuxX64 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_LINUX -fPIC -target x86_64-linux-gnu " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkLinuxX64 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
2016-08-26 11:13:11 +03:00
local cmd = " llvm-ar rcs -format=gnu Linux \\ x86_64 \\ " .. outputName .. " .a " .. objs_str
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
function BuildLinuxX86 ( cfile )
local flags = " "
if debug then flags = debug_flags else flags = release_flags end
2017-05-16 05:21:57 +03:00
local cmd = " clang -DNP_LINUX -fPIC -target i386-linux-gnu " .. common_flags .. " " .. flags .. " -o " .. cfile .. " .o " .. " -c " .. cfile
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
if os.execute ( cmd ) == 0 then table.insert ( objs , cfile .. " .o " ) end
end
function LinkLinuxX86 ( )
local objs_str = " "
for i , o in ipairs ( objs ) do
objs_str = objs_str .. o .. " "
end
local cmd = " llvm-ar rcs -format=gnu Linux \\ x86 \\ " .. outputName .. " .a " .. objs_str
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
2016-05-28 03:49:48 +03:00
os.execute ( cmd )
end
if platform == " windows " then
lfs.mkdir ( " Windows " )
lfs.chdir ( " Windows " )
lfs.mkdir ( " x64 " )
lfs.mkdir ( " x86 " )
lfs.chdir ( " .. " )
2016-08-26 09:22:29 +03:00
print ( " Building Windows x86 DLL... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
2017-05-14 08:16:12 +03:00
BuildWindows32DLL ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildWindows32DLL ( f , true )
2016-05-28 03:49:48 +03:00
end
LinkWindows32DLL ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Windows x86... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindows32 ( f )
end
LinkWindows32 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Windows x64... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindows64 ( f )
end
LinkWindows64 ( )
objs = { }
lfs.mkdir ( " WindowsUWP " )
lfs.chdir ( " WindowsUWP " )
lfs.mkdir ( " x64 " )
lfs.mkdir ( " x86 " )
lfs.mkdir ( " ARM " )
lfs.chdir ( " .. " )
2016-08-26 09:22:29 +03:00
print ( " Building Windows UWP x86... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindowsUWP32 ( f )
end
LinkWindowsUWP32 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Windows UWP x64... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindowsUWP64 ( f )
end
LinkWindowsUWP64 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Windows UWP ARM... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindowsUWPARM ( f )
end
LinkWindowsUWPARM ( )
objs = { }
lfs.mkdir ( " Windows8.1 " )
lfs.chdir ( " Windows8.1 " )
lfs.mkdir ( " x64 " )
lfs.mkdir ( " x86 " )
lfs.mkdir ( " ARM " )
lfs.chdir ( " .. " )
2016-08-26 09:22:29 +03:00
print ( " Building Windows UWP 8.1 x86... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindowsUWP32 ( f )
end
LinkWindows8132 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Windows UWP 8.1 x64... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindowsUWP64 ( f )
end
LinkWindows8164 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Windows UWP 8.1 ARM... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindowsUWPARM ( f )
end
LinkWindows81ARM ( )
2016-06-21 06:57:56 +03:00
--
objs = { }
lfs.mkdir ( " WindowsPhone " )
lfs.chdir ( " WindowsPhone " )
lfs.mkdir ( " x86 " )
lfs.mkdir ( " ARM " )
lfs.chdir ( " .. " )
2016-08-26 09:22:29 +03:00
print ( " Building Windows Phone x86... " )
2016-06-21 06:57:56 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindowsUWP32 ( f )
end
LinkWindowsWP32 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Windows Phone ARM... " )
2016-06-21 06:57:56 +03:00
for i , f in ipairs ( cfiles ) do
BuildWindowsUWPARM ( f )
end
LinkWindowsWPARM ( )
2016-08-26 09:22:29 +03:00
2016-05-28 03:49:48 +03:00
elseif platform == " ios " then
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building iOS arm7... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
2017-05-14 08:16:12 +03:00
BuildIOSArm7 ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildIOSArm7 ( f , true )
2016-05-28 03:49:48 +03:00
end
2016-06-21 15:12:53 +03:00
LinkIOSArm7 ( )
2016-05-28 03:49:48 +03:00
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building iOS arm7s... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
2016-06-21 15:12:53 +03:00
BuildIOSArm7s ( f )
2016-05-28 03:49:48 +03:00
end
2016-06-21 15:12:53 +03:00
LinkIOSArm7s ( )
2016-05-28 03:49:48 +03:00
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building iOS arm64... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
2016-06-21 15:12:53 +03:00
BuildIOSArm64 ( f )
2016-05-28 03:49:48 +03:00
end
2016-06-21 15:12:53 +03:00
LinkIOSArm64 ( )
2016-05-28 03:49:48 +03:00
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building iOS x86... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
2016-06-21 15:12:53 +03:00
BuildIOSx86 ( f )
2016-05-28 03:49:48 +03:00
end
2016-06-21 15:12:53 +03:00
LinkIOSx86 ( )
2016-05-28 03:49:48 +03:00
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building iOS x64... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
2016-06-21 15:12:53 +03:00
BuildIOSx64 ( f )
2016-05-28 03:49:48 +03:00
end
2016-06-21 15:12:53 +03:00
LinkIOSx64 ( )
2016-05-28 03:49:48 +03:00
lfs.mkdir ( " iOS " )
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
os.execute ( " lipo iOS \\ " .. outputName .. " _armv7.a iOS \\ " .. outputName .. " _armv7s.a iOS \\ " .. outputName .. " _arm64.a iOS \\ " .. outputName .. " _i386.a iOS \\ " .. outputName .. " _x86_64.a -create -output iOS \\ " .. outputName .. " .a " )
os.remove ( " iOS \\ " .. outputName .. " _armv7.a " )
os.remove ( " iOS \\ " .. outputName .. " _armv7s.a " )
os.remove ( " iOS \\ " .. outputName .. " _arm64.a " )
os.remove ( " iOS \\ " .. outputName .. " _i386.a " )
os.remove ( " iOS \\ " .. outputName .. " _x86_64.a " )
2016-07-04 13:11:06 +03:00
elseif platform == " macos " then
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building macOS x86... " )
2016-07-04 13:11:06 +03:00
for i , f in ipairs ( cfiles ) do
BuildMacOSx86 ( f )
end
LinkMacOSx86 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building macOS x64... " )
2016-07-04 13:11:06 +03:00
for i , f in ipairs ( cfiles ) do
BuildMacOSx64 ( f )
end
LinkMacOSx64 ( )
lfs.mkdir ( " macOS " )
2016-08-26 11:13:11 +03:00
if is_verbose == true then
print ( cmd )
end
os.execute ( " lipo macOS \\ " .. outputName .. " _i386.a macOS \\ " .. outputName .. " _x86_64.a -create -output macOS \\ " .. outputName .. " .a " )
os.remove ( " macOS \\ " .. outputName .. " _i386.a " )
os.remove ( " macOS \\ " .. outputName .. " _x86_64.a " )
2017-05-15 04:55:41 +03:00
elseif platform == " llvm " then
2017-05-15 14:04:49 +03:00
lfs.mkdir ( " LLVM " )
2017-05-15 04:55:41 +03:00
objs = { }
print ( " Building LLVM x86... " )
for i , f in ipairs ( cfiles ) do
2017-05-15 14:04:49 +03:00
BuildLLVM32 ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildLLVM32 ( f , true )
2017-05-15 04:55:41 +03:00
end
LinkLLVM32 ( )
objs = { }
print ( " Building LLVM x64... " )
for i , f in ipairs ( cfiles ) do
2017-05-15 14:04:49 +03:00
BuildLLVM64 ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildLLVM64 ( f , true )
2017-05-15 04:55:41 +03:00
end
LinkLLVM64 ( )
2017-05-15 14:04:49 +03:00
objs = { }
print ( " Building LLVM armv6... " )
for i , f in ipairs ( cfiles ) do
BuildLLVMarmv6 ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildLLVMarmv6 ( f , true )
end
LinkLLVMarmv6 ( )
objs = { }
print ( " Building LLVM armv7... " )
for i , f in ipairs ( cfiles ) do
BuildLLVMarmv7 ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildLLVMarmv7 ( f , true )
end
LinkLLVMarmv7 ( )
objs = { }
2017-05-17 13:19:26 +03:00
print ( " Building LLVM AArch64... " )
for i , f in ipairs ( cfiles ) do
BuildLLVMAArch64 ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildLLVMAArch64 ( f , true )
end
LinkLLVMAArch64 ( )
objs = { }
print ( " Building LLVM x86 Apple... " )
2017-05-15 14:04:49 +03:00
for i , f in ipairs ( cfiles ) do
2017-05-17 13:19:26 +03:00
BuildLLVM32Appl ( f , false )
2017-05-15 14:04:49 +03:00
end
for i , f in ipairs ( cppfiles ) do
2017-05-17 13:19:26 +03:00
BuildLLVM32Appl ( f , true )
2017-05-15 14:04:49 +03:00
end
2017-05-17 13:19:26 +03:00
LinkLLVM32Appl ( )
2017-05-15 14:04:49 +03:00
objs = { }
2017-05-17 13:19:26 +03:00
print ( " Building LLVM x64 Apple... " )
2017-05-15 14:04:49 +03:00
for i , f in ipairs ( cfiles ) do
2017-05-17 13:19:26 +03:00
BuildLLVM64Appl ( f , false )
2017-05-15 14:04:49 +03:00
end
for i , f in ipairs ( cppfiles ) do
2017-05-17 13:19:26 +03:00
BuildLLVM64Appl ( f , true )
2017-05-15 14:04:49 +03:00
end
2017-05-17 13:19:26 +03:00
LinkLLVM64Appl ( )
objs = { }
print ( " Building LLVM armv7 Apple... " )
for i , f in ipairs ( cfiles ) do
BuildLLVMarmv7Appl ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildLLVMarmv7Appl ( f , true )
end
LinkLLVMarmv7Appl ( )
objs = { }
print ( " Building LLVM armv7s Apple... " )
for i , f in ipairs ( cfiles ) do
BuildLLVMarmv7sAppl ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildLLVMarmv7sAppl ( f , true )
end
LinkLLVMarmv7sAppl ( )
objs = { }
print ( " Building LLVM AArch64 Apple... " )
for i , f in ipairs ( cfiles ) do
BuildLLVMAArch64Appl ( f , false )
end
for i , f in ipairs ( cppfiles ) do
BuildLLVMAArch64Appl ( f , true )
end
LinkLLVMAArch64Appl ( )
2016-08-26 11:13:11 +03:00
2016-05-28 03:49:48 +03:00
elseif platform == " linux " then
lfs.mkdir ( " Linux " )
lfs.chdir ( " Linux " )
2016-08-26 11:32:14 +03:00
lfs.mkdir ( " x86_64 " )
2016-05-28 03:49:48 +03:00
lfs.mkdir ( " x86 " )
lfs.chdir ( " .. " )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Linux x64... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildLinuxX64 ( f )
end
LinkLinuxX64 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Linux x86... " )
2016-05-28 03:49:48 +03:00
for i , f in ipairs ( cfiles ) do
BuildLinuxX86 ( f )
end
LinkLinuxX86 ( )
2016-08-26 09:22:29 +03:00
2016-06-21 15:12:53 +03:00
elseif platform == " android " then
lfs.mkdir ( " Android " )
lfs.chdir ( " Android " )
lfs.mkdir ( " x86_64 " )
lfs.mkdir ( " x86 " )
lfs.mkdir ( " arm64-v8a " )
lfs.mkdir ( " armeabi " )
lfs.mkdir ( " armeabi-v7a " )
lfs.chdir ( " .. " )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Android arm... " )
2016-06-21 15:12:53 +03:00
for i , f in ipairs ( cfiles ) do
BuildAndroidArm ( f )
end
LinkAndroidArm ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Android arm7... " )
2016-06-21 15:12:53 +03:00
for i , f in ipairs ( cfiles ) do
BuildAndroidArm7 ( f )
end
LinkAndroidArm7 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Android arm64... " )
2016-06-21 15:12:53 +03:00
for i , f in ipairs ( cfiles ) do
BuildAndroidArm64 ( f )
end
LinkAndroidArm64 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Android x86... " )
2016-06-21 15:12:53 +03:00
for i , f in ipairs ( cfiles ) do
BuildAndroidx86 ( f )
end
LinkAndroidx86 ( )
objs = { }
2016-08-26 09:22:29 +03:00
print ( " Building Android x64... " )
2016-06-21 15:12:53 +03:00
for i , f in ipairs ( cfiles ) do
BuildAndroidx64 ( f )
end
LinkAndroidx64 ( )
2016-05-28 03:49:48 +03:00
end