forked from edo9300/edopro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
premake5.lua
143 lines (123 loc) · 3.7 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
newoption {
trigger = "no-direct3d",
description = "Disable DirectX options in irrlicht if the DirectX SDK isn't installed"
}
newoption {
trigger = "sound",
value = "backend",
description = "Choose sound backend",
allowed = {
{ "irrklang", "irrklang" },
{ "sdl-mixer", "SDL2-mixer" }
}
}
newoption {
trigger = "pics",
value = "url_template",
description = "Default URL for card images"
}
newoption {
trigger = "fields",
value = "url_template",
description = "Default URL for Field Spell backgrounds"
}
newoption {
trigger = "covers",
value = "url_template",
description = "Default URL for cover images"
}
newoption {
trigger = "prebuilt-core",
value = "path",
description = "Path to library folder containing libocgcore"
}
newoption {
trigger = "vcpkg-root",
value = "path",
description = "Path to vcpkg installation"
}
newoption {
trigger = "discord",
value = "app_id_token",
description = "Discord App ID for rich presence"
}
newoption {
trigger = "update-url",
value = "url",
description = "API endpoint to check for updates from"
}
workspace "ygo"
location "build"
language "C++"
objdir "obj"
startproject "ygopro"
staticruntime "on"
configurations { "Debug", "Release" }
filter "system:windows"
systemversion "latest"
defines { "WIN32", "_WIN32", "NOMINMAX" }
if _OPTIONS["vcpkg-root"] then
filter "system:linux"
includedirs { _OPTIONS["vcpkg-root"] .. "/installed/x64-linux/include" }
filter { "system:linux", "configurations:Debug" }
libdirs { _OPTIONS["vcpkg-root"] .. "/installed/x64-linux/debug/lib" }
filter { "system:linux", "configurations:Release" }
libdirs { _OPTIONS["vcpkg-root"] .. "/installed/x64-linux/lib" }
filter "system:macosx"
includedirs { _OPTIONS["vcpkg-root"] .. "/installed/x64-osx/include" }
filter { "system:macosx", "configurations:Debug" }
libdirs { _OPTIONS["vcpkg-root"] .. "/installed/x64-osx/debug/lib" }
filter { "system:macosx", "configurations:Release" }
libdirs { _OPTIONS["vcpkg-root"] .. "/installed/x64-osx/lib" }
end
filter "system:macosx"
defines { "GL_SILENCE_DEPRECATION" }
includedirs { "/usr/local/include" }
libdirs { "/usr/local/lib" }
filter "action:vs*"
vectorextensions "SSE2"
buildoptions "-wd4996"
defines "_CRT_SECURE_NO_WARNINGS"
filter "action:not vs*"
buildoptions { "-fno-strict-aliasing", "-Wno-multichar" }
filter { "action:not vs*", "system:windows" }
buildoptions { "-static-libgcc" }
filter "configurations:Debug"
symbols "On"
defines "_DEBUG"
targetdir "bin/debug"
runtime "Debug"
filter { "configurations:Release*" , "action:not vs*" }
symbols "On"
defines "NDEBUG"
filter "configurations:Release"
optimize "Size"
targetdir "bin/release"
subproject = true
if not _OPTIONS["prebuilt-core"] then
include "ocgcore"
end
include "gframe"
if os.istarget("windows") then
include "freetype"
include "irrlicht"
end
if os.istarget("macosx") and _OPTIONS["discord"] then
include "discord-launcher"
end
local function vcpkgStaticTriplet(prj)
premake.w('<VcpkgTriplet Condition="\'$(Platform)\'==\'Win32\'">x86-windows-static</VcpkgTriplet>')
premake.w('<VcpkgTriplet Condition="\'$(Platform)\'==\'x64\'">x64-windows-static</VcpkgTriplet>')
end
local function vcpkgStaticTriplet202006(prj)
premake.w('<VcpkgEnabled>true</VcpkgEnabled>')
premake.w('<VcpkgUseStatic>true</VcpkgUseStatic>')
premake.w('<VcpkgAutoLink>true</VcpkgAutoLink>')
end
require('vstudio')
premake.override(premake.vstudio.vc2010.elements, "globals", function(base, prj)
local calls = base(prj)
table.insertafter(calls, premake.vstudio.vc2010.targetPlatformVersionGlobal, vcpkgStaticTriplet)
table.insertafter(calls, premake.vstudio.vc2010.globals, vcpkgStaticTriplet202006)
return calls
end)