pax_global_header00006660000000000000000000000064131075033520014511gustar00rootroot0000000000000052 comment=6f6e22a5a515825d9e97a2c41ac7bdf22d677609 forge-1.0.1/000077500000000000000000000000001310750335200126125ustar00rootroot00000000000000forge-1.0.1/.github/000077500000000000000000000000001310750335200141525ustar00rootroot00000000000000forge-1.0.1/.github/ISSUE_TEMPLATE.md000066400000000000000000000004731310750335200166630ustar00rootroot00000000000000**What issue(memory leak, slow renders, docs fix etc.) did you face?** **Please check if the issue fulfills these requirements** - [ ] For code issues, please share a small code stub that can reproduce the issue on our end. - [ ] For performance issues, please share comparison benchmarks. **Other information**: forge-1.0.1/.github/PULL_REQUEST_TEMPLATE.md000066400000000000000000000016571310750335200177640ustar00rootroot00000000000000**What kind of change does this PR introduce? (Bug fix, feature, documentation update, new examples etc.)** **What is the current behavior? (You can also link to an open issue here)** **What is the new behavior (if this is a feature change)?** **Does this PR ensure that key events handling across different window toolkits is identical if it has changes related to window toolkits?** **Does this PR introduce a breaking change?** **Please check if the PR fulfills these requirements** - [ ] The commit message following the [guidelines](https://github.com/arrayfire/forge/blob/devel/CONTRIBUTING.md#commit-message-format) - [ ] Examples for all compute backends, CUDA & OpenCL, have been added (for new examples) - [ ] Docs have been added / updated (for bug fixes / features) - [ ] Change compiles and executes on Linux, OSX and Windows (for window toolkit changes as CI builds don't check for this yet). **Other information**: forge-1.0.1/.gitignore000066400000000000000000000002771310750335200146100ustar00rootroot00000000000000build*/ *.swp *.swn *.swo **~ CMakeCache.txt CMakeFiles/ Makefile cmake_install.cmake GTAGS GRTAGS GPATH .dir-locals.el include/fg/version.h src/backend/version.hpp docs/details/examples.dox forge-1.0.1/CMakeLists.txt000066400000000000000000000111271310750335200153540ustar00rootroot00000000000000CMAKE_MINIMUM_REQUIRED(VERSION 3.0) OPTION(USE_HUNTER "Use Hunter cmake package handler" OFF) if(USE_HUNTER) include(${CMAKE_CURRENT_LIST_DIR}/CMakeModules/HunterGate.cmake) HunterGate( URL "https://github.com/ruslo/hunter/archive/v0.18.43.tar.gz" SHA1 "d2c8c42cd07f7cefe18fd9a9b9c13114b1a15a27" # LOCAL ) endif() PROJECT(FORGE) SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") INCLUDE(FGInstallDirs) INCLUDE(Version) ############################## BEGIN - CMAKE OPTIONS ########################## OPTION(BUILD_DOCUMENTATION "Build Documentation" OFF) OPTION(BUILD_EXAMPLES "Build Examples" ON) OPTION(USE_FREEIMAGE "Use freeimage to allow saving of charts" ON) # Set a default build type if none was specified IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") ENDIF() ############################## END - CMAKE OPTIONS ########################## ############################## BEGIN - OS Definitions ######################### IF(UNIX) ADD_DEFINITIONS(-Wall -std=c++11 -fvisibility=hidden) ENDIF() IF(UNIX) IF(APPLE) ADD_DEFINITIONS(-DOS_MAC) SET(CMAKE_MACOSX_RPATH ON) SET(CMAKE_SKIP_BUILD_RPATH FALSE) SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}") SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}") ENDIF("${isSystemDir}" STREQUAL "-1") ELSE(APPLE) ADD_DEFINITIONS(-DOS_LNX) ENDIF(APPLE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") ELSE(UNIX) ADD_DEFINITIONS(-DOS_WIN -DNOMINMAX) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") ENDIF(UNIX) ############################## END - OS Definitions ########################### INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include") ## X11 libraries need to be explicitly linked on MacOS ## This is required by both examples and the library itself ## Hence, it is placed here. SET(X11_LIBS "") IF(APPLE) FIND_PACKAGE(X11 REQUIRED) INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR}) SET(X11_LIBS ${X11_LIBRARIES}) ENDIF(APPLE) ADD_SUBDIRECTORY(src/backend) IF(BUILD_EXAMPLES) ADD_SUBDIRECTORY(examples) ENDIF() # Generate documentation IF(BUILD_DOCUMENTATION) ADD_SUBDIRECTORY(docs) ENDIF(BUILD_DOCUMENTATION) #-------------------------------------------------------------------- # Create generated files #-------------------------------------------------------------------- INCLUDE(CMakePackageConfigHelpers) configure_package_config_file("${PROJECT_SOURCE_DIR}/CMakeModules/ForgeConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/ForgeConfig.cmake" INSTALL_DESTINATION ${FG_INSTALL_CMAKE_DIR} PATH_VARS CMAKE_INSTALL_PREFIX NO_CHECK_REQUIRED_COMPONENTS_MACRO) write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/ForgeConfigVersion.cmake" VERSION ${FG_VERSION} COMPATIBILITY SameMajorVersion) #-------------------------------------------------------------------- # Install files other than the library, examples and docs # The library is installed by src/backend/*/CMakeLists.txt #-------------------------------------------------------------------- INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION "${FG_INSTALL_INC_DIR}" FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN ".gitignore" EXCLUDE ) INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/ForgeConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/ForgeConfigVersion.cmake" DESTINATION ${FG_INSTALL_CMAKE_DIR}) # We are only installing the source files for examples. # So this should not depend on the value of BUILD_EXAMPLES # These examples will be installed without building the executables for the examples INSTALL(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/examples/" DESTINATION "${FG_INSTALL_EXAMPLE_DIR}" COMPONENT examples) INSTALL(FILES "${PROJECT_SOURCE_DIR}/CMakeModules/FindOpenCL.cmake" DESTINATION "${FG_INSTALL_EXAMPLE_DIR}/CMakeModules/" COMPONENT examples) forge-1.0.1/CMakeModules/000077500000000000000000000000001310750335200151235ustar00rootroot00000000000000forge-1.0.1/CMakeModules/FGInstallDirs.cmake000066400000000000000000000035011310750335200205710ustar00rootroot00000000000000# # Sets Forge installation paths. # # NOTE: These paths are all relative to the project installation prefix. # Executables if(NOT DEFINED FG_INSTALL_BIN_DIR) set(FG_INSTALL_BIN_DIR "bin" CACHE PATH "Installation path for executables") endif() # Libraries if(NOT DEFINED FG_INSTALL_LIB_DIR) set(FG_INSTALL_LIB_DIR "lib" CACHE PATH "Installation path for libraries") endif() # Header files if(NOT DEFINED FG_INSTALL_INC_DIR) set(FG_INSTALL_INC_DIR "include" CACHE PATH "Installation path for headers") endif() # Data files if(NOT DEFINED FG_INSTALL_DATA_DIR) set(FG_INSTALL_DATA_DIR "share/Forge" CACHE PATH "Installation path for data files") endif() # Documentation if(NOT DEFINED FG_INSTALL_DOC_DIR) set(FG_INSTALL_DOC_DIR "${FG_INSTALL_DATA_DIR}/doc" CACHE PATH "Installation path for documentation") endif() if(NOT DEFINED FG_INSTALL_EXAMPLE_DIR) set(FG_INSTALL_EXAMPLE_DIR "${FG_INSTALL_DATA_DIR}/examples" CACHE PATH "Installation path for examples") endif() # Man pages if(NOT DEFINED FG_INSTALL_MAN_DIR) set(FG_INSTALL_MAN_DIR "${FG_INSTALL_DATA_DIR}/man" CACHE PATH "Installation path for man pages") endif() # CMake files if(NOT DEFINED FG_INSTALL_CMAKE_DIR) set(FG_INSTALL_CMAKE_DIR "${FG_INSTALL_DATA_DIR}/cmake" CACHE PATH "Installation path for CMake files") endif() # Use absolute paths (these changes are internal and will not show up in cache) # The cache will continue to show relative/absolute paths as used without modifications # This is required for configure_package_config_file in CMakeLists.txt # CMAKE_INSTALL_PREFIX # If this is relative, it is relative to PROJECT_BINARY_DIR if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX}) get_filename_component(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}" ABSOLUTE) endif() forge-1.0.1/CMakeModules/FindFontConfig.cmake000066400000000000000000000035611310750335200207670ustar00rootroot00000000000000#sourced from #https://github.com/rougier/freetype-gl/blob/master/CMakeModules/FindFontConfig.cmake # - Try to find Fontconfig # Once done this will define # # FONTCONFIG_FOUND - system has Fontconfig # FONTCONFIG_INCLUDE_DIR - the Fontconfig include directory # FONTCONFIG_LIBRARY - Link these to use Fontconfig # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. IF ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY ) # in cache already SET(Fontconfig_FIND_QUIETLY TRUE) ENDIF ( FONTCONFIG_INCLUDE_DIR AND FONTCONFIG_LIBRARY ) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls IF (NOT WIN32) FIND_PACKAGE(PkgConfig) pkg_check_modules(FONTCONFIG_PKG QUIET fontconfig) ENDIF (NOT WIN32) FIND_PATH(FONTCONFIG_INCLUDE_DIR NAMES fontconfig/fontconfig.h PATHS /usr/local/include /usr/X11/include /usr/include HINTS ${FONTCONFIG_PKG_INCLUDE_DIRS} # Generated by pkg-config ) IF (DEFINED FONTCONFIG_INCLUDE_DIR-NOTFOUND) MESSAGE(FATAL_ERROR "FontConfig header files not found") ENDIF (DEFINED FONTCONFIG_INCLUDE_DIR-NOTFOUND) FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig ${FONTCONFIG_PKG_LIBRARY} PATHS /usr/local /usr/X11 /usr HINTS ${FONTCONFIG_PKG_LIBRARY_DIRS} # Generated by pkg-config PATH_SUFFIXES lib64 lib ) IF (DEFINED FONTCONFIG_LIBRARY-NOTFOUND) MESSAGE(FATAL_ERROR "FontConfig library files not found") ENDIF (DEFINED FONTCONFIG_LIBRARY-NOTFOUND) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR) # show the FONTCONFIG_INCLUDE_DIR and FONTCONFIG_LIBRARY variables only in the advanced view MARK_AS_ADVANCED(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIBRARY) forge-1.0.1/CMakeModules/FindFreeImage.cmake000066400000000000000000000033171310750335200205560ustar00rootroot00000000000000# # Try to find the FreeImage library and include path. # Once done this will define # # FREEIMAGE_FOUND # FREEIMAGE_INCLUDE_PATH # FREEIMAGE_LIBRARY # FREEIMAGE_STATIC_LIBRARY # FREEIMAGE_DYNAMIC_LIBRARY # OPTION(USE_FREEIMAGE_STATIC "Use Static FreeImage Lib" OFF) FIND_PATH( FREEIMAGE_INCLUDE_PATH NAMES FreeImage.h HINTS ${PROJECT_SOURCE_DIR}/extern/FreeImage PATHS /usr/include /usr/local/include /sw/include /opt/local/include DOC "The directory where FreeImage.h resides") FIND_LIBRARY( FREEIMAGE_DYNAMIC_LIBRARY NAMES FreeImage freeimage HINTS ${PROJECT_SOURCE_DIR}/FreeImage PATHS /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /sw/lib /opt/local/lib DOC "The FreeImage library") SET(PX ${CMAKE_STATIC_LIBRARY_PREFIX}) SET(SX ${CMAKE_STATIC_LIBRARY_SUFFIX}) FIND_LIBRARY( FREEIMAGE_STATIC_LIBRARY NAMES ${PX}FreeImageLIB${SX} ${PX}FreeImage${SX} ${PX}freeimage${SX} HINTS ${PROJECT_SOURCE_DIR}/FreeImage PATHS /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /sw/lib /opt/local/lib DOC "The FreeImage library") UNSET(PX) UNSET(SX) IF(USE_FREEIMAGE_STATIC) MESSAGE(STATUS "Using Static FreeImage Lib") ADD_DEFINITIONS(-DFREEIMAGE_LIB) SET(FREEIMAGE_LIBRARY ${FREEIMAGE_STATIC_LIBRARY}) ELSE(USE_FREEIMAGE_STATIC) MESSAGE(STATUS "Using Dynamic FreeImage Lib") REMOVE_DEFINITIONS(-DFREEIMAGE_LIB) SET(FREEIMAGE_LIBRARY ${FREEIMAGE_DYNAMIC_LIBRARY}) ENDIF(USE_FREEIMAGE_STATIC) MARK_AS_ADVANCED( FREEIMAGE_DYNAMIC_LIBRARY FREEIMAGE_STATIC_LIBRARY ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FREEIMAGE DEFAULT_MSG FREEIMAGE_INCLUDE_PATH FREEIMAGE_LIBRARY) forge-1.0.1/CMakeModules/FindGLFW.cmake000066400000000000000000000037121310750335200174700ustar00rootroot00000000000000# Sourced from #https://code.google.com/p/assembly3d/ # Locate the glfw library # This module defines the following variables: # GLFW_LIBRARY, the name of the library; # GLFW_INCLUDE_DIR, where to find glfw include files. # GLFW_FOUND, true if both the GLFW_LIBRARY and GLFW_INCLUDE_DIR have been found. # # To help locate the library and include file, you could define an environment variable called # GLFW_ROOT which points to the root of the glfw library installation. This is pretty useful # on a Windows platform. # # # Usage example to compile an "executable" target to the glfw library: # # FIND_PACKAGE (GLFW REQUIRED) # INCLUDE_DIRECTORIES (${GLFW_INCLUDE_DIR}) # ADD_EXECUTABLE (executable ${EXECUTABLE_SRCS}) # TARGET_LINK_LIBRARIES (executable ${GLFW_LIBRARY}) # # TODO: # Allow the user to select to link to a shared library or to a static library. #Search for the include file... FIND_PATH(GLFW_INCLUDE_DIR GLFW/glfw3.h DOC "Path to GLFW include directory." HINTS $ENV{GLFW_ROOT} PATH_SUFFIX include #For finding the include file under the root of the glfw expanded archive, typically on Windows. PATHS /usr/include/ /usr/local/include/ # By default headers are under GLFW subfolder /usr/include/GLFW /usr/local/include/GLFW ${GLFW_ROOT_DIR}/include/ # added by ptr ) FIND_LIBRARY(GLFW_LIBRARY DOC "Absolute path to GLFW library." NAMES glfw GLFW.lib glfw3 HINTS $ENV{GLFW_ROOT} PATH_SUFFIXES lib/x64 release debug #For finding the library file under the root of the glfw expanded archive, typically on Windows. PATHS /usr/lib /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/lib/arm-linux-gnueabihf /usr/local/lib /usr/local/lib64 /sw/lib /opt/local/lib ${GLFW_ROOT_DIR}/lib-msvc100 # added by ptr ${GLFW_ROOT_DIR}/lib-msvc110 ${GLFW_ROOT_DIR}/lib-msvc120 ${GLFW_ROOT_DIR}/lib ) SET(GLFW_FOUND 0) IF(GLFW_LIBRARY AND GLFW_INCLUDE_DIR) SET(GLFW_FOUND 1) message(STATUS "GLFW found!") ENDIF(GLFW_LIBRARY AND GLFW_INCLUDE_DIR) forge-1.0.1/CMakeModules/FindOpenCL.cmake000066400000000000000000000125461310750335200200560ustar00rootroot00000000000000#.rst: # FindOpenCL # ---------- # # Try to find OpenCL # # Once done this will define:: # # OpenCL_FOUND - True if OpenCL was found # OpenCL_INCLUDE_DIRS - include directories for OpenCL # OpenCL_LIBRARIES - link against this library to use OpenCL # OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2) # OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation # OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation # # The module will also define two cache variables:: # # OpenCL_INCLUDE_DIR - the OpenCL include directory # OpenCL_LIBRARY - the path to the OpenCL library # #============================================================================= # From CMake 3.2 # Copyright 2014 Matthaeus G. Chajdas # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. # CMake - Cross Platform Makefile Generator # Copyright 2000-2014 Kitware, Inc. # Copyright 2000-2011 Insight Software Consortium # 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 names of Kitware, Inc., the Insight Software Consortium, # nor the names of their 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 THE COPYRIGHT # HOLDER OR CONTRIBUTORS 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. #============================================================================= function(_FIND_OPENCL_VERSION) include(CheckSymbolExists) include(CMakePushCheckState) set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY}) CMAKE_PUSH_CHECK_STATE() foreach(VERSION "2_0" "1_2" "1_1" "1_0") set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}") if(APPLE) CHECK_SYMBOL_EXISTS( CL_VERSION_${VERSION} "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h" OPENCL_VERSION_${VERSION}) else() CHECK_SYMBOL_EXISTS( CL_VERSION_${VERSION} "${OpenCL_INCLUDE_DIR}/CL/cl.h" OPENCL_VERSION_${VERSION}) endif() if(OPENCL_VERSION_${VERSION}) string(REPLACE "_" "." VERSION "${VERSION}") set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE) string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}") list(GET version_components 0 major_version) list(GET version_components 1 minor_version) set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE) set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE) break() endif() endforeach() CMAKE_POP_CHECK_STATE() endfunction() find_path(OpenCL_INCLUDE_DIR NAMES CL/cl.h OpenCL/cl.h PATHS ENV "PROGRAMFILES(X86)" ENV NVSDKCOMPUTE_ROOT ENV CUDA_PATH ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV ATISTREAMSDKROOT PATH_SUFFIXES include OpenCL/common/inc "AMD APP/include") _FIND_OPENCL_VERSION() if(WIN32) if(CMAKE_SIZEOF_VOID_P EQUAL 4) find_library(OpenCL_LIBRARY NAMES OpenCL PATHS ENV "PROGRAMFILES(X86)" ENV CUDA_PATH ENV NVSDKCOMPUTE_ROOT ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV ATISTREAMSDKROOT PATH_SUFFIXES "AMD APP/lib/x86" lib/x86 lib/Win32 OpenCL/common/lib/Win32) elseif(CMAKE_SIZEOF_VOID_P EQUAL 8) find_library(OpenCL_LIBRARY NAMES OpenCL PATHS ENV "PROGRAMFILES(X86)" ENV CUDA_PATH ENV NVSDKCOMPUTE_ROOT ENV AMDAPPSDKROOT ENV INTELOCLSDKROOT ENV ATISTREAMSDKROOT PATH_SUFFIXES "AMD APP/lib/x86_64" lib/x86_64 lib/x64 OpenCL/common/lib/x64) endif() else() find_library(OpenCL_LIBRARY NAMES OpenCL) endif() set(OpenCL_LIBRARIES ${OpenCL_LIBRARY}) set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR}) #include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args( OpenCL FOUND_VAR OpenCL_FOUND REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR VERSION_VAR OpenCL_VERSION_STRING) mark_as_advanced( OpenCL_INCLUDE_DIR OpenCL_LIBRARY) forge-1.0.1/CMakeModules/FindSDL2.cmake000066400000000000000000000021401310750335200174270ustar00rootroot00000000000000# Uses SDL2_ROOT_DIR variable to look up headers # and libraries along with standard system paths. This variable # is quite helpful on windows platform to specify SDL2 installation # path. # Up on finding required files, the following variables # will be set # SDL2_FOUND # SDL2_INCLUDE_DIR # SLD2_LIBRARY FIND_PATH(SDL2_INCLUDE_DIR SDL.h HINTS ${SDL2_ROOT_DIR} $ENV{SDL2_ROOT_DIR} PATH_SUFFIXES SDL2 # path suffixes to search inside ENV{SDL2_ROOT_DIR} include/SDL2 include ) FIND_LIBRARY(SDL2_LIBRARY NAMES SDL2 HINTS ${SDL2_ROOT_DIR} $ENV{SDL2_ROOT_DIR} PATH_SUFFIXES lib/x64 release debug PATHS /usr/lib /usr/lib64 /usr/lib/x86_64-linux-gnu /usr/lib/arm-linux-gnueabihf /usr/local/lib /usr/local/lib64 /sw/lib /opt/local/lib ${SDL2_ROOT_DIR}/lib-msvc100 ${SDL2_ROOT_DIR}/lib-msvc110 ${SDL2_ROOT_DIR}/lib-msvc120 ${SDL2_ROOT_DIR}/lib ) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) MARK_AS_ADVANCED(SDL2_INCLUDE_DIR SDL2_LIBRARY) forge-1.0.1/CMakeModules/ForgeConfig.cmake.in000066400000000000000000000045511310750335200207270ustar00rootroot00000000000000# Defines the following variables: # Forge_INCLUDE_DIRS - Location of Forge's include directory. # Forge_LIBRARIES - Location of Forge's libraries. # Forge_FOUND - True if Forge has been located # # You may provide a hint to where Forge's root directory may be located # by setting Forge_DIR. # #============================================================================= # Copyright (c) 2015, ArrayFire # 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 ArrayFire 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. #============================================================================= SET(FORGE_VERSION "@FORGE_VERSION@") @PACKAGE_INIT@ SET_AND_CHECK(FORGE_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/@FG_INSTALL_INC_DIR@") SET_AND_CHECK(FORGE_LIBRARY_DIRS "${PACKAGE_PREFIX_DIR}/@FG_INSTALL_LIB_DIR@") FIND_LIBRARY(FORGE_LIBRARIES forge HINTS ${FORGE_LIBRARY_DIRS}) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FORGE DEFAULT_MSG FORGE_INCLUDE_DIRS FORGE_LIBRARIES) forge-1.0.1/CMakeModules/ForgeConfigVersion.cmake.in000066400000000000000000000062721310750335200222770ustar00rootroot00000000000000#============================================================================= # Copyright (c) 2015, ArrayFire # 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 ArrayFire 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. #============================================================================= # This is a basic version file for the Config-mode of find_package(). # # The created file sets PACKAGE_VERSION_EXACT if the current version string and # the requested version string are exactly the same and it sets # PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, # but only if the requested major version is the same as the current one. set(PACKAGE_VERSION "@FG_VERSION_MAJOR@@FG_VERSION_MINOR@") if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() if("@FG_VERSION_MAJOR@@FG_VERSION_MINOR@" MATCHES "^([0-9]+)\\.") set(FORGE_VERSION_MAJOR "${CMAKE_MATCH_1}") else() set(FORGE_VERSION_MAJOR "@FG_VERSION_MAJOR@@FG_VERSION_MINOR@") endif() if("${PACKAGE_FIND_VERSION_MAJOR}" STREQUAL "${FORGE_VERSION_MAJOR}") set(PACKAGE_VERSION_COMPATIBLE TRUE) else() set(PACKAGE_VERSION_COMPATIBLE FALSE) endif() if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") set(PACKAGE_VERSION_EXACT TRUE) endif() endif() # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") return() endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) endif() forge-1.0.1/CMakeModules/GLSLtoH.cmake000066400000000000000000000046171310750335200173510ustar00rootroot00000000000000# Function to turn an GLSL shader source file into a C string within a source file. # xxd uses its input's filename to name the string and its length, so we # need to move them to a name that depends only on the path output, not its # input. Otherwise, builds in different relative locations would put the # source into different variable names, and everything would fall over. # The actual name will be filename (.s replaced with underscores), and length # name_len. # # Usage example: # # set(KERNELS a.cl b/c.cl) # resource_to_cxx_source( # SOURCES ${KERNELS} # VARNAME OUTPUTS # ) # add_executable(foo ${OUTPUTS}) # # The namespace they are placed in is taken from filename.namespace. # # For example, if the input file is kernel.cl, the two variables will be # unsigned char ns::kernel_cl[]; # unsigned int ns::kernel_cl_len; # # where ns is the contents of kernel.cl.namespace. INCLUDE(CMakeParseArguments) SET(GLSL2CPP_PROGRAM "glsl2cpp") FUNCTION(GLSL_TO_H) CMAKE_PARSE_ARGUMENTS(RTCS "" "VARNAME;EXTENSION;OUTPUT_DIR;TARGETS;NAMESPACE;EOF" "SOURCES" ${ARGN}) SET(_output_files "") FOREACH(_input_file ${RTCS_SOURCES}) GET_FILENAME_COMPONENT(_path "${_input_file}" PATH) GET_FILENAME_COMPONENT(_name "${_input_file}" NAME) GET_FILENAME_COMPONENT(var_name "${_input_file}" NAME_WE) SET(_namespace "${RTCS_NAMESPACE}") STRING(REPLACE "." "_" var_name ${var_name}) SET(_output_path "${CMAKE_CURRENT_BINARY_DIR}/${RTCS_OUTPUT_DIR}") SET(_output_file "${_output_path}/${var_name}.${RTCS_EXTENSION}") ADD_CUSTOM_COMMAND( OUTPUT ${_output_file} DEPENDS ${_input_file} ${GLSL2CPP_PROGRAM} COMMAND ${CMAKE_COMMAND} -E make_directory "${_output_path}" COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\<${_path}/${var_name}.hpp\\>" >>"${_output_file}" COMMAND ${GLSL2CPP_PROGRAM} --file ${_name} --namespace ${_namespace} --output ${_output_file} --name ${var_name} --eof ${RTCS_EOF} WORKING_DIRECTORY "${_path}" COMMENT "Converting ${_input_file} to GLSL source string" ) LIST(APPEND _output_files ${_output_file}) ENDFOREACH() ADD_CUSTOM_TARGET(${RTCS_NAMESPACE}_bin_target DEPENDS ${_output_files}) SET("${RTCS_VARNAME}" ${_output_files} PARENT_SCOPE) SET("${RTCS_TARGETS}" ${RTCS_NAMESPACE}_bin_target PARENT_SCOPE) ENDFUNCTION(GLSL_TO_H) forge-1.0.1/CMakeModules/HunterGate.cmake000066400000000000000000000372371310750335200202070ustar00rootroot00000000000000# Copyright (c) 2013-2015, Ruslan Baratov # 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. # # 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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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. # This is a gate file to Hunter package manager. # Include this file using `include` command and add package you need, example: # # cmake_minimum_required(VERSION 3.0) # # include("cmake/HunterGate.cmake") # HunterGate( # URL "https://github.com/path/to/hunter/archive.tar.gz" # SHA1 "798501e983f14b28b10cda16afa4de69eee1da1d" # ) # # project(MyProject) # # hunter_add_package(Foo) # hunter_add_package(Boo COMPONENTS Bar Baz) # # Projects: # * https://github.com/hunter-packages/gate/ # * https://github.com/ruslo/hunter cmake_minimum_required(VERSION 3.0) # Minimum for Hunter include(CMakeParseArguments) # cmake_parse_arguments option(HUNTER_ENABLED "Enable Hunter package manager support" ON) option(HUNTER_STATUS_PRINT "Print working status" ON) option(HUNTER_STATUS_DEBUG "Print a lot info" OFF) set(HUNTER_WIKI "https://github.com/ruslo/hunter/wiki") function(hunter_gate_status_print) foreach(print_message ${ARGV}) if(HUNTER_STATUS_PRINT OR HUNTER_STATUS_DEBUG) message(STATUS "[hunter] ${print_message}") endif() endforeach() endfunction() function(hunter_gate_status_debug) foreach(print_message ${ARGV}) if(HUNTER_STATUS_DEBUG) string(TIMESTAMP timestamp) message(STATUS "[hunter *** DEBUG *** ${timestamp}] ${print_message}") endif() endforeach() endfunction() function(hunter_gate_wiki wiki_page) message("------------------------------ WIKI -------------------------------") message(" ${HUNTER_WIKI}/${wiki_page}") message("-------------------------------------------------------------------") message("") message(FATAL_ERROR "") endfunction() function(hunter_gate_internal_error) message("") foreach(print_message ${ARGV}) message("[hunter ** INTERNAL **] ${print_message}") endforeach() message("[hunter ** INTERNAL **] [Directory:${CMAKE_CURRENT_LIST_DIR}]") message("") hunter_gate_wiki("error.internal") endfunction() function(hunter_gate_fatal_error) cmake_parse_arguments(hunter "" "WIKI" "" "${ARGV}") string(COMPARE EQUAL "${hunter_WIKI}" "" have_no_wiki) if(have_no_wiki) hunter_gate_internal_error("Expected wiki") endif() message("") foreach(x ${hunter_UNPARSED_ARGUMENTS}) message("[hunter ** FATAL ERROR **] ${x}") endforeach() message("[hunter ** FATAL ERROR **] [Directory:${CMAKE_CURRENT_LIST_DIR}]") message("") hunter_gate_wiki("${hunter_WIKI}") endfunction() function(hunter_gate_user_error) hunter_gate_fatal_error(${ARGV} WIKI "error.incorrect.input.data") endfunction() function(hunter_gate_self root version sha1 result) string(COMPARE EQUAL "${root}" "" is_bad) if(is_bad) hunter_gate_internal_error("root is empty") endif() string(COMPARE EQUAL "${version}" "" is_bad) if(is_bad) hunter_gate_internal_error("version is empty") endif() string(COMPARE EQUAL "${sha1}" "" is_bad) if(is_bad) hunter_gate_internal_error("sha1 is empty") endif() string(SUBSTRING "${sha1}" 0 7 archive_id) if(EXISTS "${root}/cmake/Hunter") set(hunter_self "${root}") else() set( hunter_self "${root}/_Base/Download/Hunter/${version}/${archive_id}/Unpacked" ) endif() set("${result}" "${hunter_self}" PARENT_SCOPE) endfunction() # Set HUNTER_GATE_ROOT cmake variable to suitable value. function(hunter_gate_detect_root) # Check CMake variable string(COMPARE NOTEQUAL "${HUNTER_ROOT}" "" not_empty) if(not_empty) set(HUNTER_GATE_ROOT "${HUNTER_ROOT}" PARENT_SCOPE) hunter_gate_status_debug("HUNTER_ROOT detected by cmake variable") return() endif() # Check environment variable string(COMPARE NOTEQUAL "$ENV{HUNTER_ROOT}" "" not_empty) if(not_empty) set(HUNTER_GATE_ROOT "$ENV{HUNTER_ROOT}" PARENT_SCOPE) hunter_gate_status_debug("HUNTER_ROOT detected by environment variable") return() endif() # Check HOME environment variable string(COMPARE NOTEQUAL "$ENV{HOME}" "" result) if(result) set(HUNTER_GATE_ROOT "$ENV{HOME}/.hunter" PARENT_SCOPE) hunter_gate_status_debug("HUNTER_ROOT set using HOME environment variable") return() endif() # Check SYSTEMDRIVE and USERPROFILE environment variable (windows only) if(WIN32) string(COMPARE NOTEQUAL "$ENV{SYSTEMDRIVE}" "" result) if(result) set(HUNTER_GATE_ROOT "$ENV{SYSTEMDRIVE}/.hunter" PARENT_SCOPE) hunter_gate_status_debug( "HUNTER_ROOT set using SYSTEMDRIVE environment variable" ) return() endif() string(COMPARE NOTEQUAL "$ENV{USERPROFILE}" "" result) if(result) set(HUNTER_GATE_ROOT "$ENV{USERPROFILE}/.hunter" PARENT_SCOPE) hunter_gate_status_debug( "HUNTER_ROOT set using USERPROFILE environment variable" ) return() endif() endif() hunter_gate_fatal_error( "Can't detect HUNTER_ROOT" WIKI "error.detect.hunter.root" ) endfunction() macro(hunter_gate_lock dir) if(NOT HUNTER_SKIP_LOCK) if("${CMAKE_VERSION}" VERSION_LESS "3.2") hunter_gate_fatal_error( "Can't lock, upgrade to CMake 3.2 or use HUNTER_SKIP_LOCK" WIKI "error.can.not.lock" ) endif() hunter_gate_status_debug("Locking directory: ${dir}") file(LOCK "${dir}" DIRECTORY GUARD FUNCTION) hunter_gate_status_debug("Lock done") endif() endmacro() function(hunter_gate_download dir) string( COMPARE NOTEQUAL "$ENV{HUNTER_DISABLE_AUTOINSTALL}" "" disable_autoinstall ) if(disable_autoinstall AND NOT HUNTER_RUN_INSTALL) hunter_gate_fatal_error( "Hunter not found in '${dir}'" "Set HUNTER_RUN_INSTALL=ON to auto-install it from '${HUNTER_GATE_URL}'" "Settings:" " HUNTER_ROOT: ${HUNTER_GATE_ROOT}" " HUNTER_SHA1: ${HUNTER_GATE_SHA1}" WIKI "error.run.install" ) endif() string(COMPARE EQUAL "${dir}" "" is_bad) if(is_bad) hunter_gate_internal_error("Empty 'dir' argument") endif() string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" is_bad) if(is_bad) hunter_gate_internal_error("HUNTER_GATE_SHA1 empty") endif() string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" is_bad) if(is_bad) hunter_gate_internal_error("HUNTER_GATE_URL empty") endif() set(done_location "${dir}/DONE") set(sha1_location "${dir}/SHA1") set(build_dir "${dir}/Build") set(cmakelists "${dir}/CMakeLists.txt") hunter_gate_lock("${dir}") if(EXISTS "${done_location}") # while waiting for lock other instance can do all the job hunter_gate_status_debug("File '${done_location}' found, skip install") return() endif() file(REMOVE_RECURSE "${build_dir}") file(REMOVE_RECURSE "${cmakelists}") file(MAKE_DIRECTORY "${build_dir}") # check directory permissions # Disabling languages speeds up a little bit, reduces noise in the output # and avoids path too long windows error file( WRITE "${cmakelists}" "cmake_minimum_required(VERSION 3.0)\n" "project(HunterDownload LANGUAGES NONE)\n" "include(ExternalProject)\n" "ExternalProject_Add(\n" " Hunter\n" " URL\n" " \"${HUNTER_GATE_URL}\"\n" " URL_HASH\n" " SHA1=${HUNTER_GATE_SHA1}\n" " DOWNLOAD_DIR\n" " \"${dir}\"\n" " SOURCE_DIR\n" " \"${dir}/Unpacked\"\n" " CONFIGURE_COMMAND\n" " \"\"\n" " BUILD_COMMAND\n" " \"\"\n" " INSTALL_COMMAND\n" " \"\"\n" ")\n" ) if(HUNTER_STATUS_DEBUG) set(logging_params "") else() set(logging_params OUTPUT_QUIET) endif() hunter_gate_status_debug("Run generate") # Need to add toolchain file too. # Otherwise on Visual Studio + MDD this will fail with error: # "Could not find an appropriate version of the Windows 10 SDK installed on this machine" if(EXISTS "${CMAKE_TOOLCHAIN_FILE}") set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") else() # 'toolchain_arg' can't be empty set(toolchain_arg "-DCMAKE_TOOLCHAIN_FILE=") endif() execute_process( COMMAND "${CMAKE_COMMAND}" "-H${dir}" "-B${build_dir}" "-G${CMAKE_GENERATOR}" "${toolchain_arg}" WORKING_DIRECTORY "${dir}" RESULT_VARIABLE download_result ${logging_params} ) if(NOT download_result EQUAL 0) hunter_gate_internal_error("Configure project failed") endif() hunter_gate_status_print( "Initializing Hunter workspace (${HUNTER_GATE_SHA1})" " ${HUNTER_GATE_URL}" " -> ${dir}" ) execute_process( COMMAND "${CMAKE_COMMAND}" --build "${build_dir}" WORKING_DIRECTORY "${dir}" RESULT_VARIABLE download_result ${logging_params} ) if(NOT download_result EQUAL 0) hunter_gate_internal_error("Build project failed") endif() file(REMOVE_RECURSE "${build_dir}") file(REMOVE_RECURSE "${cmakelists}") file(WRITE "${sha1_location}" "${HUNTER_GATE_SHA1}") file(WRITE "${done_location}" "DONE") hunter_gate_status_debug("Finished") endfunction() # Must be a macro so master file 'cmake/Hunter' can # apply all variables easily just by 'include' command # (otherwise PARENT_SCOPE magic needed) macro(HunterGate) if(HUNTER_GATE_DONE) # variable HUNTER_GATE_DONE set explicitly for external project # (see `hunter_download`) set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES) endif() # First HunterGate command will init Hunter, others will be ignored get_property(_hunter_gate_done GLOBAL PROPERTY HUNTER_GATE_DONE SET) if(NOT HUNTER_ENABLED) # Empty function to avoid error "unknown function" function(hunter_add_package) endfunction() elseif(_hunter_gate_done) hunter_gate_status_debug("Secondary HunterGate (use old settings)") hunter_gate_self( "${HUNTER_CACHED_ROOT}" "${HUNTER_VERSION}" "${HUNTER_SHA1}" _hunter_self ) include("${_hunter_self}/cmake/Hunter") else() set(HUNTER_GATE_LOCATION "${CMAKE_CURRENT_LIST_DIR}") string(COMPARE NOTEQUAL "${PROJECT_NAME}" "" _have_project_name) if(_have_project_name) hunter_gate_fatal_error( "Please set HunterGate *before* 'project' command. " "Detected project: ${PROJECT_NAME}" WIKI "error.huntergate.before.project" ) endif() cmake_parse_arguments( HUNTER_GATE "LOCAL" "URL;SHA1;GLOBAL;FILEPATH" "" ${ARGV} ) string(COMPARE EQUAL "${HUNTER_GATE_SHA1}" "" _empty_sha1) string(COMPARE EQUAL "${HUNTER_GATE_URL}" "" _empty_url) string( COMPARE NOTEQUAL "${HUNTER_GATE_UNPARSED_ARGUMENTS}" "" _have_unparsed ) string(COMPARE NOTEQUAL "${HUNTER_GATE_GLOBAL}" "" _have_global) string(COMPARE NOTEQUAL "${HUNTER_GATE_FILEPATH}" "" _have_filepath) if(_have_unparsed) hunter_gate_user_error( "HunterGate unparsed arguments: ${HUNTER_GATE_UNPARSED_ARGUMENTS}" ) endif() if(_empty_sha1) hunter_gate_user_error("SHA1 suboption of HunterGate is mandatory") endif() if(_empty_url) hunter_gate_user_error("URL suboption of HunterGate is mandatory") endif() if(_have_global) if(HUNTER_GATE_LOCAL) hunter_gate_user_error("Unexpected LOCAL (already has GLOBAL)") endif() if(_have_filepath) hunter_gate_user_error("Unexpected FILEPATH (already has GLOBAL)") endif() endif() if(HUNTER_GATE_LOCAL) if(_have_global) hunter_gate_user_error("Unexpected GLOBAL (already has LOCAL)") endif() if(_have_filepath) hunter_gate_user_error("Unexpected FILEPATH (already has LOCAL)") endif() endif() if(_have_filepath) if(_have_global) hunter_gate_user_error("Unexpected GLOBAL (already has FILEPATH)") endif() if(HUNTER_GATE_LOCAL) hunter_gate_user_error("Unexpected LOCAL (already has FILEPATH)") endif() endif() hunter_gate_detect_root() # set HUNTER_GATE_ROOT # Beautify path, fix probable problems with windows path slashes get_filename_component( HUNTER_GATE_ROOT "${HUNTER_GATE_ROOT}" ABSOLUTE ) hunter_gate_status_debug("HUNTER_ROOT: ${HUNTER_GATE_ROOT}") if(NOT HUNTER_ALLOW_SPACES_IN_PATH) string(FIND "${HUNTER_GATE_ROOT}" " " _contain_spaces) if(NOT _contain_spaces EQUAL -1) hunter_gate_fatal_error( "HUNTER_ROOT (${HUNTER_GATE_ROOT}) contains spaces." "Set HUNTER_ALLOW_SPACES_IN_PATH=ON to skip this error" "(Use at your own risk!)" WIKI "error.spaces.in.hunter.root" ) endif() endif() string( REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-_a-z0-9]*" HUNTER_GATE_VERSION "${HUNTER_GATE_URL}" ) string(COMPARE EQUAL "${HUNTER_GATE_VERSION}" "" _is_empty) if(_is_empty) set(HUNTER_GATE_VERSION "unknown") endif() hunter_gate_self( "${HUNTER_GATE_ROOT}" "${HUNTER_GATE_VERSION}" "${HUNTER_GATE_SHA1}" _hunter_self ) set(_master_location "${_hunter_self}/cmake/Hunter") if(EXISTS "${HUNTER_GATE_ROOT}/cmake/Hunter") # Hunter downloaded manually (e.g. by 'git clone') set(_unused "xxxxxxxxxx") set(HUNTER_GATE_SHA1 "${_unused}") set(HUNTER_GATE_VERSION "${_unused}") else() get_filename_component(_archive_id_location "${_hunter_self}/.." ABSOLUTE) set(_done_location "${_archive_id_location}/DONE") set(_sha1_location "${_archive_id_location}/SHA1") # Check Hunter already downloaded by HunterGate if(NOT EXISTS "${_done_location}") hunter_gate_download("${_archive_id_location}") endif() if(NOT EXISTS "${_done_location}") hunter_gate_internal_error("hunter_gate_download failed") endif() if(NOT EXISTS "${_sha1_location}") hunter_gate_internal_error("${_sha1_location} not found") endif() file(READ "${_sha1_location}" _sha1_value) string(COMPARE EQUAL "${_sha1_value}" "${HUNTER_GATE_SHA1}" _is_equal) if(NOT _is_equal) hunter_gate_internal_error( "Short SHA1 collision:" " ${_sha1_value} (from ${_sha1_location})" " ${HUNTER_GATE_SHA1} (HunterGate)" ) endif() if(NOT EXISTS "${_master_location}") hunter_gate_user_error( "Master file not found:" " ${_master_location}" "try to update Hunter/HunterGate" ) endif() endif() include("${_master_location}") set_property(GLOBAL PROPERTY HUNTER_GATE_DONE YES) endif() endmacro() forge-1.0.1/CMakeModules/Version.cmake000066400000000000000000000032511310750335200175530ustar00rootroot00000000000000# # Make a version file that includes the Forge version and git revision # CMAKE_POLICY(PUSH) IF("${CMAKE_VERSION}" VERSION_GREATER "3.1" OR "${CMAKE_VERSION}" VERSION_EQUAL "3.1") CMAKE_POLICY(SET CMP0054 OLD) ENDIF() SET(FG_VERSION_MAJOR "1") SET(FG_VERSION_MINOR "0") SET(FG_VERSION_PATCH "1") SET(FG_VERSION "${FG_VERSION_MAJOR}.${FG_VERSION_MINOR}.${FG_VERSION_PATCH}") SET(FG_API_VERSION_CURRENT ${FG_VERSION_MAJOR}${FG_VERSION_MINOR}) # From CMake 3.0.0 CMAKE__COMPILER_ID is AppleClang for OSX machines # that use clang for compilations IF("${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang") SET(COMPILER_NAME "AppleClang") ELSEIF("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") SET(COMPILER_NAME "LLVM Clang") ELSEIF("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") SET(COMPILER_NAME "GNU Compiler Collection(GCC/G++)") ELSEIF("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel") SET(COMPILER_NAME "Intel Compiler") ELSEIF("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") SET(COMPILER_NAME "Microsoft Visual Studio") ENDIF() SET(COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}") SET(FG_COMPILER_STRING "${COMPILER_NAME} ${COMPILER_VERSION}") EXECUTE_PROCESS( COMMAND git log -1 --format=%h WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) IF(NOT GIT_COMMIT_HASH) MESSAGE(STATUS "No git. Setting hash to default") SET(GIT_COMMIT_HASH "default") ENDIF() CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/CMakeModules/version.h.in ${PROJECT_SOURCE_DIR}/include/fg/version.h ) CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/CMakeModules/version.hpp.in ${PROJECT_SOURCE_DIR}/src/backend/version.hpp ) CMAKE_POLICY(POP) forge-1.0.1/CMakeModules/build_cl2hpp.cmake000066400000000000000000000016531310750335200205010ustar00rootroot00000000000000INCLUDE(ExternalProject) SET(prefix ${PROJECT_BINARY_DIR}/third_party/cl2hpp) ExternalProject_Add( cl2hpp-ext GIT_REPOSITORY https://github.com/KhronosGroup/OpenCL-CLHPP.git GIT_TAG 75bb7d0d8b2ffc6aac0a3dcaa22f6622cab81f7c PREFIX "${prefix}" INSTALL_DIR "${prefix}/package" UPDATE_COMMAND "" CONFIGURE_COMMAND ${CMAKE_COMMAND} -Wno-dev "-G${CMAKE_GENERATOR}" -DCMAKE_SOURCE_DIR:PATH= -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_DOCS:BOOL=OFF -DBUILD_EXAMPLES:BOOL=OFF -DBUILD_TESTS:BOOL=OFF ) ExternalProject_Get_Property(cl2hpp-ext install_dir) ADD_CUSTOM_TARGET(cl2hpp DEPENDS "${prefix}/package/CL/cl2.hpp") ADD_DEPENDENCIES(cl2hpp cl2hpp-ext) SET(CL2HPP_INCLUDE_DIRECTORY ${install_dir}) forge-1.0.1/CMakeModules/build_freetype.cmake000066400000000000000000000037161310750335200211360ustar00rootroot00000000000000INCLUDE(ExternalProject) SET(prefix ${PROJECT_BINARY_DIR}/third_party/ft) SET(LIB_POSTFIX "") IF (${CMAKE_BUILD_TYPE} STREQUAL "Debug") SET(LIB_POSTFIX "d") ENDIF() SET(freetype_location ${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}freetype${LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) IF(CMAKE_VERSION VERSION_LESS 3.2) IF(CMAKE_GENERATOR MATCHES "Ninja") MESSAGE(WARNING "Building freetype with Ninja has known issues with CMake older than 3.2") endif() SET(byproducts) ELSE() SET(byproducts BYPRODUCTS ${freetype_location}) ENDIF() IF(UNIX) SET(CXXFLAGS "${CMAKE_CXX_FLAGS} -w -fPIC") SET(CFLAGS "${CMAKE_C_FLAGS} -w -fPIC") ENDIF(UNIX) ExternalProject_Add( ft-ext GIT_REPOSITORY http://git.sv.nongnu.org/r/freetype/freetype2.git GIT_TAG VER-2-7-1 PREFIX "${prefix}" INSTALL_DIR "${prefix}" UPDATE_COMMAND "" CONFIGURE_COMMAND ${CMAKE_COMMAND} -Wno-dev "-G${CMAKE_GENERATOR}" -DWITH_HarfBuzz=OFF -DWITH_ZLIB=OFF -DWITH_BZip2=OFF -DWITH_PNG=OFF -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS:STRING=${CXXFLAGS} -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_C_FLAGS:STRING=${CFLAGS} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= ${byproducts} ) ADD_LIBRARY(freetype IMPORTED STATIC) ExternalProject_Get_Property(ft-ext install_dir) SET_TARGET_PROPERTIES(freetype PROPERTIES IMPORTED_LOCATION ${freetype_location}) ADD_DEPENDENCIES(freetype ft-ext) # Based on the instructions on freetype site # for header path inclusion given at below URL # https://www.freetype.org/freetype2/docs/tutorial/step1.html#section-1 # we are including /include/freetype2 as FREETYPE_INCLUDE_DIRS SET(FREETYPE_INCLUDE_DIRS "${install_dir}/include/freetype2" CACHE INTERNAL "" FORCE) SET(FREETYPE_LIBRARIES ${freetype_location} CACHE INTERNAL "" FORCE) SET(FREETYPE_FOUND ON CACHE INTERNAL "" FORCE) forge-1.0.1/CMakeModules/build_glbinding.cmake000066400000000000000000000034401310750335200212420ustar00rootroot00000000000000INCLUDE(ExternalProject) SET(prefix ${PROJECT_BINARY_DIR}/third_party/glb) SET(LIB_POSTFIX "") IF (${CMAKE_BUILD_TYPE} STREQUAL "Debug") SET(LIB_POSTFIX "d") ENDIF() SET(glbinding_location ${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}glbinding${LIB_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) IF(CMAKE_VERSION VERSION_LESS 3.2) IF(CMAKE_GENERATOR MATCHES "Ninja") MESSAGE(WARNING "Building with Ninja has known issues with CMake older than 3.2") endif() SET(byproducts) ELSE() SET(byproducts BYPRODUCTS ${glbinding_location}) ENDIF() IF(UNIX) SET(CXXFLAGS "${CMAKE_CXX_FLAGS} -w -fPIC") SET(CFLAGS "${CMAKE_C_FLAGS} -w -fPIC") ENDIF(UNIX) ExternalProject_Add( glb-ext GIT_REPOSITORY https://github.com/cginternals/glbinding.git GIT_TAG v2.1.1 UPDATE_COMMAND "" PREFIX "${prefix}" INSTALL_DIR "${prefix}" CONFIGURE_COMMAND ${CMAKE_COMMAND} -Wno-dev "-G${CMAKE_GENERATOR}" -DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS:STRING=${CXXFLAGS} -DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} -DCMAKE_C_FLAGS:STRING=${CFLAGS} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DBUILD_SHARED_LIBS:BOOL=OFF -DOPTION_BUILD_TESTS:BOOL=OFF -DGLFW_LIBRARY_RELEASE:PATH=${GLFW_LIBRARY} -DGLFW_LIBRARY_DEBUG:PATH=${GLFW_LIBRARY} ${byproducts} ) ADD_LIBRARY(glbinding IMPORTED STATIC) ExternalProject_Get_Property(glb-ext install_dir) SET_TARGET_PROPERTIES(glbinding PROPERTIES IMPORTED_LOCATION ${glbinding_location}) ADD_DEPENDENCIES(glbinding glb-ext) SET(GLBINDING_INCLUDE_DIRS ${install_dir}/include CACHE INTERNAL "" FORCE) SET(GLBINDING_LIBRARIES ${glbinding_location} CACHE INTERNAL "" FORCE) SET(GLBINDING_FOUND ON CACHE INTERNAL "" FORCE) forge-1.0.1/CMakeModules/build_glm.cmake000066400000000000000000000041151310750335200200640ustar00rootroot00000000000000SET(VER 0.9.7.4) SET(URL https://github.com/g-truc/glm/archive/${VER}.tar.gz) SET(MD5 475b0092c3baaf6ac899dc0dcd87f898) SET(thirdPartyDir "${PROJECT_BINARY_DIR}/third_party") SET(srcDir "${thirdPartyDir}/glm-${VER}") SET(archive ${srcDir}.tar.gz) SET(inflated ${srcDir}-inflated) # the config to be used in the code SET(GLM_INCLUDE_DIRS "${srcDir}") # do we have to do it again? SET(doExtraction ON) IF(EXISTS "${inflated}") FILE(READ "${inflated}" extractedMD5) IF("${extractedMD5}" STREQUAL "${MD5}") # nope, everything looks fine return() ENDIF() ENDIF() # lets get and extract GLM MESSAGE(STATUS "GLM...") IF(EXISTS "${archive}") FILE(MD5 "${archive}" md5) IF(NOT "${md5}" STREQUAL "${MD5}") MESSAGE(" wrong check sum ${md5}, redownloading") FILE(REMOVE "${archive}") ENDIF() ENDIF() IF(NOT EXISTS "${archive}") MESSAGE(STATUS " getting ${URL}") FILE(DOWNLOAD "${URL}" ${archive} STATUS rv SHOW_PROGRESS) ENDIF() MESSAGE(STATUS " validating ${archive}") FILE(MD5 "${archive}" md5) IF(NOT "${md5}" STREQUAL "${MD5}") MESSAGE(WARNING "${archive}: Invalid check sum ${md5}. Expected was ${MD5}") IF("${md5}" STREQUAL "d41d8cd98f00b204e9800998ecf8427e") MESSAGE(STATUS "Trying wget ${URL}") EXECUTE_PROCESS(COMMAND wget -O ${archive} ${URL}) FILE(MD5 "${archive}" md5_) IF(NOT "${md5_}" STREQUAL "${MD5}") MESSAGE(FATAL_ERROR "${archive}: Invalid check sum ${md5_}. Expected was ${MD5}") ENDIF(NOT "${md5_}" STREQUAL "${MD5}") MESSAGE(STATUS "wget successful") ENDIF("${md5}" STREQUAL "d41d8cd98f00b204e9800998ecf8427e") ENDIF() IF(IS_DIRECTORY ${srcDir}) MESSAGE(STATUS " cleaning ${cleaning}") FILE(REMOVE_RECURSE ${srcDir}) ENDIF() MESSAGE(STATUS " extracting ${archive}") FILE(MAKE_DIRECTORY ${srcDir}) EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E tar xfz ${archive} WORKING_DIRECTORY ${thirdPartyDir} RESULT_VARIABLE rv) IF(NOT rv EQUAL 0) MESSAGE(FATAL_ERROR "'${archive}' extraction failed") ENDIF() FILE(WRITE ${inflated} "${MD5}") forge-1.0.1/CMakeModules/examples.dox.in000066400000000000000000000000271310750335200200610ustar00rootroot00000000000000/** @EXAMPLES_LIST@ */ forge-1.0.1/CMakeModules/glsl2cpp.cpp000066400000000000000000000114021310750335200173530ustar00rootroot00000000000000// Umar Arshad // Copyright 2015-2019 // // Modified by Pradeep Garigipati on Dec 30, 2015 for Forge // Purpose of modification: To use the program to convert // GLSL shader files into compile time constant string literals #include #include #include #include #include #include #include using namespace std; typedef map opt_t; static void print_usage() { cout << R"delimiter(GLSL2CPP Converts OpenGL shader files to C++ headers. It is similar to bin2c and xxd but adds support for namespaces. | --name | name of the variable (default: var) | | --file | input file | | --output | output file (If no output is specified then it prints to stdout) | | --type | Type of variable (default: char) | | --namespace | A space seperated list of namespaces | | --formatted | Tabs for formatting | | --version | Prints my name | | --help | Prints usage info | Example ------- Command: ./glsl2cpp --file blah.txt --namespace shaders --formatted --name image_vs Will produce the following: #pragma once #include namespace shaders { static const char image_vs[] = R"shader( #version 330 layout(location = 0) in vec3 pos; layout(location = 1) in vec2 tex; uniform mat4 matrix; out vec2 texcoord; void main() { texcoord = tex; gl_Position = matrix * vec4(pos,1.0); } )shader"; } )delimiter"; exit(0); } static bool formatted; static void add_tabs(const int level) { if(formatted) { for(int i =0; i < level; i++) { cout << "\t"; } } } static opt_t parse_options(const vector& args) { opt_t options; options["--name"] = ""; options["--type"] = ""; options["--file"] = ""; options["--output"] = ""; options["--namespace"] = ""; options["--eof"] = ""; //Parse Arguments string curr_opt; bool verbose = false; for(auto arg : args) { if(arg == "--verbose") { verbose = true; } else if(arg == "--formatted") { formatted = true; } else if(arg == "--version") { cout << args[0] << " Original Author: Umar Arshad;\n Modified later by: Pradeep Garigipati." << endl; } else if(arg == "--help") { print_usage(); } else if(options.find(arg) != options.end()) { curr_opt = arg; } else if(curr_opt.empty()) { //cerr << "Invalid Argument: " << arg << endl; } else { if(options[curr_opt] != "") { options[curr_opt] += " " + arg; } else { options[curr_opt] += arg; } } } if(verbose) { for(auto opts : options) { cout << get<0>(opts) << " " << get<1>(opts) << endl; } } return options; } int main(int argc, const char * const * const argv) { vector args(argv, argv+argc); opt_t&& options = parse_options(args); //Save default cout buffer. Need this to prevent crash. auto bak = cout.rdbuf(); unique_ptr outfile; // Set defaults if(options["--name"] == "") { options["--name"] = "var"; } if(options["--output"] != "") { //redirect stream if output file is specified outfile.reset(new ofstream(options["--output"])); cout.rdbuf(outfile->rdbuf()); } cout << "#pragma once\n"; cout << "#include \n"; // defines std::string int ns_cnt = 0; int level = 0; if(options["--namespace"] != "") { std::stringstream namespaces(options["--namespace"]); string name; namespaces >> name; do { add_tabs(level++); cout << "namespace " << name << "\n{\n"; ns_cnt++; namespaces >> name; } while(!namespaces.fail()); } if(options["--type"] == "") { options["--type"] = "std::string"; } add_tabs(level); cout << "static const " << options["--type"] << " " << options["--name"] << " = R\"shader(\n"; level++; ifstream input(options["--file"]); for(std::string line; std::getline(input, line);) { add_tabs(level); cout << line << endl; } if (options["--eof"].c_str()[0] == '1') { // Add end of file character cout << "0x0"; } add_tabs(--level); cout << ")shader\";\n"; while(ns_cnt--) { add_tabs(--level); cout << "}\n"; } cout.rdbuf(bak); } forge-1.0.1/CMakeModules/version.h.in000066400000000000000000000010731310750335200173670ustar00rootroot00000000000000/******************************************************* * Copyright (c) 2014, ArrayFire * All rights reserved. * * This file is distributed under 3-clause BSD license. * The complete license agreement can be obtained at: * http://arrayfire.com/licenses/BSD-3-Clause ********************************************************/ #pragma once #define FG_VERSION "@FG_VERSION@" #define FG_VERSION_MAJOR @FG_VERSION_MAJOR@ #define FG_VERSION_MINOR @FG_VERSION_MINOR@ #define FG_VERSION_PATCH @FG_VERSION_PATCH@ #define FG_API_VERSION_CURRENT @FG_API_VERSION_CURRENT@ forge-1.0.1/CMakeModules/version.hpp.in000066400000000000000000000006601310750335200177300ustar00rootroot00000000000000/******************************************************* * Copyright (c) 2014, ArrayFire * All rights reserved. * * This file is distributed under 3-clause BSD license. * The complete license agreement can be obtained at: * http://arrayfire.com/licenses/BSD-3-Clause ********************************************************/ #pragma once #define FG_REVISION "@GIT_COMMIT_HASH@" #define FG_CMPLR_STR "@FG_COMPILER_STRING@" forge-1.0.1/CONTRIBUTING.md000066400000000000000000000162051310750335200150470ustar00rootroot00000000000000# Contributing to Forge We'd love for you to contribute to our source code and to make Forge even better than it is today! Here are the guidelines we'd like you to follow: - [Question or Problem?](#question) - [Issues and Bugs](#issue) - [Feature Requests](#feature) - [Submission Guidelines](#submit) - [Commit Message Guidelines](#commit) ## Got a Question or Problem? If you have questions about how to use Forge, please direct these to the [Google Group][groups] discussion list or [Github][github]. We are also available on [Gitter][gitter]. ## Found an Issue? If you find a bug in the source code or a mistake in the documentation, you can help us by submitting an issue to our [GitHub Repository][github]. Even better you can submit a Pull Request with a fix. ## Want a Feature? You can request a new feature by submitting an issue to our [GitHub Repository][github]. If you would like to implement a new feature then consider what kind of change it is: * **Major Changes** that you wish to contribute to the project should be discussed first on our [Github][github] or [Gitter][gitter] so that we can better coordinate our efforts, prevent duplication of work, and help you to craft the change so that it is successfully accepted into the project. * **Small Changes** can be crafted and submitted to the [GitHub Repository][github] as a Pull Request. ## Want a Documentation Fix? If you want to help improve the documentation, it's a good idea to let others know what you're working on to minimize duplication of effort. Create a new issue (or comment on a related existing one) to let others know what you're working on. Please build and test the documentation before submitting the PR to be sure you haven't accidentally introduced any layout or formatting issues. You should also make sure that your commit message starts with "docs" and follows the **[Commit Message Guidelines](#commit)** outlined below. ## Submission Guidelines ### Submitting an Issue Before you submit your issue search the archive, maybe your question was already answered. If your issue appears to be a bug, and hasn't been reported, open a new issue. Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. Providing the following information will increase the chances of your issue being dealt with quickly: * **Overview of the Issue** * **Forge Version(s)** - is it a regression? * **Operating System** - is this a problem on all OSes? * **Reproduce the Error** - provide an example piece of code that can replicate the issue on our end. * **Related Issues** - has a similar issue been reported before? * **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit) ### Submitting a Pull Request Before you submit your pull request consider the following guidelines: * Search [GitHub](https://github.com/arrayfire/forge/pulls) for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort. * Make your changes in a new git branch: ```shell git checkout -b my-fix-branch hotfixes-major-minor-patch ``` If there is no hotfixes branch, branch off of devel. ```shell git checkout -b my-fix-branch devel ``` * Commit your changes using a descriptive commit message that follows our [commit message conventions](#commit). Adherence to the [commit message conventions](#commit) is required. ```shell git commit -a ``` Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files. * Build your changes locally to ensure everything checks out. * Push your branch to GitHub: ```shell git push origin my-fix-branch ``` In GitHub, send a pull request to `forge`. If we suggest changes, then: * Make the required updates. * Re-build and check corresponding examples work as expected. * Commit your changes to your branch (e.g. `my-fix-branch`). * Push the changes to your GitHub repository (this will update your Pull Request). If the PR gets too outdated we may ask you to rebase and force push to update the PR: _WARNING: Squashing or reverting commits and force-pushing thereafter may remove GitHub comments on code that were previously made by you or others in your commits. Avoid any form of rebasing unless necessary._ That's it! Thank you for your contribution! #### After your pull request is merged After your pull request is merged, you can safely delete your branch and pull the changes from the upstream repository: * Delete the remote branch on GitHub either through the GitHub web UI or your local shell * Check out the parent(hotfixes-\*.\*.\*/devel) branch * Delete the local branch * Update the parent branch with the latest upstream version ## Git Commit Guidelines We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history** and while generating change log. ### Commit Message Format Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**: ``` :