aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2019-05-20 08:43:29 +0800
committerGriffin Downs <35574547+grdowns@users.noreply.github.com>2019-05-19 17:43:29 -0700
commitaf248a0709e8d1ccebf053a2c3b5e5c0ef3bb2cf (patch)
treecb012afe517c9386e52fccfd78231a3c3abf4e3e
parentd10918a71ab43df46689f52fa3280830ae79ffee (diff)
downloadvcpkg-af248a0709e8d1ccebf053a2c3b5e5c0ef3bb2cf.tar.gz
vcpkg-af248a0709e8d1ccebf053a2c3b5e5c0ef3bb2cf.zip
[raylib] Add new port (fix #4500) (#5946)
* [raylib] Add new port (fix #4500) * [raylib] Update to 2019-04-27 * [raylib] Bump version number * [raylib] Minor fixes * [raylib] Fix Threads_FOUND not defined error on Ubuntu * [raylib] Bump version number * Add system dependencies message * [raylib] Display dependencies message on UNIX * Modify message to appear based on build target, not build host
-rw-r--r--ports/raylib/CONTROL7
-rw-r--r--ports/raylib/portfile.cmake89
-rw-r--r--ports/raylib/usage5
-rw-r--r--ports/raylib/vcpkg-cmake-wrapper.cmake14
4 files changed, 115 insertions, 0 deletions
diff --git a/ports/raylib/CONTROL b/ports/raylib/CONTROL
new file mode 100644
index 000000000..3be7c5eac
--- /dev/null
+++ b/ports/raylib/CONTROL
@@ -0,0 +1,7 @@
+Source: raylib
+Version: 2019-04-27-2
+Description: A simple and easy-to-use library to enjoy videogames programming
+#Build-Depends: glfw3
+
+Feature: non-audio
+Description: Build raylib without audio module
diff --git a/ports/raylib/portfile.cmake b/ports/raylib/portfile.cmake
new file mode 100644
index 000000000..82c79a44c
--- /dev/null
+++ b/ports/raylib/portfile.cmake
@@ -0,0 +1,89 @@
+# https://github.com/raysan5/raylib/issues/388
+if(TARGET_TRIPLET MATCHES "^arm" OR TARGET_TRIPLET MATCHES "uwp$")
+ message(FATAL_ERROR "raylib doesn't support ARM or UWP.")
+endif()
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ message(
+ "raylib currently requires the following libraries from the system package manager:
+ libgl1-mesa-dev
+ libx11-dev
+ libxcursor-dev
+ libxinerama-dev
+ libxrandr-dev
+These can be installed on Ubuntu systems via sudo apt install libgl1-mesa-dev libx11-dev libxcursor-dev libxinerama-dev libxrandr-dev"
+ )
+endif()
+
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO raysan5/raylib
+ REF f37e55a77bd6177dbaea4d7f484961c09104e104
+ SHA512 57146ebc7ab22a4e60c1d9eecd4c7a8f1930d6709f45761af809da9ea4f161e9fd450fa1042252a80bd7952ed9571a5d8dee4d454c8903a778e3e1328300b2bd
+ HEAD_REF master
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SHARED)
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" STATIC)
+
+if("non-audio" IN_LIST FEATURES)
+ set(USE_AUDIO OFF)
+else()
+ set(USE_AUDIO ON)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DBUILD_EXAMPLES=OFF
+ -DBUILD_GAMES=OFF
+ -DSHARED=${SHARED}
+ -DSTATIC=${STATIC}
+ -DUSE_AUDIO=${USE_AUDIO}
+ -DUSE_EXTERNAL_GLFW=OFF # externl glfw3 causes build errors on Windows
+ OPTIONS_DEBUG
+ -DENABLE_ASAN=ON
+ -DENABLE_UBSAN=ON
+ -DENABLE_MSAN=OFF
+ OPTIONS_RELEASE
+ -DENABLE_ASAN=OFF
+ -DENABLE_UBSAN=OFF
+ -DENABLE_MSAN=OFF
+)
+
+vcpkg_install_cmake()
+
+vcpkg_copy_pdbs()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
+
+configure_file(
+ ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
+ ${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake
+ @ONLY
+)
+
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/debug/share
+)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ vcpkg_replace_string(
+ ${CURRENT_PACKAGES_DIR}/include/raylib.h
+ "defined(USE_LIBTYPE_SHARED)"
+ "1 // defined(USE_LIBTYPE_SHARED)"
+ )
+endif()
+
+# Install usage
+configure_file(${CMAKE_CURRENT_LIST_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+#vcpkg_test_cmake(PACKAGE_NAME ${PORT})
diff --git a/ports/raylib/usage b/ports/raylib/usage
new file mode 100644
index 000000000..936b74f50
--- /dev/null
+++ b/ports/raylib/usage
@@ -0,0 +1,5 @@
+The package @PORT@:@TARGET_TRIPLET@ provides CMake targets:
+
+ find_package(@PORT@ CONFIG REQUIRED)
+ target_include_directories(main PRIVATE ${raylib_INCLUDE_DIRS})
+ target_link_libraries(main PRIVATE ${raylib_LIBRARIES})
diff --git a/ports/raylib/vcpkg-cmake-wrapper.cmake b/ports/raylib/vcpkg-cmake-wrapper.cmake
new file mode 100644
index 000000000..1efda7c9e
--- /dev/null
+++ b/ports/raylib/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,14 @@
+set(raylib_USE_STATIC_LIBS @STATIC@)
+
+_find_package(${ARGS})
+
+if(raylib_FOUND)
+ get_filename_component(_raylib_lib_name ${raylib_LIBRARY} NAME)
+
+ set(raylib_LIBRARY
+ debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/${_raylib_lib_name}
+ optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/${_raylib_lib_name}
+ )
+
+ set(raylib_LIBRARIES ${raylib_LIBRARY})
+endif()