Skip to content

Commit

Permalink
misc android fixes (premake#15)
Browse files Browse the repository at this point in the history
* fixed exception handling and rtti 'Off' setting
ignored warnings now auto generated additional build params as such
added support for pch (which need to take a relative path from cwd)
instead of a file located via the search path.

* added unit test for android pch
  • Loading branch information
bwhittle authored and TurkeyMan committed Jun 4, 2018
1 parent 12e3b1d commit 6b585d6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
15 changes: 15 additions & 0 deletions modules/android/tests/test_android_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,18 @@
<AdditionalOptions>-std=c++1z %(AdditionalOptions)</AdditionalOptions>
]]
end


function suite.precompiledHeader()
location "build"
pchheader "include/foo.h"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>../include/foo.h</PrecompiledHeaderFile>
<Optimization>Disabled</Optimization>
<ExceptionHandling>Enabled</ExceptionHandling>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
]]
end
17 changes: 15 additions & 2 deletions modules/android/vsandroid_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@
if cfg.system == p.ANDROID then
local opts = cfg.buildoptions

if cfg.disablewarnings and #cfg.disablewarnings > 0 then
for _, warning in ipairs(cfg.disablewarnings) do
table.insert(opts, '-Wno-'..warning)
end
end

local cpp_langmap = {
["C++17"] = "-std=c++1z",
["gnu++17"] = "-std=gnu++1z",
Expand Down Expand Up @@ -315,7 +321,7 @@
premake.override(vc2010, "exceptionHandling", function(oldfn, cfg, condition)
if cfg.system == p.ANDROID then
-- Note: Android defaults to 'off'
if cfg.exceptionhandling then
if cfg.exceptionhandling and cfg.exceptionhandling ~= premake.OFF then
if _ACTION >= "vs2015" then
vc2010.element("ExceptionHandling", condition, "Enabled")
else
Expand All @@ -330,14 +336,21 @@
premake.override(vc2010, "runtimeTypeInfo", function(oldfn, cfg, condition)
if cfg.system == premake.ANDROID then
-- Note: Android defaults to 'off'
if cfg.rtti then
if cfg.rtti and cfg.rtti ~= premake.OFF then
vc2010.element("RuntimeTypeInfo", condition, "true")
end
else
oldfn(cfg, condition)
end
end)

premake.override(vc2010, "precompiledHeaderFile", function(oldfn, fileName, cfg)
if cfg.system == premake.ANDROID then
vc2010.element("PrecompiledHeaderFile", nil, "%s", path.rebase(fileName, cfg.basedir, cfg.location))
else
oldfn(fileName, cfg)
end
end)

--
-- Extend Link.
Expand Down

0 comments on commit 6b585d6

Please sign in to comment.