vcpkg/ports/raylib/portfile.cmake
Hristo Iliev 809a7384dd
[raylib] Fix dependency on glfw for emscripten and compilation options (#28079)
* Fix dependency on glfw for emscripten and compilation options

* Updated port version and commit

* add port-version

* vdb

Co-authored-by: FrankXie <v-frankxie@microsoft.com>
2022-12-28 13:52:08 -08:00

85 lines
2.4 KiB
CMake

if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_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()
if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_LINUX)
set(patches fix-linkGlfw.patch)
endif()
if(VCPKG_TARGET_IS_EMSCRIPTEN)
set(ADDITIONAL_OPTIONS "-DPLATFORM=Web")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO raysan5/raylib
REF 387c06000618ef0aa3b15c5e46d1c525ba194c50 #v4.2.0
SHA512 df7640dcf2979128586c7b671da4f17b628bed8a4526f252469d2d25aee2c9b16695087c8766c10bfdf26a89ff1a8f7ff6005baa7c0dbf77dadc8a0c469e1217
HEAD_REF master
PATCHES ${patches}
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SHARED)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" STATIC)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
hidpi SUPPORT_HIGH_DPI
use-audio USE_AUDIO
)
if(VCPKG_TARGET_IS_MINGW)
set(DEBUG_ENABLE_SANITIZERS OFF)
else()
set(DEBUG_ENABLE_SANITIZERS ON)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_EXAMPLES=OFF
-DSHARED=${SHARED}
-DSTATIC=${STATIC}
-DUSE_EXTERNAL_GLFW=OFF # externl glfw3 causes build errors on Windows
${FEATURE_OPTIONS}
${ADDITIONAL_OPTIONS}
OPTIONS_DEBUG
-DENABLE_ASAN=${DEBUG_ENABLE_SANITIZERS}
-DENABLE_UBSAN=${DEBUG_ENABLE_SANITIZERS}
-DENABLE_MSAN=OFF
OPTIONS_RELEASE
-DENABLE_ASAN=OFF
-DENABLE_UBSAN=OFF
-DENABLE_MSAN=OFF
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
vcpkg_fixup_pkgconfig()
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()
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)