Port for arrayfire/forge rendering library (#5242)

* Port for arrayfire/forge rendering library

* [forge] Simplify portfile
This commit is contained in:
pradeep 2019-02-02 10:50:06 +05:30 committed by Robert Schumacher
parent 6cb714f850
commit 86f15d6daf
4 changed files with 202 additions and 0 deletions

4
ports/forge/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: forge
Version: 1.0.3-1
Description: Helps with high performance visulizations involving OpenGL-CUDA/OpenCL interop.
Build-Depends: glfw3, glm, glbinding, freetype, boost-functional, freeimage, fontconfig (!windows)

View File

@ -0,0 +1,115 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c7236a6..b4b910a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -110,64 +110,63 @@ install(DIRECTORY include/
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN ".gitignore" EXCLUDE)
-# The Forge version header is generated and thus need to be
-# included explicitly
+
install(FILES ${Forge_BINARY_DIR}/include/fg/version.h
DESTINATION "${FG_INSTALL_INC_DIR}/fg/"
COMPONENT headers)
-install(EXPORT ForgeTargets
- NAMESPACE Forge::
- DESTINATION ${FG_INSTALL_CMAKE_DIR}
- COMPONENT forge)
-
-export(EXPORT ForgeTargets
- NAMESPACE Forge::
- FILE cmake/ForgeTargets.cmake)
+# install the examples irrespective of the FG_BUILD_EXAMPLES value
+# only the examples source files are installed, so the installation of these
+# source files does not depend on FG_BUILD_EXAMPLES
+# when FG_BUILD_EXAMPLES is OFF, the examples source is installed without
+# building the example executables
+install(DIRECTORY examples/ #NOTE The slash at the end is important
+ DESTINATION ${FG_INSTALL_EXAMPLE_DIR}
+ COMPONENT examples)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
- "${Forge_BINARY_DIR}/cmake/ForgeConfigVersion.cmake"
+ "${Forge_BINARY_DIR}/ForgeConfigVersion.cmake"
COMPATIBILITY SameMajorVersion)
-# This config file will be installed so we need to set the install_destination
-# path relative to the install path
+
+# export install config file
set(INCLUDE_DIRS include)
set(CMAKE_DIR ${FG_INSTALL_CMAKE_DIR})
configure_package_config_file(
- "${PROJECT_SOURCE_DIR}/CMakeModules/ForgeConfig.cmake.in"
- "cmake/install/ForgeConfig.cmake"
- INSTALL_DESTINATION "${FG_INSTALL_CMAKE_DIR}"
- PATH_VARS INCLUDE_DIRS CMAKE_DIR)
-
-install(FILES ${Forge_BINARY_DIR}/cmake/install/ForgeConfig.cmake
- ${Forge_BINARY_DIR}/cmake/ForgeConfigVersion.cmake
+ "${PROJECT_SOURCE_DIR}/CMakeModules/ForgeConfig.cmake.in"
+ "cmake_install/ForgeConfig.cmake"
+ INSTALL_DESTINATION "${FG_INSTALL_CMAKE_DIR}"
+ PATH_VARS INCLUDE_DIRS CMAKE_DIR
+)
+install(FILES ${Forge_BINARY_DIR}/cmake_install/ForgeConfig.cmake
+ ${Forge_BINARY_DIR}/ForgeConfigVersion.cmake
DESTINATION ${FG_INSTALL_CMAKE_DIR}
- COMPONENT cmake)
+ COMPONENT cmake
+)
+install(EXPORT ForgeTargets
+ NAMESPACE Forge::
+ DESTINATION ${FG_INSTALL_CMAKE_DIR}
+ COMPONENT forge
+)
-# Following file will be used to create the config file for the build directory.
-# These config files will be used by the examples to find the Forge
-# libraries
+
+# export build tree targets config file
set(INCLUDE_DIRS "${Forge_SOURCE_DIR}/include" "${Forge_BINARY_DIR}/include")
-set(CMAKE_DIR "${Forge_BINARY_DIR}/cmake")
+set(CMAKE_DIR "${Forge_BINARY_DIR}")
configure_package_config_file(
- "${PROJECT_SOURCE_DIR}/CMakeModules/ForgeConfig.cmake.in"
- "cmake/ForgeConfig.cmake"
- INSTALL_DESTINATION "${Forge_BINARY_DIR}/cmake"
- PATH_VARS INCLUDE_DIRS CMAKE_DIR
- INSTALL_PREFIX "${Forge_BINARY_DIR}")
+ "${PROJECT_SOURCE_DIR}/CMakeModules/ForgeConfig.cmake.in"
+ "ForgeConfig.cmake"
+ INSTALL_DESTINATION "${Forge_BINARY_DIR}"
+ PATH_VARS INCLUDE_DIRS CMAKE_DIR
+ INSTALL_PREFIX "${Forge_BINARY_DIR}"
+)
+export(EXPORT ForgeTargets
+ NAMESPACE Forge::
+ FILE ForgeTargets.cmake
+)
+#export(PACKAGE Forge)
-#--------------------------------------------------------------------
-# Install examples
-#--------------------------------------------------------------------
-# install the examples irrespective of the FG_BUILD_EXAMPLES value
-# only the examples source files are installed, so the installation of these
-# source files does not depend on FG_BUILD_EXAMPLES
-# when FG_BUILD_EXAMPLES is OFF, the examples source is installed without
-# building the example executables
-install(DIRECTORY examples/ #NOTE The slash at the end is important
- DESTINATION ${FG_INSTALL_EXAMPLE_DIR}
- COMPONENT examples)
include(CPackConfig)
@@ -177,4 +176,4 @@ conditional_directory(FG_BUILD_EXAMPLES examples)
mark_as_advanced(
pkgcfg_lib_FontConfigPkg_freetype
pkgcfg_lib_FontConfigPkg_fontconfig
- )
+)

