changeset 1:0aaa058b0994

Version with sdl and sdl_ttf functions.
author Eris Caffee <discordia@eldalin.com>
date Thu, 14 Oct 2010 00:42:55 -0500
parents bacb3b7b582e
children 837f5d6c4a72
files .hgignore CMakeLists.txt src/main.c
diffstat 3 files changed, 36 insertions(+), 164 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/.hgignore	Thu Oct 14 00:42:55 2010 -0500
     1.3 @@ -0,0 +1,5 @@
     1.4 +syntax: glob
     1.5 +
     1.6 +build*/*
     1.7 +*~
     1.8 +
     2.1 --- a/CMakeLists.txt	Sat Oct 09 02:35:16 2010 -0500
     2.2 +++ b/CMakeLists.txt	Thu Oct 14 00:42:55 2010 -0500
     2.3 @@ -51,9 +51,13 @@
     2.4  # system wide.
     2.5  
     2.6  
     2.7 +
     2.8 +# Probably not needed, but it may save someone else a headache someday.
     2.9  CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
    2.10  
    2.11  
    2.12 +
    2.13 +# Name your program!
    2.14  SET (App_Name "check-sdl-version")
    2.15  IF (App_Name STREQUAL "") 
    2.16    MESSAGE (FATAL_ERROR "You must set the App_Name variable!")
    2.17 @@ -63,6 +67,7 @@
    2.18  #SET (CMAKE_VERBOSE_MAKEFILE ON)
    2.19  
    2.20  
    2.21 +# Every project must have a name.
    2.22  PROJECT (${App_Name})
    2.23  
    2.24  
    2.25 @@ -83,20 +88,17 @@
    2.26  ENDIF ()
    2.27  
    2.28  
    2.29 -###############################################################################
    2.30 -# If you have your own custom cmake modules that you want to include, put them
    2.31 -# in the the cmake/modules subdirectory of your project.
    2.32 -
    2.33 -SET (CMAKE_MODULE_PATH ${${App_Name}_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
    2.34 -
    2.35 -
    2.36  ################################################################################
    2.37 -# Set up the basic build environment                                 
    2.38 +# Set up the basic build environment
    2.39 +# A build type defines which options are passed to the compiler, and there are
    2.40 +# several that CMake defines by default. It does not set one by default, though
    2.41 +# so we need to set the build type manually here, and we are setting it to the
    2.42 +# generally useful "Release with debug info"
    2.43  
    2.44  IF (CMAKE_BUILD_TYPE STREQUAL "")
    2.45 -  # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
    2.46 +  # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This messes up
    2.47    # differentiation between debug and release builds.               
    2.48 -  SET (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
    2.49 +  SET (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
    2.50  ENDIF ()
    2.51  
    2.52                                                                  
    2.53 @@ -106,110 +108,44 @@
    2.54  FILE (GLOB SRCS src/*.c src/*.cpp)
    2.55  FILE (GLOB HDRS include/*.h include/*.hpp)
    2.56  
    2.57 +# The directories that contain the libraries we will be linking against.
    2.58 +# This must come before the ADD_EXECUTABLE directive.
    2.59  LINK_DIRECTORIES (
    2.60  )
    2.61  
    2.62 +# The directories that contain the include files our programs use.
    2.63 +# This must come before the ADD_EXECUTABLE directive.
    2.64  INCLUDE_DIRECTORIES (
    2.65    ${PROJECT_SOURCE_DIR}/include
    2.66  )
    2.67  
    2.68 +# Define the executable program file we are creating.  We must list all of
    2.69 +# the source files.
    2.70  ADD_EXECUTABLE (${App_Name}
    2.71        ${SRCS}
    2.72        ${HDRS}
    2.73  )
    2.74  
    2.75 +# Although we listed the library  directories above, we also need to list the
    2.76 +# individual libraries we will be linking against.
    2.77  TARGET_LINK_LIBRARIES (${App_Name}
    2.78  )
    2.79  
    2.80  
    2.81 -# # An example for a unix library named utils with a test driver program.
    2.82 -
    2.83 -# set (SRCS_utils
    2.84 -#   src/utils.cpp
    2.85 -#   include/utils.h
    2.86 -# )
    2.87 -
    2.88 -# INCLUDE_DIRECTORIES (
    2.89 -#   ${PROJECT_SOURCE_DIR}/include
    2.90 -# )
    2.91 -
    2.92 -# # Build both static and shared libraries
    2.93 -# # The target properties are needed because, by default, the output name
    2.94 -# # will be the name in the add_library command, and we need to have different
    2.95 -# # names in the two commands for the shared and static versions, even though
    2.96 -# # we want the final files to have the same names with different extensions.
    2.97 -# #
    2.98 -# # The prefix is needed mostly in case we build on windows, which has no prefix
    2.99 -# # by default.
   2.100 -# # 
   2.101 -# # The clean_direct_output option makes sure that the two lib builds don't
   2.102 -# # clobber each others temp files since they are being built from the same
   2.103 -# # sources.
   2.104 -
   2.105 -# ADD_LIBRARY (utils SHARED
   2.106 -#   ${SRCS_utils}
   2.107 -# )
   2.108 -# SET_TARGET_PROPERTIES (utils PROPERTIES OUTPUT_NAME "utils")
   2.109 -# SET_TARGET_PROPERTIES (utils PROPERTIES PREFIX "lib")
   2.110 -# SET_TARGET_PROPERTIES (utils PROPERTIES CLEAN_DIRECT_OUTPUT 1)
   2.111 -
   2.112 -# ADD_LIBRARY (utils-static STATIC
   2.113 -#   ${SRCS_utils}
   2.114 -# )
   2.115 -# SET_TARGET_PROPERTIES (utils-static PROPERTIES OUTPUT_NAME "utils")
   2.116 -# SET_TARGET_PROPERTIES (utils-static PROPERTIES PREFIX "lib")
   2.117 -# SET_TARGET_PROPERTIES (utils-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
   2.118 -
   2.119 -
   2.120 -
   2.121 -# # Build a test application.
   2.122 -
   2.123 -# ADD_EXECUTABLE (test
   2.124 -#   src/main.cpp
   2.125 -# )
   2.126 -
   2.127 -# TARGET_LINK_LIBRARIES (test
   2.128 -#   utils
   2.129 -# )
   2.130 -
   2.131 -
   2.132  ################################################################################
   2.133  # SDL Support
   2.134  #
   2.135  # Enabling SDL support enables several suboptions to make some common SDL
   2.136 -# extension libraries available as well.  On Windows, you will need to
   2.137 -# specify the path of the directory where you have installed the headers and
   2.138 -# libraries.  See below.
   2.139 +# extension libraries available as well. 
   2.140 +#
   2.141 +# If any of the SDL libraries are not found automatically, you will need
   2.142 +# to set the appropriate environment variables and rerun cmake.  You will
   2.143 +# need to remove the CMake cache before doing so.
   2.144  
   2.145  OPTION (Option_SDL_Dev "Build an SDL application." OFF)
   2.146  
   2.147  IF (Option_SDL_Dev)
   2.148  
   2.149 -  IF (WIN32)
   2.150 -
   2.151 -  # Windows has no standard locations for include files and libraries, 
   2.152 -  # so you need to specify them by hand.  Each of the SDLDIR environment
   2.153 -  # variables below is used by the corresponding FIND_PACAKGE script
   2.154 -  # to locate the needed include files and libraries.  Set each variable 
   2.155 -  # to the directory containing the files.  
   2.156 -
   2.157 -  # Some of the sdl packages do not provide built in support for MinGW 
   2.158 -  # compilation, and you will need to install the files appropriately by hand.
   2.159 -  # Each one needs 3 subdirectories under its top level: bin, include, and lib.
   2.160 -  # The bin directory is where you put the dll files, the include directory 
   2.161 -  # holds the header files, and the lib directory holds the libSDL*.a files
   2.162 -  # needed by the mingw linker.  Note that the dll's are not actually needed
   2.163 -  # for compilation, while the libs are, yet are run time the dlls are needed.
   2.164 -  # You will need to manually copy the dll's into an appropriate location, such
   2.165 -  # as the installation directory of your program.
   2.166 -
   2.167 -    SET (ENV{SDLDIR} "C:/deps/SDL-1.2.14")
   2.168 -    SET (ENV{SDLTTFDIR} "C:/deps/SDL_ttf-2.0.10")
   2.169 -    SET (ENV{SDLIMAGEDIR} "C:/deps/SDL_image-1.2.10")
   2.170 -    SET (ENV{SDLMIXERDIR} "C:/deps/SDL_mixer-1.2.11")
   2.171 -    SET (ENV{SDLNETDIR} "C:/deps/SDL_net-1.2.7")
   2.172 -  ENDIF (WIN32)
   2.173 -
   2.174    # SDL base package
   2.175    # To use a version of SDL other than your systems default, set the SDLDIR
   2.176    # environment variable to the installation location of your preferred version.
   2.177 @@ -306,77 +242,3 @@
   2.178  
   2.179  
   2.180  ################################################################################
   2.181 -
   2.182 -OPTION(Option_OGRE_Dev "Build with OGRE/OIS application." OFF)
   2.183 -
   2.184 -IF (Option_OGRE_Dev)
   2.185 -  set(CMAKE_MODULE_PATH                                                
   2.186 -    /usr/local/lib/OGRE/cmake
   2.187 -    ${CMAKE_MODULE_PATH}                                   
   2.188 -    )                                                                    
   2.189 -
   2.190 -  FIND_PACKAGE(OGRE)
   2.191 -  FIND_PACKAGE(OIS)
   2.192 -  INCLUDE_DIRECTORIES(
   2.193 -    ${INCLUDE_DIRECTORIES}
   2.194 -    ${OGRE_INCLUDE_DIRS}
   2.195 -    ${OGRE_CEGUIRenderer_INCLUDE_DIRS}
   2.196 -    ${OIS_INCLUDE_DIRS}
   2.197 -    )
   2.198 -  
   2.199 -  TARGET_LINK_LIBRARIES(${App_Name}
   2.200 -    ${TARGET_LINK_LIBRARIES}
   2.201 -    ${OGRE_LIBRARIES}
   2.202 -    ${OIS_LIBRARIES}
   2.203 -    ${TARGET_LINK_LIBRARIES}
   2.204 -    )
   2.205 -ENDIF (Option_OGRE_Dev)
   2.206 -
   2.207 -
   2.208 -################################################################################
   2.209 -#    ${OGRE_CEGUIRenderer_LIBRARIES}
   2.210 -
   2.211 -
   2.212 -
   2.213 -################################################################################
   2.214 -
   2.215 -OPTION(Option_OpenAL_Dev "Build an OpenAL Application." OFF)
   2.216 -
   2.217 -IF (Option_OpenAL_Dev)
   2.218 -  FIND_PACKAGE(OpenAL)
   2.219 -
   2.220 -  INCLUDE_DIRECTORIES(
   2.221 -    ${OpenAL_INCLUDE_DIR}
   2.222 -    ${INCLUDE_DIRECTORIES}
   2.223 -    )
   2.224 -
   2.225 -  TARGET_LINK_LIBRARIES(${App_Name}
   2.226 -    ${OpenAL_LIBRARIES}
   2.227 -    ${TARGET_LINK_LIBRARIES}
   2.228 -    )
   2.229 -
   2.230 -ENDIF (Option_OpenAL_Dev)
   2.231 -
   2.232 -
   2.233 -
   2.234 -################################################################################
   2.235 -
   2.236 -OPTION(Option_OpenGL_Dev "Build an OpenGL Application." OFF)
   2.237 -
   2.238 -IF (Option_OpenGL_Dev)
   2.239 -
   2.240 -  FIND_PACKAGE(OpenGL)
   2.241 -
   2.242 -  INCLUDE_DIRECTORIES(
   2.243 -    ${OpenGL_INCLUDE_DIR}
   2.244 -    ${INCLUDE_DIRECTORIES}
   2.245 -    )
   2.246 -
   2.247 -  TARGET_LINK_LIBRARIES(${App_Name}
   2.248 -    ${OpenGL_LIBRARIES}
   2.249 -    ${TARGET_LINK_LIBRARIES}
   2.250 -    )
   2.251 -
   2.252 -ENDIF (Option_OpenGL_Dev)
   2.253 -
   2.254 -################################################################################
     3.1 --- a/src/main.c	Sat Oct 09 02:35:16 2010 -0500
     3.2 +++ b/src/main.c	Thu Oct 14 00:42:55 2010 -0500
     3.3 @@ -3,6 +3,11 @@
     3.4  // check-sdl-version
     3.5  // Copyright (c) 2010 Sarah Eris Horsley Caffee
     3.6  //
     3.7 +// Just a quick test program to verify SDL installation and to use as an
     3.8 +// example for learning to use CMake.
     3.9 +//
    3.10 +// This program may be freely copied, distributed, and used for any purpose.
    3.11 +// 
    3.12  ******************************************************************************/
    3.13  
    3.14  #include <stdio.h>
    3.15 @@ -26,6 +31,6 @@
    3.16     SDL_TTF_VERSION(&ttf_compiled);
    3.17     ttf_linked = TTF_Linked_Version();
    3.18     printf("SDL_ttf version\t\t%d.%d.%d\t\t\t%d.%d.%d\n", ttf_compiled.major, ttf_compiled.minor, ttf_compiled.patch,
    3.19 -	  ttf_linked->major, ttf_linked->minor, ttf_linked->patch);
    3.20 +   	  ttf_linked->major, ttf_linked->minor, ttf_linked->patch);
    3.21  
    3.22     }