-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake5.lua
145 lines (100 loc) · 3.05 KB
/
premake5.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
-- On Linux We have to query the dependencies of gtk+3 for sr_gui, we do this on the host for now.
if os.ishost("linux") then
listing, code = os.outputof("pkg-config --libs libnotify gtk+-3.0")
liballLibs = string.explode(string.gsub(listing, "-l", ""), " ")
end
workspace("Quanto")
-- Configuration.
configurations({ "Release", "Dev"})
location("build")
targetdir ("build/%{prj.name}/%{cfg.longname}")
debugdir ("build/%{prj.name}/%{cfg.longname}")
architecture("x64")
systemversion("latest")
filter("system:macosx")
systemversion("10.12:latest")
filter({})
-- Configuration specific settings.
filter("configurations:Release")
defines({ "NDEBUG" })
optimize("On")
filter("configurations:Dev")
defines({ "DEBUG" })
symbols("On")
filter({})
startproject("Quanto")
-- Projects
function CLibrarySetup(path)
kind("StaticLib")
language("C")
files({ path })
filter("action:vs*")
defines({ "_CRT_SECURE_NO_WARNINGS" })
filter({})
end
function CommonFlags()
language("C++")
cppdialect("C++17")
-- Compiler flags
filter("toolset:not msc*")
buildoptions({ "-Wall", "-Wextra" })
filter("toolset:msc*")
buildoptions({ "-W3"})
filter({})
-- visual studio filters
filter("action:vs*")
defines({ "_CRT_SECURE_NO_WARNINGS" })
filter({})
end
group("Libs")
project("imagequant")
CLibrarySetup("libs/imagequant/*.*")
project("posterizer")
CLibrarySetup("libs/posterizer/*.*")
project("pngnq")
CLibrarySetup("libs/pngnq/*.*")
-- Include sr_gui and GLFW premake files.
include("libs/sr_gui/premake5.lua")
include("libs/glfw/premake5.lua")
group("Quanto")
project("QuantoTool")
kind("ConsoleApp")
CommonFlags()
includedirs({"src/"})
externalincludedirs({ "libs/" })
-- common files
files({"src/core/**", "src/libs/stb_image/**", "src/libs/lodepng/**", "src/tool/**", "premake5.lua"})
removefiles({"**.DS_STORE", "**.thumbs"})
links({"imagequant", "posterizer", "pngnq"})
project("Quanto")
kind("WindowedApp")
CommonFlags()
includedirs({"src/"})
externalincludedirs({ "libs/", "libs/glfw/include/" })
-- common files
files({"src/core/**", "src/libs/**", "src/app/**", "premake5.lua"})
removefiles({"**.DS_STORE", "**.thumbs"})
-- per platform files
filter("action:vs*")
files({"resources/windows/*"})
filter("action:xcode*")
files({"resources/macos/*"})
filter({})
links({"imagequant", "posterizer", "pngnq", "sr_gui", "glfw3"})
-- Libraries for each platform.
filter("system:macosx")
links({"OpenGL.framework", "Cocoa.framework", "IOKit.framework", "CoreVideo.framework", "AppKit.framework"})
filter("system:windows")
links({"opengl32", "User32", "Comdlg32", "Comctl32", "Shell32", "runtimeobject"})
filter("system:linux")
links({"GL", "X11", "Xi", "Xrandr", "Xxf86vm", "Xinerama", "Xcursor", "Xext", "Xrender", "Xfixes", "xcb", "Xau", "Xdmcp", "rt", "m", "pthread", "dl", liballLibs})
filter({})
newaction {
trigger = "clean",
description = "Clean the build directory",
execute = function ()
print("Cleaning...")
os.rmdir("./build")
print("Done.")
end
}