Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/build/premake/premake5.lua
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | if cc == nil or cc == "" then | ||||
else | else | ||||
cc = "gcc" | cc = "gcc" | ||||
end | end | ||||
end | end | ||||
end | end | ||||
-- detect CPU architecture (simplistic, currently only supports x86, amd64 and ARM) | -- detect CPU architecture (simplistic, currently only supports x86, amd64 and ARM) | ||||
arch = "x86" | arch = "x86" | ||||
macos_arch = "x86_64" | |||||
if _OPTIONS["android"] then | if _OPTIONS["android"] then | ||||
arch = "arm" | arch = "arm" | ||||
elseif os.istarget("windows") then | elseif os.istarget("windows") then | ||||
if os.getenv("PROCESSOR_ARCHITECTURE") == "amd64" or os.getenv("PROCESSOR_ARCHITEW6432") == "amd64" then | if os.getenv("PROCESSOR_ARCHITECTURE") == "amd64" or os.getenv("PROCESSOR_ARCHITEW6432") == "amd64" then | ||||
arch = "amd64" | arch = "amd64" | ||||
end | end | ||||
else | else | ||||
arch = os.getenv("HOSTTYPE") | arch = os.getenv("HOSTTYPE") | ||||
if arch == "x86_64" or arch == "amd64" then | -- Force x86_64 on Mac OS for now, as Spidermonkey 78 isn't Apple Silicon compatible. | ||||
if os.istarget("macosx") then | |||||
arch = "amd64" | |||||
macos_arch = "x86_64" | |||||
elseif arch == "x86_64" or arch == "amd64" then | |||||
arch = "amd64" | arch = "amd64" | ||||
else | else | ||||
os.execute(cc .. " -dumpmachine > .gccmachine.tmp") | os.execute(cc .. " -dumpmachine > .gccmachine.tmp") | ||||
local f = io.open(".gccmachine.tmp", "r") | local f = io.open(".gccmachine.tmp", "r") | ||||
local machine = f:read("*line") | local machine = f:read("*line") | ||||
f:close() | f:close() | ||||
if string.find(machine, "x86_64") == 1 or string.find(machine, "amd64") == 1 then | if string.find(machine, "x86_64") == 1 or string.find(machine, "amd64") == 1 then | ||||
arch = "amd64" | arch = "amd64" | ||||
▲ Show 20 Lines • Show All 461 Lines • ▼ Show 20 Lines | function setup_static_lib_project (project_name, rel_source_dirs, extern_libs, extra_params) | ||||
if not extra_params["no_default_link"] then | if not extra_params["no_default_link"] then | ||||
table.insert(static_lib_names, project_name) | table.insert(static_lib_names, project_name) | ||||
end | end | ||||
-- Deactivate Run Time Type Information. Performance of dynamic_cast is very poor. | -- Deactivate Run Time Type Information. Performance of dynamic_cast is very poor. | ||||
-- The exception to this principle is Atlas UI, which is not a static library. | -- The exception to this principle is Atlas UI, which is not a static library. | ||||
rtti "off" | rtti "off" | ||||
if os.istarget("macosx") and _OPTIONS["macosx-version-min"] then | if os.istarget("macosx") then | ||||
architecture(macos_arch) | |||||
buildoptions { "-arch " .. macos_arch } | |||||
linkoptions { "-arch " .. macos_arch } | |||||
xcodebuildsettings { ARCHS = macos_arch } | |||||
if _OPTIONS["macosx-version-min"] then | |||||
xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | ||||
end | end | ||||
end | end | ||||
end | |||||
function setup_third_party_static_lib_project (project_name, rel_source_dirs, extern_libs, extra_params) | function setup_third_party_static_lib_project (project_name, rel_source_dirs, extern_libs, extra_params) | ||||
setup_static_lib_project(project_name, rel_source_dirs, extern_libs, extra_params) | setup_static_lib_project(project_name, rel_source_dirs, extern_libs, extra_params) | ||||
includedirs { source_root .. "third_party/" .. project_name .. "/include/" } | includedirs { source_root .. "third_party/" .. project_name .. "/include/" } | ||||
end | end | ||||
function setup_shared_lib_project (project_name, rel_source_dirs, extern_libs, extra_params) | function setup_shared_lib_project (project_name, rel_source_dirs, extern_libs, extra_params) | ||||
local target_type = "SharedLib" | local target_type = "SharedLib" | ||||
project_create(project_name, target_type) | project_create(project_name, target_type) | ||||
project_add_contents(source_root, rel_source_dirs, {}, extra_params) | project_add_contents(source_root, rel_source_dirs, {}, extra_params) | ||||
project_add_extern_libs(extern_libs, target_type) | project_add_extern_libs(extern_libs, target_type) | ||||
if not extra_params["no_default_link"] then | if not extra_params["no_default_link"] then | ||||
table.insert(static_lib_names, project_name) | table.insert(static_lib_names, project_name) | ||||
end | end | ||||
if os.istarget("windows") then | if os.istarget("windows") then | ||||
links { "delayimp" } | links { "delayimp" } | ||||
elseif os.istarget("macosx") and _OPTIONS["macosx-version-min"] then | elseif os.istarget("macosx") then | ||||
architecture(macos_arch) | |||||
buildoptions { "-arch " .. macos_arch } | |||||
linkoptions { "-arch " .. macos_arch } | |||||
xcodebuildsettings { ARCHS = macos_arch } | |||||
if _OPTIONS["macosx-version-min"] then | |||||
xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | ||||
end | end | ||||
end | end | ||||
end | |||||
-- this is where the source tree is chopped up into static libs. | -- this is where the source tree is chopped up into static libs. | ||||
-- can be changed very easily; just copy+paste a new setup_static_lib_project, | -- can be changed very easily; just copy+paste a new setup_static_lib_project, | ||||
-- or remove existing ones. static libs are automagically added to | -- or remove existing ones. static libs are automagically added to | ||||
-- main_exe link step. | -- main_exe link step. | ||||
function setup_all_libs () | function setup_all_libs () | ||||
▲ Show 20 Lines • Show All 501 Lines • ▼ Show 20 Lines | elseif os.istarget("linux") or os.istarget("bsd") then | ||||
filter "Debug" | filter "Debug" | ||||
linkoptions { "-rdynamic" } | linkoptions { "-rdynamic" } | ||||
filter { } | filter { } | ||||
elseif os.istarget("macosx") then | elseif os.istarget("macosx") then | ||||
links { "pthread" } | links { "pthread" } | ||||
links { "ApplicationServices.framework", "Cocoa.framework", "CoreFoundation.framework" } | links { "ApplicationServices.framework", "Cocoa.framework", "CoreFoundation.framework" } | ||||
architecture(macos_arch) | |||||
buildoptions { "-arch " .. macos_arch } | |||||
linkoptions { "-arch " .. macos_arch } | |||||
xcodebuildsettings { ARCHS = macos_arch } | |||||
if _OPTIONS["macosx-version-min"] then | if _OPTIONS["macosx-version-min"] then | ||||
xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | ||||
end | end | ||||
end | end | ||||
end | end | ||||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||||
Show All 15 Lines | function setup_atlas_project(project_name, target_type, rel_source_dirs, rel_include_dirs, extern_libs, extra_params) | ||||
project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params) | project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params) | ||||
project_add_extern_libs(extern_libs, target_type) | project_add_extern_libs(extern_libs, target_type) | ||||
-- Platform Specifics | -- Platform Specifics | ||||
if os.istarget("windows") then | if os.istarget("windows") then | ||||
-- Link to required libraries | -- Link to required libraries | ||||
links { "winmm", "delayimp" } | links { "winmm", "delayimp" } | ||||
elseif os.istarget("macosx") then | |||||
architecture(macos_arch) | |||||
buildoptions { "-arch " .. macos_arch } | |||||
linkoptions { "-arch " .. macos_arch } | |||||
xcodebuildsettings { ARCHS = macos_arch } | |||||
if _OPTIONS["macosx-version-min"] then | |||||
xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | |||||
end | |||||
elseif os.istarget("linux") or os.istarget("bsd") then | elseif os.istarget("linux") or os.istarget("bsd") then | ||||
if os.getversion().description == "FreeBSD" then | if os.getversion().description == "FreeBSD" then | ||||
buildoptions { "-fPIC" } | buildoptions { "-fPIC" } | ||||
linkoptions { "-fPIC" } | linkoptions { "-fPIC" } | ||||
else | else | ||||
buildoptions { "-rdynamic", "-fPIC" } | buildoptions { "-rdynamic", "-fPIC" } | ||||
linkoptions { "-fPIC", "-rdynamic" } | linkoptions { "-fPIC", "-rdynamic" } | ||||
end | end | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | function setup_atlas_frontend_project (project_name) | ||||
-- Platform Specifics | -- Platform Specifics | ||||
if os.istarget("windows") then | if os.istarget("windows") then | ||||
-- see manifest.cpp | -- see manifest.cpp | ||||
project_add_manifest() | project_add_manifest() | ||||
else -- Non-Windows, = Unix | else -- Non-Windows, = Unix | ||||
links { "AtlasObject" } | links { "AtlasObject" } | ||||
if os.istarget("macosx") then | |||||
architecture(macos_arch) | |||||
buildoptions { "-arch " .. macos_arch } | |||||
linkoptions { "-arch " .. macos_arch } | |||||
xcodebuildsettings { ARCHS = macos_arch } | |||||
end | |||||
end | end | ||||
links { "AtlasUI" } | links { "AtlasUI" } | ||||
end | end | ||||
function setup_atlas_frontends() | function setup_atlas_frontends() | ||||
setup_atlas_frontend_project("ActorEditor") | setup_atlas_frontend_project("ActorEditor") | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | elseif os.istarget("bsd") then | ||||
linkoptions { "-rdynamic" } | linkoptions { "-rdynamic" } | ||||
elseif os.istarget("macosx") then | elseif os.istarget("macosx") then | ||||
-- define MACOS-something? | -- define MACOS-something? | ||||
buildoptions { "-fno-strict-aliasing" } | buildoptions { "-fno-strict-aliasing" } | ||||
-- On OSX, fcollada uses a few utility functions from coreservices | -- On OSX, fcollada uses a few utility functions from coreservices | ||||
links { "CoreServices.framework" } | links { "CoreServices.framework" } | ||||
architecture(macos_arch) | |||||
buildoptions { "-arch " .. macos_arch } | |||||
linkoptions { "-arch " .. macos_arch } | |||||
xcodebuildsettings { ARCHS = macos_arch } | |||||
end | end | ||||
end | end | ||||
-- build all Collada component projects | -- build all Collada component projects | ||||
function setup_collada_projects() | function setup_collada_projects() | ||||
setup_collada_project("Collada", "SharedLib", | setup_collada_project("Collada", "SharedLib", | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | elseif os.istarget("linux") or os.istarget("bsd") then | ||||
-- For debug_resolve_symbol | -- For debug_resolve_symbol | ||||
filter "Debug" | filter "Debug" | ||||
linkoptions { "-rdynamic" } | linkoptions { "-rdynamic" } | ||||
filter { } | filter { } | ||||
includedirs { source_root .. "pch/test/" } | includedirs { source_root .. "pch/test/" } | ||||
elseif os.istarget("macosx") and _OPTIONS["macosx-version-min"] then | elseif os.istarget("macosx") then | ||||
architecture(macos_arch) | |||||
buildoptions { "-arch " .. macos_arch } | |||||
linkoptions { "-arch " .. macos_arch } | |||||
xcodebuildsettings { ARCHS = macos_arch } | |||||
if _OPTIONS["macosx-version-min"] then | |||||
xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | xcodebuildsettings { MACOSX_DEPLOYMENT_TARGET = _OPTIONS["macosx-version-min"] } | ||||
end | end | ||||
end | end | ||||
end | |||||
-- must come first, so that VC sets it as the default project and therefore | -- must come first, so that VC sets it as the default project and therefore | ||||
-- allows running via F5 without the "where is the EXE" dialog. | -- allows running via F5 without the "where is the EXE" dialog. | ||||
setup_main_exe() | setup_main_exe() | ||||
setup_all_libs() | setup_all_libs() | ||||
-- add the static libs to the main EXE project. only now (after | -- add the static libs to the main EXE project. only now (after | ||||
Show All 22 Lines |
Wildfire Games · Phabricator