Skip to content

Commit 826d8ae

Browse files
committed
Cleanup and allow running tests on windows.
1 parent bb8932f commit 826d8ae

File tree

2 files changed

+61
-135
lines changed

2 files changed

+61
-135
lines changed

dev/test/premake5.lua

Lines changed: 60 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,68 @@ newaction {
1313
end
1414
}
1515

16+
WINDOWS_CLANG_CL_SUPPRESSED_WARNINGS = {
17+
"-Wno-c++98-compat",
18+
"-Wno-c++98-compat-pedantic",
19+
"-Wno-reserved-macro-identifier",
20+
"-Wno-newline-eof",
21+
"-Wno-old-style-cast",
22+
"-Wno-unused-parameter",
23+
"-Wno-float-equal",
24+
"-Wno-implicit-float-conversion",
25+
"-Wno-shadow",
26+
"-Wno-sign-conversion",
27+
"-Wno-inconsistent-missing-destructor-override",
28+
"-Wno-nested-anon-types",
29+
"-Wno-suggest-destructor-override",
30+
"-Wno-non-virtual-dtor",
31+
"-Wno-unknown-argument",
32+
"-Wno-gnu-anonymous-struct",
33+
"-Wno-extra-semi",
34+
"-Wno-cast-qual",
35+
"-Wno-ignored-qualifiers",
36+
"-Wno-double-promotion",
37+
"-Wno-tautological-unsigned-zero-compare",
38+
"-Wno-unreachable-code-break",
39+
"-Wno-global-constructors",
40+
"-Wno-switch-enum",
41+
"-Wno-shorten-64-to-32",
42+
"-Wno-missing-prototypes",
43+
"-Wno-implicit-int-conversion",
44+
"-Wno-unused-macros",
45+
"-Wno-deprecated-copy-with-user-provided-dtor",
46+
"-Wno-missing-variable-declarations",
47+
"-Wno-ctad-maybe-unsupported",
48+
"-Wno-vla-extension",
49+
"-Wno-float-conversion",
50+
"-Wno-gnu-zero-variadic-macro-arguments",
51+
"-Wno-undef",
52+
"-Wno-documentation",
53+
"-Wno-documentation-pedantic",
54+
"-Wno-documentation-unknown-command",
55+
"-Wno-suggest-override",
56+
"-Wno-unused-exception-parameter",
57+
"-Wno-cast-align",
58+
"-Wno-deprecated-declarations",
59+
"-Wno-shadow-field",
60+
"-Wno-nonportable-system-include-path",
61+
"-Wno-reserved-identifier",
62+
"-Wno-thread-safety-negative",
63+
"-Wno-exit-time-destructors",
64+
"-Wno-unreachable-code",
65+
"-Wno-zero-as-null-pointer-constant",
66+
"-Wno-pedantic",
67+
"-Wno-sign-compare",
68+
}
69+
1670
workspace "rive_tests"
1771
configurations {"debug"}
1872

1973
project("tests")
2074
kind "ConsoleApp"
2175
language "C++"
2276
cppdialect "C++17"
77+
toolset "clang"
2378
targetdir "build/bin/%{cfg.buildcfg}"
2479
objdir "build/obj/%{cfg.buildcfg}"
2580

@@ -37,137 +92,8 @@ filter "configurations:debug"
3792
defines {"DEBUG"}
3893
symbols "On"
3994

