update SDL_mixer to SDL3_mixer 3.2.0
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
if(CPACK_PACKAGE_FILE_NAME MATCHES ".*-src$")
|
||||
message(FATAL_ERROR "Creating source archives is not supported.")
|
||||
endif()
|
||||
|
||||
set(PROJECT_NAME "@PROJECT_NAME@")
|
||||
set(PROJECT_VERSION "@PROJECT_VERSION@")
|
||||
set(PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@")
|
||||
set(SDL_CMAKE_PLATFORM "@SDL_CMAKE_PLATFORM@")
|
||||
set(SDL_CPU_NAMES "@SDL_CPU_NAMES@")
|
||||
list(SORT SDL_CPU_NAMES)
|
||||
|
||||
string(TOLOWER "${SDL_CMAKE_PLATFORM}" SDL_CMAKE_PLATFORM)
|
||||
string(TOLOWER "${SDL_CPU_NAMES}" SDL_CPU_NAMES)
|
||||
if(lower_sdl_cmake_platform STREQUAL lower_sdl_cpu_names)
|
||||
set(SDL_CPU_NAMES_WITH_DASHES)
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" "-" SDL_CPU_NAMES_WITH_DASHES "${SDL_CPU_NAMES}")
|
||||
if(SDL_CPU_NAMES_WITH_DASHES)
|
||||
set(SDL_CPU_NAMES_WITH_DASHES "-${SDL_CPU_NAMES_WITH_DASHES}")
|
||||
endif()
|
||||
|
||||
set(MSVC @MSVC@)
|
||||
set(MINGW @MINGW@)
|
||||
if(MSVC)
|
||||
set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-VC")
|
||||
elseif(MINGW)
|
||||
set(SDL_CMAKE_PLATFORM "${SDL_CMAKE_PLATFORM}-mingw")
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-${SDL_CMAKE_PLATFORM}${SDL_CPU_NAMES_WITH_DASHES}")
|
||||
|
||||
if(CPACK_GENERATOR STREQUAL "DragNDrop")
|
||||
set(CPACK_DMG_VOLUME_NAME "@PROJECT_NAME@ @PROJECT_VERSION@")
|
||||
# FIXME: use pre-built/create .DS_Store through AppleScript (CPACK_DMG_DS_STORE/CPACK_DMG_DS_STORE_SETUP_SCRIPT)
|
||||
set(CPACK_DMG_DS_STORE "${PROJECT_SOURCE_DIR}/Xcode/SDL/pkg-support/resources/SDL_DS_Store")
|
||||
endif()
|
||||
@@ -0,0 +1,44 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_FLAC QUIET flac)
|
||||
|
||||
find_library(FLAC_LIBRARY
|
||||
NAMES FLAC
|
||||
HINTS ${PC_FLAC_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(FLAC_INCLUDE_PATH
|
||||
NAMES FLAC/all.h
|
||||
HINTS ${PC_FLAC_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_FLAC_FOUND)
|
||||
get_flags_from_pkg_config("${FLAC_LIBRARY}" "PC_FLAC" "_flac")
|
||||
endif()
|
||||
|
||||
set(FLAC_COMPILE_OPTIONS "${_flac_compile_options}" CACHE STRING "Extra compile options of FLAC")
|
||||
|
||||
set(FLAC_LINK_LIBRARIES "${_flac_link_libraries}" CACHE STRING "Extra link libraries of FLAC")
|
||||
|
||||
set(FLAC_LINK_OPTIONS "${_flac_link_options}" CACHE STRING "Extra link flags of FLAC")
|
||||
|
||||
set(FLAC_LINK_DIRECTORIES "${_flac_link_directories}" CACHE PATH "Extra link directories of FLAC")
|
||||
|
||||
find_package_handle_standard_args(FLAC
|
||||
REQUIRED_VARS FLAC_LIBRARY FLAC_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if(FLAC_FOUND)
|
||||
if(NOT TARGET FLAC::FLAC)
|
||||
add_library(FLAC::FLAC UNKNOWN IMPORTED)
|
||||
set_target_properties(FLAC::FLAC PROPERTIES
|
||||
IMPORTED_LOCATION "${FLAC_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_PATH}"
|
||||
INTERFACE_COMPILE_OPTIONS "${FLAC_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${FLAC_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${FLAC_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${FLAC_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,55 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_FLUIDSYNTH QUIET fluidsynth)
|
||||
|
||||
find_library(FluidSynth_LIBRARY
|
||||
NAMES fluidsynth fluidsynth-3 libfluidsynth
|
||||
HINTS ${PC_FLUIDSYNTH_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(FluidSynth_INCLUDE_PATH
|
||||
NAMES fluidsynth.h
|
||||
HINTS ${PC_FLUIDSYNTH_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_FLUIDSYNTH_FOUND)
|
||||
get_flags_from_pkg_config("${FluidSynth_LIBRARY}" "PC_FLUIDSYNTH" "_fluidsynth")
|
||||
endif()
|
||||
|
||||
set(FluidSynth_COMPILE_OPTIONS "${_fluidsynth_compile_options}" CACHE STRING "Extra compile options of FluidSynth")
|
||||
|
||||
set(FluidSynth_LINK_LIBRARIES "${_fluidsynth_link_libraries}" CACHE STRING "Extra link libraries of FluidSynth")
|
||||
|
||||
set(FluidSynth_LINK_OPTIONS "${_fluidsynth_link_options}" CACHE STRING "Extra link flags of FluidSynth")
|
||||
|
||||
set(FluidSynth_LINK_DIRECTORIES "${_fluidsynth_link_directories}" CACHE PATH "Extra link directories of FluidSynth")
|
||||
|
||||
set(FLUIDSYNTH_VERSION "FLUIDSYNTH_VERSION-NOTFOUND")
|
||||
if(EXISTS "${FluidSynth_INCLUDE_PATH}/fluidsynth/version.h")
|
||||
file(READ "${FluidSynth_INCLUDE_PATH}/fluidsynth/version.h" _fluidsynth_version_h)
|
||||
set(_fluidsynth_version_regex "#define[ \t]+FLUIDSYNTH_VERSION[ \t]+\"([1-9]+\\.[0-9]+\\.[0-9]+)\"")
|
||||
string(REGEX MATCH "${_fluidsynth_version_regex}" _re_fluidsynth_version "${_fluidsynth_version_h}")
|
||||
if(_re_fluidsynth_version)
|
||||
set(FLUIDSYNTH_VERSION "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(FluidSynth
|
||||
REQUIRED_VARS FluidSynth_LIBRARY FluidSynth_INCLUDE_PATH
|
||||
VERSION_VAR FLUIDSYNTH_VERSION
|
||||
)
|
||||
|
||||
if(FluidSynth_FOUND)
|
||||
if(NOT TARGET FluidSynth::libfluidsynth)
|
||||
add_library(FluidSynth::libfluidsynth UNKNOWN IMPORTED)
|
||||
set_target_properties(FluidSynth::libfluidsynth PROPERTIES
|
||||
IMPORTED_LOCATION "${FluidSynth_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FluidSynth_INCLUDE_PATH}"
|
||||
INTERFACE_COMPILE_OPTIONS "${FluidSynth_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${FluidSynth_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${FluidSynth_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${FluidSynth_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,50 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_OGG QUIET ogg)
|
||||
|
||||
find_library(Ogg_LIBRARY
|
||||
NAMES ogg
|
||||
HINTS ${PC_OGG_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(Ogg_INCLUDE_PATH
|
||||
NAMES ogg/ogg.h
|
||||
HINTS ${PC_OGG_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_OGG_FOUND)
|
||||
get_flags_from_pkg_config("${Ogg_LIBRARY}" "PC_OGG" "_ogg")
|
||||
endif()
|
||||
|
||||
set(Ogg_COMPILE_OPTIONS "${_ogg_compile_options}" CACHE STRING "Extra compile options of ogg")
|
||||
|
||||
set(Ogg_LINK_LIBRARIES "${_ogg_link_libraries}" CACHE STRING "Extra link libraries of ogg")
|
||||
|
||||
set(Ogg_LINK_OPTIONS "${_ogg_link_options}" CACHE STRING "Extra link flags of ogg")
|
||||
|
||||
set(Ogg_LINK_DIRECTORIES "${_ogg_link_directories}" CACHE PATH "Extra link directories of ogg")
|
||||
|
||||
find_package_handle_standard_args(Ogg
|
||||
REQUIRED_VARS Ogg_LIBRARY Ogg_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if(Ogg_FOUND)
|
||||
set(Ogg_dirs ${Ogg_INCLUDE_PATH})
|
||||
if(EXISTS "${Ogg_INCLUDE_PATH}/ogg")
|
||||
list(APPEND Ogg_dirs "${Ogg_INCLUDE_PATH}/ogg")
|
||||
endif()
|
||||
if(NOT TARGET Ogg::ogg)
|
||||
add_library(Ogg::ogg UNKNOWN IMPORTED)
|
||||
set_target_properties(Ogg::ogg PROPERTIES
|
||||
IMPORTED_LOCATION "${Ogg_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Ogg_dirs}"
|
||||
INTERFACE_COMPILE_OPTIONS "${Ogg_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${Ogg_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${Ogg_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${Ogg_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(Ogg_INCLUDE_DIRS ${Ogg_INCLUDE_PATH})
|
||||
@@ -0,0 +1,53 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_OPUS QUIET opus)
|
||||
|
||||
find_library(Opus_LIBRARY
|
||||
NAMES opus
|
||||
HINTS ${PC_OPUS_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(Opus_INCLUDE_PATH
|
||||
NAMES opus.h
|
||||
PATH_SUFFIXES opus
|
||||
HINTS ${PC_OPUS_INCLUDEDIR}
|
||||
)
|
||||
if(EXISTS "${Opus_INCLUDE_PATH}/opus")
|
||||
list(APPEND Opus_INCLUDE_PATH "${Opus_INCLUDE_PATH}/opus")
|
||||
endif()
|
||||
|
||||
if(PC_OPUS_FOUND)
|
||||
get_flags_from_pkg_config("${Opus_LIBRARY}" "PC_OPUS" "_opus")
|
||||
endif()
|
||||
|
||||
set(Opus_COMPILE_OPTIONS "${_opus_compile_options}" CACHE STRING "Extra compile options of opus")
|
||||
|
||||
set(Opus_LINK_LIBRARIES "${_opus_link_libraries}" CACHE STRING "Extra link libraries of opus")
|
||||
|
||||
set(Opus_LINK_OPTIONS "${_opus_link_options}" CACHE STRING "Extra link flags of opus")
|
||||
|
||||
set(Opus_LINK_DIRECTORIES "${_opus_link_directories}" CACHE PATH "Extra link directories of opus")
|
||||
|
||||
find_package(Ogg ${required})
|
||||
|
||||
find_package_handle_standard_args(Opus
|
||||
REQUIRED_VARS Opus_LIBRARY Opus_INCLUDE_PATH Ogg_FOUND
|
||||
)
|
||||
|
||||
if(Opus_FOUND)
|
||||
set(Opus_dirs ${Opus_INCLUDE_PATH})
|
||||
if(NOT TARGET Opus::opus)
|
||||
add_library(Opus::opus UNKNOWN IMPORTED)
|
||||
set_target_properties(Opus::opus PROPERTIES
|
||||
IMPORTED_LOCATION "${Opus_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Opus_dirs}"
|
||||
INTERFACE_COMPILE_OPTIONS "${Opus_COMPILE_OPTIONS}:$<TARGET_PROPERTY:Ogg::ogg,INTERFACE_INCLUDE_DIRECTORIES>"
|
||||
INTERFACE_LINK_LIBRARIES "${Opus_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${Opus_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${Opus_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(Opus_INCLUDE_DIRS ${Opus_INCLUDE_PATH})
|
||||
@@ -0,0 +1,52 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_OPUSFILE QUIET opusfile)
|
||||
|
||||
find_library(OpusFile_LIBRARY
|
||||
NAMES opusfile
|
||||
HINTS ${PC_OPUSFILE_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(OpusFile_INCLUDE_PATH
|
||||
NAMES opusfile.h
|
||||
PATH_SUFFIXES opus
|
||||
HINTS ${PC_OPUSFILE_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_OPUSFILE_FOUND)
|
||||
get_flags_from_pkg_config("${OpusFile_LIBRARY}" "PC_OPUSFILE" "_opusfile")
|
||||
endif()
|
||||
|
||||
set(OpusFile_COMPILE_OPTIONS "${_opusfile_compile_options}" CACHE STRING "Extra compile options of opusfile")
|
||||
|
||||
set(OpusFile_LINK_LIBRARIES "${_opusfile_link_libraries}" CACHE STRING "Extra link libraries of opusfile")
|
||||
|
||||
set(OpusFile_LINK_OPTIONS "${_opusfile_link_options}" CACHE STRING "Extra link flags of opusfile")
|
||||
|
||||
set(OpusFile_LINK_DIRECTORIES "${_opusfile_link_directories}" CACHE PATH "Extra link directories of opusfile")
|
||||
|
||||
find_package(Ogg)
|
||||
find_package(Opus)
|
||||
|
||||
find_package_handle_standard_args(OpusFile
|
||||
REQUIRED_VARS OpusFile_LIBRARY OpusFile_INCLUDE_PATH Ogg_FOUND Opus_FOUND
|
||||
)
|
||||
|
||||
if(OpusFile_FOUND)
|
||||
set(OpusFile_dirs ${OpusFile_INCLUDE_PATH})
|
||||
if(EXISTS "${OpusFile_INCLUDE_PATH}/opus")
|
||||
list(APPEND OpusFile_dirs "${OpusFile_INCLUDE_PATH}/opus")
|
||||
endif()
|
||||
if(NOT TARGET OpusFile::opusfile)
|
||||
add_library(OpusFile::opusfile UNKNOWN IMPORTED)
|
||||
set_target_properties(OpusFile::opusfile PROPERTIES
|
||||
IMPORTED_LOCATION "${OpusFile_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OpusFile_dirs};$<TARGET_PROPERTY:Ogg::ogg,INTERFACE_INCLUDE_DIRECTORIES>;$<TARGET_PROPERTY:Opus::opus,INTERFACE_INCLUDE_DIRECTORIES>"
|
||||
INTERFACE_COMPILE_OPTIONS "${OpusFile_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${OpusFile_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${OpusFile_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${OpusFile_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,44 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_VORBIS QUIET vorbisfile)
|
||||
|
||||
find_library(Vorbis_vorbisfile_LIBRARY
|
||||
NAMES vorbisfile
|
||||
HINTS ${PC_VORBIS_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(Vorbis_vorbisfile_INCLUDE_PATH
|
||||
NAMES vorbis/vorbisfile.h
|
||||
HINTS ${PC_VORBIS_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_VORBIS_FOUND)
|
||||
get_flags_from_pkg_config("${Vorbis_vorbisfile_LIBRARY}" "PC_VORBIS" "_vorbisfile")
|
||||
endif()
|
||||
|
||||
set(Vorbis_vorbisfile_COMPILE_OPTIONS "${_vorbisfile_compile_options}" CACHE STRING "Extra compile options of vorbisfile")
|
||||
|
||||
set(Vorbis_vorbisfile_LINK_LIBRARIES "${_vorbisfile_link_libraries}" CACHE STRING "Extra link libraries of vorbisfile")
|
||||
|
||||
set(Vorbis_vorbisfile_LINK_OPTIONS "${_vorbisfile_link_options}" CACHE STRING "Extra link flags of vorbisfile")
|
||||
|
||||
set(Vorbis_vorbisfile_LINK_DIRECTORIES "${_vorbisfile_link_directories}" CACHE PATH "Extra link directories of vorbisfile")
|
||||
|
||||
find_package_handle_standard_args(Vorbis
|
||||
REQUIRED_VARS Vorbis_vorbisfile_LIBRARY Vorbis_vorbisfile_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if (Vorbis_FOUND)
|
||||
if (NOT TARGET Vorbis::vorbisfile)
|
||||
add_library(Vorbis::vorbisfile UNKNOWN IMPORTED)
|
||||
set_target_properties(Vorbis::vorbisfile PROPERTIES
|
||||
IMPORTED_LOCATION "${Vorbis_vorbisfile_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_vorbisfile_INCLUDE_PATH}"
|
||||
INTERFACE_COMPILE_OPTIONS "${Vorbis_vorbisfile_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${Vorbis_vorbisfile_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${Vorbis_vorbisfile_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${Vorbis_vorbisfile_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,48 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_GME QUIET libgme)
|
||||
|
||||
find_library(gme_LIBRARY
|
||||
NAMES gme
|
||||
HINTS ${PC_GME_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(gme_INCLUDE_PATH
|
||||
NAMES gme/gme.h
|
||||
HINTS ${PC_GME_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_GME_FOUND)
|
||||
get_flags_from_pkg_config("${gme_LIBRARY}" "PC_GME" "_gme")
|
||||
endif()
|
||||
|
||||
set(gme_COMPILE_OPTIONS "${_gme_compile_options}" CACHE STRING "Extra compile options of gme")
|
||||
|
||||
set(gme_LINK_LIBRARIES "${_gme_link_libraries}" CACHE STRING "Extra link libraries of gme")
|
||||
|
||||
set(gme_LINK_OPTIONS "${_gme_link_options}" CACHE STRING "Extra link flags of gme")
|
||||
|
||||
set(gme_LINK_DIRECTORIES "${_gme_link_directories}" CACHE PATH "Extra link directories of gme")
|
||||
|
||||
find_package_handle_standard_args(gme
|
||||
REQUIRED_VARS gme_LIBRARY gme_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if(gme_FOUND)
|
||||
set(gme_dirs ${gme_INCLUDE_PATH})
|
||||
if(EXISTS "${gme_INCLUDE_PATH}/gme")
|
||||
list(APPEND gme_dirs "${gme_INCLUDE_PATH}/gme")
|
||||
endif()
|
||||
if(NOT TARGET gme::gme)
|
||||
add_library(gme::gme UNKNOWN IMPORTED)
|
||||
set_target_properties(gme::gme PROPERTIES
|
||||
IMPORTED_LOCATION "${gme_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${gme_dirs}"
|
||||
INTERFACE_COMPILE_OPTIONS "${gme_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${gme_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${gme_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${gme_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,45 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_XMPLITE QUIET libxmp-lite)
|
||||
|
||||
find_library(libxmp_lite_LIBRARY
|
||||
NAMES xmp-lite libxmp-lite
|
||||
HINTS ${PC_XMPLITE_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(libxmp_lite_INCLUDE_PATH
|
||||
NAMES xmp.h
|
||||
PATH_SUFFIXES libxmp-lite
|
||||
HINTS ${PC_XMPLITE_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_XMPLITE_FOUND)
|
||||
get_flags_from_pkg_config("${libxmp_lite_LIBRARY}" "PC_XMPLITE" "_libxmp_lite")
|
||||
endif()
|
||||
|
||||
set(libxmp_lite_COMPILE_OPTIONS "${_libxmp_lite_compile_options}" CACHE STRING "Extra compile options of libxmp_lite")
|
||||
|
||||
set(libxmp_lite_LINK_LIBRARIES "${_libxmp_lite_link_libraries}" CACHE STRING "Extra link libraries of libxmp_lite")
|
||||
|
||||
set(libxmp_lite_LINK_OPTIONS "${_libxmp_lite_link_options}" CACHE STRING "Extra link flags of libxmp_lite")
|
||||
|
||||
set(libxmp_lite_LINK_DIRECTORIES "${_libxmp_lite_link_directories}" CACHE PATH "Extra link directories of libxmp_lite")
|
||||
|
||||
find_package_handle_standard_args(libxmp-lite
|
||||
REQUIRED_VARS libxmp_lite_LIBRARY libxmp_lite_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if(libxmp-lite_FOUND)
|
||||
if(NOT TARGET libxmp-lite::libxmp-lite)
|
||||
add_library(libxmp-lite::libxmp-lite UNKNOWN IMPORTED)
|
||||
set_target_properties(libxmp-lite::libxmp-lite PROPERTIES
|
||||
IMPORTED_LOCATION "${libxmp_lite_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${libxmp_lite_INCLUDE_PATH}"
|
||||
INTERFACE_COMPILE_OPTIONS "${libxmp_lite_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${libxmp_lite_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${libxmp_lite_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${libxmp_lite_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,44 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_XMP QUIET libxmp)
|
||||
|
||||
find_library(libxmp_LIBRARY
|
||||
NAMES xmp
|
||||
HINTS ${PC_XMP_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(libxmp_INCLUDE_PATH
|
||||
NAMES xmp.h
|
||||
HINTS ${PC_XMP_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_XMP_FOUND)
|
||||
get_flags_from_pkg_config("${libxmp_LIBRARY}" "PC_XMP" "_libxmp")
|
||||
endif()
|
||||
|
||||
set(libxmp_COMPILE_OPTIONS "${_libxmp_compile_options}" CACHE STRING "Extra compile options of libxmp")
|
||||
|
||||
set(libxmp_LINK_LIBRARIES "${_libxmp_link_libraries}" CACHE STRING "Extra link libraries of libxmp")
|
||||
|
||||
set(libxmp_LINK_OPTIONS "${_libxmp_link_options}" CACHE STRING "Extra link flags of libxmp")
|
||||
|
||||
set(libxmp_LINK_DIRECTORIES "${_libxmp_link_directories}" CACHE PATH "Extra link flags of libxmp")
|
||||
|
||||
find_package_handle_standard_args(libxmp
|
||||
REQUIRED_VARS libxmp_LIBRARY libxmp_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if(libxmp_FOUND)
|
||||
if(NOT TARGET libxmp::libxmp)
|
||||
add_library(libxmp::libxmp UNKNOWN IMPORTED)
|
||||
set_target_properties(libxmp::libxmp PROPERTIES
|
||||
IMPORTED_LOCATION "${libxmp_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${libxmp_INCLUDE_PATH}"
|
||||
INTERFACE_COMPILE_OPTIONS "${libxmp_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${libxmp_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${libxmp_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${libxmp_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,44 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_MPG123 QUIET libmpg123)
|
||||
|
||||
find_library(mpg123_LIBRARY
|
||||
NAMES mpg123
|
||||
HINTS ${PC_MPG123_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(mpg123_INCLUDE_PATH
|
||||
NAMES mpg123.h
|
||||
HINTS ${PC_MPG123_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_MPG123_FOUND)
|
||||
get_flags_from_pkg_config("${mpg123_LIBRARY}" "PC_MPG123" "_mpg123")
|
||||
endif()
|
||||
|
||||
set(mpg123_COMPILE_OPTIONS "${_mpg123_compile_options}" CACHE STRING "Extra compile options of mpg123")
|
||||
|
||||
set(mpg123_LINK_LIBRARIES "${_mpg123_link_libraries}" CACHE STRING "Extra link libraries of mpg123")
|
||||
|
||||
set(mpg123_LINK_OPTIONS "${_mpg123_link_options}" CACHE STRING "Extra link flags of mpg123")
|
||||
|
||||
set(mpg123_LINK_DIRECTORIES "${_mpg123_link_directories}" CACHE PATH "Extra link directories of mpg123")
|
||||
|
||||
find_package_handle_standard_args(mpg123
|
||||
REQUIRED_VARS mpg123_LIBRARY mpg123_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if(mpg123_FOUND)
|
||||
if(NOT TARGET MPG123::libmpg123)
|
||||
add_library(MPG123::libmpg123 UNKNOWN IMPORTED)
|
||||
set_target_properties(MPG123::libmpg123 PROPERTIES
|
||||
IMPORTED_LOCATION "${mpg123_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${mpg123_INCLUDE_PATH}"
|
||||
INTERFACE_COMPILE_OPTIONS "${mpg123_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${mpg123_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${mpg123_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${mpg123_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,44 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_TREMOR QUIET vorbisidec)
|
||||
|
||||
find_library(tremor_LIBRARY
|
||||
NAMES vorbisidec libvorbisidec
|
||||
HINTS ${PC_TREMOR_LIBDIR}
|
||||
)
|
||||
|
||||
find_path(tremor_INCLUDE_PATH
|
||||
NAMES tremor/ivorbisfile.h
|
||||
HINTS ${PC_TREMOR_INCLUDEDIR}
|
||||
)
|
||||
|
||||
if(PC_TREMOR_FOUND)
|
||||
get_flags_from_pkg_config("${tremor_LIBRARY}" "PC_TREMOR" "_tremor")
|
||||
endif()
|
||||
|
||||
set(tremor_COMPILE_OPTIONS "${_tremor_compile_options}" CACHE STRING "Extra compile options of vorbis")
|
||||
|
||||
set(tremor_LINK_LIBRARIES "${_tremor_link_libraries}" CACHE STRING "Extra link libraries of vorbis")
|
||||
|
||||
set(tremor_LINK_OPTIONS "${_tremor_link_options}" CACHE STRING "Extra link flags of vorbis")
|
||||
|
||||
set(tremor_LINK_DIRECTORIES "${_tremor_link_directories}" CACHE PATH "Extra link directories of vorbis")
|
||||
|
||||
find_package_handle_standard_args(tremor
|
||||
REQUIRED_VARS tremor_LIBRARY tremor_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if (tremor_FOUND)
|
||||
if (NOT TARGET tremor::tremor)
|
||||
add_library(tremor::tremor UNKNOWN IMPORTED)
|
||||
set_target_properties(tremor::tremor PROPERTIES
|
||||
IMPORTED_LOCATION "${tremor_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${tremor_INCLUDE_PATH}"
|
||||
INTERFACE_COMPILE_OPTIONS "${tremor_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${tremor_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${tremor_LINK_OPTIONS}"
|
||||
INTERFACE_LINK_DIRECTORIES "${tremor_LINK_DIRECTORIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,37 @@
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if(WIN32)
|
||||
set(wavpack_find_names wavpack libwavpack wavpackdll)
|
||||
else()
|
||||
set(wavpack_find_names wavpack)
|
||||
endif()
|
||||
find_library(wavpack_LIBRARY
|
||||
NAMES ${wavpack_find_names}
|
||||
)
|
||||
|
||||
find_path(wavpack_INCLUDE_PATH
|
||||
NAMES wavpack/wavpack.h
|
||||
)
|
||||
|
||||
set(wavpack_COMPILE_OPTIONS "" CACHE STRING "Extra compile options of wavpack")
|
||||
|
||||
set(wavpack_LINK_LIBRARIES "" CACHE STRING "Extra link libraries of wavpack")
|
||||
|
||||
set(wavpack_LINK_OPTIONS "" CACHE STRING "Extra link flags of wavpack")
|
||||
|
||||
find_package_handle_standard_args(wavpack
|
||||
REQUIRED_VARS wavpack_LIBRARY wavpack_INCLUDE_PATH
|
||||
)
|
||||
|
||||
if (wavpack_FOUND)
|
||||
if (NOT TARGET WavPack::WavPack)
|
||||
add_library(WavPack::WavPack UNKNOWN IMPORTED)
|
||||
set_target_properties(WavPack::WavPack PROPERTIES
|
||||
IMPORTED_LOCATION "${wavpack_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${wavpack_INCLUDE_PATH}"
|
||||
INTERFACE_COMPILE_OPTIONS "${wavpack_COMPILE_OPTIONS}"
|
||||
INTERFACE_LINK_LIBRARIES "${wavpack_LINK_LIBRARIES}"
|
||||
INTERFACE_LINK_OPTIONS "${wavpack_LINK_OPTIONS}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -0,0 +1,300 @@
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the working tree (--dirty option),
|
||||
# and adjusting the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# git_local_changes(<var>)
|
||||
#
|
||||
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||
# Does not regard untracked files.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
#
|
||||
# Copyright 2009-2013, Iowa State University.
|
||||
# Copyright 2013-2020, Ryan Pavlik
|
||||
# Copyright 2013-2020, Contributors
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
# Function _git_find_closest_git_dir finds the next closest .git directory
|
||||
# that is part of any directory in the path defined by _start_dir.
|
||||
# The result is returned in the parent scope variable whose name is passed
|
||||
# as variable _git_dir_var. If no .git directory can be found, the
|
||||
# function returns an empty string via _git_dir_var.
|
||||
#
|
||||
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
|
||||
# neither foo nor bar contain a file/directory .git. This will return
|
||||
# C:/bla/.git
|
||||
#
|
||||
function(_git_find_closest_git_dir _start_dir _git_dir_var)
|
||||
set(cur_dir "${_start_dir}")
|
||||
set(git_dir "${_start_dir}/.git")
|
||||
while(NOT EXISTS "${git_dir}")
|
||||
# .git dir not found, search parent directories
|
||||
set(git_previous_parent "${cur_dir}")
|
||||
get_filename_component(cur_dir "${cur_dir}" DIRECTORY)
|
||||
if(cur_dir STREQUAL git_previous_parent)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_git_dir_var}
|
||||
""
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(git_dir "${cur_dir}/.git")
|
||||
endwhile()
|
||||
set(${_git_dir_var}
|
||||
"${git_dir}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
|
||||
|
||||
if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
|
||||
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
|
||||
else()
|
||||
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE)
|
||||
endif()
|
||||
if(NOT "${GIT_DIR}" STREQUAL "")
|
||||
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
|
||||
"${GIT_DIR}")
|
||||
if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
|
||||
# We've gone above the CMake root dir.
|
||||
set(GIT_DIR "")
|
||||
endif()
|
||||
endif()
|
||||
if("${GIT_DIR}" STREQUAL "")
|
||||
set(${_refspecvar}
|
||||
"GITDIR-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
set(${_hashvar}
|
||||
"GITDIR-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check if the current source dir is a git submodule or a worktree.
|
||||
# In both cases .git is a file instead of a directory.
|
||||
#
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
# The following git command will return a non empty string that
|
||||
# points to the super project working tree if the current
|
||||
# source dir is inside a git submodule.
|
||||
# Otherwise the command will return an empty string.
|
||||
#
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse
|
||||
--show-superproject-working-tree
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT "${out}" STREQUAL "")
|
||||
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
|
||||
${submodule})
|
||||
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
|
||||
ABSOLUTE)
|
||||
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||
else()
|
||||
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
|
||||
file(READ ${GIT_DIR} worktree_ref)
|
||||
# The .git directory contains a path to the worktree information directory
|
||||
# inside the parent git repo of the worktree.
|
||||
#
|
||||
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
|
||||
${worktree_ref})
|
||||
string(STRIP ${git_worktree_dir} git_worktree_dir)
|
||||
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
|
||||
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
|
||||
endif()
|
||||
else()
|
||||
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake" @ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
# Fallback for reftable or other storage formats
|
||||
if(NOT HEAD_HASH OR HEAD_HASH STREQUAL "")
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE HEAD_HASH
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(HEAD_HASH "")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(${_refspecvar}
|
||||
"${HEAD_REF}"
|
||||
PARENT_SCOPE)
|
||||
set(${_hashvar}
|
||||
"${HEAD_HASH}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var}
|
||||
"HEAD-HASH-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe_working_tree _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var}
|
||||
"${out}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_local_changes _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var}
|
||||
"GIT-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var}
|
||||
"HEAD-HASH-NOTFOUND"
|
||||
PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE res
|
||||
OUTPUT_VARIABLE out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
set(${_var}
|
||||
"CLEAN"
|
||||
PARENT_SCOPE)
|
||||
else()
|
||||
set(${_var}
|
||||
"DIRTY"
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright 2009-2012, Iowa State University
|
||||
# Copyright 2011-2015, Contributors
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
elseif(EXISTS "@GIT_DIR@/packed-refs")
|
||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
elseif(EXISTS "@GIT_DIR@/reftable/tables.list")
|
||||
configure_file("@GIT_DIR@/reftable/tables.list" "@GIT_DATA@/reftable-tables.list" COPYONLY)
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH AND EXISTS "@GIT_DATA@/head-ref")
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
||||
@@ -0,0 +1,34 @@
|
||||
# Helper for Find modules
|
||||
|
||||
function(get_flags_from_pkg_config _library _pc_prefix _out_prefix)
|
||||
if("${_library}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
|
||||
set(_cflags ${_pc_prefix}_STATIC_CFLAGS_OTHER)
|
||||
set(_link_libraries ${_pc_prefix}_STATIC_LIBRARIES)
|
||||
set(_link_options ${_pc_prefix}_STATIC_LDFLAGS_OTHER)
|
||||
set(_library_dirs ${_pc_prefix}_STATIC_LIBRARY_DIRS)
|
||||
else()
|
||||
set(_cflags ${_pc_prefix}_CFLAGS_OTHER)
|
||||
set(_link_libraries ${_pc_prefix}_LIBRARIES)
|
||||
set(_link_options ${_pc_prefix}_LDFLAGS_OTHER)
|
||||
set(_library_dirs ${_pc_prefix}_LIBRARY_DIRS)
|
||||
endif()
|
||||
|
||||
# The *_LIBRARIES lists always start with the library itself
|
||||
list(POP_FRONT "${_link_libraries}")
|
||||
|
||||
# Work around CMake's flag deduplication when pc files use `-framework A` instead of `-Wl,-framework,A`
|
||||
string(REPLACE "-framework;" "-Wl,-framework," "_filtered_link_options" "${${_link_options}}")
|
||||
|
||||
set(${_out_prefix}_compile_options
|
||||
"${${_cflags}}"
|
||||
PARENT_SCOPE)
|
||||
set(${_out_prefix}_link_libraries
|
||||
"${${_link_libraries}}"
|
||||
PARENT_SCOPE)
|
||||
set(${_out_prefix}_link_options
|
||||
"${_filtered_link_options}"
|
||||
PARENT_SCOPE)
|
||||
set(${_out_prefix}_link_directories
|
||||
"${${_library_dirs}}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,377 @@
|
||||
# This file is shared amongst SDL_image/SDL_mixer/SDL_ttf
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CMakePushCheckState)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.18")
|
||||
include(CheckLinkerFlag)
|
||||
endif()
|
||||
|
||||
macro(sdl_calculate_derived_version_variables MAJOR MINOR MICRO)
|
||||
set(SO_VERSION_MAJOR "0")
|
||||
set(SO_VERSION_MINOR "${MINOR_VERSION}")
|
||||
set(SO_VERSION_MICRO "${MICRO_VERSION}")
|
||||
set(SO_VERSION "${SO_VERSION_MAJOR}.${SO_VERSION_MINOR}.${SO_VERSION_MICRO}")
|
||||
|
||||
if(MINOR MATCHES "[02468]$")
|
||||
math(EXPR DYLIB_COMPAT_VERSION_MAJOR "100 * ${MINOR} + 1")
|
||||
set(DYLIB_COMPAT_VERSION_MINOR "0")
|
||||
math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${DYLIB_COMPAT_VERSION_MAJOR}")
|
||||
set(DYLIB_CURRENT_VERSION_MINOR "${MICRO}")
|
||||
else()
|
||||
math(EXPR DYLIB_COMPAT_VERSION_MAJOR "100 * ${MINOR} + ${MICRO} + 1")
|
||||
set(DYLIB_COMPAT_VERSION_MINOR "0")
|
||||
math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${DYLIB_COMPAT_VERSION_MAJOR}")
|
||||
set(DYLIB_CURRENT_VERSION_MINOR "0")
|
||||
endif()
|
||||
set(DYLIB_COMPAT_VERSION_MICRO "0")
|
||||
set(DYLIB_CURRENT_VERSION_MICRO "0")
|
||||
|
||||
set(DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.${DYLIB_CURRENT_VERSION_MINOR}.${DYLIB_CURRENT_VERSION_MICRO}")
|
||||
set(DYLIB_COMPAT_VERSION "${DYLIB_COMPAT_VERSION_MAJOR}.${DYLIB_COMPAT_VERSION_MINOR}.${DYLIB_COMPAT_VERSION_MICRO}")
|
||||
endmacro()
|
||||
|
||||
function(read_absolute_symlink DEST PATH)
|
||||
file(READ_SYMLINK "${PATH}" p)
|
||||
if(NOT IS_ABSOLUTE "${p}")
|
||||
get_filename_component(pdir "${PATH}" DIRECTORY)
|
||||
set(p "${pdir}/${p}")
|
||||
endif()
|
||||
get_filename_component(p "${p}" ABSOLUTE)
|
||||
set("${DEST}" "${p}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(win32_implib_identify_dll DEST IMPLIB)
|
||||
cmake_parse_arguments(ARGS "NOTFATAL" "" "" ${ARGN})
|
||||
if(CMAKE_DLLTOOL)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_DLLTOOL}" --identify "${IMPLIB}"
|
||||
RESULT_VARIABLE retcode
|
||||
OUTPUT_VARIABLE stdout
|
||||
ERROR_VARIABLE stderr)
|
||||
if(NOT retcode EQUAL 0)
|
||||
if(NOT ARGS_NOTFATAL)
|
||||
message(FATAL_ERROR "${CMAKE_DLLTOOL} failed.")
|
||||
else()
|
||||
set("${DEST}" "${DEST}-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
string(STRIP "${stdout}" result)
|
||||
set(${DEST} "${result}" PARENT_SCOPE)
|
||||
elseif(MSVC)
|
||||
get_filename_component(CMAKE_C_COMPILER_DIRECTORY "${CMAKE_C_COMPILER}" DIRECTORY CACHE)
|
||||
find_program(CMAKE_DUMPBIN NAMES dumpbin PATHS "${CMAKE_C_COMPILER_DIRECTORY}")
|
||||
if(CMAKE_DUMPBIN)
|
||||
execute_process(
|
||||
COMMAND "${CMAKE_DUMPBIN}" "-headers" "${IMPLIB}"
|
||||
RESULT_VARIABLE retcode
|
||||
OUTPUT_VARIABLE stdout
|
||||
ERROR_VARIABLE stderr)
|
||||
if(NOT retcode EQUAL 0)
|
||||
if(NOT ARGS_NOTFATAL)
|
||||
message(FATAL_ERROR "dumpbin failed.")
|
||||
else()
|
||||
set(${DEST} "${DEST}-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
string(REGEX MATCH "DLL name[ ]+:[ ]+([^\n]+)\n" match "${stdout}")
|
||||
if(NOT match)
|
||||
if(NOT ARGS_NOTFATAL)
|
||||
message(FATAL_ERROR "dumpbin did not find any associated dll for ${IMPLIB}.")
|
||||
else()
|
||||
set(${DEST} "${DEST}-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
set(result "${CMAKE_MATCH_1}")
|
||||
set(${DEST} "${result}" PARENT_SCOPE)
|
||||
else()
|
||||
message(FATAL_ERROR "Cannot find dumpbin, please set CMAKE_DUMPBIN cmake variable")
|
||||
endif()
|
||||
else()
|
||||
if(NOT ARGS_NOTFATAL)
|
||||
message(FATAL_ERROR "Don't know how to identify dll from import library. Set CMAKE_DLLTOOL (for mingw) or CMAKE_DUMPBIN (for MSVC)")
|
||||
else()
|
||||
set(${DEST} "${DEST}-NOTFOUND")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(get_actual_target)
|
||||
set(dst "${ARGV0}")
|
||||
set(target "${${dst}}")
|
||||
set(input "${target}")
|
||||
get_target_property(alias "${target}" ALIASED_TARGET)
|
||||
while(alias)
|
||||
set(target "${alias}")
|
||||
get_target_property(alias "${target}" ALIASED_TARGET)
|
||||
endwhile()
|
||||
message(DEBUG "get_actual_target(\"${input}\") -> \"${target}\"")
|
||||
set("${dst}" "${target}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(target_get_dynamic_library DEST TARGET)
|
||||
set(result)
|
||||
if(DEFINED ${DEST})
|
||||
if(NOT EXISTS "${${DEST}}")
|
||||
message(FATAL_ERROR "${DEST}=${${DEST}} does not exist")
|
||||
endif()
|
||||
get_filename_component(filename ${${DEST}} NAME)
|
||||
set(${DEST} ${filename} PARENT_SCOPE)
|
||||
else()
|
||||
get_actual_target(TARGET)
|
||||
if(WIN32)
|
||||
# Use the target dll of the import library
|
||||
set(props_to_check IMPORTED_IMPLIB)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND props_to_check IMPORTED_IMPLIB_${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
list(APPEND props_to_check IMPORTED_LOCATION)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND props_to_check IMPORTED_LOCATION_${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
foreach (config_type ${CMAKE_CONFIGURATION_TYPES} RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
|
||||
list(APPEND props_to_check IMPORTED_IMPLIB_${config_type})
|
||||
list(APPEND props_to_check IMPORTED_LOCATION_${config_type})
|
||||
endforeach()
|
||||
|
||||
foreach(prop_to_check ${props_to_check})
|
||||
if(NOT result)
|
||||
get_target_property(propvalue "${TARGET}" ${prop_to_check})
|
||||
if(propvalue AND EXISTS "${propvalue}")
|
||||
win32_implib_identify_dll(result "${propvalue}" NOTFATAL)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
# 1. find the target library a file might be symbolic linking to
|
||||
# 2. find all other files in the same folder that symolic link to it
|
||||
# 3. sort all these files, and select the 1st item on Linux, and last on Macos
|
||||
set(location_properties IMPORTED_LOCATION)
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND location_properties IMPORTED_LOCATION_${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
foreach (config_type ${CMAKE_CONFIGURATION_TYPES} RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
|
||||
list(APPEND location_properties IMPORTED_LOCATION_${config_type})
|
||||
endforeach()
|
||||
if(APPLE)
|
||||
set(valid_shared_library_regex "\\.[0-9]+\\.dylib$")
|
||||
else()
|
||||
set(valid_shared_library_regex "\\.so\\.([0-9.]+)?[0-9]")
|
||||
endif()
|
||||
foreach(location_property ${location_properties})
|
||||
if(NOT result)
|
||||
get_target_property(library_path "${TARGET}" ${location_property})
|
||||
message(DEBUG "get_target_property(${TARGET} ${location_propert}) -> ${library_path}")
|
||||
if(EXISTS "${library_path}")
|
||||
get_filename_component(library_path "${library_path}" ABSOLUTE)
|
||||
while (IS_SYMLINK "${library_path}")
|
||||
read_absolute_symlink(library_path "${library_path}")
|
||||
endwhile()
|
||||
message(DEBUG "${TARGET} -> ${library_path}")
|
||||
get_filename_component(libdir "${library_path}" DIRECTORY)
|
||||
file(GLOB subfiles "${libdir}/*")
|
||||
set(similar_files "${library_path}")
|
||||
foreach(subfile ${subfiles})
|
||||
if(IS_SYMLINK "${subfile}")
|
||||
read_absolute_symlink(subfile_target "${subfile}")
|
||||
while(IS_SYMLINK "${subfile_target}")
|
||||
read_absolute_symlink(subfile_target "${subfile_target}")
|
||||
endwhile()
|
||||
get_filename_component(subfile_target "${subfile_target}" ABSOLUTE)
|
||||
if(subfile_target STREQUAL library_path AND subfile MATCHES "${valid_shared_library_regex}")
|
||||
list(APPEND similar_files "${subfile}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
list(SORT similar_files)
|
||||
message(DEBUG "files that are similar to \"${library_path}\"=${similar_files}")
|
||||
if(APPLE)
|
||||
list(REVERSE similar_files)
|
||||
endif()
|
||||
list(GET similar_files 0 item)
|
||||
get_filename_component(result "${item}" NAME)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
if(result)
|
||||
string(TOLOWER "${result}" result_lower)
|
||||
if(WIN32 OR OS2)
|
||||
if(NOT result_lower MATCHES ".*dll")
|
||||
message(FATAL_ERROR "\"${result}\" is not a .dll library")
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if(NOT result_lower MATCHES ".*dylib.*")
|
||||
message(FATAL_ERROR "\"${result}\" is not a .dylib shared library")
|
||||
endif()
|
||||
else()
|
||||
if(NOT result_lower MATCHES ".*so.*")
|
||||
message(FATAL_ERROR "\"${result}\" is not a .so shared library")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
get_target_property(target_type ${TARGET} TYPE)
|
||||
if(target_type MATCHES "SHARED_LIBRARY|MODULE_LIBRARY")
|
||||
# OK
|
||||
elseif(target_type MATCHES "STATIC_LIBRARY|OBJECT_LIBRARY|INTERFACE_LIBRARY|EXECUTABLE")
|
||||
message(SEND_ERROR "${TARGET} is not a shared library, but has type=${target_type}")
|
||||
else()
|
||||
message(WARNING "Unable to extract dynamic library from target=${TARGET}, type=${target_type}.")
|
||||
endif()
|
||||
# TARGET_SONAME_FILE is not allowed for DLL target platforms.
|
||||
if(WIN32)
|
||||
set(result "$<TARGET_FILE_NAME:${TARGET}>")
|
||||
else()
|
||||
set(result "$<TARGET_SONAME_FILE_NAME:${TARGET}>")
|
||||
endif()
|
||||
endif()
|
||||
set(${DEST} ${result} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_check_project_in_subfolder relative_subfolder name vendored_option)
|
||||
cmake_parse_arguments(ARG "" "FILE" "" ${ARGN})
|
||||
if(NOT ARG_FILE)
|
||||
set(ARG_FILE "CMakeLists.txt")
|
||||
endif()
|
||||
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${relative_subfolder}/${ARG_FILE}")
|
||||
message(FATAL_ERROR "Could not find ${ARG_FILE} for ${name} in ${relative_subfolder}.\n"
|
||||
"Run the download script in the external folder, or re-configure with -D${vendored_option}=OFF to use system packages.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(sdl_check_linker_flag flag var)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS "3.18")
|
||||
check_linker_flag(C "${flag}" "${var}")
|
||||
else()
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "${flag}")
|
||||
check_c_source_compiles("int main() { return 0; }" ${var} FAIL_REGEX "(unsupported|syntax error|unrecognized option)")
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(SDL_detect_linker)
|
||||
if(CMAKE_VERSION VERSION_LESS 3.29)
|
||||
if(NOT DEFINED SDL_CMAKE_C_COMPILER_LINKER_ID)
|
||||
execute_process(COMMAND ${CMAKE_LINKER} -v OUTPUT_VARIABLE LINKER_OUTPUT ERROR_VARIABLE LINKER_OUTPUT)
|
||||
string(REGEX REPLACE "[\r\n]" " " LINKER_OUTPUT "${LINKER_OUTPUT}")
|
||||
if(LINKER_OUTPUT MATCHES ".*Microsoft.*")
|
||||
set(linker MSVC)
|
||||
else()
|
||||
set(linker GNUlike)
|
||||
endif()
|
||||
message(STATUS "Linker identification: ${linker}")
|
||||
set(SDL_CMAKE_C_COMPILER_LINKER_ID "${linker}" CACHE STRING "Linker identification")
|
||||
mark_as_advanced(SDL_CMAKE_C_COMPILER_LINKER_ID)
|
||||
endif()
|
||||
set(CMAKE_C_COMPILER_LINKER_ID "${SDL_CMAKE_C_COMPILER_LINKER_ID}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(check_linker_support_version_script VAR)
|
||||
SDL_detect_linker()
|
||||
if(CMAKE_C_COMPILER_LINKER_ID MATCHES "^(MSVC)$")
|
||||
set(LINKER_SUPPORTS_VERSION_SCRIPT FALSE)
|
||||
else()
|
||||
cmake_push_check_state(RESET)
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummy.sym" "n_0 {\n global:\n func;\n local: *;\n};\n")
|
||||
list(APPEND CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/dummy.sym")
|
||||
check_c_source_compiles("int func(void) {return 0;} int main(int argc,char*argv[]){(void)argc;(void)argv;return func();}" LINKER_SUPPORTS_VERSION_SCRIPT FAIL_REGEX "(unsupported|syntax error|unrecognized option)")
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
set(${VAR} "${LINKER_SUPPORTS_VERSION_SCRIPT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(sdl_target_link_options_no_undefined TARGET)
|
||||
if(NOT MSVC AND NOT CMAKE_SYSTEM_NAME MATCHES ".*OpenBSD.*")
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
|
||||
else()
|
||||
sdl_check_linker_flag("-Wl,--no-undefined" HAVE_WL_NO_UNDEFINED)
|
||||
if(HAVE_WL_NO_UNDEFINED AND NOT ((CMAKE_C_COMPILER_ID MATCHES "Clang") AND WIN32))
|
||||
target_link_options(${TARGET} PRIVATE "-Wl,--no-undefined")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_target_link_option_version_file TARGET VERSION_SCRIPT)
|
||||
check_linker_support_version_script(HAVE_WL_VERSION_SCRIPT)
|
||||
if(HAVE_WL_VERSION_SCRIPT)
|
||||
target_link_options(${TARGET} PRIVATE "-Wl,--version-script=${VERSION_SCRIPT}")
|
||||
set_property(TARGET ${TARGET} APPEND PROPERTY LINK_DEPENDS "${VERSION_SCRIPT}")
|
||||
else()
|
||||
if(LINUX OR ANDROID)
|
||||
message(FATAL_ERROR "Linker does not support '-Wl,--version-script=xxx.sym'. This is required on the current host platform.")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_add_warning_options TARGET)
|
||||
cmake_parse_arguments(ARGS "" "WARNING_AS_ERROR" "" ${ARGN})
|
||||
if(MSVC)
|
||||
target_compile_options(${TARGET} PRIVATE /W2)
|
||||
else()
|
||||
target_compile_options(${TARGET} PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
||||
endif()
|
||||
if(ARGS_WARNING_AS_ERROR)
|
||||
if(MSVC)
|
||||
target_compile_options(${TARGET} PRIVATE /WX)
|
||||
else()
|
||||
target_compile_options(${TARGET} PRIVATE -Werror)
|
||||
endif()
|
||||
get_property(target_type TARGET ${TARGET} PROPERTY TYPE)
|
||||
if(NOT (APPLE OR MSVC))
|
||||
if(target_type MATCHES "SHARED_LIBRARY|MODULE_LIBRARY")
|
||||
sdl_check_linker_flag("-Wl,-fatal-warnings" HAVE_WL_FATAL_WARNINGS)
|
||||
if(HAVE_WL_FATAL_WARNINGS)
|
||||
target_link_options(${TARGET} PRIVATE "-Wl,-fatal-warnings")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_no_deprecated_errors TARGET)
|
||||
check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
|
||||
if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
|
||||
target_compile_options(${TARGET} PRIVATE "-Wno-error=deprecated-declarations")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(sdl_get_git_revision_hash VARNAME)
|
||||
set("${VARNAME}" "" CACHE STRING "${PROJECT_NAME} revision")
|
||||
set(revision "${${VARNAME}}")
|
||||
if(NOT revision)
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt")
|
||||
# If VERSION.txt exists, it contains the SDL version
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt" revision_version)
|
||||
string(STRIP "${revision_version}" revision_version)
|
||||
else()
|
||||
# If VERSION.txt does not exist, use git to calculate a version
|
||||
git_describe(revision_version)
|
||||
if(NOT revision_version)
|
||||
set(revision_version "${PROJECT_VERSION}-no-vcs")
|
||||
endif()
|
||||
endif()
|
||||
set(revision "${revision_version}")
|
||||
endif()
|
||||
set("${VARNAME}" "${revision}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(SDL_install_pdb TARGET DIRECTORY)
|
||||
get_property(type TARGET ${TARGET} PROPERTY TYPE)
|
||||
if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$")
|
||||
install(FILES $<TARGET_PDB_FILE:${TARGET}> DESTINATION "${DIRECTORY}" OPTIONAL)
|
||||
elseif(type STREQUAL "STATIC_LIBRARY")
|
||||
# FIXME: Use $<TARGET_COMPILE_PDB_FILE:${TARGET} once it becomes available (https://gitlab.kitware.com/cmake/cmake/-/issues/25244)
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual Studio.*")
|
||||
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/${TARGET}.pdb\")")
|
||||
else()
|
||||
install(CODE "file(INSTALL DESTINATION \"\${CMAKE_INSTALL_PREFIX}/${DIRECTORY}\" TYPE FILE OPTIONAL FILES \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TARGET}.dir/${TARGET}.pdb\")")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,155 @@
|
||||
# sdl3_mixer cmake project-config input for CMakeLists.txt script
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL3_mixer PROPERTIES
|
||||
URL "https://www.libsdl.org/projects/SDL_mixer/"
|
||||
DESCRIPTION "SDL_mixer is a sample multi-channel audio mixer library"
|
||||
)
|
||||
|
||||
set(SDL3_mixer_FOUND ON)
|
||||
|
||||
set(SDLMIXER_VENDORED @SDLMIXER_VENDORED@)
|
||||
|
||||
set(SDLMIXER_FLAC @SDLMIXER_FLAC_ENABLED@)
|
||||
set(SDLMIXER_FLAC_LIBFLAC @SDLMIXER_FLAC_LIBFLAC_ENABLED@)
|
||||
set(SDLMIXER_FLAC_DRFLAC @SDLMIXER_FLAC_DRFLAC_ENABLED@)
|
||||
|
||||
set(SDLMIXER_GME @SDLMIXER_GME_ENABLED@)
|
||||
|
||||
set(SDLMIXER_MOD @SDLMIXER_MOD_ENABLED@)
|
||||
set(SDLMIXER_MOD_XMP @SDLMIXER_MOD_XMP_ENABLED@)
|
||||
set(SDLMIXER_MOD_XMP_LITE @SDLMIXER_MOD_XMP_ENABLED@)
|
||||
|
||||
set(SDLMIXER_MP3 @SDLMIXER_MP3_ENABLED@)
|
||||
set(SDLMIXER_MP3_DRMP3 @SDLMIXER_MP3_DRMP3_ENABLED@)
|
||||
set(SDLMIXER_MP3_MPG123 @SDLMIXER_MP3_MPG123_ENABLED@)
|
||||
|
||||
set(SDLMIXER_MIDI @SDLMIXER_MIDI_ENABLED@)
|
||||
set(SDLMIXER_MIDI_FLUIDSYNTH @SDLMIXER_MIDI_FLUIDSYNTH_ENABLED@)
|
||||
set(SDLMIXER_MIDI_TIMIDITY @SDLMIXER_MIDI_TIMIDITY_ENABLED@)
|
||||
|
||||
set(SDLMIXER_OPUS @SDLMIXER_OPUS_ENABLED@)
|
||||
|
||||
set(SDLMIXER_VORBIS @SDLMIXER_VORBIS_ENABLED@)
|
||||
set(SDLMIXER_VORBIS_STB @SDLMIXER_VORBIS_STB_ENABLED@)
|
||||
set(SDLMIXER_VORBIS_TREMOR @SDLMIXER_VORBIS_TREMOR_ENABLED@)
|
||||
set(SDLMIXER_VORBIS_VORBISFILE @SDLMIXER_VORBIS_VORBISFILE_ENABLED@)
|
||||
|
||||
set(SDLMIXER_WAVE @SDLMIXER_WAVE_ENABLED@)
|
||||
|
||||
set(SDLMIXER_WAVPACK @SDLMIXER_WAVPACK_ENABLED@)
|
||||
|
||||
set(SDLMIXER_SDL3_REQUIRED_VERSION @SDL_REQUIRED_VERSION@)
|
||||
|
||||
set(SDL3_mixer_SDL3_mixer-shared_FOUND FALSE)
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_mixer-shared-targets.cmake")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL3_mixer-shared-targets.cmake")
|
||||
set(SDL3_mixer_SDL3_mixer-shared_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
set(SDL3_mixer_SDL3_mixer-static FALSE)
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_mixer-static-targets.cmake")
|
||||
|
||||
if(SDLMIXER_VENDORED)
|
||||
if(SDLMIXER_GME)
|
||||
include(CheckLanguage)
|
||||
check_language(CXX)
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
message(WARNING "CXX language not enabled. Linking to SDL3_mixer::SDL3_mixer-static might fail.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(_sdl_cmake_module_path "${CMAKE_MODULE_PATH}")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
include(PkgConfigHelper)
|
||||
|
||||
if(NOT DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_FLAC_LIBFLAC AND NOT TARGET FLAC::FLAC)
|
||||
find_dependency(FLAC)
|
||||
# Xiph's CMake script does not handle Threads::Threads correctly:
|
||||
# https://github.com/xiph/flac/issues/820
|
||||
get_property(flac_interface_link_libraries TARGET FLAC::FLAC PROPERTY INTERFACE_LINK_LIBRARIES)
|
||||
if(Threads::Threads IN_LIST flac_interface_link_libraries)
|
||||
find_package(Threads)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_MOD_XMP AND NOT TARGET libxmp::libxmp)
|
||||
find_dependency(libxmp)
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_MOD_XMP_LITE AND NOT TARGET libxmp-lite::libxmp-lite)
|
||||
find_dependency(libxmp-lite)
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_MP3_MPG123 AND NOT TARGET MPG123::mpg123)
|
||||
find_dependency(mpg123)
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_MIDI_FLUIDSYNTH AND NOT TARGET FluidSynth::libfluidsynth)
|
||||
find_dependency(FluidSynth "2.2.0")
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_VORBIS_TREMOR AND NOT TARGET tremor::tremor)
|
||||
find_dependency(tremor)
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_VORBIS_VORBISFILE AND NOT TARGET Vorbis::vorbisfile)
|
||||
find_dependency(Vorbis)
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_OPUS AND NOT TARGET OpusFile::opusfile)
|
||||
find_dependency(OpusFile)
|
||||
endif()
|
||||
|
||||
if(SDLMIXER_WAVPACK AND NOT TARGET WavPack::WavPack)
|
||||
find_dependency(wavpack)
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH "${_sdl_cmake_module_path}")
|
||||
unset(_sdl_cmake_module_path)
|
||||
|
||||
if(HAIKU AND SDLMIXER_MIDI_NATIVE)
|
||||
include(CheckLanguage)
|
||||
check_language(CXX)
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
message(WARNING "CXX language not enabled. Linking to SDL3_mixer::SDL3_mixer-static might fail.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/SDL3_mixer-static-targets.cmake")
|
||||
set(SDL3_mixer_SDL3_mixer-static TRUE)
|
||||
endif()
|
||||
|
||||
function(_sdl_create_target_alias_compat NEW_TARGET TARGET)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.18")
|
||||
# Aliasing local targets is not supported on CMake < 3.18, so make it global.
|
||||
add_library(${NEW_TARGET} INTERFACE IMPORTED)
|
||||
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}")
|
||||
else()
|
||||
add_library(${NEW_TARGET} ALIAS ${TARGET})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Make sure SDL3_mixer::SDL3_mixer always exists
|
||||
if(NOT TARGET SDL3_mixer::SDL3_mixer)
|
||||
if(TARGET SDL3_mixer::SDL3_mixer-shared)
|
||||
_sdl_create_target_alias_compat(SDL3_mixer::SDL3_mixer SDL3_mixer::SDL3_mixer-shared)
|
||||
elseif(TARGET SDL3_mixer::SDL3_mixer-static)
|
||||
_sdl_create_target_alias_compat(SDL3_mixer::SDL3_mixer SDL3_mixer::SDL3_mixer-static)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT SDL3_mixer_COMPONENTS AND NOT TARGET SDL3_mixer::SDL3_mixer-shared AND NOT TARGET SDL3_mixer::SDL3_mixer-static)
|
||||
set(SDL3_mixer_FOUND FALSE)
|
||||
endif()
|
||||
@PACKAGE_INIT@
|
||||
check_required_components(SDL3_mixer)
|
||||
@@ -0,0 +1,13 @@
|
||||
prefix=@SDL_PKGCONFIG_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=@LIBDIR_FOR_PKG_CONFIG@
|
||||
includedir=@INCLUDEDIR_FOR_PKG_CONFIG@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: mixer library for Simple DirectMedia Layer
|
||||
Version: @PROJECT_VERSION@
|
||||
Requires: sdl3 >= @SDL_REQUIRED_VERSION@
|
||||
Libs: -L${libdir} -lSDL3_mixer
|
||||
Requires.private: @PC_REQUIRES@
|
||||
Libs.private: @PC_LIBS@
|
||||
Cflags: -I${includedir}
|
||||
@@ -0,0 +1,158 @@
|
||||
function(SDL_DetectTargetCPUArchitectures DETECTED_ARCHS)
|
||||
|
||||
set(known_archs EMSCRIPTEN ARM32 ARM64 ARM64EC LOONGARCH64 POWERPC32 POWERPC64 RISCV32 RISCV64 X86 X64)
|
||||
|
||||
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
set(SDL_CPU_${known_arch} "0" PARENT_SCOPE)
|
||||
endforeach()
|
||||
set(detected_archs)
|
||||
foreach(osx_arch IN LISTS CMAKE_OSX_ARCHITECTURES)
|
||||
if(osx_arch STREQUAL "x86_64")
|
||||
set(SDL_CPU_X64 "1" PARENT_SCOPE)
|
||||
list(APPEND detected_archs "X64")
|
||||
elseif(osx_arch STREQUAL "arm64")
|
||||
set(SDL_CPU_ARM64 "1" PARENT_SCOPE)
|
||||
list(APPEND detected_archs "ARM64")
|
||||
endif()
|
||||
endforeach()
|
||||
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(detected_archs)
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
if(SDL_CPU_${known_arch})
|
||||
list(APPEND detected_archs "${known_arch}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(detected_archs)
|
||||
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(arch_check_ARM32 "defined(__arm__) || defined(_M_ARM)")
|
||||
set(arch_check_ARM64 "defined(__aarch64__) || defined(_M_ARM64)")
|
||||
set(arch_check_ARM64EC "defined(_M_ARM64EC)")
|
||||
set(arch_check_EMSCRIPTEN "defined(__EMSCRIPTEN__)")
|
||||
set(arch_check_LOONGARCH64 "defined(__loongarch64)")
|
||||
set(arch_check_POWERPC32 "(defined(__PPC__) || defined(__powerpc__)) && !defined(__powerpc64__)")
|
||||
set(arch_check_POWERPC64 "defined(__PPC64__) || defined(__powerpc64__)")
|
||||
set(arch_check_RISCV32 "defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32")
|
||||
set(arch_check_RISCV64 "defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64")
|
||||
set(arch_check_X86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)")
|
||||
set(arch_check_X64 "(defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)) && !defined(_M_ARM64EC)")
|
||||
|
||||
set(src_vars "")
|
||||
set(src_main "")
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
set(detected_${known_arch} "0")
|
||||
|
||||
string(APPEND src_vars "
|
||||
#if ${arch_check_${known_arch}}
|
||||
#define ARCH_${known_arch} \"1\"
|
||||
#else
|
||||
#define ARCH_${known_arch} \"0\"
|
||||
#endif
|
||||
const char *arch_${known_arch} = \"INFO<${known_arch}=\" ARCH_${known_arch} \">\";
|
||||
")
|
||||
string(APPEND src_main "
|
||||
result += arch_${known_arch}[argc];")
|
||||
endforeach()
|
||||
|
||||
set(src_arch_detect "${src_vars}
|
||||
int main(int argc, char *argv[]) {
|
||||
int result = 0;
|
||||
(void)argv;
|
||||
${src_main}
|
||||
return result;
|
||||
}")
|
||||
|
||||
if(CMAKE_C_COMPILER)
|
||||
set(ext ".c")
|
||||
elseif(CMAKE_CXX_COMPILER)
|
||||
set(ext ".cpp")
|
||||
else()
|
||||
enable_language(C)
|
||||
set(ext ".c")
|
||||
endif()
|
||||
set(path_src_arch_detect "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch${ext}")
|
||||
file(WRITE "${path_src_arch_detect}" "${src_arch_detect}")
|
||||
set(path_dir_arch_detect "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch")
|
||||
set(path_bin_arch_detect "${path_dir_arch_detect}/bin")
|
||||
|
||||
set(detected_archs)
|
||||
|
||||
set(msg "Detecting Target CPU Architecture")
|
||||
message(STATUS "${msg}")
|
||||
|
||||
include(CMakePushCheckState)
|
||||
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
|
||||
|
||||
cmake_push_check_state(RESET)
|
||||
try_compile(SDL_CPU_CHECK_ALL
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/SDL_detect_arch"
|
||||
SOURCES "${path_src_arch_detect}"
|
||||
COPY_FILE "${path_bin_arch_detect}"
|
||||
)
|
||||
cmake_pop_check_state()
|
||||
if(NOT SDL_CPU_CHECK_ALL)
|
||||
message(STATUS "${msg} - <ERROR>")
|
||||
message(WARNING "Failed to compile source detecting the target CPU architecture")
|
||||
else()
|
||||
set(re "INFO<([A-Z0-9]+)=([01])>")
|
||||
file(STRINGS "${path_bin_arch_detect}" infos REGEX "${re}")
|
||||
|
||||
foreach(info_arch_01 IN LISTS infos)
|
||||
string(REGEX MATCH "${re}" A "${info_arch_01}")
|
||||
if(NOT "${CMAKE_MATCH_1}" IN_LIST known_archs)
|
||||
message(WARNING "Unknown architecture: \"${CMAKE_MATCH_1}\"")
|
||||
continue()
|
||||
endif()
|
||||
set(arch "${CMAKE_MATCH_1}")
|
||||
set(arch_01 "${CMAKE_MATCH_2}")
|
||||
set(detected_${arch} "${arch_01}")
|
||||
endforeach()
|
||||
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
if(detected_${known_arch})
|
||||
list(APPEND detected_archs ${known_arch})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(detected_archs)
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
set("SDL_CPU_${known_arch}" "${detected_${known_arch}}" CACHE BOOL "Detected architecture ${known_arch}")
|
||||
endforeach()
|
||||
message(STATUS "${msg} - ${detected_archs}")
|
||||
else()
|
||||
include(CheckCSourceCompiles)
|
||||
cmake_push_check_state(RESET)
|
||||
foreach(known_arch IN LISTS known_archs)
|
||||
if(NOT detected_archs)
|
||||
set(cache_variable "SDL_CPU_${known_arch}")
|
||||
set(test_src "
|
||||
int main(int argc, char *argv[]) {
|
||||
#if ${arch_check_${known_arch}}
|
||||
return 0;
|
||||
#else
|
||||
choke
|
||||
#endif
|
||||
}
|
||||
")
|
||||
check_c_source_compiles("${test_src}" "${cache_variable}")
|
||||
if(${cache_variable})
|
||||
set(SDL_CPU_${known_arch} "1" CACHE BOOL "Detected architecture ${known_arch}")
|
||||
set(detected_archs ${known_arch})
|
||||
else()
|
||||
set(SDL_CPU_${known_arch} "0" CACHE BOOL "Detected architecture ${known_arch}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
set("${DETECTED_ARCHS}" "${detected_archs}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,68 @@
|
||||
include(CMakeParseArguments)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
function(SDL_generate_manpages)
|
||||
cmake_parse_arguments(ARG "" "RESULT_VARIABLE;NAME;BUILD_DOCDIR;HEADERS_DIR;SOURCE_DIR;SYMBOL;OPTION_FILE;WIKIHEADERS_PL_PATH;REVISION" "" ${ARGN})
|
||||
|
||||
set(wikiheaders_extra_args)
|
||||
|
||||
if(NOT ARG_NAME)
|
||||
set(ARG_NAME "${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
if(NOT ARG_SOURCE_DIR)
|
||||
set(ARG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
if(NOT ARG_OPTION_FILE)
|
||||
set(ARG_OPTION_FILE "${PROJECT_SOURCE_DIR}/.wikiheaders-options")
|
||||
endif()
|
||||
|
||||
if(NOT ARG_HEADERS_DIR)
|
||||
message(FATAL_ERROR "Missing required HEADERS_DIR argument")
|
||||
endif()
|
||||
|
||||
# FIXME: get rid of SYMBOL and let the perl script figure out the dependencies
|
||||
if(NOT ARG_SYMBOL)
|
||||
message(FATAL_ERROR "Missing required SYMBOL argument")
|
||||
endif()
|
||||
|
||||
if(ARG_REVISION)
|
||||
list(APPEND wikiheaders_extra_args "--rev=${ARG_REVISION}")
|
||||
endif()
|
||||
|
||||
if(NOT ARG_BUILD_DOCDIR)
|
||||
set(ARG_BUILD_DOCDIR "${CMAKE_CURRENT_BINARY_DIR}/docs")
|
||||
endif()
|
||||
set(BUILD_WIKIDIR "${ARG_BUILD_DOCDIR}/wiki")
|
||||
set(BUILD_MANDIR "${ARG_BUILD_DOCDIR}/man")
|
||||
|
||||
find_package(Perl)
|
||||
file(GLOB HEADER_FILES "${ARG_HEADERS_DIR}/*.h")
|
||||
|
||||
set(result FALSE)
|
||||
|
||||
if(PERL_FOUND AND EXISTS "${ARG_WIKIHEADERS_PL_PATH}")
|
||||
add_custom_command(
|
||||
OUTPUT "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md"
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory "${BUILD_WIKIDIR}"
|
||||
COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" --copy-to-wiki ${wikiheaders_extra_args}
|
||||
DEPENDS ${HEADER_FILES} "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}"
|
||||
COMMENT "Generating ${ARG_NAME} wiki markdown files"
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${BUILD_MANDIR}/man3/${ARG_SYMBOL}.3"
|
||||
COMMAND "${PERL_EXECUTABLE}" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_SOURCE_DIR}" "${BUILD_WIKIDIR}" "--options=${ARG_OPTION_FILE}" "--manpath=${BUILD_MANDIR}" --copy-to-manpages ${wikiheaders_extra_args}
|
||||
DEPENDS "${BUILD_WIKIDIR}/${ARG_SYMBOL}.md" "${ARG_WIKIHEADERS_PL_PATH}" "${ARG_OPTION_FILE}"
|
||||
COMMENT "Generating ${ARG_NAME} man pages"
|
||||
)
|
||||
add_custom_target(${ARG_NAME}-docs ALL DEPENDS "${BUILD_MANDIR}/man3/${ARG_SYMBOL}.3")
|
||||
|
||||
install(DIRECTORY "${BUILD_MANDIR}/" DESTINATION "${CMAKE_INSTALL_MANDIR}")
|
||||
set(result TRUE)
|
||||
endif()
|
||||
|
||||
if(ARG_RESULT_VARIABLE)
|
||||
set(${ARG_RESULT_VARIABLE} ${result} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,106 @@
|
||||
macro(SDL_DetectCMakePlatform)
|
||||
set(SDL_CMAKE_PLATFORM )
|
||||
# Get the platform
|
||||
if(WIN32)
|
||||
set(SDL_CMAKE_PLATFORM Windows)
|
||||
elseif(PSP)
|
||||
set(SDL_CMAKE_PLATFORM psp)
|
||||
elseif(APPLE)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
|
||||
set(SDL_CMAKE_PLATFORM Darwin)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
|
||||
set(SDL_CMAKE_PLATFORM MacosX)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
|
||||
set(SDL_CMAKE_PLATFORM tvOS)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
|
||||
set(SDL_CMAKE_PLATFORM iOS)
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
|
||||
set(SDL_CMAKE_PLATFORM Haiku)
|
||||
elseif(NINTENDO_3DS)
|
||||
set(SDL_CMAKE_PLATFORM n3ds)
|
||||
elseif(PS2)
|
||||
set(SDL_CMAKE_PLATFORM ps2)
|
||||
elseif(VITA)
|
||||
set(SDL_CMAKE_PLATFORM Vita)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
|
||||
set(SDL_CMAKE_PLATFORM Linux)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
|
||||
set(SDL_CMAKE_PLATFORM FreeBSD)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
|
||||
set(SDL_CMAKE_PLATFORM NetBSD)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
|
||||
set(SDL_CMAKE_PLATFORM OpenBSD)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
|
||||
set(SDL_CMAKE_PLATFORM GNU)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
|
||||
set(SDL_CMAKE_PLATFORM BSDi)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
|
||||
set(SDL_CMAKE_PLATFORM FreeBSD)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
|
||||
set(SDL_CMAKE_PLATFORM SYSV5)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
|
||||
set(SDL_CMAKE_PLATFORM Solaris)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
|
||||
set(SDL_CMAKE_PLATFORM HPUX)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
|
||||
set(SDL_CMAKE_PLATFORM AIX)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
|
||||
set(SDL_CMAKE_PLATFORM Minix)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Android.*")
|
||||
set(SDL_CMAKE_PLATFORM Android)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Emscripten.*")
|
||||
set(SDL_CMAKE_PLATFORM Emscripten)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "QNX.*")
|
||||
set(SDL_CMAKE_PLATFORM QNX)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
|
||||
message(FATAL_ERROR "BeOS support has been removed as of SDL 2.0.2.")
|
||||
endif()
|
||||
|
||||
if(SDL_CMAKE_PLATFORM)
|
||||
string(TOUPPER "${SDL_CMAKE_PLATFORM}" _upper_platform)
|
||||
set(${_upper_platform} TRUE)
|
||||
else()
|
||||
set(SDL_CMAKE_PLATFORM} "unknown")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(SDL_DetectCPUArchitecture)
|
||||
set(sdl_cpu_names)
|
||||
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
|
||||
if(osx_arch STREQUAL "x86_64")
|
||||
list(APPEND sdl_cpu_names "x64")
|
||||
elseif(osx_arch STREQUAL "arm64")
|
||||
list(APPEND sdl_cpu_names "arm64")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(sdl_known_archs x64 x86 arm64 arm32 emscripten powerpc64 powerpc32 loongarch64)
|
||||
if(NOT sdl_cpu_names)
|
||||
set(found FALSE)
|
||||
foreach(sdl_known_arch ${sdl_known_archs})
|
||||
if(NOT found)
|
||||
string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper)
|
||||
set(var_name "SDL_CPU_${sdl_known_arch_upper}")
|
||||
check_cpu_architecture(${sdl_known_arch} ${var_name})
|
||||
if(${var_name})
|
||||
list(APPEND sdl_cpu_names ${sdl_known_arch})
|
||||
set(found TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
foreach(sdl_known_arch ${sdl_known_archs})
|
||||
string(TOUPPER "${sdl_known_arch}" sdl_known_arch_upper)
|
||||
set(var_name "SDL_CPU_${sdl_known_arch_upper}")
|
||||
if(sdl_cpu_names MATCHES "(^|;)${sdl_known_arch}($|;)") # FIXME: use if(IN_LIST)
|
||||
set(${var_name} 1 PARENT_SCOPE)
|
||||
else()
|
||||
set(${var_name} 0 PARENT_SCOPE)
|
||||
endif()
|
||||
endforeach()
|
||||
set(SDL_CPU_NAMES ${sdl_cpu_names} PARENT_SCOPE)
|
||||
endfunction()
|
||||
@@ -0,0 +1,44 @@
|
||||
# This cmake build script is meant for verifying the various CMake configuration script.
|
||||
|
||||
cmake_minimum_required(VERSION 3.12...3.28)
|
||||
project(sdl_test LANGUAGES C)
|
||||
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
|
||||
# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL3_mixer outside of sysroot
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER)
|
||||
|
||||
include(FeatureSummary)
|
||||
|
||||
option(TEST_SHARED "Test linking to shared SDL3_mixer library" ON)
|
||||
add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library")
|
||||
|
||||
option(TEST_STATIC "Test linking to static SDL3_mixer libary" ON)
|
||||
add_feature_info("TEST_STATIC" TEST_STATIC "Test linking with static library")
|
||||
|
||||
if(ANDROID)
|
||||
macro(add_executable NAME)
|
||||
set(args ${ARGN})
|
||||
list(REMOVE_ITEM args WIN32)
|
||||
add_library(${NAME} SHARED ${args})
|
||||
unset(args)
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
if(TEST_SHARED)
|
||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
|
||||
find_package(SDL3_mixer REQUIRED CONFIG)
|
||||
add_executable(main_shared main.c)
|
||||
target_link_libraries(main_shared PRIVATE SDL3_mixer::SDL3_mixer-shared SDL3::SDL3)
|
||||
endif()
|
||||
|
||||
if(TEST_STATIC)
|
||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
|
||||
# some static vendored libraries use c++ (enable CXX after `find_package` might show a warning)
|
||||
enable_language(CXX)
|
||||
find_package(SDL3_mixer REQUIRED CONFIG)
|
||||
add_executable(main_static main.c)
|
||||
target_link_libraries(main_static PRIVATE SDL3_mixer::SDL3_mixer-static SDL3::SDL3)
|
||||
endif()
|
||||
|
||||
feature_summary(WHAT ALL)
|
||||
@@ -0,0 +1,17 @@
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3_mixer/SDL_mixer.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if (!SDL_Init(0)) {
|
||||
SDL_Log("SDL_Init: could not initialize SDL: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
if (MIX_Init() == 0) {
|
||||
SDL_Log("MIX_Init: no sound/music loaders supported (%s)\n", SDL_GetError());
|
||||
}
|
||||
MIX_Quit();
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user