vcpkg/ports/raylib/portfile.cmake

90 lines
2.6 KiB
CMake

# 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 a9f33c9a8962735fed5dd1857709d159bc4056fc # 2.5.0
SHA512 36ee474d5f1791385a6841e20632e078c0d3a591076faed0a648533513a3218e2817b0bbf7a921cc003c9aaf6a07024fd48830697d9d85eba307be27bd884ad8
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})