Commit 2a262886 authored by Lars Krecklau's avatar Lars Krecklau

Added lots of options for building ACGL to the CMakeLists

parent 7b5df1f5
......@@ -13,75 +13,119 @@ SET(NEED_ACGL_GLOBAL_EXTERN_DIR TRUE)
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/GlobalAndLocalExternACGL.txt)
# OpenGL Support
IF(NOT DEFINED OPENGL_SUPPORT)
IF(NOT DEFINED OPENGL_SUPPORT_CORE_4_0)
SET(OPENGL_SUPPORT_CORE_4_0 TRUE CACHE BOOL "")
ENDIF()
IF(NOT DEFINED ACGL_OPENGL_SUPPORT)
SET(ACGL_OPENGL_SUPPORT CORE_42 CACHE STRING "")
SET_PROPERTY(CACHE ACGL_OPENGL_SUPPORT PROPERTY STRINGS CORE_32 CORE_33 CORE_40 CORE_41 CORE_41_ES CORE_42 FULL_21 FULL_30 FULL_31 FULL_32 FULL_33 FULL_40 FULL_41 FULL_42 ES_20)
ENDIF()
IF(NOT DEFINED OPENGL_SUPPORT_ES_2_1)
SET(OPENGL_SUPPORT_ES_2_1 TRUE CACHE BOOL "")
ENDIF()
IF(OPENGL_SUPPORT_CORE_4_0)
SET(OPENGL_SUPPORT_LIST ${OPENGL_SUPPORT_LIST} GL_CORE_4_0)
ENDIF()
# Error Level
IF(NOT DEFINED ACGL_ERROR_LEVEL)
SET(ACGL_ERROR_LEVEL EC0 CACHE STRING "")
SET_PROPERTY(CACHE ACGL_ERROR_LEVEL PROPERTY STRINGS EC0 EC1 EC2 EC3)
ENDIF()
IF(OPENGL_SUPPORT_ES_2_1)
SET(OPENGL_SUPPORT_LIST ${OPENGL_SUPPORT_LIST} GL_ES_2_1)
ENDIF()
ELSE()
SET(OPENGL_SUPPORT_LIST ${OPENGL_SUPPORT})
# UseQT
IF(NOT DEFINED ACGL_COMPILE_WITH_QT)
SET(ACGL_COMPILE_WITH_QT Yes CACHE STRING "")
SET_PROPERTY(CACHE ACGL_COMPILE_WITH_QT PROPERTY STRINGS Yes No)
ENDIF()
FOREACH(OPENGL_SUPPORT ${OPENGL_SUPPORT_LIST} )
################################################################################
# Basic Configuration
################################################################################
################################################################################
# Basic Configuration
################################################################################
# Where to find the cmake finders?
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Target directory
SET(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib")
################################################################################
# Project Files
################################################################################
# Name of the Project
PROJECT(AC${OPENGL_SUPPORT})
# Find all used files of certain file-types
FILE(GLOB_RECURSE SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc")
FILE(GLOB_RECURSE HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hh")
# Where to find the cmake finders?
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Add ACGL to the include path
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/include")
# Target directory
SET(LIBRARY_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib")
################################################################################
# Defines
################################################################################
################################################################################
# Project Files
################################################################################
# Define error check
ADD_DEFINITIONS(-DACGL_ERROR_LEVEL_${ACGL_ERROR_LEVEL})
# Define OpenGL Profile and Version:
STRING(REPLACE "_" ";" ACGL_OPENGL_SUPPORT_SPLIT ${ACGL_OPENGL_SUPPORT})
LIST(GET ACGL_OPENGL_SUPPORT_SPLIT 0 ACGL_OPENGL_PROFILE)
LIST(GET ACGL_OPENGL_SUPPORT_SPLIT 1 ACGL_OPENGL_VERSION)
ADD_DEFINITIONS(-DACGL_OPENGL_SUPPORT_${ACGL_OPENGL_SUPPORT})
ADD_DEFINITIONS(-DACGL_OPENGL_PROFILE_${ACGL_OPENGL_PROFILE})
ADD_DEFINITIONS(-DACGL_OPENGL_VERSION_${ACGL_OPENGL_VERSION})
# Set target platform
SET(ACGL_POSTFIX_ES "")
SET(ACGL_PLATFORM DESKTOP)
STRING(COMPARE EQUAL ${ACGL_OPENGL_PROFILE} ES EQ)
IF(EQ)
SET(FIND_GLEW FALSE)
SET(ACGL_PLATFORM MOBILE)
ELSE()
SET(FIND_GLEW TRUE)
LIST(FIND ACGL_OPENGL_SUPPORT_SPLIT ES ID)
IF(NOT ID EQUAL -1)
ADD_DEFINITIONS(-DACGL_SIMULATE_ES)
SET(ACGL_POSTFIX_ES "_ES")
ENDIF()
ENDIF()
# Find all used files of certain file-types
FILE(GLOB_RECURSE SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc")
FILE(GLOB_RECURSE HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hh")
ADD_DEFINITIONS(-DACGL_PLATFORM_${ACGL_PLATFORM})
# Add ACGL to the include path
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/include")
# Use Qt
SET(ACGL_POSTFIX_QT "")
STRING(COMPARE EQUAL ${ACGL_COMPILE_WITH_QT} Yes EQ)
IF(EQ)
SET(ACGL_POSTFIX_QT "_QT")
SET(FIND_QT TRUE)
ELSE()
SET(FIND_QT FALSE)
ENDIF()
################################################################################
# External Libraries
################################################################################
################################################################################
# External Libraries
################################################################################
# Qt
# Qt
IF(FIND_QT)
#MESSAGE("QT")
SET(QT_USE_QTOPENGL TRUE)
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
SET(LIBRARIES ${LIBRARIES} ${QT_LIBRARIES})
ENDIF()
# GLM
FIND_PACKAGE(GLM REQUIRED)
INCLUDE_DIRECTORIES(${GLM_INCLUDE_DIR})
# GLM
FIND_PACKAGE(GLM REQUIRED)
INCLUDE_DIRECTORIES(${GLM_INCLUDE_DIR})
# GLEW
# GLEW
IF(FIND_GLEW)
#MESSAGE("GLEW")
FIND_PACKAGE(GLEW REQUIRED)
INCLUDE_DIRECTORIES(${GLEW_INCLUDE_DIR})
SET(LIBRARIES ${LIBRARIES} ${GLEW_LIBRARIES})
ENDIF()
################################################################################
# Final Definition
################################################################################
# Define the Project, add all required sources and dependencies to it
ADD_LIBRARY(AC${OPENGL_SUPPORT}${COMPILE_POSTFIX} STATIC ${SOURCE_FILES} ${HEADER_FILES})
TARGET_LINK_LIBRARIES(AC${OPENGL_SUPPORT}${COMPILE_POSTFIX} ${LIBRARIES})
ENDFOREACH()
################################################################################
# Final Definition
################################################################################
# Define the Project, add all required sources and dependencies to it
SET(LIBRARY_NAME ACGL_${ACGL_ERROR_LEVEL}_${ACGL_OPENGL_PROFILE}${ACGL_OPENGL_VERSION}${ACGL_POSTFIX_ES}${ACGL_POSTFIX_QT}${COMPILE_POSTFIX})
ADD_LIBRARY(${LIBRARY_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES})
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${LIBRARIES})
#MESSAGE(${LIBRARY_NAME})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment