2013-04-14 19:32:40 +00:00
|
|
|
# Minimum cmake version required
|
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|
|
|
|
|
|
|
# Project configuration
|
|
|
|
PROJECT(OPENGLFRAMEWORK)
|
|
|
|
|
2013-09-10 19:53:34 +00:00
|
|
|
# Options
|
|
|
|
OPTION(USE_JPEG_TEXTURES "Select this if you want to use jpeg textures (libjpeg required)" OFF)
|
|
|
|
|
2013-04-14 19:32:40 +00:00
|
|
|
# Where to find the module to find special packages/libraries
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
|
|
|
|
|
|
|
# Find OpenGL
|
|
|
|
FIND_PACKAGE(OpenGL REQUIRED)
|
|
|
|
if(OPENGL_FOUND)
|
|
|
|
MESSAGE("OpenGL found")
|
|
|
|
else()
|
|
|
|
MESSAGE("OpenGL not found")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Find the GLEW library
|
|
|
|
FIND_PACKAGE(GLEW REQUIRED)
|
|
|
|
if(GLEW_FOUND)
|
|
|
|
MESSAGE("GLEW found")
|
|
|
|
else()
|
|
|
|
MESSAGE("GLEW not found")
|
|
|
|
endif()
|
|
|
|
|
2013-09-10 19:53:34 +00:00
|
|
|
# If the user wants to use JPEG textures
|
|
|
|
if(USE_JPEG_TEXTURES)
|
|
|
|
|
|
|
|
# Find the LIBJPEG library
|
|
|
|
FIND_PACKAGE(JPEG REQUIRED)
|
|
|
|
if(JPEG_FOUND)
|
|
|
|
MESSAGE("LIBJPEG found")
|
|
|
|
else()
|
|
|
|
MESSAGE("LIBJPEG not found")
|
|
|
|
endif()
|
2013-04-14 19:32:40 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Freeglut
|
|
|
|
add_subdirectory(freeglut)
|
|
|
|
|
|
|
|
# Headers
|
|
|
|
INCLUDE_DIRECTORIES(src freeglut ${JPEG_INCLUDE_DIR})
|
|
|
|
|
2013-09-10 19:53:34 +00:00
|
|
|
if(USE_JPEG_TEXTURES)
|
|
|
|
add_definitions(-DUSE_JPEG_TEXTURE)
|
|
|
|
endif()
|
|
|
|
|
2013-04-14 19:32:40 +00:00
|
|
|
# Library configuration
|
|
|
|
file (
|
|
|
|
GLOB_RECURSE
|
|
|
|
OPENGLFRAMEWORK_SOURCES_FILES
|
|
|
|
src/*
|
|
|
|
)
|
|
|
|
|
|
|
|
# Require the opengl-framework code to be compiled in a static library
|
|
|
|
ADD_LIBRARY (
|
|
|
|
openglframework
|
|
|
|
STATIC
|
|
|
|
${OPENGLFRAMEWORK_SOURCES_FILES}
|
|
|
|
)
|
|
|
|
|
|
|
|
TARGET_LINK_LIBRARIES(openglframework ${GLEW_LIBRARIES} ${OPENGL_LIBRARY} freeglut_static)
|