Home
Contact Information
Office Hours
Announcements
LMS (Discussion Forum)
Syllabus
Prerequisites
Textbook
Grading
Assigned Readings
Calendar
Lecture notes
Lab materials
Homework
Test reviews
Homework
Homework Late Policy
Collaboration Policy
Electronic Submission
Compilers
CMake notes
gcc/g++ notes
GL/glut notes
memory debugging
Final Project
Spring '13 Projects
Spring '12 Projects
Spring '11 Projects
Spring '10 Projects
Spring '09 Projects
Spring '08 Projects
Spring '07 Projects
Academic Integrity
|
Using CMake
We will use CMake, a
cross-platform, open-source make system. The provided homework code
will be developed on MaxOSX using CMake/g++, but has been tested and
should also work on Linux using CMake/g++, and Windows using
CMake/VisualStudio.
When you start a new assignment/project, you should first run
cmake on the provided code following the directions below. These
steps allow you to setup the build environment, verify installation of
all libraries, ensure the project correctly compiles and links, and
allows you to test the initial executable. These steps create the
Makefile or Visual Studio project file for your system. Once
completed you can launch your favorite source code editor or
Integrated Development Environment (IDE) and start working on the
assignment.
Please let the instructor know if you catch any portability bugs
while working on the homework (and post bug fixes to LMS for the other
students). Also, please share any installation/compilation
instructions you have for your specific environment.
On Linux or MacOSX
-
Install
CMake and GLUT (see GL/glut notes)
- Make a directory for your source code for this project (e.g.,
hw1/src). Put the CMakeLists.txt file, and all your .cpp and
.h files in that directory. You can put your README.txt file and your
self-assessment gradesheet here too!
- Make a directory for building this project (e.g.,
hw1/build). Open up a terminal/shell and cd into
the build directory. Then run CMake giving it the source code
directory. E.g.,
cmake ../src
This generates a Makefile in the current directory.
Now build the program:
make
Your executable will be in the current directory.
- To run the program, and refer to a data file that is in the src
directory, you'll type something like this:
./ifs -input ../src/fern.txt
- If you add new .cpp files, be sure to add them to the CMakeLists.txt file.
- To rebuild the program after changing the souce files, just type make.
On Windows with Visual Studio
- Install Visual Studio
Note: Visual Studio 2008 users will probably need to install
Visual C++ 2008 Feature Pack Release to get Standard Library TR1, which includes unordered_map (and change provided code to from std::unordered_map to std::tr1::unordered map)
- Install CMake
Note: Windows CMake should be on the path ahead of Cygwin CMake. (This is a common mistake!)
- Install
GLUT
and GLEW, http://glew.sourceforge.net/
(following
Chris Wyman's detailed instructions for Windows
for placing the .h, .lib, and .dll files):
On a 64 bit machine running windows 7:
NOTE: even though you have a 64-bit OS, download the 32-bit versions of GLUT & GLEW
- Put the files "glut32.dll" and "glew32.dll" in
"C:\WINDOWS\SysWOW64" (yes, non-sensically, 32-bit DLLs go in SysWOW64)
- Put "glut.h", "glew.h", and "wglew.h" into "C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A\include\gl"
(You've got the right directory if you see a copy of "gl.h")
-
Put "glut32.lib" and "glew32.lib" in "C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A\Lib"
(There should be lots of .lib files here, including "opengl32.lib" and "glu32.lib")
- Make a directory for your source code for this project (e.g.,
hw1/src). Put the CMakeLists.txt file, and all your .cpp and
.h files in that directory. You can put your README.txt file and your
self-assessment gradesheet here too!
- Make a directory for building this project (e.g.,
hw1/build).
-
Launch the Visual Studio command shell (not just the cmd shell).
From the Start menu, under All Programs, find your Visual Studio
version (e.g., 2010) and expand it. Then expand Visual Studio
Tools. Select the "Visual Studio 2010 Command Prompt".
- Within the Visual Studio command shell, navigate (using cd)
into the build directory. Then run CMake giving it the source code
directory. E.g.,
cmake ../src
It should say something like: "Building for: Visual Studio 2010"
Hopefully it finds all the necessary libraries and completes successfully!
If it complains about GLUT or GLEW not being found, make sure you
have installed them correctly. (NOTE: You need to re-launch the
Visual Studio command shell after installing new libraries).
- Now actually run the compiler:
cmake --build .
And hopefully the build is successful and you have an executable will be in Debug/your_program.exe or debug/your_program.exe
- To run your executable with a data file in the source directory, type something like this:
debug/ifs.exe -input ../src/fern.txt
- Once your build environment is setup, you can launch the Visual
Studio IDE by opening the solution file (named XXX.sln). E.g.,
start hw0.sln
Other Important OpenGL Compilation Notes:
-
Make sure you have recent graphic card drivers (download the specific
driver for your card from NVidia, ATI, or Intel rather than the
default Linux or Microsoft driver).
-
WARNING: OpenGL features beyond OpenGL 1.1 generally do not work over Remote Desktop
|