Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • Glow/glow
  • dseyb/glow
  • cmattes/glow
  • 1832/glow
  • yhe/glow
  • nspeetzen/glow
6 results
Select Git revision
Show changes
Commits on Source (379)
Showing
with 21053 additions and 63743 deletions
......@@ -8,7 +8,7 @@ Standard: Cpp11
# 80 columns guideline
ColumnLimit: 120
ColumnLimit: 150
PenaltyExcessCharacter: 1
PenaltyBreakString: 50
......@@ -17,7 +17,7 @@ PenaltyBreakString: 50
IndentWidth: 4
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortFunctionsOnASingleLine: All
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
#BraceBreakingStyle: ???
......@@ -32,7 +32,8 @@ IndentCaseLabels: false
# Spaces
DerivePointerAlignment: true
DerivePointerAlignment: false
PointerAlignment: Left
DerivePointerBinding: true
MaxEmptyLinesToKeep: 2
SpaceAfterControlStatementKeyword: true
......@@ -50,5 +51,9 @@ AccessModifierOffset: -4
# Comments
FixNamespaceComments: false
AlignTrailingComments: true
CommentPragmas: '!Api.*'
# Includes
IncludeBlocks: Preserve
\ No newline at end of file
[submodule "extern/glm"]
path = extern/glm
url = https://github.com/g-truc/glm
[submodule "extern/stb/stb"]
path = extern/stb/stb
url = https://github.com/nothings/stb.git
[submodule "extern/lodepng/lodepng"]
path = extern/lodepng/lodepng
url = https://github.com/lvandeve/lodepng
[submodule "extern/snappy/snappy"]
path = extern/snappy/snappy
url = https://github.com/google/snappy.git
......@@ -6,46 +6,72 @@ project(glow)
# minimum opengl
# e.g. CORE_42 or COMPATIBILITY_33
set(GLOW_OPENGL_SUPPORT CORE_44 CACHE STRING "Defines the OpenGL version with supported C++ code (higher versions work, but GLOW features are disabled. If you have a lower version, GLOW may crash when using those)")
set(GLOW_OPENGL_SUPPORT CORE_45 CACHE STRING "Defines the OpenGL version with supported C++ code (higher versions work, but GLOW features are disabled. If you have a lower version, GLOW may crash when using those)")
# libs
set(GLOW_USE_OWN_GLM ON CACHE BOOL "If true, extern/glm is used")
set(GLOW_USE_OWN_GLAD ON CACHE BOOL "If true, extern/glad is used")
set(GLOW_USE_OWN_FMT ON CACHE BOOL "If true, extern/fmt is used")
set(GLOW_USE_OWN_STB ON CACHE BOOL "If true, extern/stb is used")
set(GLOW_USE_OWN_LODEPNG ON CACHE BOOL "If true, extern/lodepng is used")
set(GLOW_USE_OWN_GLI ON CACHE BOOL "If true, extern/gli is used")
set(GLOW_USE_OWN_SNAPPY ON CACHE BOOL "If true, extern/snappy is used")
# build options
set(GLOW_LINK_TYPE SHARED CACHE STRING "Defines the build type of libraries (shared is default)")
set(GLOW_USE_GOLD_LINKER ON CACHE BOOL "If true, ld.gold is used for linking")
set(GLOW_USE_MOLD_LINKER ON CACHE BOOL "If true, ld.mold is used for linking")
set(GLOW_USE_GOLD_LINKER OFF CACHE BOOL "If true, ld.gold is used for linking")
set(GLOW_ENABLE_MARCH_NATIVE ON CACHE BOOL "If true, adds -march=native")
# misc
set(GLOW_AUTO_PROFILING ON CACHE BOOL "If true and aion target is present, glow will profile some likely-to-be-costly functions")
set(GLOW_VALIDATION ON CACHE BOOL "If true, checks if glow is initialized and called from the correct thread (very low performance impact)")
set(GLOW_CHECK_CXX_STANDARD ON CACHE BOOL "If true, checks if C++ standard is set globally (this is strongly recommended)")
set(GLOW_EXPERIMENTAL_THREAD_AGNOSTIC OFF CACHE BOOL "If true, glow does not use thread local and leaves thread management to the user")
set(GLOW_CMAKE_REPORT OFF CACHE BOOL "If true, prints a more elaborate report in cmake")
# binary dir
if (NOT GLOW_BIN_DIR)
set(GLOW_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(GLOW_BIN_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} PARENT_SCOPE)
message(STATUS "[glow] set GLOW_BIN_DIR to ${GLOW_BIN_DIR}")
endif()
# ==================================
# Basics
include(cmake/basic-setup.cmake)
include(cmake/UnityBuild.cmake)
if (GLOW_CMAKE_REPORT)
message(STATUS "GLOW CMake Config")
message(STATUS " Operating System : ${OPERATING_SYSTEM}")
message(STATUS " Compiler : ${COMPILER}")
message(STATUS " OpenGL : ${GLOW_OPENGL_SUPPORT}")
endif()
if(MSVC)
set(GLOW_LINK_TYPE STATIC CACHE STRING "" FORCE) # unfortunately, we need to link statically here
if(MSVC OR APPLE)
# we need to link statically on Windows and OSX
set(GLOW_LINK_TYPE STATIC CACHE STRING "" FORCE)
endif()
if(APPLE)
set(GLOW_USE_GOLD_LINKER OFF CACHE STRING "" FORCE) # no gold linker on mac
endif()
if (GLOW_CHECK_CXX_STANDARD)
if (NOT "${CMAKE_CXX_STANDARD}" GREATER 16)
message(FATAL_ERROR "[glow] CMAKE_CXX_STANDARD is less than 17, please specify at least SET(CMAKE_CXX_STANDARD 17)")
endif()
endif()
option(GLOW_ENABLE_UNITY_BUILD "If enabled, compiles this library as a single compilation unit" ON)
# ==================================
# Collect files
file(GLOB_RECURSE SOURCE_FILES "src/*.cc")
file(GLOB_RECURSE HEADER_FILES "src/*.hh")
file(GLOB_RECURSE HEADER_FILES "src/*.hh" "src/*.h")
file(GLOB_RECURSE TEST_FILES "test/*.cc" "test/*.hh")
file(GLOB_RECURSE SCRIPT_FILES "scripts/*.sh" "scripts/*.py")
if(${CMAKE_VERSION} VERSION_GREATER "3.8.0")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" FILES ${SOURCE_FILES} ${HEADER_FILES})
endif()
if (GLOW_ENABLE_UNITY_BUILD)
arcana_enable_unity_build(glow SOURCE_FILES 100 cc)
endif()
# ==================================
# Create GLOW target
......@@ -57,16 +83,12 @@ add_library(glow ${GLOW_LINK_TYPE}
# ==================================
# Compiler flags
if(NOT MSVC)
# internally, enable Werror and Wall
target_compile_options(glow PRIVATE
-Wall
-Werror
# for extra WHAM
# for extra errors
-Wextra
-Wpedantic
# -Wpedantic # glm broke this :(
# -Wshadow # glm has a lot of these unfortunately
-Wstrict-overflow
# -Wstrict-overflow # false positives!
-Wno-unused-parameter # we don't consider this an error
)
if(GCC)
......@@ -74,21 +96,33 @@ if(NOT MSVC)
else()
# clang supports this only at newer version
endif()
if (CLANG)
target_compile_options(glow PUBLIC
# -Wno-strict-aliasing # Temporary fix for https://github.com/g-truc/glm/issues/473
-Wno-gnu-anonymous-struct # used by glm
-Wno-nested-anon-types # used by glm
)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)
target_compile_options(glow PUBLIC
# C++11 for C++ files
$<$<COMPILE_LANGUAGE:CXX>:-std=c++11>
-Wno-strict-aliasing # Temporary fix for https://github.com/g-truc/glm/issues/473
-Wno-undefined-var-template # glTypeOf<>
)
endif()
endif()
target_link_libraries(glow PUBLIC pthread)
# mold linker
if(GLOW_USE_MOLD_LINKER)
target_link_libraries(glow PUBLIC -fuse-ld=mold)
# gold linker
if(GLOW_USE_GOLD_LINKER)
elseif(GLOW_USE_GOLD_LINKER)
# WRONG: target_compile_options(glow PUBLIC -fuse-ld=gold )
target_link_libraries(glow PUBLIC -fuse-ld=gold)
endif()
# arch-dependend optimization
if(NOT DEPLOY)
# optimize for native arch in non-deploy
if(GLOW_ENABLE_MARCH_NATIVE)
# optimize for native arch
target_compile_options(glow PUBLIC -march=native)
else()
# otherwise at least sse4.2
......@@ -97,6 +131,7 @@ if(NOT MSVC)
else() # MSVC
target_compile_options(glow PUBLIC
/MP # multi processor compilation
/FC # proper absolute paths from __FILE__
)
target_compile_definitions(glow PUBLIC
NOMINMAX # windows.h ...
......@@ -107,10 +142,6 @@ endif()
# ==================================
# Defines
target_compile_definitions(glow PUBLIC
# Build Type
GLOW_${GLOW_BUILD_TYPE}
GLOW_BUILD_TYPE=${GLOW_BUILD_TYPE}
# OS
GLOW_OS_${OPERATING_SYSTEM}
......@@ -133,6 +164,19 @@ string(REGEX MATCH "([0-9]+)" GLOW_OPENGL_VERSION ${GLOW_OPENGL_SUPPORT})
target_compile_definitions(glow PUBLIC GLOW_OPENGL_VERSION_${GLOW_OPENGL_VERSION})
target_compile_definitions(glow PUBLIC GLOW_OPENGL_VERSION=${GLOW_OPENGL_VERSION})
if(${GLOW_VALIDATION})
target_compile_definitions(glow PUBLIC GLOW_PERFORM_VALIDATION)
endif()
if (${GLOW_EXPERIMENTAL_THREAD_AGNOSTIC})
target_compile_definitions(glow PUBLIC GLOW_THREAD_AGNOSTIC)
endif()
if(GCC)
# workaround for https://github.com/nothings/stb/issues/280
target_link_libraries(glow PUBLIC gcc_s gcc)
endif()
# ==================================
# Include Dirs
target_include_directories(glow PUBLIC
......@@ -143,6 +187,7 @@ target_include_directories(glow PUBLIC
# Libraries
# OpenGL
set(OpenGL_GL_PREFERENCE GLVND) # prefer new opengl
find_package(OpenGL REQUIRED)
target_link_libraries(glow PUBLIC ${OpenGL_LIBRARIES})
if(WIN32) # Windows
......@@ -154,9 +199,32 @@ else() # Probably Linux
target_link_libraries(glow PUBLIC GL)
endif()
# Qt if found
if(Qt5Gui_FOUND)
message(STATUS "[glow] found Qt GUI, building with Qt support.")
target_link_libraries(glow PUBLIC ${Qt5Gui_LIBRARIES})
target_compile_definitions(glow PUBLIC GLOW_USE_QT)
endif()
# GLM
if(GLOW_USE_OWN_GLM)
target_include_directories(glow PUBLIC extern/glm)
if(TARGET glm)
target_link_libraries(glow PUBLIC glm)
target_compile_definitions(glow PUBLIC GLOW_USE_GLM)
target_compile_definitions(glow PUBLIC GLOW_HAS_GLM)
endif()
# clean-core
if (NOT TARGET clean-core)
message(FATAL_ERROR "[glow] requires clean-core")
endif()
target_link_libraries(glow PUBLIC clean-core)
# typed geometry
if(TARGET typed-geometry)
target_link_libraries(glow PUBLIC typed-geometry)
target_compile_definitions(glow PUBLIC GLOW_HAS_TG)
else()
message(FATAL_ERROR "no target 'typed-geomtry' found. GLOW requires typed-geometry. Is a submodule/dependency missing?")
endif()
# GLAD loader
......@@ -168,55 +236,18 @@ if(GLOW_USE_OWN_GLAD)
target_link_libraries(glow PUBLIC glad)
endif()
# C++ format
if(GLOW_USE_OWN_FMT)
add_subdirectory(extern/fmt)
target_link_libraries(glow PRIVATE fmt)
endif()
# STB image
if(GLOW_USE_OWN_STB)
add_subdirectory(extern/stb)
target_link_libraries(glow PRIVATE stb)
endif()
# Lodepng
if(GLOW_USE_OWN_LODEPNG)
add_subdirectory(extern/lodepng)
target_link_libraries(glow PRIVATE lodepng)
endif()
# GLI
if(GLOW_USE_OWN_GLI)
add_subdirectory(extern/gli)
target_link_libraries(glow PRIVATE gli)
endif()
# Snappy
if(GLOW_USE_OWN_SNAPPY)
add_subdirectory(extern/snappy)
target_link_libraries(glow PRIVATE snappy)
endif()
# AION
if(GLOW_AUTO_PROFILING)
if (TARGET aion)
message(STATUS "Building with aion-profiling ('aion' target found and auto-profiling active)")
message(STATUS "[glow] building with aion-profiling ('aion' target found and auto-profiling active)")
target_link_libraries(glow PUBLIC aion)
target_compile_definitions(glow PUBLIC GLOW_AION_PROFILING)
endif()
endif()
# ==================================
# dummy target for additional files
add_custom_target(_dummy_glow SOURCES
Readme.md
.clang-format
${SCRIPT_FILES}
)
# ==================================
# Report
if(GLOW_CMAKE_REPORT)
message(STATUS "")
message(STATUS "**************************************")
message(STATUS "GLOW CMake Report")
......@@ -247,3 +278,4 @@ endforeach()
message(STATUS "")
message(STATUS "**************************************")
message(STATUS "")
endif()
# Changelog
## Migration Guide
### to 1.0
* `typed-graphics` is now the required, internally used math library and `glm` is an optionally supported
* OpenGL 4.5+ is required
### to 0.9
* `glm` is an external dependency now (applications need to provide it themselves and make a target `glm` available)
* `ColorSpace` is now mandatory when loading textures
## Changes
### 1.0 (next version)
* Migration to C++17
* OpenGL 4.5+ is required
### 0.9 (current version)
* `glow::info()` now works with `glm` types again (and anything that either has `operator<<` or `to_string`)
* removed `fmt` and `snappy` dependencies
* made `glm` an externally-provided dependency
* CMake is now multi-config friendly (a single `.sln` for VS is sufficient now)
MIT License
Copyright (c) 2017 Visual Computing Institute
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
......@@ -2,22 +2,21 @@
## Requirements
* C++11
* C++17
* CMake 3.0+
* OpenGL 3.3+
* OpenGL 4.5+
## Dependencies
Most dependencies are configurable and can be replaced by own versions.
* GLM (math)
* Glad (ogl loading)
* `glm` (math, requires `GLM_ENABLE_EXPERIMENTAL` and `GLM_FORCE_CTOR_INIT` to be defined)
## Features and Goals
* Modern CMake Usage
* Modern C++ (C++11)
* Modern OpenGL (3.3+)
* Modern C++ (C++17)
* Modern OpenGL (4.5+)
* OpenGL Object Binding via RAII
* Automatic location mapping negotiation
* Automatic texture unit assignment
......
#
# Copyright (c) 2009-2012 Christoph Heindl
# Copyright (c) 2015 Csaba Kertész (csaba.kertesz@gmail.com)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the <organization> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
MACRO (arcana_commit_unity_file UNITY_FILE FILE_CONTENT)
SET(DIRTY FALSE)
# Check if the build file exists
SET(OLD_FILE_CONTENT "")
IF (NOT EXISTS ${${UNITY_FILE}} AND NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${${UNITY_FILE}})
SET(DIRTY TRUE)
ELSE ()
# Check the file content
FILE(STRINGS ${${UNITY_FILE}} OLD_FILE_CONTENT)
STRING(REPLACE ";" "" OLD_FILE_CONTENT "${OLD_FILE_CONTENT}")
STRING(REPLACE "\n" "" NEW_CONTENT "${${FILE_CONTENT}}")
STRING(COMPARE EQUAL "${OLD_FILE_CONTENT}" "${NEW_CONTENT}" EQUAL_CHECK)
IF (NOT EQUAL_CHECK EQUAL 1)
SET(DIRTY TRUE)
ENDIF ()
ENDIF ()
IF (DIRTY MATCHES TRUE)
MESSAGE(STATUS "[arcana_commit_unity_file] writing unity build file: " ${${UNITY_FILE}})
FILE(WRITE ${${UNITY_FILE}} "${${FILE_CONTENT}}")
ENDIF ()
# Create a dummy copy of the unity file to trigger CMake reconfigure if it is deleted.
SET(UNITY_FILE_PATH "")
SET(UNITY_FILE_NAME "")
GET_FILENAME_COMPONENT(UNITY_FILE_PATH ${${UNITY_FILE}} PATH)
GET_FILENAME_COMPONENT(UNITY_FILE_NAME ${${UNITY_FILE}} NAME)
CONFIGURE_FILE(${${UNITY_FILE}} ${UNITY_FILE_PATH}/CMakeFiles/${UNITY_FILE_NAME}.dummy)
ENDMACRO ()
MACRO (arcana_enable_unity_build TARGET_NAME SOURCE_VARIABLE_NAME UNIT_SIZE EXTENSION)
# Limit is zero based conversion of unit_size
MATH(EXPR LIMIT ${UNIT_SIZE}-1)
SET(FILES ${SOURCE_VARIABLE_NAME})
# Effectivly ignore the source files from the build, but keep track them for changes.
SET_SOURCE_FILES_PROPERTIES(${${FILES}} PROPERTIES HEADER_FILE_ONLY true)
# Counts the number of source files up to the threshold
SET(COUNTER ${LIMIT})
# Have one or more unity build files
SET(FILE_NUMBER 0)
SET(BUILD_FILE "")
SET(BUILD_FILE_CONTENT "")
SET(UNITY_BUILD_FILES "")
SET(_DEPS "")
FOREACH (SOURCE_FILE ${${FILES}})
IF (COUNTER EQUAL LIMIT)
SET(_DEPS "")
# Write the actual Unity Build file
IF (NOT ${BUILD_FILE} STREQUAL "" AND NOT ${BUILD_FILE_CONTENT} STREQUAL "")
arcana_commit_unity_file(BUILD_FILE BUILD_FILE_CONTENT)
ENDIF ()
SET(UNITY_BUILD_FILES ${UNITY_BUILD_FILES} ${BUILD_FILE})
# Set the variables for the current Unity Build file
SET(BUILD_FILE ${CMAKE_CURRENT_BINARY_DIR}/unitybuild_${FILE_NUMBER}_${TARGET_NAME}.${EXTENSION})
SET(BUILD_FILE_CONTENT "// Unity Build file generated by CMake\n")
MATH(EXPR FILE_NUMBER ${FILE_NUMBER}+1)
SET(COUNTER 0)
ENDIF ()
# Add source path to the file name if it is not there yet.
SET(FINAL_SOURCE_FILE "")
SET(SOURCE_PATH "")
GET_FILENAME_COMPONENT(SOURCE_PATH ${SOURCE_FILE} PATH)
IF (SOURCE_PATH STREQUAL "" OR NOT EXISTS ${SOURCE_FILE})
SET(FINAL_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
ELSE ()
SET(FINAL_SOURCE_FILE ${SOURCE_FILE})
ENDIF ()
# Treat only the existing files or moc_*.cpp files
STRING(FIND ${SOURCE_FILE} "moc_" MOC_POS)
IF (EXISTS ${FINAL_SOURCE_FILE} OR MOC_POS GREATER -1)
# Add md5 hash of the source file (except moc files) to the build file content
IF (MOC_POS LESS 0)
SET(MD5_HASH "")
FILE(MD5 ${FINAL_SOURCE_FILE} MD5_HASH)
SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}// md5: ${MD5_HASH}\n")
ENDIF ()
# Add the source file to the build file content
IF (MOC_POS GREATER -1)
SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}#include <${SOURCE_FILE}>\n")
ELSE ()
SET(BUILD_FILE_CONTENT "${BUILD_FILE_CONTENT}#include <${FINAL_SOURCE_FILE}>\n")
ENDIF ()
# Add the source dependencies to the Unity Build file
GET_SOURCE_FILE_PROPERTY(_FILE_DEPS ${SOURCE_FILE} OBJECT_DEPENDS)
IF (_FILE_DEPS)
SET(_DEPS ${_DEPS} ${_FILE_DEPS})
SET_SOURCE_FILES_PROPERTIES(${BUILD_FILE} PROPERTIES OBJECT_DEPENDS "${_DEPS}")
ENDIF()
# Keep counting up to the threshold. Increment counter.
MATH(EXPR COUNTER ${COUNTER}+1)
ENDIF ()
ENDFOREACH ()
# Write out the last Unity Build file
IF (NOT ${BUILD_FILE} STREQUAL "" AND NOT ${BUILD_FILE_CONTENT} STREQUAL "")
arcana_commit_unity_file(BUILD_FILE BUILD_FILE_CONTENT)
ENDIF ()
SET(UNITY_BUILD_FILES ${UNITY_BUILD_FILES} ${BUILD_FILE})
SET(${SOURCE_VARIABLE_NAME} ${${SOURCE_VARIABLE_NAME}} ${UNITY_BUILD_FILES})
ENDMACRO ()
MACRO (arcana_unity_generate_moc TARGET_NAME SOURCES HEADERS)
SET(NEW_SOURCES "")
FOREACH (HEADER_FILE ${${HEADERS}})
IF (NOT EXISTS ${HEADER_FILE})
MESSAGE(FATAL_ERROR "[arcana_unity_generate_moc] header file does not exist (mocing): ${HEADER_FILE}")
ENDIF ()
FILE(READ ${HEADER_FILE} FILE_CONTENT)
STRING(FIND "${FILE_CONTENT}" "Q_OBJECT" QOBJECT_POS)
STRING(FIND "${FILE_CONTENT}" "Q_SLOTS" QSLOTS_POS)
STRING(FIND "${FILE_CONTENT}" "Q_SIGNALS" QSIGNALS_POS)
STRING(FIND "${FILE_CONTENT}" "QObject" OBJECT_POS)
STRING(FIND "${FILE_CONTENT}" "slots" SLOTS_POS)
STRING(FIND "${FILE_CONTENT}" "signals" SIGNALS_POS)
IF (QOBJECT_POS GREATER 0 OR OBJECT_POS GREATER 0 OR QSLOTS_POS GREATER 0 OR Q_SIGNALS GREATER 0 OR
SLOTS_POS GREATER 0 OR SIGNALS GREATER 0)
# Generate the moc filename
GET_FILENAME_COMPONENT(HEADER_BASENAME ${HEADER_FILE} NAME_WE)
SET(MOC_FILENAME "moc_${HEADER_BASENAME}.cpp")
SET(NEW_SOURCES ${NEW_SOURCES} ; "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}")
ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}"
DEPENDS ${HEADER_FILE}
COMMAND ${QT_MOC_EXECUTABLE} ${HEADER_FILE} -o "${CMAKE_CURRENT_BINARY_DIR}/${MOC_FILENAME}")
ENDIF ()
ENDFOREACH ()
IF (NEW_SOURCES)
SET_SOURCE_FILES_PROPERTIES(${NEW_SOURCES} PROPERTIES GENERATED TRUE)
SET(${SOURCES} ${${SOURCES}} ; ${NEW_SOURCES})
ENDIF ()
ENDMACRO ()
\ No newline at end of file
......@@ -8,7 +8,7 @@
SET(LINUX ${UNIX})
SET(WINDOWS ${MSVC})
SET(MAC ${APPLE})
IF(CMAKE_CXX_COMPILER MATCHES ".*clang.?.?")
IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(CLANG ON)
SET(COMPILER CLANG)
SET(GCC OFF)
......@@ -33,22 +33,3 @@ ENDIF()
IF(${MAC})
SET(OPERATING_SYSTEM MAC)
ENDIF()
# Build Type (Debug, Release, Deploy, ...)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
ENDIF()
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release Debug Deploy)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(GLOW_BUILD_TYPE DEBUG)
elseif (CMAKE_BUILD_TYPE STREQUAL Release)
set(GLOW_BUILD_TYPE RELEASE)
elseif (CMAKE_BUILD_TYPE STREQUAL Deploy)
set(GLOW_BUILD_TYPE DEPLOY)
else()
message(ERROR "Unsupported build type! Please specify Debug, Release, or Deploy.")
endif()
# Set cmake search path
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
File moved
cmake_minimum_required(VERSION 3.0)
project(fmt)
add_library(fmt ${GLOW_LINK_TYPE}
fmt/format.cc
fmt/format.hh
)
if(MSVC)
target_compile_options(fmt PUBLIC /MP)
else()
target_compile_options(fmt PRIVATE -Wall -Werror -std=c++11)
endif()
target_include_directories(fmt PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
This diff is collapsed.
This diff is collapsed.
......@@ -15,7 +15,9 @@ endif()
set(GLAD_PATH "${GLAD_PROFILE}-${GLAD_VERSION}")
string(TOLOWER ${GLAD_PATH} GLAD_PATH)
if (GLOW_CMAKE_REPORT)
message(STATUS "including glad ${GLAD_PATH}")
endif()
add_library(glad ${GLOW_LINK_TYPE}
${GLAD_PATH}/src/glad.c
......@@ -26,4 +28,6 @@ target_include_directories(glad PUBLIC ${GLAD_PATH}/include)
if (NOT MSVC)
target_link_libraries(glad PRIVATE dl)
else()
target_link_libraries(glad PRIVATE legacy_stdio_definitions)
endif()
......@@ -2,7 +2,7 @@
#define __khrplatform_h_
/*
** Copyright (c) 2008-2009 The Khronos Group Inc.
** Copyright (c) 2008-2018 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
......@@ -26,18 +26,16 @@
/* Khronos platform-specific types and definitions.
*
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
* The master copy of khrplatform.h is maintained in the Khronos EGL
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
* The last semantic modification to khrplatform.h was at commit ID:
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by sending them to the public Khronos Bugzilla
* (http://khronos.org/bugzilla) by filing a bug against product
* "Khronos (general)" component "Registry".
*
* A predefined template which fills in some of the bug fields can be
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
* must create a Bugzilla login first.
* Please submit changes by filing pull requests or issues on
* the EGL Registry repository linked above.
*
*
* See the Implementer's Guidelines for information about where this file
......@@ -101,6 +99,8 @@
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#endif
......
This diff is collapsed.
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Khronos platform-specific types and definitions.
*
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by sending them to the public Khronos Bugzilla
* (http://khronos.org/bugzilla) by filing a bug against product
* "Khronos (general)" component "Registry".
*
* A predefined template which fills in some of the bug fields can be
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
* must create a Bugzilla login first.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef _WIN64
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.