diff --git a/examples/viewer/README.md b/examples/viewer/README.md index 4e0e087..8cb41c1 100644 --- a/examples/viewer/README.md +++ b/examples/viewer/README.md @@ -1 +1,16 @@ -Simple .obj viewer with glew + glfw3 + OpenGL +# Simple .obj viewer with glew + glfw3 + OpenGL + +## Build on Windows. + +### Requirements + +* premake5 +* Visual Studio 2013 +* Windows 64bit + * 32bit may work. + +Put glfw3 and glew library somewhere and replace include and lib path in `premake4.lua` + +Then, + + > premake5.exe vs2013 diff --git a/examples/viewer/premake4.lua b/examples/viewer/premake4.lua new file mode 100644 index 0000000..66da6f9 --- /dev/null +++ b/examples/viewer/premake4.lua @@ -0,0 +1,43 @@ +solution "objview" + -- location ( "build" ) + configurations { "Debug", "Release" } + platforms {"native", "x64", "x32"} + + project "objview" + + kind "ConsoleApp" + language "C++" + files { "viewer.cc", "trackball.cc" } + includedirs { "./" } + includedirs { "../../" } + + configuration { "linux" } + linkoptions { "`pkg-config --libs glfw3`" } + links { "GL", "GLU", "m", "GLEW", "X11", "Xrandr", "Xinerama", "Xi", "Xxf86vm", "Xcursor", "dl" } + + configuration { "windows" } + -- Path to GLFW3 + includedirs { '../../../../local/glfw-3.1.2.bin.WIN64/include' } + libdirs { '../../../../local/glfw-3.1.2.bin.WIN64/lib-vc2013' } + -- Path to GLEW + includedirs { '../../../../local/glew-1.13.0/include' } + libdirs { '../../../../local/glew-1.13.0/lib/Release/x64' } + + links { "glfw3", "glew32", "gdi32", "winmm", "user32", "glu32","opengl32", "kernel32" } + defines { "_CRT_SECURE_NO_WARNINGS" } + + configuration { "macosx" } + includedirs { "/usr/local/include" } + buildoptions { "-Wno-deprecated-declarations" } + libdirs { "/usr/local/lib" } + links { "glfw3", "GLEW" } + linkoptions { "-framework OpenGL", "-framework Cocoa", "-framework IOKit", "-framework CoreVideo" } + + configuration "Debug" + defines { "DEBUG" } + flags { "Symbols", "ExtraWarnings"} + + configuration "Release" + defines { "NDEBUG" } + flags { "Optimize", "ExtraWarnings"} + diff --git a/examples/viewer/viewer.cc b/examples/viewer/viewer.cc index a86c853..3160643 100644 --- a/examples/viewer/viewer.cc +++ b/examples/viewer/viewer.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -19,6 +20,7 @@ #include +#define TINYOBJLOADER_IMPLEMENTATION #include "../../tiny_obj_loader.h" #include "trackball.h"