View File

@ -0,0 +1,44 @@
include(vcpkg_common_functions)
if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
message(FATAL_ERROR "This port currently only supports x64 architecture")
endif()
set(PATCHES forge_targets_fix.patch)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND PATCHES static_build.patch)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO arrayfire/forge
REF v1.0.3
SHA512 e1a7688c1c3ab4659401463c5d025917b6e5766129446aefbebe0d580756cd2cc07256ddda9b20899690765220e5467b9209e00476c80ea6a51a1a0c0e9da616
HEAD_REF master
PATCHES ${PATCHES}
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DFG_BUILD_DOCS=OFF
-DFG_BUILD_EXAMPLES=OFF
-DFG_INSTALL_BIN_DIR=bin
-DFG_WITH_FREEIMAGE=OFF
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
file(GLOB DLLS ${CURRENT_PACKAGES_DIR}/bin/* ${CURRENT_PACKAGES_DIR}/debug/bin/*)
list(FILTER DLLS EXCLUDE REGEX "forge\\.dll\$")
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/examples
${CURRENT_PACKAGES_DIR}/examples
${DLLS}
)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/forge RENAME copyright)

View File

@ -0,0 +1,39 @@
diff --git a/src/backend/opengl/CMakeLists.txt b/src/backend/opengl/CMakeLists.txt
index 1aeec1e..52eff05 100755
--- a/src/backend/opengl/CMakeLists.txt
+++ b/src/backend/opengl/CMakeLists.txt
@@ -142,7 +142,7 @@ install(TARGETS forge
INCLUDES DESTINATION ${FG_INSTALL_INC_DIR})
# install dependencies
-if (WIN32)
+if (WIN32 AND BUILD_SHARED_LIBS)
if (FG_WITH_FREEIMAGE AND NOT FG_USE_STATIC_FREEIMAGE)
install(FILES $<TARGET_FILE:FreeImage::FreeImage>
DESTINATION ${FG_INSTALL_BIN_DIR}
diff --git a/src/backend/opengl/glfw/CMakeLists.txt b/src/backend/opengl/glfw/CMakeLists.txt
index caf4913..3c8d71c 100644
--- a/src/backend/opengl/glfw/CMakeLists.txt
+++ b/src/backend/opengl/glfw/CMakeLists.txt
@@ -24,7 +24,7 @@ if (NOT BUILD_SHARED_LIBS)
install(TARGETS forge_wtk_interface EXPORT ForgeTargets)
endif ()
-if (WIN32)
+if (WIN32 AND BUILD_SHARED_LIBS)
install(FILES $<TARGET_FILE:glfw>
DESTINATION ${FG_INSTALL_BIN_DIR}
COMPONENT dependencies)
diff --git a/src/backend/opengl/sdl/CMakeLists.txt b/src/backend/opengl/sdl/CMakeLists.txt
index d8cd312..d55f27d 100644
--- a/src/backend/opengl/sdl/CMakeLists.txt
+++ b/src/backend/opengl/sdl/CMakeLists.txt
@@ -24,7 +24,7 @@ if (NOT BUILD_SHARED_LIBS)
install(TARGETS forge_wtk_interface EXPORT ForgeTargets)
endif ()
-if (WIN32)
+if (WIN32 AND BUILD_SHARED_LIBS)
install(FILES $<TARGET_FILE:SDL2::SDL2>
DESTINATION ${FG_INSTALL_BIN_DIR}
COMPONENT dependencies)