-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpremake5.lua
136 lines (94 loc) · 2.93 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
function UseVisualStudio(action)
return string.find(action, "vs") ~= nil;
end
function UseGMake(action)
return not string.find(action, "gmake") ~= nil;
end
function UseCodeLite(action)
return action == "codelite";
end
function UseXCode(action)
return action == "xcode4";
end
if( UseVisualStudio(_ACTION) or
UseCodeLite(_ACTION) or
UseGMake(_ACTION) or
UseXCode(_ACTION))
then
workspace("CPU-Ray-Tracer")
location("Workspace_" .. _ACTION)
configurations({"Debug", "Release"})
platforms({"Win32", "Win64"})
language("C++")
startproject("Ray-Tracer")
targetdir("%{prj.location}/bin/%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}")
debugdir("%{prj.location}/bin/%{cfg.platform}/%{cfg.buildcfg}/%{prj.name}")
filter({"configurations:Debug"})
defines({"DEBUG", "_DEBUG"})
symbols("On")
filter({"configurations:Release"})
defines({"NDEBUG"})
optimize("On")
filter({"platforms:Win32"})
system("Windows")
architecture("x86")
filter({"platforms:Win64"})
system("Windows")
architecture("x86_64")
-- MathLibrary Project -----------------------------------------
project("MathLibrary")
kind("StaticLib")
files({"MathLibrary/*.cpp", "MathLibrary/*.h"})
-- MathTest Project --------------------------------------------
--TODO: Make sure that building for microsoft visual studio test framework is possible.
if(UseVisualStudio(_ACTION))
then
project("MathTests")
kind("SharedLib")
links({"MathLibrary"})
dependson({"MathLibrary"})
externalincludedirs({
"$(VCInstallDir)/Auxiliary/VS/UnitTest/include",
"MathLibrary"
})
syslibdirs({"$(VCInstallDir)/Auxiliary/VS/UnitTest/lib"})
files({"MathTest/*.cpp", "MathTest/*.h"})
end
-- Ray-Tracer Project -----------------------------------------
project("Ray-Tracer")
kind("ConsoleApp")
links({
"MathLibrary",
"SDL2",
"SDL2main"
})
dependson({"MathLibrary"})
includedirs({
"Deps/SDL2-2.0.9/include",
"MathLibrary"
})
files({
"RayTracer/src/*.cpp",
"RayTracer/src/headers/*.h"
})
filter({"platforms:Win32"})
libdirs({"%{prj.location}/../Deps/SDL2-2.0.9/lib/x86/"})
filter({"platforms:Win64"})
libdirs({"%{prj.location}/../Deps/SDL2-2.0.9/lib/x64/"})
filter({"system:windows", "platforms:Win32"})
postbuildcommands({
"(robocopy " ..
"%{prj.location}/../Deps/SDL2-2.0.9/lib/x86 " ..
"%{prj.location}/bin/%{cfg.platform}/%{cfg.buildcfg}/%{prj.name} " ..
"SDL2.dll)" ..
"& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0"
})
filter({"system:windows", "platforms:Win64"})
postbuildcommands({
"(robocopy " ..
"%{prj.location}/../Deps/SDL2-2.0.9/lib/x64 " ..
"%{prj.location}/bin/%{cfg.platform}/%{cfg.buildcfg}/%{prj.name} " ..
"SDL2.dll)" ..
"& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0"
})
end