5 description = "clean the build",
7 print("clean the build...")
10 -- no wildcards in os.remove, so use shell
11 os.execute("rm *.make")
12 print("build cleaned")
16 workspace "rive_tests"
17 configurations {"debug"}
23 targetdir "build/bin/%{cfg.buildcfg}"
24 objdir "build/obj/%{cfg.buildcfg}"
26 buildoptions {"-Wall", "-fno-rtti"}
32 "../../renderer/include",
33 "../../dependencies/glfw/include",
34 "../../dependencies/skia",
35 "../../dependencies/skia/include/core",
36 "../../dependencies/skia/include/effects",
37 "../../dependencies/skia/include/gpu",
38 "../../dependencies/skia/include/config",
39 "../../dependencies/FFmpeg",
40 "../../dependencies/x264/include",
46 "AudioToolbox.framework",
47 "AudioUnit.framework",
53 "CoreFoundation.framework",
54 "CoreMedia.framework",
55 "CoreServices.framework",
56 "CoreVideo.framework",
68 "VideoToolbox.framework",
74 "../../../build/bin/%{cfg.buildcfg}",
75 "../../dependencies/FFmpeg/libavcodec",
76 "../../dependencies/FFmpeg/libavformat",
77 "../../dependencies/FFmpeg/libavutil",
78 "../../dependencies/FFmpeg/libswscale",
79 "../../dependencies/FFmpeg/libswresample",
80 "../../dependencies/x264/lib",
81 "../../dependencies/glfw_build/src",
82 "../../dependencies/skia/out/Static",
83 "../../renderer/build/bin/%{cfg.buildcfg}",
89 "../src/**.cpp", -- the Rive runtime source
90 "./src/**.cpp" -- the tests
95 filter "configurations:debug"
101 -- Recursively iterate through all files in a dir
102 function dirtree(dir)
104 assert(dir and dir ~= "", "Provide a directory")
105 if string.sub(dir, -1) == "/" then
106 dir = string.sub(dir, 1, -2)
109 local function yieldtree(dir)
110 for entry in lfs.dir(dir) do
111 if entry ~= "." and entry ~= ".." then
112 entry = dir .. "/" .. entry
113 local attr = lfs.attributes(entry)
114 coroutine.yield(entry, attr)
115 if attr.mode == "directory" then
121 return coroutine.wrap(function()
126 -- Get the file extension from a string
127 function getFileExtension(path)
128 return path:match("^.+(%..+)$")
131 -- Get file paths to all files ending in the given file extension in a given dir
132 -- This will recurse through subdirs
133 function getFilesByExtension(extension, dir)
134 local function yieldfile(dir)
135 for filename, attr in dirtree(dir) do
136 if attr.mode == "file" and getFileExtension(filename) == extension then
137 coroutine.yield(filename)
141 return coroutine.wrap(function()
146 -- Build test executable for a cpp file
147 local function test(filepath)
149 local filename = filepath:match("([^/]+)$")
150 local projectname = filename:match("^[^%.]+")
151 -- print("Filepath: " .. filepath)
152 -- print("Filename: " .. filename)
153 -- print("Projectname: " .. projectname)
159 targetdir "build/bin/%{cfg.buildcfg}"
160 objdir "build/obj/%{cfg.buildcfg}"
174 "../../rive/src/**.cpp",
178 filter "configurations:debug"
183 -- Build all cpp test files in Rive's test directory
184 for cppFile in getFilesByExtension(".cpp", "../../rive/test/") do
188 -- Build test executable for a cpp file and link to the precompiled rive lib
189 local function test_precompiled(filepath)
191 local filename = filepath:match("([^/]+)$") .. "_linked"
192 local projectname = filename:match("^[^%.]+") .. "_linked"
193 -- print("Filepath: " .. filepath)
194 -- print("Filename: " .. filename)
195 -- print("Projectname: " .. projectname)
201 targetdir "build/bin/%{cfg.buildcfg}"
202 objdir "build/obj/%{cfg.buildcfg}"
219 "../../rive/build/bin/debug/librive.a"
222 filter "configurations:debug"
227 -- Build all cpp test files in Rive's test directory
228 for cppFile in getFilesByExtension(".cpp", "../../rive/test/") do
229 test_precompiled(cppFile)