@@ -106,37 +106,16 @@ if(SFML_BUILD_GRAPHICS AND NOT SFML_BUILD_WINDOW)
106106 set (SFML_BUILD_WINDOW ON )
107107endif ()
108108
109- # allow not using bundled dependencies with a switch
110- # (except for stb_image)
111- # yes this is horrible, but GLOB_RECURSE sucks
112- sfml_set_option (SFML_USE_SYSTEM_DEPS OFF BOOL "ON to use system dependencies, OFF to use the bundled ones." )
113- if (SFML_USE_SYSTEM_DEPS)
114- if (SFML_INSTALL_XCODE_TEMPLATES)
115- message (FATAL_ERROR "XCode templates installation cannot be used with the SFML_USE_SYSTEM_DEPS option (the bundled frameworks are required.)" )
116- endif ()
117-
118- file (GLOB_RECURSE DEP_LIBS "${PROJECT_SOURCE_DIR} /extlibs/libs*/*" )
119- file (GLOB_RECURSE DEP_BINS "${PROJECT_SOURCE_DIR} /extlibs/bin*/*" )
120- file (GLOB_RECURSE DEP_HEADERS "${PROJECT_SOURCE_DIR} /extlibs/headers/*" )
121-
122- foreach (DEP_FILE ${DEP_LIBS} ${DEP_BINS} ${DEP_HEADERS} )
123- get_filename_component (DEP_DIR ${DEP_FILE} PATH )
124-
125- if (NOT DEP_DIR MATCHES "/(stb_image|minimp3)(/|$)" )
126- list (APPEND CMAKE_IGNORE_PATH "${DEP_DIR} " )
127- endif ()
128-
129- get_filename_component (DEP_PARENT_DIR ${DEP_DIR} PATH )
130- while (NOT DEP_PARENT_DIR STREQUAL "${PROJECT_SOURCE_DIR} /extlibs" )
131- if (NOT DEP_DIR MATCHES "/(stb_image|minimp3)(/|$)" )
132- list (APPEND CMAKE_IGNORE_PATH "${DEP_PARENT_DIR} " )
133- endif ()
134-
135- get_filename_component (DEP_PARENT_DIR ${DEP_PARENT_DIR} PATH )
136- endwhile ()
137- endforeach ()
109+ # use bundled dependencies by default on these systems and system dependencies by default on all others (maintains old behavior)
110+ if (SFML_OS_WINDOWS OR SFML_OS_MACOS OR SFML_OS_IOS OR SFML_OS_ANDROID)
111+ set (SFML_USE_SYSTEM_DEPS_DEFAULT OFF )
112+ else ()
113+ set (SFML_USE_SYSTEM_DEPS_DEFAULT ON )
114+ endif ()
138115
139- list (REMOVE_DUPLICATES CMAKE_IGNORE_PATH )
116+ sfml_set_option (SFML_USE_SYSTEM_DEPS ${SFML_USE_SYSTEM_DEPS_DEFAULT} BOOL "ON to use system dependencies, OFF to use the bundled ones." )
117+ if (SFML_USE_SYSTEM_DEPS AND SFML_INSTALL_XCODE_TEMPLATES)
118+ message (FATAL_ERROR "XCode templates installation cannot be used with the SFML_USE_SYSTEM_DEPS option (the bundled frameworks are required.)" )
140119endif ()
141120
142121if (SFML_COMPILER_MSVC)
@@ -380,97 +359,19 @@ endif()
380359install (FILES license.md DESTINATION ${CMAKE_INSTALL_DOCDIR} )
381360install (FILES readme.md DESTINATION ${CMAKE_INSTALL_DOCDIR} )
382361
383- # install 3rd-party libraries and tools
384- if (SFML_OS_WINDOWS)
385-
386- if (NOT SFML_USE_SYSTEM_DEPS)
387- # install the binaries of SFML dependencies
388- if (ARCH_ARM64)
389- install (DIRECTORY extlibs/libs-msvc -universal/ARM64/ DESTINATION ${CMAKE_INSTALL_LIBDIR} )
390- elseif (ARCH_X86)
391- if (SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
392- install (DIRECTORY extlibs/libs-msvc -universal/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR} )
393- else ()
394- install (DIRECTORY extlibs/libs-mingw/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR} )
395- endif ()
396- elseif (ARCH_X64)
397- if (SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
398- install (DIRECTORY extlibs/libs-msvc -universal/x64/ DESTINATION ${CMAKE_INSTALL_LIBDIR} )
399- else ()
400- install (DIRECTORY extlibs/libs-mingw/x64/ DESTINATION ${CMAKE_INSTALL_LIBDIR} )
401- endif ()
402- endif ()
403- endif ()
404-
405- elseif (SFML_OS_MACOS)
406- # install extlibs dependencies only when used
407- if (SFML_BUILD_GRAPHICS)
408- if (FREETYPE_LIBRARY STREQUAL "${PROJECT_SOURCE_DIR} /extlibs/libs-macos/Frameworks/freetype.framework" )
409- install (DIRECTORY extlibs/libs-macos/Frameworks/freetype.framework DESTINATION ${CMAKE_INSTALL_LIBDIR} )
410- endif ()
411- endif ()
412-
413- if (SFML_BUILD_AUDIO)
414- if (FLAC_LIBRARY STREQUAL "${PROJECT_SOURCE_DIR} /extlibs/libs-macos/Frameworks/FLAC.framework" )
415- install (DIRECTORY extlibs/libs-macos/Frameworks/FLAC.framework DESTINATION ${CMAKE_INSTALL_LIBDIR} )
416- endif ()
417-
418- if (OGG_LIBRARY STREQUAL "${PROJECT_SOURCE_DIR} /extlibs/libs-macos/Frameworks/ogg.framework" )
419- install (DIRECTORY extlibs/libs-macos/Frameworks/ogg.framework DESTINATION ${CMAKE_INSTALL_LIBDIR} )
420- endif ()
421-
422- if (VORBIS_LIBRARY STREQUAL "${PROJECT_SOURCE_DIR} /extlibs/libs-macos/Frameworks/vorbis.framework" )
423- install (DIRECTORY extlibs/libs-macos/Frameworks/vorbis.framework DESTINATION ${CMAKE_INSTALL_LIBDIR} )
424- endif ()
425-
426- if (VORBISENC_LIBRARY STREQUAL "${PROJECT_SOURCE_DIR} /extlibs/libs-macos/Frameworks/vorbisenc.framework" )
427- install (DIRECTORY extlibs/libs-macos/Frameworks/vorbisenc.framework DESTINATION ${CMAKE_INSTALL_LIBDIR} )
428- endif ()
429-
430- if (VORBISFILE_LIBRARY STREQUAL "${PROJECT_SOURCE_DIR} /extlibs/libs-macos/Frameworks/vorbisfile.framework" )
431- install (DIRECTORY extlibs/libs-macos/Frameworks/vorbisfile.framework DESTINATION ${CMAKE_INSTALL_LIBDIR} )
432- endif ()
433- endif ()
434-
435- # install the Xcode templates if requested
436- if (SFML_INSTALL_XCODE_TEMPLATES)
437- # configure the templates plist files
438- foreach (TEMPLATE "SFML Compiler" "SFML App" )
439- configure_file (
440- "tools/xcode/templates/SFML/${TEMPLATE} .xctemplate/TemplateInfo.plist.in"
441- "${CMAKE_CURRENT_BINARY_DIR} /tools/xcode/templates/SFML/${TEMPLATE} .xctemplate/TemplateInfo.plist"
442- @ONLY )
443- endforeach ()
444- install (DIRECTORY "tools/xcode/templates/SFML" "${CMAKE_CURRENT_BINARY_DIR} /tools/xcode/templates/SFML"
445- DESTINATION /Library /Developer/Xcode/Templates
446- PATTERN "*.in" EXCLUDE
447- PATTERN ".DS_Store" EXCLUDE)
448- endif ()
449-
450- elseif (SFML_OS_IOS)
451-
452- if (NOT SFML_USE_SYSTEM_DEPS)
453- # since the iOS libraries are built as static, we must install the SFML dependencies
454- # too so that the end user can easily link them to its final application
455- if (SFML_BUILD_GRAPHICS)
456- install (FILES extlibs/libs-ios /libfreetype.a DESTINATION lib)
457- endif ()
458-
459- if (SFML_BUILD_AUDIO)
460- install (FILES extlibs/libs-ios /libflac.a
461- extlibs/libs-ios /libvorbis.a
462- extlibs/libs-ios /libogg.a
463- DESTINATION lib)
464- endif ()
465- endif ()
466-
467- elseif (SFML_OS_ANDROID)
468-
469- if (NOT SFML_USE_SYSTEM_DEPS)
470- # install extlibs
471- install (DIRECTORY extlibs/libs-android /${CMAKE_ANDROID_ARCH_ABI} DESTINATION extlibs/lib)
472- endif ()
473-
362+ # install the Xcode templates if requested
363+ if (SFML_INSTALL_XCODE_TEMPLATES)
364+ # configure the templates plist files
365+ foreach (TEMPLATE "SFML Compiler" "SFML App" )
366+ configure_file (
367+ "tools/xcode/templates/SFML/${TEMPLATE} .xctemplate/TemplateInfo.plist.in"
368+ "${CMAKE_CURRENT_BINARY_DIR} /tools/xcode/templates/SFML/${TEMPLATE} .xctemplate/TemplateInfo.plist"
369+ @ONLY )
370+ endforeach ()
371+ install (DIRECTORY "tools/xcode/templates/SFML" "${CMAKE_CURRENT_BINARY_DIR} /tools/xcode/templates/SFML"
372+ DESTINATION /Library /Developer/Xcode/Templates
373+ PATTERN "*.in" EXCLUDE
374+ PATTERN ".DS_Store" EXCLUDE)
474375endif ()
475376
476377sfml_export_targets ()
0 commit comments