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
|
2013-09-16 18:35:23 +00:00
|
|
|
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
|
2013-04-14 19:32:40 +00:00
|
|
|
|
|
|
|
# Find OpenGL
|
|
|
|
FIND_PACKAGE(OpenGL REQUIRED)
|
2013-09-16 18:35:23 +00:00
|
|
|
IF(OPENGL_FOUND)
|
2013-04-14 19:32:40 +00:00
|
|
|
MESSAGE("OpenGL found")
|
2013-09-16 18:35:23 +00:00
|
|
|
ELSE()
|
2013-04-14 19:32:40 +00:00
|
|
|
MESSAGE("OpenGL not found")
|
2013-09-16 18:35:23 +00:00
|
|
|
ENDIF()
|
2013-04-14 19:32:40 +00:00
|
|
|
|
|
|
|
# Find the GLEW library
|
|
|
|
FIND_PACKAGE(GLEW REQUIRED)
|
2013-09-16 18:35:23 +00:00
|
|
|
IF(GLEW_FOUND)
|
2013-04-14 19:32:40 +00:00
|
|
|
MESSAGE("GLEW found")
|
2013-09-16 18:35:23 +00:00
|
|
|
ELSE()
|
2013-04-14 19:32:40 +00:00
|
|
|
MESSAGE("GLEW not found")
|
2013-09-16 18:35:23 +00:00
|
|
|
ENDIF()
|
2013-04-14 19:32:40 +00:00
|
|
|
|
2013-09-10 19:53:34 +00:00
|
|
|
# If the user wants to use JPEG textures
|
2013-09-16 18:35:23 +00:00
|
|
|
IF(USE_JPEG_TEXTURES)
|
2013-09-10 19:53:34 +00:00
|
|
|
|
|
|
|
# Find the LIBJPEG library
|
|
|
|
FIND_PACKAGE(JPEG REQUIRED)
|
2013-09-16 18:35:23 +00:00
|
|
|
IF(JPEG_FOUND)
|
2013-09-10 19:53:34 +00:00
|
|
|
MESSAGE("LIBJPEG found")
|
2013-09-16 18:35:23 +00:00
|
|
|
ELSE()
|
2013-09-10 19:53:34 +00:00
|
|
|
MESSAGE("LIBJPEG not found")
|
2013-09-16 18:35:23 +00:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2013-04-14 19:32:40 +00:00
|
|
|
|
|
|
|
# Headers
|
2013-12-30 00:51:46 +00:00
|
|
|
INCLUDE_DIRECTORIES(src ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_PATH} ${JPEG_INCLUDE_DIR})
|
2013-04-14 19:32:40 +00:00
|
|
|
|
2013-09-16 18:35:23 +00:00
|
|
|
# Source files
|
|
|
|
SET(OPENGL_FRAMEWORK_SOURCES
|
|
|
|
"src/maths/Color.h"
|
|
|
|
"src/maths/Matrix3.h"
|
|
|
|
"src/maths/Matrix4.h"
|
|
|
|
"src/maths/Vector2.h"
|
|
|
|
"src/maths/Vector3.h"
|
|
|
|
"src/maths/Vector4.h"
|
|
|
|
"src/Camera.cpp"
|
|
|
|
"src/Camera.h"
|
|
|
|
"src/definitions.h"
|
|
|
|
"src/FrameBufferObject.cpp"
|
|
|
|
"src/FrameBufferObject.h"
|
|
|
|
"src/Light.h"
|
|
|
|
"src/Light.cpp"
|
|
|
|
"src/Mesh.h"
|
|
|
|
"src/Mesh.cpp"
|
|
|
|
"src/MeshReaderWriter.h"
|
|
|
|
"src/MeshReaderWriter.cpp"
|
|
|
|
"src/Object3D.h"
|
|
|
|
"src/Object3D.cpp"
|
|
|
|
"src/openglframework.h"
|
|
|
|
"src/Shader.h"
|
|
|
|
"src/Shader.cpp"
|
|
|
|
"src/Texture2D.h"
|
|
|
|
"src/Texture2D.cpp"
|
|
|
|
"src/TextureReaderWriter.h"
|
|
|
|
"src/TextureReaderWriter.cpp"
|
|
|
|
"src/VertexBufferObject.h"
|
|
|
|
"src/VertexBufferObject.cpp"
|
2013-04-14 19:32:40 +00:00
|
|
|
)
|
|
|
|
|
2013-09-16 18:35:23 +00:00
|
|
|
IF(USE_JPEG_TEXTURES)
|
|
|
|
ADD_DEFINITIONS(-DUSE_JPEG_TEXTURE)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# Create the library
|
|
|
|
ADD_LIBRARY (openglframework STATIC ${OPENGL_FRAMEWORK_SOURCES})
|
2013-04-14 19:32:40 +00:00
|
|
|
|
2013-09-16 18:35:23 +00:00
|
|
|
# Link with others libraries
|
2013-12-30 00:51:46 +00:00
|
|
|
TARGET_LINK_LIBRARIES(openglframework ${GLEW_LIBRARIES} ${OPENGL_LIBRARY})
|