# HG changeset patch # User Eris Caffee # Date 1287374928 18000 # Node ID 0495feee881fbb5c9b09ff69c0ab3bd76b04f0dc First version almost done. Need to make old_views aware of which Fractal type the view is for. diff -r 000000000000 -r 0495feee881f .hgignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sun Oct 17 23:08:48 2010 -0500 @@ -0,0 +1,5 @@ +syntax: glob + +build*/* +*~ + diff -r 000000000000 -r 0495feee881f CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Sun Oct 17 23:08:48 2010 -0500 @@ -0,0 +1,209 @@ +############################################################################### +# +# A generalized cmake file for developing cross-platform games. +# +# Copyright (c) 2010 Eris Caffee +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# Instructions: +# This cmake file assumes that your source files are laid in out in the +# following manner: +# +# project_dir\ Top level directory of the project. +# |---include\ Header files are here. +# |---src\ Source files are here. +# |---build\ Binaries/objects go here. Run cmake from here. +# !---cmake\ +# | |---modules\ Custom cmake include files, if any, go here. +# |---CMakeLists.txt This file. +# +# You may have more directories, of course, but these are assumed. You probably +# want more than one build directory. I normally have build-linux\ +# and build-windows\ directories. +# +# Set the App_Name variable, below, to the name of your application and you +# are ready to start. Run ccmake, or cmake-gui from within your build +# directory, choose the options you need, such as enabling SDL, and you +# should be good to go. +# +# You can uncomment the "SET (CMAKE_VERBOSE_MAKEFILE ON) command if you +# need to debug the actual makefile that is generated. +# +# On windows, you may need to set the SDLDIR environment variable to the location +# of your SDL installation before you run cmake-gui. +# +# When writing path names on Windows, such as when manually specifiying a +# file or directory name, either use unix-style forward slashes '/' in the +# path names or use double backslashes. If you use a single backslash as the +# path name seperator, then cmake will interpret it as an esacpe sequence. +# Thus, write "C:/source" or "C:\\source" instead of "C:\source". It's +# probably best to use forward slashes in case to ever have a situation +# where cmake needs to do recursive processing: each level of cmake will +# strip out one of the slashes, so if there are two lev3els of cmake you +# need to write \\\, three levels requires \\\\, etc. +# +# Note that some of the cmake support scripts that find libraries for you +# can be controlled by environment variables. For example, you can set the +# SDLDIR environment variable before running cmake in order to point to +# a different version of SDL than your systems default copy. This is useful +# for trying out cutting edge versions of libraries without installing them +# system wide. + +cmake_minimum_required (VERSION 2.6 FATAL_ERROR) +#set (CMAKE_VERBOSE_MAKEFILE ON) + +# Name your program! +set (App_Name "mandelbrot") +if (App_Name STREQUAL "") + message (FATAL_ERROR "You must set the App_Name variable!") +endif () + +# Every project must have a name. +project (${App_Name}) + + +################################################################################ +# Ensure that we are not building in our source directories. + +set (Build_Dir_OK "TRUE") +string (REGEX MATCH "^${CMAKE_SOURCE_DIR}" In_Sub_Dir ${CMAKE_BINARY_DIR}) +if (In_Sub_Dir) + string (REGEX MATCH "^${CMAKE_SOURCE_DIR}/build" In_Build_Dir ${CMAKE_BINARY_DIR}) + if (NOT In_Build_Dir) + set (Build_Dir_OK "FALSE") + endif () +endif () + +if (NOT Build_Dir_OK) + message (FATAL_ERROR "You must run cmake from a directory that is not in your source tree, or that is in a special subdirectory of the tree whose name begins with 'build'.") +endif () + + +################################################################################ +# Set up the basic build environment +# A build type defines which options are passed to the compiler, and there are +# several that CMake defines by default. It does not set one by default, though +# so we need to set the build type manually here, and we are setting it to the +# generally useful "Release with debug info" + +if (CMAKE_BUILD_TYPE STREQUAL "") + # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This messes up + # differentiation between debug and release builds. + set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) +endif () + + +################################################################################ +# The core project files + +file (GLOB SRCS src/*.c src/*.cpp) +file (GLOB HDRS include/*.h include/*.hpp) + +# The directories that contain the libraries we will be linking against. +# This must come before the ADD_EXECUTABLE directive. +link_directories ( + ) + +# The directories that contain the include files our programs use. +# This must come before the ADD_EXECUTABLE directive. +include_directories ( + ${CMAKE_SOURCE_DIR}/include + ) + +# Define the executable program file we are creating. We must list all of +# the source files. +if (WIN32) + add_executable (${App_Name} WIN32 + ${SRCS} + ${HDRS} + ) +else () + add_executable (${App_Name} + ${SRCS} + ${HDRS} + ) +endif () + +# Although we listed the library directories above, we also need to list the +# individual libraries we will be linking against. +target_link_libraries (${App_Name} +) + + +################################################################################ +# SDL Support +# +# Enabling SDL support enables several suboptions to make some common SDL +# extension libraries available as well. +# +# If any of the SDL libraries are not found automatically, you will need +# to set the appropriate environment variables and rerun cmake. You will +# need to remove the CMake cache before doing so. + +# If you don't want to set actual environment variables before running +# CMake, then uncomment the if block below and put in the actual +# locations of your SDL installation. + +# if (WIN32) +# set (ENV{SDLDIR} "c:\gamedev\deps\sdl\SDL-build") +# else () +# set (ENV{SDLDIR} "/home/eris/gamedev/deps/sdl/SDL-build") +# endif () + +option(Option_SDL_Dev "Build an SDL application." OFF) + +if (Option_SDL_Dev) + + # SDL base package + # To use a version of SDL other than your systems default, set the SDLDIR + # environment variable to the installation location of your preferred version. + find_package (SDL) + if (NOT SDL_FOUND) + message (FATAL_ERROR "SDL not found!") + endif (NOT SDL_FOUND) + include_directories( + ${SDL_INCLUDE_DIR} + ${INCLUDE_DIRECTORIES} + ) + target_link_libraries(${App_Name} + ${SDL_LIBRARY} + ${TARGET_LINK_LIBRARIES} + ) + + # SDL_image + # Environment variables SDLIMAGEDIR and SDLDIR will be checked in that order + # and if set cmake will try to find SDL_image in the specified directory. + OPTION(Option_SDL_Dev_SDL_image "Use SDL_image." OFF) + IF (Option_SDL_Dev_SDL_image) + FIND_PACKAGE (SDL_image) + IF (NOT SDLIMAGE_FOUND) + MESSAGE (FATAL_ERROR "SDL_image not found!") + ENDIF (NOT SDLIMAGE_FOUND) + INCLUDE_DIRECTORIES( + ${SDLIMAGE_INCLUDE_DIR} + ${INCLUDE_DIRECTORIES} + ) + TARGET_LINK_LIBRARIES(${App_Name} + ${SDLIMAGE_LIBRARY} + ${TARGET_LINK_LIBRARIES} + ) + ENDIF (Option_SDL_Dev_SDL_image) + +endif (Option_SDL_Dev) + + +################################################################################