forked from Immanuel-C/IWindow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
premake5.lua
151 lines (102 loc) · 3.97 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
146
147
148
149
150
workspace "IWindow"
configurations {"Debug", "Release"}
architecture "x86_64"
configuration {"macosx"}
linkoptions {"-framework Cocoa"}
print ("Make sure to set the vulkan sdk path!")
vulkanSdk = os.getenv("VULKAN_SDK");
function defaultBuildCfg()
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
runtime "Debug"
optimize "Debug"
filter "configurations:Release"
defines { "NDEBUG" }
symbols "Off"
runtime "Release"
optimize "Speed"
end
function defaultBuildLocation()
targetdir ("bin/%{prj.name}/%{cfg.buildcfg}")
objdir ("bin-int/%{prj.name}/%{cfg.buildcfg}")
end
startproject "TestWindow"
project "TestWindow"
location "test/TestWindow"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
platformLinks = nil
platformFiles = nil
if os.istarget("macosx") then
platformFiles = {"src/IWindowCocoa.mm", "src/IWindowCocoaGamepad.cpp"}
platformLinks = {}
else
platformFiles = {"src/IWindowWin32.cpp", "src/IWindowWin32Gamepad.cpp"}
platformLinks = {"User32", "XInput"}
end
files {"%{prj.location}/Window.cpp", "%{prj.location}/stb.cpp", platformFiles}
includedirs { "src" }
links { "User32", "XInput" }
defaultBuildLocation()
defaultBuildCfg()
project "TestWindowGL"
location "test/TestWindowGL"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
files {"%{prj.location}/WindowGL.cpp", "%{prj.location}/glad.cpp"}
includedirs { "src", "%{prj.location}/deps/glad/include" }
links {"IWindowWin32GL", "OpenGL32"}
defaultBuildLocation()
defaultBuildCfg()
project "TestWindowVk"
location "test/TestWindowVk"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
files {"%{prj.location}/WindowVk.cpp"}
if package.config:sub(1,1) == "/" then -- Linux
platformLinks = { "IWindowXlibVk", "X11", "Xcursor", "vulkan", "GLX" }
includedirs { "src" }
else
libdirs { vulkanSdk .. "/Lib" }
includedirs { vulkanSdk .. "/Include", "src" }
platformLinks = { "IWindowWin32Vk", "User32", "vulkan-1" }
end
links { platformLinks }
defaultBuildLocation()
defaultBuildCfg()
project "IWindowWin32GL"
location "src"
kind "StaticLib"
language "C++"
cppdialect "C++17"
includedirs { "src" }
files {"%{prj.location}/IWindowWin32.cpp", "%{prj.location}/IWindowWin32GL.cpp", "src/IWindowWin32Gamepad.cpp", "%{prj.location}/**.h", "%{prj.location}/**.hpp"}
links {"User32", "OpenGL32", "XInput"}
defaultBuildLocation()
defaultBuildCfg()
project "IWindowWin32Vk"
location "src"
kind "StaticLib"
language "C++"
cppdialect "C++17"
files {"%{prj.location}/IWindowWin32.cpp", "%{prj.location}/IWindowWin32Vk.cpp", "src/IWindowWin32Gamepad.cpp", "%{prj.location}/**.h", "%{prj.location}/**.hpp"}
includedirs { vulkanSdk .. "/Include", "src" }
libdirs { vulkanSdk .. "/Lib" }
links {"User32", "vulkan-1", "XInput"}
defaultBuildLocation()
defaultBuildCfg()
project "IWindowWin32All"
location "src"
kind "StaticLib"
language "C++"
cppdialect "C++17"
files {"%{prj.location}/IWindowWin32.cpp", "src/IWindowWin32Vk.cpp", "%{prj.location}/IWindowWin32GL.cpp", "src/IWindowWin32Gamepad.cpp", "%{prj.location}/**.h", "%{prj.location}/**.hpp"}
includedirs { vulkanSdk .. "/Include", "src" }
libdirs { vulkanSdk .. "/Lib" }
links {"User32", "vulkan-1", "OpenGL32", "XInput"}
defaultBuildLocation()
defaultBuildCfg()