Permalink
Browse files

Got rid of the old Makefile and updated the README with CMake instruc…

…tions.
  • Loading branch information...
1 parent 09be4b6 commit dbf2f1d40ac2777b46fc117db926da41bb06241c @vilya committed Aug 24, 2010
Showing with 38 additions and 169 deletions.
  1. +0 −152 Makefile
  2. +38 −17 README.txt
View
@@ -1,152 +0,0 @@
-DBGFLAGS := -g
-OPTFLAGS := -O3 -fopenmp
-#OPTFLAGS := -O3 -msse3 -m3dnow -mfpmath=sse
-#OPTFLAGS := -O3
-
-CXX := g++
-CC := gcc
-LD := g++
-
-SRC := src
-OBJ := build/obj
-DIST := dist
-BIN := bin
-THIRDPARTY_SRC := thirdparty
-THIRDPARTY_OBJ := build/thirdparty
-EXAMPLE_SRC := example
-TEST_SRC := test
-
-ifeq ($(OSTYPE), linux-gnu)
-DYLIB_PRE := lib
-DYLIB_EXT := .so
-LIBVGL := $(DYLIB_PRE)vgl$(DYLIB_EXT)
-LIBVGL_BIN := $(DIST)/lib/$(LIBVGL)
-CXXFLAGS := -Wall -m64 -fPIC -shared
-LDFLAGS := -m64 -fopenmp -Wl,--rpath,\$$ORIGIN -fPIC -shared
-LDFLAGS_EXE := -m64 -fopenmp -Wl,--rpath,\$$ORIGIN
-INCLUDE := -I$(THIRDPARTY_SRC)
-LIBS := -lglut -lpthread -ljpeg -lpng -ltiff
-else
-DYLIB_PRE := lib
-DYLIB_EXT := .dylib
-LIBVGL := $(DYLIB_PRE)vgl$(DYLIB_EXT)
-LIBVGL_BIN := $(DIST)/lib/$(LIBVGL)
-CXXFLAGS := -Wall -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -shared
-LDFLAGS := -framework OpenGL -framework GLUT \
- -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -arch x86_64 -shared \
- -install_name @rpath/$(LIBVGL)
-LDFLAGS_EXE := -framework OpenGL -framework GLUT \
- -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -arch x86_64 \
- -Wl,-rpath,@loader_path/
-INCLUDE := -I/opt/local/include -I$(THIRDPARTY_SRC)
-LIBS := -L/opt/local/lib -ljpeg -lpng -ltiff
-endif
-
-LIBVGL_OBJS := \
- $(OBJ)/vgl_arcballcamera.o \
- $(OBJ)/vgl_basecamera.o \
- $(OBJ)/vgl_camera.o \
- $(OBJ)/vgl_funcs.o \
- $(OBJ)/vgl_image.o \
- $(OBJ)/vgl_objparser.o \
- $(OBJ)/vgl_orthocamera.o \
- $(OBJ)/vgl_parser.o \
- $(OBJ)/vgl_plane3.o \
- $(OBJ)/vgl_plyparser.o \
- $(OBJ)/vgl_quaternion.o \
- $(OBJ)/vgl_ray3.o \
- $(OBJ)/vgl_utils.o \
- $(OBJ)/vgl_vec2.o \
- $(OBJ)/vgl_vec3.o \
- $(OBJ)/vgl_vec4.o \
- $(OBJ)/vgl_viewer.o
-LIBVGL_INCS := \
- $(DIST)/include/vgl.h \
- $(DIST)/include/vgl_arcballcamera.h \
- $(DIST)/include/vgl_basecamera.h \
- $(DIST)/include/vgl_camera.h \
- $(DIST)/include/vgl_funcs.h \
- $(DIST)/include/vgl_image.h \
- $(DIST)/include/vgl_matrix3.h \
- $(DIST)/include/vgl_matrix4.h \
- $(DIST)/include/vgl_objparser.h \
- $(DIST)/include/vgl_orthocamera.h \
- $(DIST)/include/vgl_parser.h \
- $(DIST)/include/vgl_plane3.h \
- $(DIST)/include/vgl_plyparser.h \
- $(DIST)/include/vgl_quaternion.h \
- $(DIST)/include/vgl_ray3.h \
- $(DIST)/include/vgl_renderer.h \
- $(DIST)/include/vgl_utils.h \
- $(DIST)/include/vgl_vec2.h \
- $(DIST)/include/vgl_vec3.h \
- $(DIST)/include/vgl_vec4.h \
- $(DIST)/include/vgl_viewer.h
-
-THIRDPARTY_OBJS := $(THIRDPARTY_OBJ)/ply.o
-
-
-.PRECIOUS: $(LIBVGL_OBJS) $(THIRDPARTY_OBJS)
-
-
-.PHONY: debug
-debug:
- $(MAKE) CXXFLAGS="$(DBGFLAGS) $(CXXFLAGS)" all
-
-
-.PHONY: release
-release:
- $(MAKE) CXXFLAGS="$(OPTFLAGS) $(CXXFLAGS)" all
-
-
-.PHONY: all
-all: build_libvgl build_example build_test
-
-
-.PHONY: dirs
-dirs:
- @mkdir -p $(OBJ)
- @mkdir -p $(THIRDPARTY_OBJ)
- @mkdir -p $(DIST)/include
- @mkdir -p $(DIST)/lib
- @mkdir -p $(BIN)
-
-
-.PHONY: build_example
-build_example: dirs build_libvgl $(BIN)/$(LIBVGL)
- $(MAKE) -C $(EXAMPLE_SRC) CXXFLAGS="$(CXXFLAGS)" all
-
-
-.PHONY: build_test
-build_test: dirs build_libvgl $(BIN)/$(LIBVGL)
- $(MAKE) -C $(TEST_SRC) CXXFLAGS="$(CXXFLAGS)" all
-
-
-.PHONY: build_libvgl
-build_libvgl: dirs $(LIBVGL_BIN) $(LIBVGL_INCS)
-
-
-$(BIN)/$(LIBVGL): $(LIBVGL_BIN)
- cp $^ $@
-
-
-$(LIBVGL_BIN): $(LIBVGL_OBJS) $(THIRDPARTY_OBJS)
- $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-
-$(DIST)/include/%: $(SRC)/%
- cp $< $@
-
-
-$(OBJ)/%.o: $(SRC)/%.cpp
- $(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
-
-
-$(THIRDPARTY_OBJ)/ply.o: $(THIRDPARTY_SRC)/ply.c
- $(CC) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
-
-
-.PHONY: clean
-clean:
- rm -rf bin/* build/* dist/*
-
View
@@ -16,18 +16,18 @@ So far it includes:
- Single window, set up for drawing into with OpenGL.
- Customisable (by overriding) mapping of input events to GUI actions.
- Default behaviour which maps input events to camera controls.
-- The usual 3D math classes:
- - Templated Vec2, Vec3 and Vec4 classes
- - Templated Matrix3 and Matrix4 classes
- - A templated Quaternion class
+- The usual templated 3D math classes:
+ - Vec2, Vec3 and Vec4
+ - Matrix3 and Matrix4
+ - Quaternion
- Support for loading (but not saving) a number of 2d image formats:
- BMP
- PNG
- JPG
- TGA
- TIF
- Note that you're expected to have libpng and libjpeg already installed on
- your system somewhere.
+ Note that you're expected to have libpng, libjpeg and libtiff already
+ installed on your system somewhere.
- Support for a loading (but not saving) a number of 3d geometry formats:
- OBJ
- PLY
@@ -37,8 +37,8 @@ So far it includes:
- A base class, intended for subclassing.
- A *very* simple renderer abstraction.
- Helper functions for dealing with OpenGL shaders.
-- An example program which draws a lit teapot.
-- An example program which loads and displays a model file.
+- Some example programs which demonstrate various aspects of the library.
+- A build system using CMake
License
@@ -57,7 +57,7 @@ Pre-requisites
- libpng
- libjpeg6b
- libtiff
- - cppunit (for the unit tests)
+ - cppunit (optional; only needed for the unit tests)
Getting the code
@@ -66,25 +66,46 @@ Getting the code
git clone http://github.com/vilya
-Compiling it
-============
+Building it
+===========
+VGL uses CMake, so you have the option of generating Makefiles or project files
+for various IDEs.
+
+Building with make
+------------------
+I recommend doing an out-of-source build. If you're inside the top-level VGL
+directory, this should do the trick:
+
+ mkdir build
+ cd build
+ cmake ..
make
-...should do the trick. You may need to adjust the include paths and library
-paths if you've got your libraries installed in custom locations.
+If you want to see the command line it's passing to the compiler, just write:
+
+ make VERBOSE=1
+
+The build is set up to try and autodetect the location of the libraries it
+needs; if you have them installed in non-standard locations, you'll need to
+tell CMake where to find them:
+
+ cmake -DCMAKE_LIBRARY_PATH=/path/to/your/library/dir ..
+
+The generated makefile includes targets for running tests, installing the
+library and so on:
-After a successful make, the library and headers will be inside the dist
-directory; the example programs (and a second copy of the library) will be
-inside the bin directory along with the test programs.
+ make test Run all the tests
+ make install Install the library
+ make help List out all the targets provided by the makefile.
Running the examples
====================
If you're in the project root folder, you should be able to run the example
programs by typing (for example):
- ./bin/example
+ ./build/arcball
Reporting bugs

0 comments on commit dbf2f1d

Please sign in to comment.