-
Notifications
You must be signed in to change notification settings - Fork 90
/
premake5.lua
114 lines (100 loc) · 3.41 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
newoption {
trigger = "with-gtk3nfd",
description = "Build with native file dialog support(GTK3 required. Linux only)"
}
newoption {
trigger = "asan",
description = "Enable Address Sanitizer(gcc5+ ang clang only)"
}
sources = {
"main.cc",
"render.cc",
"render-config.cc",
"obj-loader.cc",
"../common/matrix.cc",
"../common/trackball.cc",
"../common/imgui/imgui.cpp",
"../common/imgui/imgui_draw.cpp",
"../common/imgui/imgui_widgets.cpp",
"../common/imgui/imgui_impl_btgui.cpp",
"../common/imgui/ImGuizmo.cpp",
}
solution "NanoSGSolution"
configurations { "Release", "Debug" }
if os.is("Windows") then
platforms { "x64", "x32" }
else
platforms { "native", "x64", "x32" }
end
-- RootDir for OpenGLWindow
projectRootDir = os.getcwd() .. "/../common/"
dofile ("../common/findOpenGLGlewGlut.lua")
initOpenGL()
initGlew()
-- Use c++11
flags { "c++11" }
-- A project defines one build target
project "viwewer"
kind "ConsoleApp"
language "C++"
files { sources }
includedirs { "./", "../../" }
includedirs { "../common" }
includedirs { "../common/imgui" }
includedirs { "../common/glm" }
--includedirs { "../common/nativefiledialog/src/include" }
if _OPTIONS['asan'] then
buildoptions { "-fsanitize=address" }
linkoptions { "-fsanitize=address" }
end
if os.is("Windows") then
warnings "Extra" -- /W4
defines { "NOMINMAX" }
defines { "USE_NATIVEFILEDIALOG" }
buildoptions { "/W4" } -- raise compile error level.
files{
"../common/OpenGLWindow/Win32OpenGLWindow.cpp",
"../common/OpenGLWindow/Win32OpenGLWindow.h",
"../common/OpenGLWindow/Win32Window.cpp",
"../common/OpenGLWindow/Win32Window.h",
}
includedirs { "./../common/nativefiledialog/src/include" }
files { "../common/nativefiledialog/src/nfd_common.c",
"../common/nativefiledialog/src/nfd_win.cpp" }
end
if os.is("Linux") then
files {
"../common/OpenGLWindow/X11OpenGLWindow.cpp",
"../common/OpenGLWindow/X11OpenGLWindows.h"
}
links {"X11", "pthread", "dl"}
if _OPTIONS["with-gtk3nfd"] then
defines { "USE_NATIVEFILEDIALOG" }
includedirs { "./../common/nativefiledialog/src/include" }
files { "../common/nativefiledialog/src/nfd_gtk.c",
"../common/nativefiledialog/src/nfd_common.c"
}
buildoptions { "`pkg-config --cflags gtk+-3.0`" }
linkoptions { "`pkg-config --libs gtk+-3.0`" }
end
end
if os.is("MacOSX") then
defines { "USE_NATIVEFILEDIALOG" }
links {"Cocoa.framework"}
files {
"../common/OpenGLWindow/MacOpenGLWindow.h",
"../common/OpenGLWindow/MacOpenGLWindow.mm",
}
includedirs { "./../common/nativefiledialog/src/include" }
files { "../common/nativefiledialog/src/nfd_cocoa.m",
"../common/nativefiledialog/src/nfd_common.c" }
end
configuration "Debug"
defines { "DEBUG" } -- -DDEBUG
symbols "On"
targetname "view_debug"
configuration "Release"
-- defines { "NDEBUG" } -- -NDEBUG
symbols "On"
optimize "On"
targetname "view"