-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathpremake5.lua
125 lines (102 loc) · 2.94 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
require("vstudio")
require('remake')
if HORUS_NO_WORKSPACE then
project "horus"
else
workspace "horus"
end
configurations { "Debug", "Development", "Release" }
-- global options
cppdialect "gnu++17"
architecture "x64" -- We only support 64bit architectures
characterset "Unicode" -- We support Unicode
flags { "NoMinimalRebuild", "MultiProcessorCompile", "NoPCH" }
-- build config
if _ACTION == "vs2019" then
system "windows"
isWindows = true
elseif _ACTION == "gmake" then
if _ARGS[1] == "macos" then
system "macosx"
else
system "linux"
end
isLinux = true
elseif _ACTION == "xcode" then
system "macosx"
isLinux = true
else
premake.error("Unknown/Unsupported build action: " .. _ACTION)
end
paths = Config('src', 'libs', ('build_' .. _ACTION), 'bin')
--- prepare naming convention for library files
filter "kind:SharedLib or StaticLib"
pic "on"
filter { "kind:SharedLib or *App", "configurations:Debug or Development" }
targetsuffix '_d'
filter { "kind:StaticLib", "configurations:Debug or Development" }
targetsuffix '_sd'
--- prepare the configurations
filter "configurations:Debug"
symbols "On"
optimize "Debug"
defines "_DEBUG"
warnings "Off"
filter "configurations:Development"
symbols "On"
optimize "Speed"
defines { "_DEVELOPMENT", "NDEBUG" }
warnings "Off"
filter "configurations:Release"
symbols "Off"
optimize "Full"
flags "LinkTimeOptimization"
defines { "_SHIPPING", "_RELEASE", "NDEBUG" }
warnings "Off"
filter { "system:windows", "action:vs*" }
if isWindows then systemversion(os.winSdkVersion() .. ".0") end
filter { "system:linux or macosx or ios" }
buildoptions { "-pthread", "-fpermissive" }
filter "system:windows"
-- disable some warnings
disablewarnings { 4251, 4006, 4221, 4204 }
defines "_WINDOWS"
filter "system:macosx or ios"
defines "_APPLE"
filter "system:linux"
defines "_LINUX"
filter{}
library("os", function()
if os.target() == "windows" then
public.links {
"shlwapi", "Ws2_32", "Wininet", "dbghelp",
"user32", "gdi32", "ole32", "oleaut32", "uuid"
}
elseif os.target() == "linux" then
public.links {
"X11 `pkg-config --libs gtk+-3.0`",
"Xi", "dl", "pthread", "Xext"
}
elseif os.target() == "macosx" then
public.links {
"dl", "ForceFeedback.framework", "CoreVideo.framework", "Cocoa.framework",
"IOKit.framework", "Carbon.framework", "CoreAudio.framework", "AudioToolbox.framework",
}
end
end)
library("opengl", function()
public.defines "USE_OPENGL"
if os.target() == "windows" then
public.links "opengl32"
elseif os.target() == "linux" then
public.links { "GL", "GLU", "X11" }
elseif os.target() == "macosx" then
public.links "OpenGL.framework"
end
end)
group "libs"
include "libs"
group "horus"
include "src"
group "examples"
includeall "examples"