Open CrHasher opened 10 years ago
Hi, GLFW3 is currently untested on windows since I've only two windows machines available. But generally most of the build system is necessary only to build the examples properly, if you want to develop your own apps you basically just need to do the following:
include/
and 'implement/`` directories to a compiler search pathoglplus/config/site.hpp
file according to the template in config/oglplus/config/site.hpp.in
or define`OGLPLUS_NO_SITE_CONFIG`` before including any oglplus header.#undef
the GL version macros like GL_VERSION_4_4
in the site-config if some features are not supported.HTH
and I'll bump up the priority on the GLFW3 support.
Thanks for the quick reply. Could you please elaborate a bit on why the site_config.hpp is needed? And what are the implications of using OGLPLUS_NO_SITE_CONFIG? If let’s say I use two compilers (msvc and g++ on the same system) then I would need 2 site config files or one that works with both?
The site-config indicates which third-party libraries are available, the compiler's support for C++11 (or the lack thereof), etc. So yes, generally when using two or more different compilers you need several site configs, or have one large site config header with different sections (distinguished by #ifdef HAS_SOME_COMPILER
). Note however that this is just one of the solutions.
You may also define the OGLPLUS_NO_SITE_CONFIG
PP symbol, which causes the site config not to be included and some defaults being used. The defaults usually expect that your compiler supports all used C++11 features. In this case you can also define all the required symbols (like the OGLPLUS_NO_*
macros) in your (C)Makefile or in an IDE solution/project file.
So I modified the CMakeLists.txt of OGLPlus based on your input to:
# Copyright 2010-2014 Matus Chochlik. Distributed under the Boost
# Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
cmake_minimum_required(VERSION 2.8)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
project(OGLplus)
# install the "regular" headers
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/include/oglplus
DESTINATION ${OGLPLUS_INSTALL_BASE_DIR}/include
)
# install the implementation inline files
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/implement/oglplus
DESTINATION ${OGLPLUS_INSTALL_BASE_DIR}/include
)
Wrote a FindOGlplus.cmake file:
# - Find the OGLPlus library
# This module defines the following variables:
# OGLPLUS_INCLUDE_DIRS - include directories for OGLplus
# OGLPLUS_FOUND - true if OGLplus has been found and can be used
find_path(OGLPLUS_INCLUDE_DIR NAMES oglplus/all.hpp PATHS ${WE3D_LIBRARIES_DIR}/oglplus/include)
set(OGLPLUS_INCLUDE_DIRS ${OGLPLUS_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OGLPLUS
REQUIRED_VARS OGLPLUS_INCLUDE_DIR)
mark_as_advanced(OGLPLUS_INCLUDE_DIR)
Added some lines to my project CMakeLists.txt:
find_package(OGLplus REQUIRED)
#-- OGLplus configuration options
ADD_DEFINITIONS("-DOGLPLUS_NO_SITE_CONFIG") # Disable site config file
ADD_DEFINITIONS("-DOGLPLUS_USE_GLEW")
ADD_DEFINITIONS("-DOGLPLUS_USE_BOOST_CONFIG")
if(COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# ALL FEATURES SUPPORTED GCC 4.8.1 and above
elseif(MSVC)
# MSVC 2013 CTP Nov limitations
ADD_DEFINITIONS("-DOGLPLUS_NO_NOEXCEPT") #
ADD_DEFINITIONS("-DOGLPLUS_NO_UNICODE_LITERALS")
ADD_DEFINITIONS("-DOGLPLUS_NO_USER_DEFINED_LITERALS")
ADD_DEFINITIONS("-DOGLPLUS_NO_VARIADIC_TEMPLATES")
endif()
#--
I did not test this yet and did not #undef GL_VERSION_x_x but I get the idea behind it and will add some undef's if necessary.
Could you please double-check this config, do you see anything missing?
The first two look good at the first glance, in the third you generally need to give the OGLPLUS_*
symbols a boolean value 0
or 1
. For example
ADD_DEFINITIONS("-DOGLPLUS_USE_GLEW=1")
ADD_DEFINITIONS("-DOGLPLUS_USE_BOOST_CONFIG=1")
etc.
Changed last file to:
find_package(OGLplus REQUIRED)
#-- OGLplus configuration options
ADD_DEFINITIONS("-DOGLPLUS_NO_SITE_CONFIG") # Disable site config file
ADD_DEFINITIONS("-DOGLPLUS_OPENAL_FOUND=0")
ADD_DEFINITIONS("-DOGLPLUS_FREEGLUT_FOUND=0")
ADD_DEFINITIONS("-DOGLPLUS_PNG_FOUND=0")
ADD_DEFINITIONS("-DOGLPLUS_PANGO_CAIRO_FOUND=0")
ADD_DEFINITIONS("-DOGLPLUS_LOW_PROFILE=0")
ADD_DEFINITIONS("-DOGLPLUS_USE_GLCOREARB_H=0")
ADD_DEFINITIONS("-DOGLPLUS_USE_GL3_H=0")
ADD_DEFINITIONS("-DOGLPLUS_USE_GLEW=1")
ADD_DEFINITIONS("-DOGLPLUS_USE_GL3W=0")
ADD_DEFINITIONS("-DOGLPLUS_USE_BOOST_CONFIG=1")
if(COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# ALL FEATURES SUPPORTED GCC 4.8.1 and above
elseif(MSVC)
# MSVC 2013 CTP Nov c++11 support for OGLplus
ADD_DEFINITIONS("-DOGLPLUS_NO_SCOPED_ENUMS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_VARIADIC_MACROS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_VARIADIC_TEMPLATES=1")
ADD_DEFINITIONS("-DOGLPLUS_NO_UNIFIED_INITIALIZATION_SYNTAX=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_INITIALIZER_LISTS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_DEFAULTED_FUNCTIONS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_DELETED_FUNCTIONS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_EXPLICIT_CONVERSION_OPERATORS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_UNICODE_LITERALS=1")
ADD_DEFINITIONS("-DOGLPLUS_NO_USER_DEFINED_LITERALS=1")
ADD_DEFINITIONS("-DOGLPLUS_NO_TEMPLATE_ALIASES=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_CONSTEXPR=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_NOEXCEPT=1")
ADD_DEFINITIONS("-DOGLPLUS_NO_LAMBDAS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_NULLPTR=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_INHERITED_CONSTRUCTORS=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_CHRONO=0")
ADD_DEFINITIONS("-DOGLPLUS_NO_THREADS=0")
endif()
#--
Looks good, I don't see any problems there, but it's hard to tell without actually running the script.
Thanks for all the valuable info, I will start using OGLplus and will give more feedback if I run into issues. First I need to get started with some basic examples see if they work.
No problem, thanks for the feedback so far.
The header including OGLplus now looks like:
#pragma once
#define OPENGL_TARGET_VERSION_MAJOR 4
#define OPENGL_TARGET_VERSION_MINOR 0
#define OPENGL_TARGET_VERSION ( OPENGL_TARGET_VERSION_MAJOR * 10 \
+ OPENGL_TARGET_VERSION_MINOR * 1 )
///-- GLEW (always include before GLFW)
#define GLEW_STATIC
#include "GL/glew.h"
///--
///-- GLFW
#include "GLFW/glfw3.h"
///--
///-- GLM
#include "glm/glm.hpp"
///--
///-- OGLplus
#if OPENGL_TARGET_VERSION < 44
#ifdef GL_VERSION_4_4
#undef GL_VERSION_4_4
#endif
#endif
#if OPENGL_TARGET_VERSION < 43
#ifdef GL_VERSION_4_3
#undef GL_VERSION_4_3
#endif
#endif
#if OPENGL_TARGET_VERSION < 42
#ifdef GL_VERSION_4_2
#undef GL_VERSION_4_2
#endif
#endif
#if OPENGL_TARGET_VERSION < 41
#ifdef GL_VERSION_4_1
#undef GL_VERSION_4_1
#endif
#endif
#if OPENGL_TARGET_VERSION < 40
#ifdef GL_VERSION_4_0
#undef GL_VERSION_4_0
#endif
#endif
#if OPENGL_TARGET_VERSION < 33
#ifdef GL_VERSION_3_3
#undef GL_VERSION_3_3
#endif
#endif
#if OPENGL_TARGET_VERSION < 32
#ifdef GL_VERSION_3_2
#undef GL_VERSION_3_2
#endif
#endif
#if OPENGL_TARGET_VERSION < 31
#ifdef GL_VERSION_3_1
#undef GL_VERSION_3_1
#endif
#endif
#include "oglplus/all.hpp"
///--
Looks OK
When I run the configure script on Windows 7:
I get error:
After this I tried building OGLPlus with cmake and specifying all the includes and libs by hand but then I get error:
I managed to get to a state where I can run generate and build install to see what files are actually generated by cmake these are:
Are these files absolutely necessary for developing applications with OGLPlus? I don’t need to build the examples or documentation and can initialize opengl context myself with glfw3 and glew. Can I strip down CMakeLists.txt to a version that only installs oglplus headers to a directory and use those headers without issues? What should I do about the generated files?