40-
--[[
41-
42-
-- Recursively iterate through all files in a dir
43-
function dirtree(dir)
44-
45-
assert(dir and dir ~= "", "Provide a directory")
46-
if string.sub(dir, -1) == "/" then
47-
dir = string.sub(dir, 1, -2)
48-
end
49-
50-
local function yieldtree(dir)
51-
for entry in lfs.dir(dir) do
52-
if entry ~= "." and entry ~= ".." then
53-
entry = dir .. "/" .. entry
54-
local attr = lfs.attributes(entry)
55-
coroutine.yield(entry, attr)
56-
if attr.mode == "directory" then
57-
yieldtree(entry)
58-
end
59-
end
60-
end
61-
end
62-
return coroutine.wrap(function()
63-
yieldtree(dir)
64-
end)
65-
end
66-
67-
-- Get the file extension from a string
68-
function getFileExtension(path)
69-
return path:match("^.+(%..+)$")
70-
end
71-
72-
-- Get file paths to all files ending in the given file extension in a given dir
73-
-- This will recurse through subdirs
74-
function getFilesByExtension(extension, dir)
75-
local function yieldfile(dir)
76-
for filename, attr in dirtree(dir) do
77-
if attr.mode == "file" and getFileExtension(filename) == extension then
78-
coroutine.yield(filename)
79-
end
80-
end
81-
end
82-
return coroutine.wrap(function()
83-
yieldfile(dir)
84-
end)
85-
end
86-
87-
-- Build test executable for a cpp file
88-
local function test(filepath)
89-
90-
local filename = filepath:match("([^/]+)$")
91-
local projectname = filename:match("^[^%.]+")
92-
-- print("Filepath: " .. filepath)
93-
-- print("Filename: " .. filename)
94-
-- print("Projectname: " .. projectname)
95-
96-
project(projectname)
97-
kind "ConsoleApp"
98-
language "C++"
99-
cppdialect "C++17"
100-
targetdir "build/bin/%{cfg.buildcfg}"
101-
objdir "build/obj/%{cfg.buildcfg}"
102-
103-
buildoptions {
104-
"-Wall",
105-
"-fno-exceptions",
106-
"-fno-rtti"
107-
}
108-
109-
includedirs {
110-
"./include",
111-
"../../rive/include"
112-
}
113-
114-
files {
115-
"../../rive/src/**.cpp",
116-
filepath
117-
}
118-
119-
filter "configurations:debug"
120-
defines { "DEBUG" }
121-
symbols "On"
122-
end
123-
124-
-- Build all cpp test files in Rive's test directory
125-
for cppFile in getFilesByExtension(".cpp", "../../rive/test/") do
126-
test(cppFile)
127-
end
128-
129-
-- Build test executable for a cpp file and link to the precompiled rive lib
130-
local function test_precompiled(filepath)
131-
132-
local filename = filepath:match("([^/]+)$") .. "_linked"
133-
local projectname = filename:match("^[^%.]+") .. "_linked"
134-
-- print("Filepath: " .. filepath)
135-
-- print("Filename: " .. filename)
136-
-- print("Projectname: " .. projectname)
137-
138-
project(projectname)
139-
kind "ConsoleApp"
140-
language "C++"
141-
cppdialect "C++17"
142-
targetdir "build/bin/%{cfg.buildcfg}"
143-
objdir "build/obj/%{cfg.buildcfg}"
144-
145-
buildoptions {
146-
"-Wall",
147-
"-fno-exceptions",
148-
"-fno-rtti"
149-
}
150-
151-
includedirs {
152-
"./include",
153-
"../../rive/include"
154-
}
155-
156-
files { filepath }
157-
158-
links
159-
{
160-
"../../rive/build/bin/debug/librive.a"
161-
}
162-
163-
filter "configurations:debug"
164-
defines { "DEBUG" }
165-
symbols "On"
166-
end
167-
168-
-- Build all cpp test files in Rive's test directory
169-
for cppFile in getFilesByExtension(".cpp", "../../rive/test/") do
170-
test_precompiled(cppFile)
171-
end
172-
173-
--]]
95+
filter "system:windows"
96+
defines {"_USE_MATH_DEFINES"}
97+
buildoptions {WINDOWS_CLANG_CL_SUPPRESSED_WARNINGS}
98+
staticruntime "on" -- Match Skia's /MT flag for link compatibility
99+
runtime "Release" -- Use /MT even in debug (/MTd is incompatible with Skia)

skia/viewer/build/windows/dependencies/make_glfw.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pushd .\glfw
1111
git checkout master
1212
popd
1313

14-
mkdir -p glfw_build
14+
mkdir glfw_build
1515
cd glfw_build
1616
cmake ../glfw -DBUILD_SHARED_LIBS=OFF
1717
rem Force compile with /MT, GLFW defaults to /MDd but the rest of our libs expect /MT

0 commit comments

Comments
 (0)