Commit a98a8077 authored by Jan Möbius's avatar Jan Möbius

Added GLEWDEFINITIONS plugin macro.

Use openflipper_plugin( GLEWDEFINITIONS GL_BUFFER_UPDATE_BARRIER_BIT GL_SHADER_IMAGE_ACCESS_BARRIER_BIT )
to check for glew dependencies
closes #2258
closes #2353


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@19958 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 36a0850e
......@@ -26,6 +26,7 @@
# INCDIRS = additional include directories
# ADDSRC = additional source files
# INSTALLDATA = directories that will be installed into the openflipper data directory
# GLEWDEFINITIONS = Checks glew if it defines the given definitions
#
# TRANSLATION_LANGUAGES = language codes for translation
# TRANSLATION_ADDFILES = additional files that should be included into the translation files
......@@ -67,7 +68,7 @@ endmacro ()
# parse plugin macro parameter
macro (_get_plugin_parameters _prefix)
set (_current_var _foo)
set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD CDEFINITIONSADD LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA TRANSLATION_LANGUAGES TRANSLATION_ADDFILES)
set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD CDEFINITIONSADD LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA GLEWDEFINITIONS TRANSLATION_LANGUAGES TRANSLATION_ADDFILES)
set (_supported_flags LICENSEMANAGER)
foreach (_val ${_supported_var})
set (${_prefix}_${_val})
......@@ -367,7 +368,31 @@ macro (_plugin_licensemanagement)
endif()
endmacro ()
#======================================================
# check dependencies in GLEW library
# _prefix : prefix used ( usually the plugin name )
#======================================================
macro (_check_plugin_glew_deps _prefix )
foreach (_extension ${${_prefix}_GLEWDEFINITIONS})
acg_test_glew_definition( ${_extension} ${_prefix}_GLEW_HAS_DEFINITION_${_extension} )
# If the dependency is not found, we disable the plugin
if(NOT ${_prefix}_GLEW_HAS_DEFINITION_${_extension} )
set (${_prefix}_HAS_DEPS FALSE)
acg_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} GLEW extension ${_extension}")
endif()
endforeach()
endmacro ()
#======================================================
# main function
#======================================================
function (_build_openflipper_plugin plugin)
acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "0")
......@@ -394,6 +419,12 @@ function (_build_openflipper_plugin plugin)
set (${_PLUGIN}_HAS_DEPS)
_check_plugin_deps (${_PLUGIN} FALSE ${${_PLUGIN}_DEPS})
#============================================================================================
# CHECK for GLEW definitions
#============================================================================================
_check_plugin_glew_deps (${_PLUGIN})
#============================================================================================
# Remember Lib dirs for bundle generation
......@@ -727,4 +758,4 @@ macro (openflipper_plugin)
endmacro ()
# No stupid abundance of "Boost version" messages, please.
SET (Boost_FIND_QUIETLY TRUE PARENT_SCOPE)
\ No newline at end of file
SET (Boost_FIND_QUIETLY TRUE PARENT_SCOPE)
......@@ -957,3 +957,26 @@ function (generate_qhp_file files_loc plugin_name)
endif()
endforeach()
endfunction()
function(acg_test_glew_definition _def _out)
include(CheckCXXSourceRuns)
set(CMAKE_REQUIRED_INCLUDES ${GLEW_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${GLEW_LIBRARIES})
set(CMAKE_REQUIRED_DEFINITIONS -DCHECKING=${_def})
if(GLEW_FOUND)
if(NOT ${_out})
unset(${_out} CACHE) #clear cache, if previous test failed and try again
endif()
CHECK_CXX_SOURCE_RUNS("
#include <GL/glew.h>
int main()
{
#ifdef ${_def}
return 0;
#else
return 1;
#endif
}"
${_out})
endif()
endfunction()
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