Skip to content

Commit e9a7c76

Browse files
committed
Add build script for Windows.
Fix build on Windows.
1 parent b90f767 commit e9a7c76

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

examples/viewer/README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
Simple .obj viewer with glew + glfw3 + OpenGL
1+
# Simple .obj viewer with glew + glfw3 + OpenGL
2+
3+
## Build on Windows.
4+
5+
### Requirements
6+
7+
* premake5
8+
* Visual Studio 2013
9+
* Windows 64bit
10+
* 32bit may work.
11+
12+
Put glfw3 and glew library somewhere and replace include and lib path in `premake4.lua`
13+
14+
Then,
15+
16+
> premake5.exe vs2013

examples/viewer/premake4.lua

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
solution "objview"
2+
-- location ( "build" )
3+
configurations { "Debug", "Release" }
4+
platforms {"native", "x64", "x32"}
5+
6+
project "objview"
7+
8+
kind "ConsoleApp"
9+
language "C++"
10+
files { "viewer.cc", "trackball.cc" }
11+
includedirs { "./" }
12+
includedirs { "../../" }
13+
14+
configuration { "linux" }
15+
linkoptions { "`pkg-config --libs glfw3`" }
16+
links { "GL", "GLU", "m", "GLEW", "X11", "Xrandr", "Xinerama", "Xi", "Xxf86vm", "Xcursor", "dl" }
17+
18+
configuration { "windows" }
19+
-- Path to GLFW3
20+
includedirs { '../../../../local/glfw-3.1.2.bin.WIN64/include' }
21+
libdirs { '../../../../local/glfw-3.1.2.bin.WIN64/lib-vc2013' }
22+
-- Path to GLEW
23+
includedirs { '../../../../local/glew-1.13.0/include' }
24+
libdirs { '../../../../local/glew-1.13.0/lib/Release/x64' }
25+
26+
links { "glfw3", "glew32", "gdi32", "winmm", "user32", "glu32","opengl32", "kernel32" }
27+
defines { "_CRT_SECURE_NO_WARNINGS" }
28+
29+
configuration { "macosx" }
30+
includedirs { "/usr/local/include" }
31+
buildoptions { "-Wno-deprecated-declarations" }
32+
libdirs { "/usr/local/lib" }
33+
links { "glfw3", "GLEW" }
34+
linkoptions { "-framework OpenGL", "-framework Cocoa", "-framework IOKit", "-framework CoreVideo" }
35+
36+
configuration "Debug"
37+
defines { "DEBUG" }
38+
flags { "Symbols", "ExtraWarnings"}
39+
40+
configuration "Release"
41+
defines { "NDEBUG" }
42+
flags { "Optimize", "ExtraWarnings"}
43+

examples/viewer/viewer.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <iostream>
99
#include <limits>
1010
#include <cmath>
11+
#include <algorithm>
1112

1213
#include <GL/glew.h>
1314

@@ -19,6 +20,7 @@
1920

2021
#include <GLFW/glfw3.h>
2122

23+
#define TINYOBJLOADER_IMPLEMENTATION
2224
#include "../../tiny_obj_loader.h"
2325

2426
#include "trackball.h"

0 commit comments

Comments
 (0)