diff --git a/build/premake/extern_libs4.lua b/build/premake/extern_libs4.lua index f01afe6851..889a8649b2 100644 --- a/build/premake/extern_libs4.lua +++ b/build/premake/extern_libs4.lua @@ -235,7 +235,8 @@ extern_lib_defs = { -- Suppress all the Boost warnings on OS X by including it as a system directory buildoptions { "-isystem../" .. libraries_dir .. "boost/include" } end - if os.getversion().description == "OpenBSD" then + -- TODO: This actually applies to most libraries we use on BSDs, make this a global setting. + if os.is("bsd") then includedirs { "/usr/local/include" } end end, @@ -347,6 +348,8 @@ extern_lib_defs = { elseif os.is("macosx") then add_default_include_paths("iconv") defines { "LIBICONV_STATIC" } + elseif os.getversion().description == "FreeBSD" then + defines { "HAVE_ICONV_CONST" } end end, link_settings = function() @@ -355,10 +358,18 @@ extern_lib_defs = { end add_default_links({ win_names = { "libiconv" }, - -- TODO: glibc provides symbols for this, so we should only include that (and depend on libiconv) on non-glibc unix osx_names = { "iconv" }, dbg_suffix = "", }) + -- glibc (used on Linux and GNU/kFreeBSD) has iconv + -- FreeBSD 10+ has iconv as a part of libc + if os.is("bsd") + and not (os.getversion().description == "FreeBSD" and os.getversion().majorversion >= 10 + or os.getversion().description == "GNU/kFreeBSD") then + add_default_links({ + bsd_names = { "iconv" }, + }) + end end, }, icu = { diff --git a/build/premake/premake4.lua b/build/premake/premake4.lua index 9f1ee40cd9..c99ce6dc12 100644 --- a/build/premake/premake4.lua +++ b/build/premake/premake4.lua @@ -38,6 +38,33 @@ rootdir = "../.." dofile("extern_libs4.lua") +-- detect compiler for non-Windows +if os.is("macosx") then + cc = "clang" +elseif os.is("linux") and _OPTIONS["icc"] then + cc = "icc" +elseif not os.is("windows") then + cc = os.getenv("CC") + if cc == nil or cc == "" then + local hasgcc = os.execute("which gcc > .gccpath") + local f = io.open(".gccpath", "r") + local gccpath = f:read("*line") + f:close() + os.execute("rm .gccpath") + if gccpath == nil then + cc = "clang" + else + cc = "gcc" + end + end +end + +-- TODO: proper clang support +if cc == "clang" then + premake.gcc.cc = "clang" + premake.gcc.cxx = "clang++" +end + -- detect CPU architecture (simplistic, currently only supports x86, amd64 and ARM) arch = "x86" if _OPTIONS["android"] then @@ -51,7 +78,7 @@ else if arch == "x86_64" or arch == "amd64" then arch = "amd64" else - os.execute("gcc -dumpmachine > .gccmachine.tmp") + os.execute(cc .. " -dumpmachine > .gccmachine.tmp") local f = io.open(".gccmachine.tmp", "r") local machine = f:read("*line") f:close() @@ -67,13 +94,6 @@ else end end --- Hack to force clang as default compiler on OS X --- TODO: proper clang support -if os.is("macosx") then - premake.gcc.cc = "clang" - premake.gcc.cxx = "clang++" -end - -- Set up the Solution solution "pyrogenesis" targetdir(rootdir.."/binaries/system") @@ -109,7 +129,7 @@ else -- It's too late to do this test by the time we start compiling the PCH file, so -- do the test in this build script instead (which is kind of ugly - please fix if -- you have a better idea) - if not _OPTIONS["icc"] then + if cc == "gcc" then os.execute("gcc -dumpversion > .gccver.tmp") local f = io.open(".gccver.tmp", "r") major, dot, minor = f:read(1, 1, 1) @@ -158,7 +178,7 @@ end function project_set_build_flags() flags { "Symbols", "NoEditAndContinue" } - if not _OPTIONS["icc"] and (os.is("windows") or not _OPTIONS["minimal-flags"]) then + if cc ~= "icc" and (os.is("windows") or not _OPTIONS["minimal-flags"]) then -- adds the -Wall compiler flag flags { "ExtraWarnings" } -- this causes far too many warnings/remarks on ICC end @@ -218,7 +238,7 @@ function project_set_build_flags() end else -- *nix - if _OPTIONS["icc"] and not _OPTIONS["minimal-flags"] then + if cc == "icc" and not _OPTIONS["minimal-flags"] then buildoptions { "-w1", -- "-Wabi", @@ -391,11 +411,13 @@ end -- bundled libs function project_add_x11_dirs() if not os.is("windows") and not os.is("macosx") then - -- X11 includes may be installed in one of a gadzillion of three places + -- X11 includes may be installed in one of a gadzillion of five places -- Famous last words: "You can't include too much! ;-)" includedirs { "/usr/X11R6/include/X11", "/usr/X11R6/include", + "/usr/local/include/X11", + "/usr/local/include", "/usr/include/X11" } libdirs { "/usr/X11R6/lib" } diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformObject.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformObject.cpp index 0addd0a983..375e0c8e66 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformObject.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/TransformObject.cpp @@ -158,7 +158,7 @@ public: wxString x(xmlData->GetNodeContent()); unsigned long xTmp = 0; x.ToULong(&xTmp); - wxASSERT(xTmp <= (unsigned long)UINT32_MAX); + wxASSERT(xTmp <= (unsigned long)std::numeric_limits::max()); actorSeed = xTmp; }