@@ -50,18 +50,18 @@ workspace "PluginInteropUnity"
50
50
-- [ PluginGLInteropCUDA ] --
51
51
---- ---------------------------
52
52
project " PluginInteropUnityCUDA"
53
- local ROOT_PROJECT = pathPluginInterop
54
- location (ROOT_PROJECT )
53
+ local rootProject = pathPluginInterop
54
+ location (rootProject )
55
55
language " C++"
56
56
targetdir (pathTarget , " SampleBasic" )
57
- objdir (ROOT_PROJECT .. " /temp/" )
57
+ objdir (rootProject .. " /temp/" )
58
58
kind " SharedLib"
59
59
60
- local SourceDir = ROOT_PROJECT .. " /src/" ;
60
+ local SourceDir = rootProject .. " /src/" ;
61
61
local IncludeSubDir = pathPluginInteropIncludeSubdir ;
62
62
local IncludeDir = pathPluginInteropInclude ;
63
- local ThirdPartyGLDir = ROOT_PROJECT .. " /thirdParty/gl3w/include/" ;
64
- local SourceThirdPartyGLDir = ROOT_PROJECT .. " /thirdParty/gl3w/src/" ;
63
+ local ThirdPartyGLDir = rootProject .. " /thirdParty/gl3w/include/" ;
64
+ local SourceThirdPartyGLDir = rootProject .. " /thirdParty/gl3w/src/" ;
65
65
66
66
dependson {" Utilities" }
67
67
files
@@ -135,19 +135,19 @@ project "PluginInteropUnityCUDA"
135
135
-- [ SampleBasic ] --
136
136
---- ---------------------------
137
137
project " SampleBasic"
138
- local LOCATION_PROJECT = pathSampleProject
139
- local ROOT_PROJECT = root .. LOCATION_PROJECT
140
- location (ROOT_PROJECT )
138
+ local locationProject = pathSampleProject
139
+ local rootProject = root .. locationProject
140
+ location (rootProject )
141
141
language " C++"
142
142
targetdir (pathTarget )
143
- objdir (ROOT_PROJECT .. " /temp/" )
143
+ objdir (rootProject .. " /temp/" )
144
144
kind " SharedLib"
145
145
146
- local SourceDir = ROOT_PROJECT .. " /src/" ;
147
- local IncludeSubDir = ROOT_PROJECT .. " /include/**" ;
148
- local IncludeDir = ROOT_PROJECT .. " /include/" ;
149
- local ThirdPartyGLDir = ROOT_PROJECT .. " /thirdParty/gl3w/include/" ;
150
- local SourceThirdPartyGLDir = ROOT_PROJECT .. " /thirdParty/gl3w/src/" ;
146
+ local SourceDir = rootProject .. " /src/" ;
147
+ local IncludeSubDir = rootProject .. " /include/**" ;
148
+ local IncludeDir = rootProject .. " /include/" ;
149
+ local ThirdPartyGLDir = rootProject .. " /thirdParty/gl3w/include/" ;
150
+ local SourceThirdPartyGLDir = rootProject .. " /thirdParty/gl3w/src/" ;
151
151
dependson {" PluginInteropUnityCUDA" }
152
152
files
153
153
{
@@ -220,14 +220,14 @@ project "SampleBasic"
220
220
-- [ Utilities ] --
221
221
---- ---------------------------
222
222
project " Utilities"
223
- local ROOT_PROJECT = pathUtilities
224
- location (ROOT_PROJECT )
223
+ local rootProject = pathUtilities
224
+ location (rootProject )
225
225
kind " SharedLib"
226
226
language " C++"
227
227
targetdir (pathTarget )
228
- objdir (ROOT_PROJECT .. " /temp/" .. LOCATION_PROJECT )
228
+ objdir (rootProject .. " /temp/" .. locationProject )
229
229
230
- local SourceDir = ROOT_PROJECT .. " /src/" ;
230
+ local SourceDir = rootProject .. " /src/" ;
231
231
local IncludeDir = pathUtilitiesInclude ;
232
232
233
233
-- what files the visual studio project/makefile/etc should know about
@@ -249,5 +249,26 @@ project "Utilities"
249
249
250
250
defines {" UTILITIES_SHARED" , " UTILITIES_SHARED_EXPORTS" } symbols " On"
251
251
252
+ -- Add necessary build customization using standard Premake5
253
+ -- This assumes you have installed Visual Studio integration for CUDA
254
+ -- Here we have it set to 11.4
255
+ buildcustomizations " BuildCustomizations/CUDA 11.7"
256
+ cudaPath " /usr/local/cuda" -- Only affects linux, because the windows builds get CUDA from the VS extension
257
+
258
+ cudaMaxRegCount " 32"
259
+ -- Let's compile for all supported architectures (and also in parallel with -t0)
260
+ cudaCompilerOptions {" -arch=sm_52" , " -gencode=arch=compute_52,code=sm_52" , " -gencode=arch=compute_60,code=sm_60" ,
261
+ " -gencode=arch=compute_61,code=sm_61" , " -gencode=arch=compute_70,code=sm_70" ,
262
+ " -gencode=arch=compute_75,code=sm_75" , " -gencode=arch=compute_80,code=sm_80" ,
263
+ " -gencode=arch=compute_86,code=sm_86" , " -gencode=arch=compute_86,code=compute_86" , " -t0" }
264
+
265
+ -- On Windows, the link to cudart is done by the CUDA extension, but on Linux, this must be done manually
266
+ if os .target () == " linux" then
267
+ linkoptions {" -L/usr/local/cuda/lib64 -lcudart" }
268
+ end
269
+
270
+ filter " configurations:release"
271
+ cudaFastMath " On" -- enable fast math for release
272
+ filter " "
252
273
253
274
0 commit comments