[sfml] Use upstream CMake. Install SFMLConfig.cmake.

This commit is contained in:
Robert Schumacher 2018-05-19 19:40:08 -07:00
parent 473248862a
commit c10d9d117a
3 changed files with 18 additions and 39 deletions

View File

@ -1,35 +0,0 @@
cmake_minimum_required(VERSION 2.6)
project(SFML)
include_directories(include)
include_directories(src)
if(NOT BUILD_SHARED_LIBS)
add_definitions(-DSFML_STATIC)
endif()
add_definitions(-DUNICODE -D_UNICODE)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
# import SFML's 'sfml_add_library' macro and find_package utils
set(VERSION_MAJOR 2)
include(cmake/Config.cmake)
set(SFML_GENERATE_PDB ON)
include(cmake/Macros.cmake)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules/)
add_subdirectory(src/SFML/System)
add_subdirectory(src/SFML/Window)
add_subdirectory(src/SFML/Network)
add_subdirectory(src/SFML/Audio)
add_subdirectory(src/SFML/Graphics)
if(WIN32)
set(LIB_SUFFIX /manual-link)
add_subdirectory(src/SFML/Main)
unset(LIB_SUFFIX)
endif()
if(NOT DEFINED SFML_SKIP_HEADERS)
install(DIRECTORY include/ DESTINATION include)
endif()

View File

@ -1,4 +1,4 @@
Source: sfml
Version: 2.4.2-3
Version: 2.5.0
Description: Simple and fast multimedia library
Build-Depends: freetype, libflac, libjpeg-turbo, libogg, libvorbis, openal-soft, stb, freeglut (!uwp&&!windows)

View File

@ -5,10 +5,13 @@ vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
REF 2.5.0
HEAD_REF master
SHA512 94306dcbed7d68bb7e226cd91e25950a07bcf393988c4bb79f9de3555c18c78cae4573e911235f712e711a7c02a614bf370df32b8d85240d2f08142327e05076
PATCHES "${CMAKE_CURRENT_LIST_DIR}/portfile.cmake"
)
file(REMOVE_RECURSE ${SOURCE_PATH}/extlibs)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
# Without this, we get error: list sub-command REMOVE_DUPLICATES requires list to be present.
file(MAKE_DIRECTORY ${SOURCE_PATH}/extlibs/libs)
file(WRITE ${SOURCE_PATH}/extlibs/libs/x "")
if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message("SFML currently requires the following libraries from the system package manager:\n libudev\n libx11\n libxrandr\n opengl\n\nThese can be installed on Ubuntu systems via apt-get install libx11-dev libxrandr-dev libxi-dev libudev-dev mesa-common-dev")
@ -16,11 +19,15 @@ endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG
-DSFML_SKIP_HEADERS=ON
OPTIONS
-DSFML_BUILD_FRAMEWORKS=OFF
-DSFML_USE_SYSTEM_DEPS=ON
-DSFML_MISC_INSTALL_PREFIX=share/sfml
-DSFML_GENERATE_PDB=OFF
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/SFML)
vcpkg_copy_pdbs()
# don't force users to define SFML_STATIC while using static library
@ -34,7 +41,14 @@ if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/sfml-main.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/sfml-main.lib)
file(COPY ${CURRENT_PACKAGES_DIR}/debug/lib/sfml-main-d.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/manual-link)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/sfml-main-d.lib)
file(GLOB FILES "${CURRENT_PACKAGES_DIR}/share/sfml/SFML*Targets-*.cmake")
foreach(FILE ${FILES})
file(READ "${FILE}" _contents)
string(REPLACE "/lib/sfml-main" "/lib/manual-link/sfml-main" _contents "${_contents}")
file(WRITE "${FILE}" "${_contents}")
endforeach()
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
file(INSTALL ${SOURCE_PATH}/license.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/sfml RENAME copyright)