From 1073c3bf2b36ff8cade24034e137a7e6ce841b33 Mon Sep 17 00:00:00 2001 From: Hans L Date: Thu, 28 Feb 2019 01:47:59 -0600 Subject: [PATCH] [opencsg] Add new port (#5481) * Add opencsg package * Make opencsg static only * Add patch for illegal character, fix line endings --- ports/opencsg/CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++ ports/opencsg/CONTROL | 4 +++ ports/opencsg/illegal_char.patch | 13 +++++++++ ports/opencsg/portfile.cmake | 39 +++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 ports/opencsg/CMakeLists.txt create mode 100644 ports/opencsg/CONTROL create mode 100644 ports/opencsg/illegal_char.patch create mode 100644 ports/opencsg/portfile.cmake diff --git a/ports/opencsg/CMakeLists.txt b/ports/opencsg/CMakeLists.txt new file mode 100644 index 000000000..683529ddc --- /dev/null +++ b/ports/opencsg/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required (VERSION 3.4) +project (opencsg) + +set(HEADERS + include/opencsg.h +) + +set(SRCS + src/area.cpp + src/batch.cpp + src/context.cpp + src/channelManager.cpp + src/frameBufferObject.cpp + src/frameBufferObjectExt.cpp + src/occlusionQuery.cpp + src/opencsgRender.cpp + src/openglHelper.cpp + src/primitive.cpp + src/primitiveHelper.cpp + src/renderGoldfeather.cpp + src/renderSCS.cpp + src/scissorMemo.cpp + src/settings.cpp + src/stencilManager.cpp + src/pBufferTexture.cpp + RenderTexture/RenderTexture.cpp +) + + +add_library(opencsg ${SRCS} ${HEADERS}) + +include_directories(src include RenderTexture ".") +find_package(GLEW REQUIRED) +include_directories(${GLEW_INCLUDE_DIRS}) +target_link_libraries(opencsg PRIVATE GLEW::GLEW) + +install( + TARGETS opencsg + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +if(NOT DISABLE_INSTALL_HEADERS) + install(FILES ${HEADERS} DESTINATION include/opencsg) +endif() diff --git a/ports/opencsg/CONTROL b/ports/opencsg/CONTROL new file mode 100644 index 000000000..a2b5b0d7f --- /dev/null +++ b/ports/opencsg/CONTROL @@ -0,0 +1,4 @@ +Source: opencsg +Version: 1.4.2 +Build-Depends: glew +Description: OpenCSG is a library that does image-based CSG rendering using OpenGL. OpenCSG is written in C++ and supports most modern graphics hardware using Microsoft Windows or the Linux operating system. diff --git a/ports/opencsg/illegal_char.patch b/ports/opencsg/illegal_char.patch new file mode 100644 index 000000000..5c700fd19 --- /dev/null +++ b/ports/opencsg/illegal_char.patch @@ -0,0 +1,13 @@ +diff --git a/include/opencsg.h b/include/opencsg.h +index d753a0e..b482c40 100644 +--- a/include/opencsg.h ++++ b/include/opencsg.h +@@ -156,7 +156,7 @@ namespace OpenCSG { + /// The DepthComplexityAlgorithm specifies the strategy for profiting + /// from depth complexity when performing the CSG rendering. + /// - NoDepthComplexitySampling: Does not employ the depth complexity. +- /// This essentially makes the algorithm O(n²), but with ++ /// This essentially makes the algorithm O(n²), but with + /// low constant costs. + /// - DepthComplexitySampling: Calculates the depth complexity k using + /// the stencil buffer. This makes algorithm O(n*k), but diff --git a/ports/opencsg/portfile.cmake b/ports/opencsg/portfile.cmake new file mode 100644 index 000000000..e43a89ec5 --- /dev/null +++ b/ports/opencsg/portfile.cmake @@ -0,0 +1,39 @@ +# Common Ambient Variables: +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) +# + +include(vcpkg_common_functions) + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO floriankirsch/OpenCSG + REF "opencsg-1-4-2-release" + SHA512 df117a1b7153a95332d236918d1547b0afe6f3ead46af2733c5feee6e25cec984b21affc41fd8320a45be9292bd3b32e21ed8bb3d08371ddd657f659b9bb932a + HEAD_REF master + PATCHES illegal_char.patch +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS -DUNICODE=1 -D_UNICODE=1 + # OPTIONS_RELEASE -DOPTIMIZE=1 + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/opencsg RENAME copyright)