1newoption {
2   trigger = "with-gtk3nfd",
3   description = "Build with native file dialog support(GTK3 required. Linux only)"
4}
5
6sources = {
7   "main.cc",
8   "render.cc",
9   "render-config.cc",
10   "matrix.cc",
11   "../common/trackball.cc",
12   "../common/imgui/imgui.cpp",
13   "../common/imgui/imgui_draw.cpp",
14   "../common/imgui/imgui_widgets.cpp",
15   "../common/imgui/imgui_impl_btgui.cpp",
16   }
17
18solution "PartioViewSolution"
19   configurations { "Release", "Debug" }
20
21   if os.is("Windows") then
22      platforms { "x64", "x32" }
23   else
24      platforms { "native", "x64", "x32" }
25   end
26
27
28   -- RootDir for OpenGLWindow
29   projectRootDir = os.getcwd() .. "/../common/"
30   dofile ("../common/findOpenGLGlewGlut.lua")
31   initOpenGL()
32   initGlew()
33
34   -- Use c++11
35   flags { "c++11" }
36
37   -- A project defines one build target
38   project "partio_viewer"
39      kind "ConsoleApp"
40      language "C++"
41      files { sources }
42
43      includedirs { "./", "../../" }
44      includedirs { "../common" }
45      includedirs { "../common/imgui" }
46      --includedirs { "../common/nativefiledialog/src/include" }
47
48      if os.is("Windows") then
49         flags { "FatalCompileWarnings" }
50         warnings "Extra" -- /W4
51
52         defines { "NOMINMAX" }
53         defines { "USE_NATIVEFILEDIALOG" }
54         buildoptions { "/W4" } -- raise compile error level.
55         files{
56            "../common/OpenGLWindow/Win32OpenGLWindow.cpp",
57            "../common/OpenGLWindow/Win32OpenGLWindow.h",
58            "../common/OpenGLWindow/Win32Window.cpp",
59            "../common/OpenGLWindow/Win32Window.h",
60            }
61         includedirs { "./../common/nativefiledialog/src/include" }
62         files { "../common/nativefiledialog/src/nfd_common.c",
63                 "../common/nativefiledialog/src/nfd_win.cpp" }
64      end
65      if os.is("Linux") then
66         files {
67            "../common/OpenGLWindow/X11OpenGLWindow.cpp",
68            "../common/OpenGLWindow/X11OpenGLWindows.h"
69            }
70         links {"X11", "pthread", "dl"}
71         if _OPTIONS["with-gtk3nfd"] then
72            defines { "USE_NATIVEFILEDIALOG" }
73            includedirs { "./../common/nativefiledialog/src/include" }
74            files { "../common/nativefiledialog/src/nfd_gtk.c",
75                    "../common/nativefiledialog/src/nfd_common.c"
76                  }
77            buildoptions { "`pkg-config --cflags gtk+-3.0`" }
78            linkoptions { "`pkg-config --libs gtk+-3.0`" }
79         end
80
81         -- partio
82	 includedirs { "/usr/local/include" }
83	 libdirs { "/usr/local/lib" }
84	 links { "partio", "z" }
85      end
86
87      if os.is("MacOSX") then
88         defines { "USE_NATIVEFILEDIALOG" }
89         links {"Cocoa.framework"}
90         files {
91                "../common/OpenGLWindow/MacOpenGLWindow.h",
92                "../common/OpenGLWindow/MacOpenGLWindow.mm",
93               }
94         includedirs { "./../common/nativefiledialog/src/include" }
95         files { "../common/nativefiledialog/src/nfd_cocoa.m",
96                 "../common/nativefiledialog/src/nfd_common.c" }
97
98         -- partio(brew)
99	 includedirs { "/usr/local/include" }
100	 libdirs { "/usr/local/lib" }
101	 links { "partio", "z" }
102      end
103
104      configuration "Debug"
105         defines { "DEBUG" } -- -DDEBUG
106         flags { "Symbols" }
107         targetname "partio_view_debug"
108
109      configuration "Release"
110         -- defines { "NDEBUG" } -- -NDEBUG
111         flags { "Symbols", "Optimize" }
112         targetname "partio_view"
113