-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpremake5.lua
More file actions
126 lines (87 loc) · 3 KB
/
premake5.lua
File metadata and controls
126 lines (87 loc) · 3 KB
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
local core_project = 'core/'
local client_project = 'host/'
local render_project = 'render_client/'
-- go through opencl vendors env variables for opencl.lib locations
local amd_root = os.getenv('AMDAPPSDKROOT', '')
local nv_root = os.getenv('CUDA_PATH', '')
local intel_root = os.getenv('INTELOCLSDKROOT', '')
local opencl_libdir = ''
-- find opencl
if (amd_root ~= '' and amd_root ~= nil) then
opencl_libdir = amd_root .. '\\lib\\x86_64'
print('Found amd sdk at: ' .. amd_root)
elseif (intel_root ~= '' and intel_root ~= nil) then
opencl_libdir = intel_root .. '\\lib\\x64'
print('Found intel opencl sdk at: ' .. intel_root)
elseif (nv_root ~= '' and nv_root ~= nil) then
opencl_libdir = nv_root .. '\\lib\\x64'
print('Found nvidia cuda sdk at: ' .. nv_root)
else
print('Could not find an OpenCL sdk. Renderer client project may not link.')
end
-- If windows, find winsdk version
local windsk_ver;
if (os.is('windows')) then
local reg_query = 'reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows Kits\\Installed Roots" /f * /k'
local req_query_output = io.popen(reg_query)
local keyname = req_query_output:read('*l')
winsdk_ver = string.gsub(keyname, '\\[^\]*]', '%1')
winsdk_ver = string.sub(winsdk_ver, 2, string.len(winsdk_ver))
end
-- link to glfw, glew
function link_to_gls(use_core)
local libdir = 'libs';
local raycore_dir_rel = 'lib\\Release'
local raycore_dir_deb = 'lib\\Debug'
filter { 'system:windows', 'configurations:debug' }
libdirs { libdir .. '\\Win32', raycore_dir_deb }
filter { 'system:windows', 'configurations:release' }
libdirs { libdir .. '\\Win32', raycore_dir_rel }
filter { 'system:linux' }
libdirs { libdir .. '\\Unix' }
filter {}
links { 'glfw3', 'glew32' }
if (use_core) then
links { 'raycore' }
end
end
function include_dirs()
includedirs { 'include' }
end
workspace 'raytracer'
configurations { 'Debug', 'Release' }
location 'build'
startproject 'render_client'
architecture 'x64'
project 'core'
kind 'StaticLib'
language 'C++'
targetdir 'lib/%{cfg.buildcfg}'
targetname 'raycore'
configuration "vs*"
configuration {}
files { core_project .. '**.c', core_project .. '**.h', core_project .. '**.cpp', core_project .. '**.hpp' }
include_dirs()
libdirs { opencl_libdir }
links { 'opencl' }
link_to_gls(false)
project 'host'
kind 'ConsoleApp'
language 'C++'
targetdir 'bin/%{cfg.buildcfg}'
files { client_project .. '**.c', client_project .. '**.h', client_project .. '**.cpp', client_project .. '**.hpp' }
include_dirs()
includedirs(core_project)
link_to_gls(true)
links { 'OpenGL32' }
project 'render_client'
kind 'ConsoleApp'
language 'C++'
targetdir 'bin/%{cfg.buildcfg}'
files { render_project .. '**.c', render_project .. '**.h', render_project .. '**.cpp', render_project .. '**.hpp' }
include_dirs()
includedirs(core_project)
libdirs { opencl_libdir }
links { 'opencl' }
link_to_gls(true)
links { 'OpenGL32' }