diff --git a/build/premake/extern_libs4.lua b/build/premake/extern_libs4.lua index b4d9e28101..d94d1ba84a 100644 --- a/build/premake/extern_libs4.lua +++ b/build/premake/extern_libs4.lua @@ -109,6 +109,8 @@ local function add_default_links(def) names = def.linux_names elseif os.is("macosx") and def.osx_names then names = def.osx_names + elseif os.is("bsd") and def.bsd_names then + names = def.bsd_names elseif def.unix_names then names = def.unix_names end @@ -188,7 +190,9 @@ end -- * win_names: table of import library / DLL names (no extension) when -- running on Windows. -- * unix_names: as above; shared object names when running on non-Windows. --- * osx_names: as above; for OS X specificall (overrides unix_names if both are +-- * osx_names: as above; for OS X specifically (overrides unix_names if both are +-- specified) +-- * bsd_names: as above; for BSD specifically (overrides unix_names if both are -- specified) -- * linux_names: ditto for Linux (overrides unix_names if both given) -- * dbg_suffix: changes the debug suffix from the above default. @@ -213,6 +217,7 @@ extern_lib_defs = { add_default_links({ unix_names = { "boost_signals-mt", "boost_filesystem-mt", "boost_system-mt" }, osx_names = { "boost_signals-mt", "boost_filesystem-mt", "boost_system-mt" }, + bsd_names = { "boost_signals", "boost_filesystem", "boost_system" }, }) end, }, @@ -524,7 +529,14 @@ extern_lib_defs = { includedirs { libraries_dir.."wxwidgets/include/msvc" } add_default_include_paths("wxwidgets") else - pkgconfig_cflags(nil, "wx-config --unicode=yes --cxxflags") + + -- Support WX_CONFIG for overriding for the default PATH-based wx-config + wx_config_path = os.getenv("WX_CONFIG") + if not wx_config_path then + wx_config_path = "wx-config" + end + + pkgconfig_cflags(nil, wx_config_path.." --unicode=yes --cxxflags") end end, link_settings = function() @@ -536,7 +548,11 @@ extern_lib_defs = { links { "wxmsw28u_gl" } configuration { } else - pkgconfig_libs(nil, "wx-config --unicode=yes --libs std,gl") + wx_config_path = os.getenv("WX_CONFIG") + if not wx_config_path then + wx_config_path = "wx-config" + end + pkgconfig_libs(nil, wx_config_path.." --unicode=yes --libs std,gl") end end, }, diff --git a/build/premake/premake4.lua b/build/premake/premake4.lua index 724f59742c..4727bfa09c 100644 --- a/build/premake/premake4.lua +++ b/build/premake/premake4.lua @@ -32,14 +32,14 @@ elseif os.is("windows") then end else arch = os.getenv("HOSTTYPE") - if arch == "x86_64" then + if arch == "x86_64" or arch == "amd64" then arch = "amd64" else os.execute("gcc -dumpmachine > .gccmachine.tmp") local f = io.open(".gccmachine.tmp", "r") local machine = f:read("*line") f:close() - if string.find(machine, "x86_64") == 1 then + if string.find(machine, "x86_64") == 1 or string.find(machine, "amd64") == 1 then arch = "amd64" elseif string.find(machine, "i.86") == 1 then arch = "x86" @@ -237,7 +237,7 @@ function project_set_build_flags() buildoptions { "-Wno-psabi" } end - if os.is("linux") then + if os.is("linux") or os.is("bsd") then linkoptions { "-Wl,--no-undefined", "-Wl,--as-needed" } end @@ -284,15 +284,20 @@ function project_set_build_flags() defines { "INSTALLED_LIBDIR=" .. _OPTIONS["libdir"] } end - if os.is("linux") then + if os.is("linux") or os.is("bsd") then -- To use our local SpiderMonkey library, it needs to be part of the -- runtime dynamic linker path. Add it with -rpath to make sure it gets found. if _OPTIONS["libdir"] then - linkoptions {"-Wl,-rpath=" .. _OPTIONS["libdir"] } + linkoptions {"-Wl,-rpath," .. _OPTIONS["libdir"] } else + -- On FreeBSD we need to allow use of $ORIGIN + if os.is("bsd") then + linkoptions { "-Wl,-z,origin" } + end + -- Adding the executable path and taking care of correct escaping if _ACTION == "gmake" then - linkoptions { "-Wl,-rpath='$$ORIGIN'" } + linkoptions { "-Wl,-rpath,'$$ORIGIN'" } elseif _ACTION == "codeblocks" then linkoptions { "-Wl,-R\\\\$$ORIGIN" } end @@ -747,6 +752,25 @@ function setup_main_exe () linkoptions { "-rdynamic" } configuration { } + elseif os.is("bsd") then + + -- Libraries + links { + "fam", + "execinfo", + -- Utilities + "rt", + } + + -- Threading support + buildoptions { "-pthread" } + linkoptions { "-pthread" } + + -- For debug_resolve_symbol + configuration "Debug" + linkoptions { "-rdynamic" } + configuration { } + elseif os.is("macosx") then links { "pthread" } end @@ -786,7 +810,7 @@ function setup_atlas_project(project_name, target_type, rel_source_dirs, rel_inc -- required to use WinMain() on Windows, otherwise will default to main() flags { "WinMain" } - elseif os.is("linux") then + elseif os.is("linux") or os.is("bsd") then buildoptions { "-rdynamic", "-fPIC" } linkoptions { "-fPIC", "-rdynamic" } end @@ -958,6 +982,14 @@ function setup_collada_project(project_name, target_type, rel_source_dirs, rel_i buildoptions { "-rdynamic" } linkoptions { "-rdynamic" } + elseif os.is("bsd") then + -- define BSD-something? + + buildoptions { "-fno-strict-aliasing" } + + buildoptions { "-rdynamic" } + linkoptions { "-rdynamic" } + elseif os.is("macosx") then -- define MACOS-something? @@ -1102,16 +1134,21 @@ function setup_tests() project_add_manifest() - elseif os.is("linux") then + elseif os.is("linux") or os.is ("bsd") then links { "fam", -- Utilities "rt", - -- Dynamic libraries (needed for linking for gold) - "dl", } + if os.is("linux") then + links { + -- Dynamic libraries (needed for linking for gold) + "dl", + } + end + -- Threading support buildoptions { "-pthread" } linkoptions { "-pthread" }