diff --git a/src/SFML/Audio/CMakeLists.txt b/src/SFML/Audio/CMakeLists.txt index e42ba77f6..7567205c8 100644 --- a/src/SFML/Audio/CMakeLists.txt +++ b/src/SFML/Audio/CMakeLists.txt @@ -91,6 +91,9 @@ else() set(BUILD_UTILS OFF) set(BUILD_DOCS OFF) set(INSTALL_MANPAGES OFF) + set(INSTALL_DOCS OFF) + set(INSTALL_PKG_CONFIG_MODULE OFF) + set(INSTALL_PKGCONFIG_MODULES OFF) set(WITH_FORTIFY_SOURCE OFF) set(WITH_STACK_PROTECTOR OFF) set(WITH_AVX OFF) # LLVM/Clang on Windows has issues with AVX2 @@ -99,23 +102,26 @@ else() GIT_REPOSITORY https://github.com/xiph/ogg.git GIT_TAG v1.3.5 GIT_SHALLOW ON - # patch CMAKE_DEBUG_POSTFIX into the Ogg CMake configuration + # patch out parts we don't want of the Ogg CMake configuration + # - installing headers & pkgconfig files + # - add CMAKE_DEBUG_POSTFIX PATCH_COMMAND ${CMAKE_COMMAND} -DOGG_DIR=${FETCHCONTENT_BASE_DIR}/ogg-src -P ${PROJECT_SOURCE_DIR}/tools/ogg/PatchOgg.cmake) FetchContent_Declare(flac GIT_REPOSITORY https://github.com/xiph/flac.git GIT_TAG 1.4.3 GIT_SHALLOW ON - # patch out the annoying parts of the FLAC CMake configuration: + # patch out parts we don't want of the FLAC CMake configuration: # - adding unnecessary libraries that aren't even used - # - installing FLAC++ headers even though BUILD_CXXLIBS is OFF + # - installing headers & pkgconfig files # - add CMAKE_DEBUG_POSTFIX PATCH_COMMAND ${CMAKE_COMMAND} -DFLAC_DIR=${FETCHCONTENT_BASE_DIR}/flac-src -P ${PROJECT_SOURCE_DIR}/tools/flac/PatchFLAC.cmake) FetchContent_Declare(vorbis GIT_REPOSITORY https://github.com/xiph/vorbis.git GIT_TAG v1.3.7 GIT_SHALLOW ON - # patch out the annoying parts of the Vorbis CMake configuration: + # patch out parts we don't want of the Vorbis CMake configuration: # - Vorbis doesn't check if the Ogg::ogg target exists before calling find_package + # - installing headers & pkgconfig files # - add CMAKE_DEBUG_POSTFIX PATCH_COMMAND ${CMAKE_COMMAND} -DVORBIS_DIR=${FETCHCONTENT_BASE_DIR}/vorbis-src -P ${PROJECT_SOURCE_DIR}/tools/vorbis/PatchVorbis.cmake) FetchContent_MakeAvailable(ogg flac vorbis) diff --git a/src/SFML/Graphics/CMakeLists.txt b/src/SFML/Graphics/CMakeLists.txt index fa99515aa..4886ac71f 100644 --- a/src/SFML/Graphics/CMakeLists.txt +++ b/src/SFML/Graphics/CMakeLists.txt @@ -119,6 +119,7 @@ else() set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) set(BUILD_SHARED_LIBS OFF) + set(SKIP_INSTALL_HEADERS ON) set(FT_DISABLE_ZLIB ON) set(FT_DISABLE_BZIP2 ON) set(FT_DISABLE_PNG ON) @@ -129,7 +130,10 @@ else() FetchContent_Declare(Freetype GIT_REPOSITORY https://github.com/freetype/freetype.git GIT_TAG VER-2-13-2 - GIT_SHALLOW ON) + GIT_SHALLOW ON + # patch out parts we don't want of the FreeType CMake configuration + # - installing pkgconfig files + PATCH_COMMAND ${CMAKE_COMMAND} -DFREETYPE_DIR=${FETCHCONTENT_BASE_DIR}/freetype-src -P ${PROJECT_SOURCE_DIR}/tools/freetype/PatchFreetype.cmake) FetchContent_MakeAvailable(Freetype) set_target_properties(freetype PROPERTIES FOLDER "Dependencies") diff --git a/tools/flac/PatchFLAC.cmake b/tools/flac/PatchFLAC.cmake index 890a8275e..18da18e56 100644 --- a/tools/flac/PatchFLAC.cmake +++ b/tools/flac/PatchFLAC.cmake @@ -1,10 +1,10 @@ -# prevent FLAC from adding stuff that we don't use file(READ "${FLAC_DIR}/src/CMakeLists.txt" FLAC_SRC_CMAKELISTS_CONTENTS) string(REGEX REPLACE "\nadd_subdirectory\\(\"share/" "\n\#add_subdirectory(\"share/" FLAC_SRC_CMAKELISTS_CONTENTS "${FLAC_SRC_CMAKELISTS_CONTENTS}") file(WRITE "${FLAC_DIR}/src/CMakeLists.txt" "${FLAC_SRC_CMAKELISTS_CONTENTS}") file(READ "${FLAC_DIR}/CMakeLists.txt" FLAC_CMAKELISTS_CONTENTS) string(REPLACE "set_target_properties(FLAC grabbag getopt replaygain_analysis replaygain_synthesis utf8 PROPERTIES FOLDER Libraries)" "" FLAC_CMAKELISTS_CONTENTS "${FLAC_CMAKELISTS_CONTENTS}") +string(REPLACE "install(FILES \${FLAC_HEADERS} DESTINATION \"\${CMAKE_INSTALL_INCLUDEDIR}/FLAC\")" "" FLAC_CMAKELISTS_CONTENTS "${FLAC_CMAKELISTS_CONTENTS}") string(REPLACE "install(FILES \${FLAC++_HEADERS} DESTINATION \"\${CMAKE_INSTALL_INCLUDEDIR}/FLAC++\")" "" FLAC_CMAKELISTS_CONTENTS "${FLAC_CMAKELISTS_CONTENTS}") string(REPLACE "\n\nadd_subdirectory(\"src\")" "\nset(CMAKE_DEBUG_POSTFIX d)\nadd_subdirectory(\"src\")" FLAC_CMAKELISTS_CONTENTS "${FLAC_CMAKELISTS_CONTENTS}") file(WRITE "${FLAC_DIR}/CMakeLists.txt" "${FLAC_CMAKELISTS_CONTENTS}") diff --git a/tools/freetype/PatchFreetype.cmake b/tools/freetype/PatchFreetype.cmake new file mode 100644 index 000000000..d114703aa --- /dev/null +++ b/tools/freetype/PatchFreetype.cmake @@ -0,0 +1,3 @@ +file(READ "${FREETYPE_DIR}/CMakeLists.txt" FREETYPE_CMAKELISTS_CONTENTS) +string(REPLACE " install(\n FILES \${PROJECT_BINARY_DIR}/freetype2.pc\n DESTINATION \${CMAKE_INSTALL_LIBDIR}/pkgconfig\n COMPONENT pkgconfig)" "" FREETYPE_CMAKELISTS_CONTENTS "${FREETYPE_CMAKELISTS_CONTENTS}") +file(WRITE "${FREETYPE_DIR}/CMakeLists.txt" "${FREETYPE_CMAKELISTS_CONTENTS}") \ No newline at end of file diff --git a/tools/ogg/PatchOgg.cmake b/tools/ogg/PatchOgg.cmake index 4bcd2a980..bec4be9b7 100644 --- a/tools/ogg/PatchOgg.cmake +++ b/tools/ogg/PatchOgg.cmake @@ -1,3 +1,4 @@ file(READ "${OGG_DIR}/CMakeLists.txt" OGG_CMAKELISTS_CONTENTS) string(REPLACE "\n\nadd_library(ogg" "\nset(CMAKE_DEBUG_POSTFIX d)\nadd_library(ogg" OGG_CMAKELISTS_CONTENTS "${OGG_CMAKELISTS_CONTENTS}") +string(REPLACE "PUBLIC_HEADER \"\${OGG_HEADERS}\"" "" OGG_CMAKELISTS_CONTENTS "${OGG_CMAKELISTS_CONTENTS}") file(WRITE "${OGG_DIR}/CMakeLists.txt" "${OGG_CMAKELISTS_CONTENTS}") diff --git a/tools/vorbis/PatchVorbis.cmake b/tools/vorbis/PatchVorbis.cmake index d1a25bae8..221cd1dcd 100644 --- a/tools/vorbis/PatchVorbis.cmake +++ b/tools/vorbis/PatchVorbis.cmake @@ -1,5 +1,9 @@ -# help Vorbis find the Ogg::Ogg target that FetchContent provides file(READ "${VORBIS_DIR}/CMakeLists.txt" VORBIS_CMAKELISTS_CONTENTS) string(REPLACE "find_package(Ogg REQUIRED)" "set(OGG_LIBRARIES Ogg::ogg)" VORBIS_CMAKELISTS_CONTENTS "${VORBIS_CMAKELISTS_CONTENTS}") string(REPLACE "\n\nadd_subdirectory(lib)" "\nset(CMAKE_DEBUG_POSTFIX d)\nadd_subdirectory(lib)" VORBIS_CMAKELISTS_CONTENTS "${VORBIS_CMAKELISTS_CONTENTS}") +string(REPLACE "install(\n FILES\n \${CMAKE_CURRENT_BINARY_DIR}/vorbis.pc\n \${CMAKE_CURRENT_BINARY_DIR}/vorbisenc.pc\n \${CMAKE_CURRENT_BINARY_DIR}/vorbisfile.pc\n DESTINATION\n \${CMAKE_INSTALL_LIBDIR}/pkgconfig\n)" "" VORBIS_CMAKELISTS_CONTENTS "${VORBIS_CMAKELISTS_CONTENTS}") file(WRITE "${VORBIS_DIR}/CMakeLists.txt" "${VORBIS_CMAKELISTS_CONTENTS}") + +file(READ "${VORBIS_DIR}/lib/CMakeLists.txt" VORBISLIB_CMAKELISTS_CONTENTS) +string(REPLACE "install(FILES \${VORBIS_PUBLIC_HEADERS} DESTINATION \${CMAKE_INSTALL_FULL_INCLUDEDIR}/vorbis)" "" VORBISLIB_CMAKELISTS_CONTENTS "${VORBISLIB_CMAKELISTS_CONTENTS}") +file(WRITE "${VORBIS_DIR}/lib/CMakeLists.txt" "${VORBISLIB_CMAKELISTS_CONTENTS}")