[Adaptation Layer] Added rive-tizen adaptation layer class.
[platform/core/uifw/rive-tizen.git] / submodule / skia / recorder / test / premake5.lua
1 -- require "lfs"
2 -- Clean Function --
3 newaction {
4     trigger = "clean",
5     description = "clean the build",
6     execute = function()
7         print("clean the build...")
8         os.rmdir("build")
9         os.remove("Makefile")
10         -- no wildcards in os.remove, so use shell
11         os.execute("rm *.make")
12         print("build cleaned")
13     end
14 }
15
16 workspace "rive_tests"
17 configurations {"debug"}
18
19 project("tests")
20 kind "ConsoleApp"
21 language "C++"
22 cppdialect "C++17"
23 targetdir "build/bin/%{cfg.buildcfg}"
24 objdir "build/obj/%{cfg.buildcfg}"
25
26 buildoptions {"-Wall", "-fno-rtti"}
27
28 includedirs {
29     "./include",
30     "../include",
31     "../../../include",
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",
41     "/usr/local/include"
42 }
43
44 links {
45     'stdc++',
46     "AudioToolbox.framework",
47     "AudioUnit.framework",
48     "avcodec",
49     "avformat",
50     "avutil",
51     "bz2",
52     "Cocoa.framework",
53     "CoreFoundation.framework",
54     "CoreMedia.framework",
55     "CoreServices.framework",
56     "CoreVideo.framework",
57     "glfw3",
58     "iconv",
59     "IOKit.framework",
60     "lzma",
61     "m",
62     "rive_skia_renderer",
63     "rive",
64     "Security.framework",
65     "skia",
66     "swresample",
67     "swscale",
68     "VideoToolbox.framework",
69     "x264", 
70     "z",
71 }
72
73 libdirs {
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}",
84     "/usr/local/lib"
85 }
86
87
88 files {
89     "../src/**.cpp", -- the Rive runtime source
90     "./src/**.cpp" -- the tests
91 }
92
93 defines {"TESTING"}
94
95 filter "configurations:debug"
96 defines {"DEBUG"}
97 symbols "On"
98
99 --[[
100
101 -- Recursively iterate through all files in a dir
102 function dirtree(dir)
103
104     assert(dir and dir ~= "", "Provide a directory")
105     if string.sub(dir, -1) == "/" then
106         dir = string.sub(dir, 1, -2)
107     end
108
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
116                     yieldtree(entry)
117                 end
118             end
119         end
120     end
121     return coroutine.wrap(function()
122         yieldtree(dir)
123     end)
124 end
125
126 -- Get the file extension from a string
127 function getFileExtension(path)
128     return path:match("^.+(%..+)$")
129 end
130
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)
138             end
139         end
140     end
141     return coroutine.wrap(function()
142         yieldfile(dir)
143     end)
144 end
145
146 -- Build test executable for a cpp file
147 local function test(filepath)
148
149     local filename = filepath:match("([^/]+)$")
150     local projectname = filename:match("^[^%.]+")
151     -- print("Filepath: " .. filepath)
152     -- print("Filename: " .. filename)
153     -- print("Projectname: " .. projectname)
154
155     project(projectname)
156     kind "ConsoleApp"
157     language "C++"
158     cppdialect "C++17"
159     targetdir "build/bin/%{cfg.buildcfg}"
160     objdir "build/obj/%{cfg.buildcfg}"
161     
162     buildoptions {
163         "-Wall", 
164         "-fno-exceptions", 
165         "-fno-rtti"
166     }
167
168     includedirs {
169         "./include",
170         "../../rive/include"
171     }
172
173     files {
174         "../../rive/src/**.cpp",
175         filepath
176     }
177
178     filter "configurations:debug"
179         defines { "DEBUG" }
180         symbols "On"
181 end
182
183 -- Build all cpp test files in Rive's test directory
184 for cppFile in getFilesByExtension(".cpp", "../../rive/test/") do
185     test(cppFile)
186 end
187
188 -- Build test executable for a cpp file and link to the precompiled rive lib
189 local function test_precompiled(filepath)
190
191     local filename = filepath:match("([^/]+)$") .. "_linked"
192     local projectname = filename:match("^[^%.]+") .. "_linked"
193     -- print("Filepath: " .. filepath)
194     -- print("Filename: " .. filename)
195     -- print("Projectname: " .. projectname)
196
197     project(projectname)
198     kind "ConsoleApp"
199     language "C++"
200     cppdialect "C++17"
201     targetdir "build/bin/%{cfg.buildcfg}"
202     objdir "build/obj/%{cfg.buildcfg}"
203     
204     buildoptions {
205         "-Wall", 
206         "-fno-exceptions", 
207         "-fno-rtti"
208     }
209
210     includedirs {
211         "./include",
212         "../../rive/include"
213     }
214
215     files { filepath }
216
217     links
218     {
219         "../../rive/build/bin/debug/librive.a"
220     }
221
222     filter "configurations:debug"
223         defines { "DEBUG" }
224         symbols "On"
225 end
226
227 -- Build all cpp test files in Rive's test directory
228 for cppFile in getFilesByExtension(".cpp", "../../rive/test/") do
229     test_precompiled(cppFile)
230 end
231
232 --]]