aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/opengl')
-rw-r--r--vcpkg/ports/opengl/glu.pc.in10
-rw-r--r--vcpkg/ports/opengl/opengl.pc.in9
-rw-r--r--vcpkg/ports/opengl/portfile.cmake61
-rw-r--r--vcpkg/ports/opengl/usage24
-rw-r--r--vcpkg/ports/opengl/vcpkg.json11
5 files changed, 115 insertions, 0 deletions
diff --git a/vcpkg/ports/opengl/glu.pc.in b/vcpkg/ports/opengl/glu.pc.in
new file mode 100644
index 0000000..8ed2fb0
--- /dev/null
+++ b/vcpkg/ports/opengl/glu.pc.in
@@ -0,0 +1,10 @@
+prefix=${pcfiledir}/../..
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: glu
+Description: Windows OpenGL Utility library
+Version: @WINDOWS_SDK_SEMVER@
+Requires: opengl
+Libs: -L${libdir} -lglu32
+Cflags: @WINDOWS_GL_CFLAGS@
diff --git a/vcpkg/ports/opengl/opengl.pc.in b/vcpkg/ports/opengl/opengl.pc.in
new file mode 100644
index 0000000..2bb1066
--- /dev/null
+++ b/vcpkg/ports/opengl/opengl.pc.in
@@ -0,0 +1,9 @@
+prefix=${pcfiledir}/../..
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: OpenGL
+Description: Windows OpenGL library
+Version: @WINDOWS_SDK_SEMVER@
+Libs: -L${libdir} -lopengl32
+Cflags: @WINDOWS_GL_CFLAGS@
diff --git a/vcpkg/ports/opengl/portfile.cmake b/vcpkg/ports/opengl/portfile.cmake
new file mode 100644
index 0000000..5943a01
--- /dev/null
+++ b/vcpkg/ports/opengl/portfile.cmake
@@ -0,0 +1,61 @@
+function(copy_from_windows_sdk WINDOWS_SDK)
+ if (WINDOWS_SDK MATCHES "10.")
+ set(LIBGLFILEPATH "$ENV{WindowsSdkDir}Lib/${WINDOWS_SDK}/um/${TRIPLET_SYSTEM_ARCH}/OpenGL32.Lib")
+ set(LIBGLUFILEPATH "$ENV{WindowsSdkDir}Lib/${WINDOWS_SDK}/um/${TRIPLET_SYSTEM_ARCH}/GlU32.Lib")
+ set(HEADERSPATH "$ENV{WindowsSdkDir}Include/${WINDOWS_SDK}/um")
+ set(COPYRIGHT "See https://developer.microsoft.com/windows/downloads/windows-10-sdk for the Windows 10 SDK license.")
+ elseif(WINDOWS_SDK MATCHES "8.")
+ set(LIBGLFILEPATH "$ENV{WindowsSdkDir}Lib/winv6.3/um/${TRIPLET_SYSTEM_ARCH}/OpenGL32.Lib")
+ set(LIBGLUFILEPATH "$ENV{WindowsSdkDir}Lib/winv6.3/um/${TRIPLET_SYSTEM_ARCH}/GlU32.Lib")
+ set(HEADERSPATH "$ENV{WindowsSdkDir}Include/um")
+ set(COPYRIGHT "See https://developer.microsoft.com/windows/downloads/windows-8-1-sdk for the Windows 8.1 SDK license.")
+ else()
+ message(FATAL_ERROR "Portfile not yet configured for Windows SDK with version: ${WINDOWS_SDK}")
+ endif()
+
+ if (NOT EXISTS "${LIBGLFILEPATH}")
+ file(TO_NATIVE_PATH "${LIBGLFILEPATH}" DISPLAY)
+ message(FATAL_ERROR "Cannot find Windows ${WINDOWS_SDK} SDK. File does not exist: ${DISPLAY}")
+ endif()
+
+ if (NOT EXISTS "${LIBGLUFILEPATH}")
+ file(TO_NATIVE_PATH "${LIBGLUFILEPATH}" DISPLAY)
+ message(FATAL_ERROR "Cannot find Windows ${WINDOWS_SDK} SDK. File does not exist: ${DISPLAY}")
+ endif()
+
+ file(INSTALL "${HEADERSPATH}/GL/gl.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/GL")
+ file(INSTALL "${HEADERSPATH}/GL/glu.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/GL")
+ file(INSTALL "${LIBGLFILEPATH}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
+ file(INSTALL "${LIBGLUFILEPATH}" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
+ if (NOT VCPKG_BUILD_TYPE)
+ file(INSTALL "${LIBGLFILEPATH}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
+ file(INSTALL "${LIBGLUFILEPATH}" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
+ endif()
+
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+ file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "${COPYRIGHT}")
+endfunction()
+
+if(VCPKG_TARGET_IS_WINDOWS)
+ if(VCPKG_TARGET_IS_MINGW)
+ set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+ set(WINDOWS_SDK_SEMVER "10.0.0")
+ set(WINDOWS_GL_CFLAGS "")
+ else()
+ vcpkg_get_windows_sdk(WINDOWS_SDK)
+ copy_from_windows_sdk("${WINDOWS_SDK}")
+ string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" WINDOWS_SDK_SEMVER "${WINDOWS_SDK}")
+ set(WINDOWS_GL_CFLAGS "-I\${includedir}")
+ endif()
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/opengl.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opengl.pc" @ONLY)
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/glu.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/glu.pc" @ONLY)
+ if(NOT VCPKG_BUILD_TYPE)
+ file(COPY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/opengl.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
+ file(COPY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/glu.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
+ endif()
+ vcpkg_fixup_pkgconfig()
+else()
+ set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+endif()
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
diff --git a/vcpkg/ports/opengl/usage b/vcpkg/ports/opengl/usage
new file mode 100644
index 0000000..33e33f6
--- /dev/null
+++ b/vcpkg/ports/opengl/usage
@@ -0,0 +1,24 @@
+The package opengl is compatible with built-in CMake targets via CMake v3.7 and prior syntax
+
+ find_package(OpenGL REQUIRED)
+ target_link_libraries(main PRIVATE ${OPENGL_LIBRARIES})
+ target_include_directories(main PRIVATE ${OPENGL_INCLUDE_DIR})
+
+and the CMake v3.8 and beyond imported target syntax
+
+ find_package(OpenGL REQUIRED)
+ target_link_libraries(main PRIVATE OpenGL::GL)
+
+introduction of various components
+
+ find_package(OpenGL REQUIRED COMPONENTS GL # v3.8
+ GLU # v3.8
+ GLX # v3.10
+ EGL # v3.10
+ OpenGL) # v3.10
+
+The OpenGL SDK is highly platform dependent and is usually an OS component. It's not realistic to build from source for every platform.
+
+ WINDOWS: is part of the Windows SDK which this package installs.
+ LINUX: the SDK may be installed from your distro's repo or from 3rd parties manually. There are too many to count.
+ APPLE: consult your distribution vendor on the state of OpenGL support: https://support.apple.com/en-us/HT202823
diff --git a/vcpkg/ports/opengl/vcpkg.json b/vcpkg/ports/opengl/vcpkg.json
new file mode 100644
index 0000000..6e3a196
--- /dev/null
+++ b/vcpkg/ports/opengl/vcpkg.json
@@ -0,0 +1,11 @@
+{
+ "name": "opengl",
+ "version-date": "2022-12-04",
+ "port-version": 3,
+ "description": "Open Graphics Library (OpenGL)[3][4][5] is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics.",
+ "license": null,
+ "supports": "!uwp & !xbox",
+ "dependencies": [
+ "opengl-registry"
+ ]
+}