Skip to content

Commit e9eddcf

Browse files
committed
Fix premake5.lua for ubuntu
1 parent 5fd932d commit e9eddcf

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

premake5.lua

+27-17
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ local nugetPackages = {
2626
-- "vorbis-msvc14-x64:1.3.5.7785", "ogg-msvc-x64:1.3.2.8787", -- x64
2727
}
2828

29+
local PATH = os.getenv("PATH")
2930
local SDL2_DIR = os.getenv("SDL2_DIR")
3031
local SDL2_headerPath = os.findheader("SDL2/SDL.h", SDL2_DIR)
3132
local SDL2_libraryPath = os.findlib("SDL2", SDL2_DIR)
3233
local vorbis_headerPath = os.findheader("vorbis/vorbisenc.h")
3334
local ogg_headerPath = os.findheader("ogg/ogg.h")
3435

3536
print("premake:", _PREMAKE_VERSION)
37+
print("PATH: ", PATH)
3638
print("SDL2_DIR: ", SDL2_DIR)
3739
print("SDL2 header path: ", SDL2_headerPath)
3840
print("SDL2 library path: ", SDL2_libraryPath)
@@ -100,6 +102,22 @@ end
100102

101103
filter { "action:vs*" }
102104
nuget(nugetPackages)
105+
filter { "action:not vs*", "kind:ConsoleApp" }
106+
links { "SDL2main" }
107+
filter { "action:not vs*" }
108+
if vorbis_headerPath then
109+
includedirsafter { vorbis_headerPath }
110+
end
111+
if ogg_headerPath then
112+
includedirsafter { ogg_headerPath }
113+
end
114+
if SDL2_headerPath then
115+
externalincludedirs { path.join(SDL2_headerPath, "SDL2") }
116+
end
117+
if SDL2_libraryPath then
118+
libdirs { SDL2_libraryPath }
119+
end
120+
links { "SDL2", "ogg", "vorbis", "vorbisfile", "vorbisenc" }
103121
filter { "toolset:msc*" }
104122
defines { "_CRT_SECURE_NO_WARNINGS" } -- 4996: '$func': This function or variable may be unsafe. Consider using $func2 instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
105123
defines { "_USE_MATH_DEFINES" } -- for M_PI
@@ -153,21 +171,6 @@ project "resinstaller"
153171
"4703", -- potentially uninitialized local pointer variable '$var' used
154172
"4996", -- '$func': The POSIX name of this item is deprecated. Instead, use the ISO C and C++ conformant name: $func2. See online help for details.
155173
}
156-
filter "action:not vs*"
157-
if vorbis_headerPath then
158-
includedirsafter { vorbis_headerPath }
159-
end
160-
if ogg_headerPath then
161-
includedirsafter { ogg_headerPath }
162-
end
163-
if SDL2_headerPath then
164-
externalincludedirs { path.join(SDL2_headerPath, "SDL2") }
165-
end
166-
if SDL2_libraryPath then
167-
libdirs { SDL2_libraryPath }
168-
end
169-
links { "SDL2", "ogg", "vorbis", "vorbisfile", "vorbisenc" }
170-
filter {}
171174

172175
project "maxr"
173176
kind "WindowedApp"
@@ -186,14 +189,18 @@ project "maxr"
186189
includedirs { locationDir } -- for generated file (autoversion.h)
187190
end
188191

189-
files { "src/ui/**.cpp", "src/ui/**.h", "src/maxr.rc" }
192+
files { "src/ui/**.cpp", "src/ui/**.h" }
193+
filter "system:windows"
194+
files { "src/maxr.rc" }
195+
filter {}
190196
includedirs { "src", "src/lib" }
191197
externalincludedirs { "submodules/nlohmann/single_include" }
192198
links { "maxr_lib", "SDL_flic", "mveplayer" }
193199
linksToCrashRpt()
194200

195201
debugdir "data"
196202

203+
197204
project "dedicated_server"
198205
kind "ConsoleApp"
199206
targetdir "data"
@@ -210,7 +217,10 @@ project "dedicated_server"
210217
includedirs { locationDir } -- for generated file (autoversion.h)
211218
end
212219

213-
files { "src/dedicatedserver/**.cpp", "src/dedicated_server/**.h", "src/maxr.rc" }
220+
files { "src/dedicatedserver/**.cpp", "src/dedicated_server/**.h" }
221+
filter "system:windows"
222+
files { "src/maxr.rc" }
223+
filter {}
214224
includedirs { "src", "src/lib" }
215225
externalincludedirs { "submodules/nlohmann/single_include" }
216226
links { "maxr_lib", "SDL_flic", "mveplayer" }

0 commit comments

Comments
 (0)