diff options
Diffstat (limited to '3rdparty/bx/scripts/toolchain.lua')
-rw-r--r-- | 3rdparty/bx/scripts/toolchain.lua | 212 |
1 files changed, 42 insertions, 170 deletions
diff --git a/3rdparty/bx/scripts/toolchain.lua b/3rdparty/bx/scripts/toolchain.lua index 0152ce79c32..076b8fbac60 100644 --- a/3rdparty/bx/scripts/toolchain.lua +++ b/3rdparty/bx/scripts/toolchain.lua @@ -4,7 +4,6 @@ -- local bxDir = path.getabsolute("..") -local naclToolchain = "" local function crtNone() @@ -69,11 +68,8 @@ function toolchain(_buildDir, _libDir) { "tvos-simulator", "tvOS - Simulator" }, { "mingw-gcc", "MinGW" }, { "mingw-clang", "MinGW (clang compiler)" }, - { "nacl", "Native Client" }, - { "nacl-arm", "Native Client - ARM" }, { "netbsd", "NetBSD" }, { "osx", "OSX" }, - { "pnacl", "Native Client - PNaCl" }, { "orbis", "Orbis" }, { "qnx-arm", "QNX/Blackberry - ARM" }, { "riscv", "RISC-V" }, @@ -135,7 +131,7 @@ function toolchain(_buildDir, _libDir) newoption { trigger = "with-windows", value = "#", - description = "Set the Windows target platform version (default: 10.0.10240.0).", + description = "Set the Windows target platform version (default: $WindowsSDKVersion or 8.1).", } newoption { @@ -179,7 +175,7 @@ function toolchain(_buildDir, _libDir) tvosPlatform = _OPTIONS["with-tvos"] end - local windowsPlatform = "10.0.10240.0" + local windowsPlatform = string.gsub(os.getenv("WindowsSDKVersion") or "8.1", "\\", "") if _OPTIONS["with-windows"] then windowsPlatform = _OPTIONS["with-windows"] end @@ -205,7 +201,7 @@ function toolchain(_buildDir, _libDir) if not os.getenv("ANDROID_NDK_ARM") or not os.getenv("ANDROID_NDK_CLANG") or not os.getenv("ANDROID_NDK_ROOT") then - print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT envrionment variables.") + print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.") end premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang" @@ -220,7 +216,7 @@ function toolchain(_buildDir, _libDir) if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_CLANG") or not os.getenv("ANDROID_NDK_ROOT") then - print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT envrionment variables.") + print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.") end premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang" @@ -233,7 +229,7 @@ function toolchain(_buildDir, _libDir) if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_CLANG") or not os.getenv("ANDROID_NDK_ROOT") then - print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT envrionment variables.") + print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM, and ANDROID_NDK_ROOT environment variables.") end premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang" @@ -244,7 +240,7 @@ function toolchain(_buildDir, _libDir) elseif "asmjs" == _OPTIONS["gcc"] then if not os.getenv("EMSCRIPTEN") then - print("Set EMSCRIPTEN enviroment variable.") + print("Set EMSCRIPTEN environment variable.") end premake.gcc.cc = "\"$(EMSCRIPTEN)/emcc\"" @@ -316,7 +312,7 @@ function toolchain(_buildDir, _libDir) elseif "linux-steamlink" == _OPTIONS["gcc"] then if not os.getenv("MARVELL_SDK_PATH") then - print("Set MARVELL_SDK_PATH enviroment variable.") + print("Set MARVELL_SDK_PATH environment variable.") end premake.gcc.cc = "$(MARVELL_SDK_PATH)/toolchain/bin/armv7a-cros-linux-gnueabi-gcc" @@ -325,6 +321,10 @@ function toolchain(_buildDir, _libDir) location (path.join(_buildDir, "projects", _ACTION .. "-linux-steamlink")) elseif "mingw-gcc" == _OPTIONS["gcc"] then + if not os.getenv("MINGW") then + print("Set MINGW environment variable.") + end + local mingwToolchain = "x86_64-w64-mingw32" if compiler32bit then if os.is("linux") then @@ -347,42 +347,6 @@ function toolchain(_buildDir, _libDir) -- premake.gcc.llvm = true location (path.join(_buildDir, "projects", _ACTION .. "-mingw-clang")) - elseif "nacl" == _OPTIONS["gcc"] then - - if not os.getenv("NACL_SDK_ROOT") then - print("Set NACL_SDK_ROOT enviroment variable.") - end - - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_x86_glibc/bin/x86_64-nacl-" - if os.is("macosx") then - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_x86_glibc/bin/x86_64-nacl-" - elseif os.is("linux") then - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_x86_glibc/bin/x86_64-nacl-" - end - - premake.gcc.cc = naclToolchain .. "gcc" - premake.gcc.cxx = naclToolchain .. "g++" - premake.gcc.ar = naclToolchain .. "ar" - location (path.join(_buildDir, "projects", _ACTION .. "-nacl")) - - elseif "nacl-arm" == _OPTIONS["gcc"] then - - if not os.getenv("NACL_SDK_ROOT") then - print("Set NACL_SDK_ROOT enviroment variable.") - end - - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_arm_glibc/bin/arm-nacl-" - if os.is("macosx") then - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_arm_glibc/bin/arm-nacl-" - elseif os.is("linux") then - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_arm_glibc/bin/arm-nacl-" - end - - premake.gcc.cc = naclToolchain .. "gcc" - premake.gcc.cxx = naclToolchain .. "g++" - premake.gcc.ar = naclToolchain .. "ar" - location (path.join(_buildDir, "projects", _ACTION .. "-nacl-arm")) - elseif "netbsd" == _OPTIONS["gcc"] then location (path.join(_buildDir, "projects", _ACTION .. "-netbsd")) @@ -390,7 +354,7 @@ function toolchain(_buildDir, _libDir) if os.is("linux") then if not os.getenv("OSXCROSS") then - print("Set OSXCROSS enviroment variable.") + print("Set OSXCROSS environment variable.") end local osxToolchain = "x86_64-apple-darwin15-" @@ -400,28 +364,10 @@ function toolchain(_buildDir, _libDir) end location (path.join(_buildDir, "projects", _ACTION .. "-osx")) - elseif "pnacl" == _OPTIONS["gcc"] then - - if not os.getenv("NACL_SDK_ROOT") then - print("Set NACL_SDK_ROOT enviroment variable.") - end - - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/win_pnacl/bin/pnacl-" - if os.is("macosx") then - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/mac_pnacl/bin/pnacl-" - elseif os.is("linux") then - naclToolchain = "$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-" - end - - premake.gcc.cc = naclToolchain .. "clang" - premake.gcc.cxx = naclToolchain .. "clang++" - premake.gcc.ar = naclToolchain .. "ar" - location (path.join(_buildDir, "projects", _ACTION .. "-pnacl")) - elseif "orbis" == _OPTIONS["gcc"] then if not os.getenv("SCE_ORBIS_SDK_DIR") then - print("Set SCE_ORBIS_SDK_DIR enviroment variable.") + print("Set SCE_ORBIS_SDK_DIR environment variable.") end orbisToolchain = "$(SCE_ORBIS_SDK_DIR)/host_tools/bin/orbis-" @@ -434,7 +380,7 @@ function toolchain(_buildDir, _libDir) elseif "qnx-arm" == _OPTIONS["gcc"] then if not os.getenv("QNX_HOST") then - print("Set QNX_HOST enviroment variable.") + print("Set QNX_HOST environment variable.") end premake.gcc.cc = "$(QNX_HOST)/usr/bin/arm-unknown-nto-qnx8.0.0eabi-gcc" @@ -458,6 +404,10 @@ function toolchain(_buildDir, _libDir) or _ACTION == "vs2017" then + local action = premake.action.current() + action.vstudio.windowsTargetPlatformVersion = windowsPlatform + action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform + if (_ACTION .. "-clang") == _OPTIONS["vs"] then if "vs2017-clang" == _OPTIONS["vs"] then premake.vstudio.toolset = "v141_clang_c2" @@ -488,10 +438,6 @@ function toolchain(_buildDir, _libDir) premake.vstudio.toolset = "v140" premake.vstudio.storeapp = "8.2" - local action = premake.action.current() - action.vstudio.windowsTargetPlatformVersion = windowsPlatform - action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform - platforms { "ARM" } location (path.join(_buildDir, "projects", _ACTION .. "-winstore82")) @@ -507,14 +453,12 @@ function toolchain(_buildDir, _libDir) elseif "orbis" == _OPTIONS["vs"] then if not os.getenv("SCE_ORBIS_SDK_DIR") then - print("Set SCE_ORBIS_SDK_DIR enviroment variable.") + print("Set SCE_ORBIS_SDK_DIR environment variable.") end platforms { "Orbis" } location (path.join(_buildDir, "projects", _ACTION .. "-orbis")) - end - elseif ("vs2012-xp") == _OPTIONS["vs"] then premake.vstudio.toolset = ("v110_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) @@ -531,6 +475,8 @@ function toolchain(_buildDir, _libDir) premake.vstudio.toolset = ("v141_xp") location (path.join(_buildDir, "projects", _ACTION .. "-xp")) + end + elseif _ACTION == "xcode4" then if "osx" == _OPTIONS["xcode"] then @@ -601,7 +547,7 @@ function toolchain(_buildDir, _libDir) "EnableSSE2", } - configuration { "vs*", "not orbis" } + configuration { "vs*", "not orbis", "not NX32", "not NX64" } includedirs { path.join(bxDir, "include/compat/msvc") } defines { "WIN32", @@ -777,8 +723,16 @@ function toolchain(_buildDir, _libDir) configuration { "linux-gcc* or linux-clang*" } buildoptions { "-msse2", +-- "-Wdouble-promotion", +-- "-Wduplicated-branches", +-- "-Wduplicated-cond", +-- "-Wjump-misses-init", + "-Wlogical-op", + "-Wshadow", +-- "-Wnull-dereference", "-Wunused-value", "-Wundef", +-- "-Wuseless-cast", } buildoptions_cpp { "-std=c++11", @@ -1022,10 +976,14 @@ function toolchain(_buildDir, _libDir) libdirs { path.join(_libDir, "lib/asmjs") } buildoptions { "-i\"system$(EMSCRIPTEN)/system/include\"", + "-i\"system$(EMSCRIPTEN)/system/include/libcxx\"", "-i\"system$(EMSCRIPTEN)/system/include/libc\"", "-Wunused-value", "-Wundef", } + buildoptions_cpp { + "-std=c++11", + } configuration { "freebsd" } targetdir (path.join(_buildDir, "freebsd/bin")) @@ -1035,83 +993,6 @@ function toolchain(_buildDir, _libDir) path.join(bxDir, "include/compat/freebsd"), } - configuration { "nacl or nacl-arm or pnacl" } - buildoptions { - "-U__STRICT_ANSI__", -- strcasecmp, setenv, unsetenv,... - "-fno-stack-protector", - "-fdiagnostics-show-option", - "-fdata-sections", - "-ffunction-sections", - "-Wunused-value", - "-Wundef", - } - buildoptions_cpp { - "-std=c++11", - } - includedirs { - "$(NACL_SDK_ROOT)/include", - path.join(bxDir, "include/compat/nacl"), - } - - configuration { "nacl" } - buildoptions { - "-pthread", - "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic. - "-msse2", - } - linkoptions { - "-Wl,--gc-sections", - } - - configuration { "x32", "nacl" } - targetdir (path.join(_buildDir, "nacl-x86/bin")) - objdir (path.join(_buildDir, "nacl-x86/obj")) - libdirs { path.join(_libDir, "lib/nacl-x86") } - linkoptions { "-melf32_nacl" } - - configuration { "x32", "nacl", "Debug" } - libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Debug" } - - configuration { "x32", "nacl", "Release" } - libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_32/Release" } - - configuration { "x64", "nacl" } - targetdir (path.join(_buildDir, "nacl-x64/bin")) - objdir (path.join(_buildDir, "nacl-x64/obj")) - libdirs { path.join(_libDir, "lib/nacl-x64") } - linkoptions { "-melf64_nacl" } - - configuration { "x64", "nacl", "Debug" } - libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Debug" } - - configuration { "x64", "nacl", "Release" } - libdirs { "$(NACL_SDK_ROOT)/lib/glibc_x86_64/Release" } - - configuration { "nacl-arm" } - buildoptions { - "-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0 - } - targetdir (path.join(_buildDir, "nacl-arm/bin")) - objdir (path.join(_buildDir, "nacl-arm/obj")) - libdirs { path.join(_libDir, "lib/nacl-arm") } - - configuration { "nacl-arm", "Debug" } - libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Debug" } - - configuration { "nacl-arm", "Release" } - libdirs { "$(NACL_SDK_ROOT)/lib/glibc_arm/Release" } - - configuration { "pnacl" } - targetdir (path.join(_buildDir, "pnacl/bin")) - objdir (path.join(_buildDir, "pnacl/obj")) - libdirs { path.join(_libDir, "lib/pnacl") } - - configuration { "pnacl", "Debug" } - libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Debug" } - - configuration { "pnacl", "Release" } - libdirs { "$(NACL_SDK_ROOT)/lib/pnacl/Release" } - configuration { "xbox360" } targetdir (path.join(_buildDir, "xbox360/bin")) objdir (path.join(_buildDir, "xbox360/obj")) @@ -1163,6 +1044,9 @@ function toolchain(_buildDir, _libDir) buildoptions_cpp { "-std=c++11", } + buildoptions_objcpp { + "-std=c++11", + } buildoptions { "-Wfatal-errors", "-msse2", @@ -1178,6 +1062,9 @@ function toolchain(_buildDir, _libDir) buildoptions_cpp { "-std=c++11", } + buildoptions_objcpp { + "-std=c++11", + } buildoptions { "-Wfatal-errors", "-Wunused-value", @@ -1302,13 +1189,9 @@ function toolchain(_buildDir, _libDir) "$(SCE_ORBIS_SDK_DIR)/target/include", "$(SCE_ORBIS_SDK_DIR)/target/include_common", } - buildoptions { - } buildoptions_cpp { "-std=c++11", } - linkoptions { - } configuration { "qnx-arm" } targetdir (path.join(_buildDir, "qnx-arm/bin")) @@ -1418,18 +1301,6 @@ function strip() "$(SILENT) $(MINGW)/bin/strip -s \"$(TARGET)\"" } - configuration { "pnacl" } - postbuildcommands { - "$(SILENT) echo Running pnacl-finalize.", - "$(SILENT) " .. naclToolchain .. "finalize \"$(TARGET)\"" - } - - configuration { "*nacl*", "Release" } - postbuildcommands { - "$(SILENT) echo Stripping symbols.", - "$(SILENT) " .. naclToolchain .. "strip -s \"$(TARGET)\"" - } - configuration { "asmjs" } postbuildcommands { "$(SILENT) echo Running asmjs finalize.", @@ -1441,7 +1312,8 @@ function strip() -- .. "-s USE_WEBGL2=1 " .. "--memory-init-file 1 " .. "\"$(TARGET)\" -o \"$(TARGET)\".html " --- .. "--preload-file ../../../examples/runtime@/" +-- .. "--preload-file ../../../examples/runtime@/ " + .. "-s PRECISE_F32=1" } configuration { "riscv" } |