From aeff6035397486e0bffbbd654fec195ebac2995a Mon Sep 17 00:00:00 2001 From: Julien Hamaide Date: Thu, 24 Jan 2019 10:42:14 +0100 Subject: [PATCH] Option to specify minimum opengl version at compile time --- CMakeLists.txt | 1 + cmake/bgfx.cmake | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 968bcf0..d7a1511 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ option( BGFX_AMALGAMATED "Amalgamated bgfx build for faster compilation" OF option( BX_AMALGAMATED "Amalgamated bx build for faster compilation" OFF ) option( BGFX_CONFIG_DEBUG "Enables debug configuration on all builds" OFF ) option( BGFX_USE_DEBUG_SUFFIX "Add 'd' suffix to debug output targets" ON ) +set( BGFX_OPENGL_VERSION "" CACHE STRING "Specify minimum opengl version" ) if( NOT BX_DIR ) set( BX_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bx" CACHE STRING "Location of bx." ) diff --git a/cmake/bgfx.cmake b/cmake/bgfx.cmake index 05c957f..a7cc4b7 100755 --- a/cmake/bgfx.cmake +++ b/cmake/bgfx.cmake @@ -43,6 +43,10 @@ if(BGFX_CONFIG_DEBUG) target_compile_definitions( bgfx PRIVATE BGFX_CONFIG_DEBUG=1) endif() +if( NOT ${BGFX_OPENGL_VERSION} STREQUAL "" ) + target_compile_definitions( bgfx PRIVATE BGFX_CONFIG_RENDERER_OPENGL=${BGFX_OPENGL_VERSION}) +endif() + # Special Visual Studio Flags if( MSVC ) target_compile_definitions( bgfx PRIVATE "_CRT_SECURE_NO_WARNINGS" )