mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Update libsndfile to 1.0.29pre2+git
This pulls in MANY (over 890) changes compared to our from our current 1.0.24 version.
This commit is contained in:
46
lib-src/libsndfile/cmake/CMakeAutoGen.cmake
Normal file
46
lib-src/libsndfile/cmake/CMakeAutoGen.cmake
Normal file
@@ -0,0 +1,46 @@
|
||||
# CMake implementation of AutoGen
|
||||
# Copyright (C) 2017 Anonymous Maarten <anonymous.maarten@gmail.com>
|
||||
|
||||
set(AUTOGEN_SCRIPT "${CMAKE_MODULE_PATH}/CMakeAutoGenScript.cmake")
|
||||
|
||||
function(lsf_autogen DIR_REL NAME_WE)
|
||||
set(EXTS ${ARGN})
|
||||
set(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${DIR_REL}/${NAME_WE}.def")
|
||||
set(OUTPUTS)
|
||||
foreach(EXT ${EXTS})
|
||||
list(APPEND OUTPUTS "${NAME_WE}.${EXT}")
|
||||
endforeach()
|
||||
add_autogen_target("${INPUT}" "${CMAKE_CURRENT_BINARY_DIR}/${DIR_REL}" ${OUTPUTS})
|
||||
endfunction()
|
||||
|
||||
function(add_autogen_target INPUT OUTPUTDIR)
|
||||
set(OUTPUTFILES "${ARGN}")
|
||||
|
||||
if (OUTPUTDIR)
|
||||
set(PREFIX "${OUTPUTDIR}/")
|
||||
else()
|
||||
set(PREFIX "")
|
||||
endif()
|
||||
|
||||
set(ARTIFACTS)
|
||||
foreach(OUTPUTFILE ${OUTPUTFILES})
|
||||
list(APPEND ARTIFACTS "${PREFIX}${OUTPUTFILE}")
|
||||
endforeach()
|
||||
|
||||
set(EXTRA_ARGS)
|
||||
if (AUTOGEN_DEBUG)
|
||||
list(APPEND EXTRA_ARGS "-DDEBUG=1")
|
||||
endif()
|
||||
if (OUTPUTDIR)
|
||||
list(APPEND EXTRA_ARGS "-DOUTPUTDIR=${OUTPUTDIR}")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${ARTIFACTS}
|
||||
COMMAND ${CMAKE_COMMAND} "-DDEFINITION=${INPUT}" ${EXTRA_ARGS} -P "${AUTOGEN_SCRIPT}"
|
||||
MAIN_DEPENDENCY "${INPUT}"
|
||||
DEPENDS "${AUTOGEN_SCRIPT}"
|
||||
COMMENT "CMakeAutoGen: generating ${OUTPUTFILES}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
)
|
||||
endfunction()
|
442
lib-src/libsndfile/cmake/CMakeAutoGenScript.cmake
Normal file
442
lib-src/libsndfile/cmake/CMakeAutoGenScript.cmake
Normal file
@@ -0,0 +1,442 @@
|
||||
# CMake implementation of AutoGen
|
||||
# Copyright (C) 2017 Anonymous Maarten <anonymous.maarten@gmail.com>
|
||||
|
||||
set(WS " \t\r\n")
|
||||
|
||||
function(cutoff_first_occurrence TEXT OCCURRENCE RESULT)
|
||||
string(FIND "${TEXT}" "${OCCURRENCE}" OCCURRENCE_INDEX)
|
||||
if (OCCURRENCE_INDEX EQUAL -1)
|
||||
set(${TEXT} "" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(LENGTH "${OCCURRENCE}" OCCURRENCE_LENGTH)
|
||||
math(EXPR CUTOFF_INDEX "${OCCURRENCE_INDEX}+${OCCURRENCE_LENGTH}")
|
||||
string(SUBSTRING "${TEXT}" ${CUTOFF_INDEX} -1 TEXT_REMAINDER)
|
||||
set(${RESULT} "${TEXT_REMAINDER}" PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
function(read_definition DEFINITION_FILENAME TEMPLATE_FILENAME DATA)
|
||||
file(READ "${DEFINITION_FILENAME}" DEFINITION_CONTENTS)
|
||||
|
||||
string(REGEX MATCH "autogen definitions ([a-zA-Z\\._-]+);[${WS}]*" TEMPLATE_MATCH "${DEFINITION_CONTENTS}")
|
||||
if (NOT TEMPLATE_MATCH)
|
||||
message(FATAL_ERROR "${DEFINITION_FILENAME} doest not contain an AutoGen definition.")
|
||||
endif()
|
||||
|
||||
get_filename_component(DEFINITION_DIR "${DEFINITION_FILENAME}" PATH)
|
||||
set(${TEMPLATE_FILENAME} "${DEFINITION_DIR}/${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||
if (DEBUG)
|
||||
message("found: TEMPLATE_FILENAME=${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
|
||||
cutoff_first_occurrence("${DEFINITION_CONTENTS}" "${TEMPLATE_MATCH}" DEFINITION_CONTENTS)
|
||||
|
||||
set(DEFINITION "")
|
||||
|
||||
while (1)
|
||||
string(REGEX MATCH "([a-zA-Z_][a-zA-Z0-9_]*)[${WS}]*=[${WS}]*{[${WS}]*" GROUPSTART_MATCH "${DEFINITION_CONTENTS}")
|
||||
if (NOT GROUPSTART_MATCH)
|
||||
break()
|
||||
endif()
|
||||
set(GROUPNAME "${CMAKE_MATCH_1}")
|
||||
cutoff_first_occurrence("${DEFINITION_CONTENTS}" "${GROUPSTART_MATCH}" DEFINITION_CONTENTS)
|
||||
if (DEBUG)
|
||||
message("found: GROUPNAME=${GROUPNAME}")
|
||||
endif()
|
||||
set(NBKEYS 0)
|
||||
set(GROUP_KEY_VALUES "")
|
||||
while (1)
|
||||
string(REGEX MATCH "^([a-zA-Z_][a-zA-Z0-9_]*)[${WS}]*=[${WS}]*(([\"']([${WS}a-zA-Z0-9_%\\\"<>\(\)\\.*+/?:,\\-]+)[\"'])|([a-zA-Z0-9_%\\]+))[${WS}]*;[${WS}]*" KEY_VALUE_MATCH "${DEFINITION_CONTENTS}")
|
||||
if (NOT KEY_VALUE_MATCH)
|
||||
break()
|
||||
endif()
|
||||
set(KEY "${CMAKE_MATCH_1}")
|
||||
if ("${CMAKE_MATCH_4}" STREQUAL "")
|
||||
set(VALUE "${CMAKE_MATCH_5}")
|
||||
else()
|
||||
string(REPLACE "\\\"" "\"" VALUE "${CMAKE_MATCH_4}")
|
||||
#set(VALUE "${CMAKE_MATCH_4}")
|
||||
endif()
|
||||
|
||||
if (DEBUG)
|
||||
message("found: KEY=${KEY}, VALUE=${VALUE}")
|
||||
endif()
|
||||
math(EXPR NBKEYS "${NBKEYS}+1")
|
||||
list(APPEND GROUP_KEY_VALUES "${KEY}" "${VALUE}")
|
||||
cutoff_first_occurrence("${DEFINITION_CONTENTS}" "${KEY_VALUE_MATCH}" DEFINITION_CONTENTS)
|
||||
endwhile()
|
||||
string(REGEX MATCH "^[${WS}]*}[${WS}]*;[${WS}]*" GROUPEND_MATCH "${DEFINITION_CONTENTS}")
|
||||
if (NOT GROUPEND_MATCH)
|
||||
message(FATAL_ERROR "Group ${GROUPNAME} did not finish.")
|
||||
endif()
|
||||
cutoff_first_occurrence("${DEFINITION_CONTENTS}" "${GROUPEND_MATCH}" DEFINITION_CONTENTS)
|
||||
list(APPEND DEFINITION "${GROUPNAME}" ${NBKEYS} ${GROUP_KEY_VALUES})
|
||||
endwhile()
|
||||
set(${DATA} "${DEFINITION}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(match_autogen_group TEXT START POS0 POS1 MATCH FOUND)
|
||||
string(SUBSTRING "${TEXT}" "${START}" -1 TEXT)
|
||||
string(REGEX MATCH "\\[\\+[${WS}]*([ a-zA-Z0-9=_$%\\(\\)\"\\+\\-]+)[${WS}]*\\+\\]" MATCH_GROUP "${TEXT}")
|
||||
if ("${MATCH_GROUP}" STREQUAL "")
|
||||
set(${FOUND} 0 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
string(FIND "${TEXT}" "${MATCH_GROUP}" START_TEXT)
|
||||
math(EXPR POS0_var "${START}+${START_TEXT}")
|
||||
string(LENGTH "${MATCH_GROUP}" MATCH_LENGTH)
|
||||
math(EXPR POS1_var "${POS0_var}+${MATCH_LENGTH}")
|
||||
set(${POS0} "${POS0_var}" PARENT_SCOPE)
|
||||
set(${POS1} "${POS1_var}" PARENT_SCOPE)
|
||||
set(${FOUND} 1 PARENT_SCOPE)
|
||||
string(STRIP "${CMAKE_MATCH_1}" CONTENT)
|
||||
set("${MATCH}" "${CONTENT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(append_output SUFFICES_FILENAMES TEXT POS0 POS1 FILTER)
|
||||
math(EXPR POS_LENGTH "${POS1}-${POS0}")
|
||||
string(LENGTH "${TEXT}" TEXT_LENGTH)
|
||||
string(SUBSTRING "${TEXT}" "${POS0}" "${POS_LENGTH}" TEXT_APPEND)
|
||||
if (DEBUG)
|
||||
message("appending ${POS0}:${POS1}, length=${POS_LENGTH}")
|
||||
endif()
|
||||
append_output_text("${SUFFICES_FILENAMES}" "${TEXT_APPEND}" "${FILTER}")
|
||||
endfunction()
|
||||
|
||||
function(append_output_text SUFFICES_FILENAMES TEXT_APPEND FILTER)
|
||||
string(LENGTH "${TEXT_APPEND}" TEXT_LENGTH)
|
||||
list(LENGTH SUFFICES_FILENAMES NB)
|
||||
math(EXPR NB_END "${NB}-1")
|
||||
foreach(INDEX RANGE 0 ${NB_END} 3)
|
||||
math(EXPR INDEX_1 "${INDEX}+1")
|
||||
math(EXPR INDEX_2 "${INDEX}+2")
|
||||
list(GET SUFFICES_FILENAMES ${INDEX} SUFFIX)
|
||||
list(GET SUFFICES_FILENAMES ${INDEX_1} FILENAME)
|
||||
list(GET SUFFICES_FILENAMES ${INDEX_2} TEMPFILENAME)
|
||||
set(WRITE_OK 1)
|
||||
if (FILTER)
|
||||
if (NOT "${SUFFIX}" STREQUAL "${FILTER}")
|
||||
set(WRITE_OK 0)
|
||||
endif()
|
||||
endif()
|
||||
if (WRITE_OK)
|
||||
if (DEBUG)
|
||||
message("Write: ${TEXT_LENGTH} characters to ${FILENAME}")
|
||||
endif()
|
||||
file(APPEND "${TEMPFILENAME}" "${TEXT_APPEND}")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(output_finish SUFFICES_FILENAMES)
|
||||
list(LENGTH SUFFICES_FILENAMES NB)
|
||||
math(EXPR NB_END "${NB}-1")
|
||||
foreach(INDEX RANGE 0 ${NB_END} 3)
|
||||
math(EXPR INDEX_1 "${INDEX}+1")
|
||||
math(EXPR INDEX_2 "${INDEX}+2")
|
||||
list(GET SUFFICES_FILENAMES ${INDEX_1} FILENAME)
|
||||
list(GET SUFFICES_FILENAMES ${INDEX_2} TEMPFILENAME)
|
||||
file(RENAME "${TEMPFILENAME}" "${FILENAME}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(stack_push STACK_ARG)
|
||||
set(STACK_LIST "${${STACK_ARG}}")
|
||||
string(REPLACE ";" " " NEWITEM "${ARGN}")
|
||||
if (DEBUG)
|
||||
list(LENGTH STACK_LIST STACK_LENGTH)
|
||||
message("Pushing \"${NEWITEM}\" onto stack (length=${STACK_LENGTH})")
|
||||
endif()
|
||||
list(APPEND STACK_LIST "${NEWITEM}")
|
||||
set(${STACK_ARG} "${STACK_LIST}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(stack_pop STACK_ARG ITEM)
|
||||
set(STACK_LIST "${${STACK_ARG}}")
|
||||
list(LENGTH STACK_LIST STACK_LENGTH)
|
||||
if (STACK_LENGTH EQUAL 0)
|
||||
message(FATAL_ERROR "ENDFOR: stack is empty")
|
||||
endif()
|
||||
math(EXPR LAST_ITEM_INDEX "${STACK_LENGTH}-1")
|
||||
list(GET STACK_LIST "${LAST_ITEM_INDEX}" LAST_ITEM)
|
||||
list(REMOVE_AT STACK_LIST "${LAST_ITEM_INDEX}")
|
||||
string(REPLACE " " ";" LAST_ITEM_LIST "${LAST_ITEM}")
|
||||
if (DEBUG)
|
||||
message("Popping \"${LAST_ITEM}\" from stack (length=${STACK_LENGTH})")
|
||||
endif()
|
||||
set(${ITEM} "${LAST_ITEM_LIST}" PARENT_SCOPE)
|
||||
set(${STACK_ARG} "${STACK_LIST}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(stack_top STACK_ARG ITEM)
|
||||
set(STACK_LIST "${${STACK_ARG}}")
|
||||
list(LENGTH STACK_LIST STACK_LENGTH)
|
||||
if (STACK_LENGTH EQUAL 0)
|
||||
message(FATAL_ERROR "ENDFOR: stack is empty")
|
||||
endif()
|
||||
math(EXPR LAST_ITEM_INDEX "${STACK_LENGTH}-1")
|
||||
list(GET STACK_LIST "${LAST_ITEM_INDEX}" LAST_ITEM)
|
||||
string(REPLACE " " ";" LAST_ITEM_LIST "${LAST_ITEM}")
|
||||
if (DEBUG)
|
||||
message("Top of stack: \"${LAST_ITEM}\" from stack (length=${STACK_LENGTH})")
|
||||
endif()
|
||||
set(${ITEM} "${LAST_ITEM_LIST}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(stack_find_key STACK_LIST TEMPLATE_PARAMETERS KEY VALUE)
|
||||
list(REVERSE STACK_LIST)
|
||||
foreach(STACK_ITEM ${STACK_LIST})
|
||||
string(REPLACE " " ";" STACK_ITEM_LIST "${STACK_ITEM}")
|
||||
list(GET STACK_ITEM_LIST 3 TP_INDEX)
|
||||
math(EXPR TP_SIZE_INDEX "${TP_INDEX}+1")
|
||||
list(GET TEMPLATE_PARAMETERS ${TP_SIZE_INDEX} TP_SIZE)
|
||||
math(EXPR TP_KV_INDEX_START "${TP_INDEX}+2")
|
||||
math(EXPR TP_KV_INDEX_END "${TP_KV_INDEX_START}+2*${TP_SIZE}-1")
|
||||
foreach(TP_KV_INDEX RANGE ${TP_KV_INDEX_START} ${TP_KV_INDEX_END} 2)
|
||||
list(GET TEMPLATE_PARAMETERS ${TP_KV_INDEX} TP_KEY)
|
||||
if("${TP_KEY}" STREQUAL "${KEY}")
|
||||
math(EXPR TP_VALUE_INDEX "${TP_KV_INDEX}+1")
|
||||
list(GET TEMPLATE_PARAMETERS ${TP_VALUE_INDEX} TP_VALUE)
|
||||
set(${VALUE} "${TP_VALUE}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endforeach()
|
||||
endforeach()
|
||||
message(FATAL_ERROR "Unknown KEY=${KEY}")
|
||||
endfunction()
|
||||
|
||||
function(template_parameters_find_next_groupname_index TEMPLATE_PARAMETERS GROUPNAME INDEX_LAST INDEX_NEXT)
|
||||
if (${INDEX_LAST} LESS 0)
|
||||
set(INDEX 0)
|
||||
else ()
|
||||
math(EXPR INDEX_1 "1+(${INDEX_LAST})")
|
||||
list(GET TEMPLATE_PARAMETERS ${INDEX_1} GROUPNAME_INDEX_SIZE)
|
||||
math(EXPR INDEX "${INDEX_LAST}+1+2*${GROUPNAME_INDEX_SIZE}+1")
|
||||
endif()
|
||||
list(LENGTH TEMPLATE_PARAMETERS PARAMETERS_LENGTH)
|
||||
while (${INDEX} LESS ${PARAMETERS_LENGTH})
|
||||
list(GET TEMPLATE_PARAMETERS ${INDEX} GROUPNAME_AT_INDEX)
|
||||
if ("${GROUPNAME}" STREQUAL "${GROUPNAME_AT_INDEX}")
|
||||
set("${INDEX_NEXT}" ${INDEX} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
math(EXPR INDEX_1 "${INDEX}+1")
|
||||
list(GET TEMPLATE_PARAMETERS ${INDEX_1} GROUPNAME_INDEX_SIZE)
|
||||
math(EXPR INDEX "${INDEX}+1+2*${GROUPNAME_INDEX_SIZE}+1")
|
||||
endwhile()
|
||||
set("${INDEX_NEXT}" -1 PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(calculate_line_number TEXT POSITION LINENUMBER_ARG)
|
||||
#math(EXPR INDEX_MAX "${POSITION}-1")
|
||||
string(SUBSTRING "${TEXT}" 0 ${POSITION} SUBTEXT)
|
||||
string(REGEX MATCHALL "\n" MATCH_NEWLINES "${SUBTEXT}")
|
||||
list(LENGTH MATCH_NEWLINES NBLINES)
|
||||
math(EXPR NBLINES "${NBLINES}+1")
|
||||
set(${LINENUMBER_ARG} ${NBLINES} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(parse_template TEMPLATE_FILENAME OUTPUT_DIR TEMPLATE_PARAMETERS)
|
||||
file(READ ${TEMPLATE_FILENAME} TEMPLATE_CONTENTS)
|
||||
set(POSITION 0)
|
||||
match_autogen_group("${TEMPLATE_CONTENTS}" "${POSITION}" POS0 POS1 AUTOGEN FOUND)
|
||||
if (NOT FOUND)
|
||||
message(FATAL_ERROR "Header of template not found")
|
||||
endif()
|
||||
string(REGEX MATCH "AutoGen5 template ([ a-zA-Z0-9]*)" SUFFICES_MATCH "${AUTOGEN}")
|
||||
if (NOT SUFFICES_MATCH)
|
||||
message(FATAL_ERROR "No output suffices found")
|
||||
endif()
|
||||
string(STRIP "${CMAKE_MATCH_1}" SUFFICES)
|
||||
string(REPLACE " " ";" SUFFICES "${SUFFICES}")
|
||||
set(SUFFICES_FILENAMES "")
|
||||
get_filename_component(TEMPLATE_NAME_WE "${TEMPLATE_FILENAME}" NAME_WE)
|
||||
foreach(SUFFIX ${SUFFICES})
|
||||
if ("${OUTPUT_DIR}" STREQUAL "")
|
||||
set(DIR_PREFIX "")
|
||||
else()
|
||||
set(DIR_PREFIX "${OUTPUT_DIR}/")
|
||||
endif()
|
||||
string(RANDOM LENGTH 64 RANDOMSTRING)
|
||||
set(FILENAME "${DIR_PREFIX}${TEMPLATE_NAME_WE}.${SUFFIX}")
|
||||
set(TEMPFILENAME "${DIR_PREFIX}${TEMPLATE_NAME_WE}${RANDOMSTRING}.${SUFFIX}")
|
||||
list(APPEND SUFFICES_FILENAMES "${SUFFIX}" "${FILENAME}" "${TEMPFILENAME}")
|
||||
file(WRITE "${FILENAME}" "")
|
||||
endforeach()
|
||||
if (DEBUG)
|
||||
message("Output files: ${SUFFICES_FILENAMES}")
|
||||
endif()
|
||||
set(WRITE_FILTER "")
|
||||
append_output("${SUFFICES_FILENAMES}" "${TEMPLATE_CONTENTS}" 0 "${POS0}" "${WRITE_FILTER}")
|
||||
math(EXPR POS1 "${POS1}+1")
|
||||
set(POSITION "${POS1}")
|
||||
if (DEBUG)
|
||||
message("Output: ${SUFFICES_FILENAMES}")
|
||||
endif()
|
||||
|
||||
set(STACK "")
|
||||
while (1)
|
||||
match_autogen_group("${TEMPLATE_CONTENTS}" "${POSITION}" POS0 POS1 GROUP_MATCH FOUND)
|
||||
if (NOT FOUND)
|
||||
if (DEBUG)
|
||||
message("No group found. Dumping rest of file.")
|
||||
endif()
|
||||
if (NOT "${STACK}" STREQUAL "")
|
||||
message(FATAL_ERROR "Stack not empty at end of file")
|
||||
endif()
|
||||
string(LENGTH "${TEMPLATE_CONTENTS}" TEXT_LENGTH)
|
||||
append_output("${SUFFICES_FILENAMES}" "${TEMPLATE_CONTENTS}" ${POSITION} ${TEXT_LENGTH} "${WRITE_FILTER}")
|
||||
break()
|
||||
endif()
|
||||
append_output("${SUFFICES_FILENAMES}" "${TEMPLATE_CONTENTS}" ${POSITION} ${POS0} "${WRITE_FILTER}")
|
||||
set(POSITION "${POS1}")
|
||||
|
||||
if (GROUP_MATCH MATCHES "^FOR")
|
||||
string(REPLACE " " ";" GROUP_MATCH_LIST "${GROUP_MATCH}")
|
||||
list(GET GROUP_MATCH_LIST 1 FOR_KEY)
|
||||
template_parameters_find_next_groupname_index("${TEMPLATE_PARAMETERS}" "${FOR_KEY}" -1 FOR_INDEX)
|
||||
if (DEBUG)
|
||||
message("FOR_KEY: ${FOR_KEY}")
|
||||
message("FOR_INDEX: ${FOR_INDEX}")
|
||||
endif()
|
||||
if (${FOR_KEY} LESS 0)
|
||||
message(FATAL_ERROR "FOR has key with empty list. Not implemented yet..")
|
||||
endif()
|
||||
stack_push(STACK FOR ${POSITION} ${FOR_KEY} ${FOR_INDEX})
|
||||
elseif (GROUP_MATCH MATCHES "^ENDFOR")
|
||||
string(REPLACE " " ";" GROUP_MATCH_LIST "${GROUP_MATCH}")
|
||||
list(GET GROUP_MATCH_LIST 1 ENDFOR_KEY)
|
||||
stack_pop(STACK FOR_ITEM)
|
||||
list(GET FOR_ITEM 0 FOR_FOR)
|
||||
if (NOT "${FOR_FOR}" STREQUAL "FOR")
|
||||
message(FATAL_ERROR "ENDFOR does not match last item: ${FOR_FOR}")
|
||||
endif()
|
||||
list(GET FOR_ITEM 1 FOR_POSITION)
|
||||
list(GET FOR_ITEM 2 FOR_KEY)
|
||||
if (NOT "${FOR_KEY}" STREQUAL "${ENDFOR_KEY}")
|
||||
calculate_line_number("${TEMPLATE_CONTENTS}" "${POSITION}" LINENUMBER)
|
||||
message("FOR and ENDFOR do not match. (line number ${LINENUMBER}) (FOR:${FOR_KEY}, ENDFOR:${ENDFOR_KEY})")
|
||||
endif()
|
||||
list(GET FOR_ITEM 3 FOR_INDEX_PREV)
|
||||
template_parameters_find_next_groupname_index("${TEMPLATE_PARAMETERS}" "${FOR_KEY}" ${FOR_INDEX_PREV} FOR_INDEX)
|
||||
if (DEBUG)
|
||||
message("FOR_INDEX was ${FOR_INDEX_PREV}, is now ${FOR_INDEX}")
|
||||
endif()
|
||||
if (${FOR_INDEX} LESS 0)
|
||||
if (DEBUG)
|
||||
message("ENDFOR: FOR_INDEX < 0 (no more key) ==> Continue")
|
||||
endif()
|
||||
else()
|
||||
set(POSITION ${FOR_POSITION})
|
||||
stack_push(STACK FOR ${FOR_POSITION} ${FOR_KEY} ${FOR_INDEX})
|
||||
if (DEBUG)
|
||||
message("ENDFOR: FOR_INDEX >= 0 (more keys available) ==> Back to position=${FOR_POSITION}")
|
||||
endif()
|
||||
endif()
|
||||
elseif (GROUP_MATCH MATCHES "^CASE")
|
||||
string(REGEX MATCH "^CASE[${WS}]+\\(([a-zA-Z]+)\\)" CASE_MATCH "${GROUP_MATCH}")
|
||||
if ("${CASE_MATCH}" STREQUAL "")
|
||||
message(FATAL_ERROR "Wrong CASE syntax")
|
||||
endif()
|
||||
set(CASE_KEY "${CMAKE_MATCH_1}")
|
||||
if (DEBUG)
|
||||
message("CASE: KEY=${CASE_KEY}")
|
||||
endif()
|
||||
stack_push(STACK CASE "${CASE_KEY}" ${POSITION})
|
||||
elseif (GROUP_MATCH MATCHES "^==")
|
||||
math(EXPR POSITION "${POSITION}+1")
|
||||
string(REGEX MATCH "^==[${WS}]+([a-zA-Z_][a-zA-Z0-9_]*)" CASE_MATCH "${GROUP_MATCH}")
|
||||
if ("${CASE_MATCH}" STREQUAL "")
|
||||
message(FATAL_ERROR "Wrong == syntax")
|
||||
endif()
|
||||
stack_top(STACK CASE_ITEM)
|
||||
list(GET CASE_ITEM 0 CASE_CASE)
|
||||
if(NOT "${CASE_CASE}" STREQUAL "CASE")
|
||||
message(FATAL_ERROR "== block must be in CASE. Top of stack=${CASE_CASE}")
|
||||
endif()
|
||||
set(CASE_VALUE "${CMAKE_MATCH_1}")
|
||||
if (DEBUG)
|
||||
message("case: == VALUE=${CASE_VALUE}")
|
||||
endif()
|
||||
list(GET CASE_ITEM 1 CASE_KEY)
|
||||
if ("${CASE_KEY}" STREQUAL "suffix")
|
||||
if (DEBUG)
|
||||
message("Setting write filter to ${CASE_VALUE}")
|
||||
endif()
|
||||
set(WRITE_FILTER "${CASE_VALUE}")
|
||||
else()
|
||||
message(FATAL_ERROR "CASE: unsupported argument ${CASE_KEY}")
|
||||
endif()
|
||||
elseif (GROUP_MATCH MATCHES "^ESAC")
|
||||
stack_pop(STACK CASE_ITEM)
|
||||
if (DEBUG)
|
||||
message("ESAC")
|
||||
endif()
|
||||
list(GET CASE_ITEM 0 CASE_CASE)
|
||||
if (NOT "${CASE_CASE}" STREQUAL "CASE")
|
||||
message(FATAL_ERROR "ESAC does not match last item: ${CASE_CASE}")
|
||||
endif()
|
||||
if ("${CASE_KEY}" STREQUAL "suffix")
|
||||
if (DEBUG)
|
||||
message("Removing write filter")
|
||||
endif()
|
||||
set(WRITE_FILTER "")
|
||||
else()
|
||||
message(FATAL_ERROR "CASE: unsupported argument ${CASE_KEY}")
|
||||
endif()
|
||||
else()
|
||||
string(REGEX MATCH "\\(([a-zA-Z0-9_$%\"${WS}\\+\\-]+)\\)" PARENTHESE_MATCH "${GROUP_MATCH}")
|
||||
if (NOT "${PARENTHESE_MATCH}" STREQUAL "")
|
||||
set(PARENTHESE_CONTENT "${CMAKE_MATCH_1}")
|
||||
string(REPLACE " " ";" PARENTHESE_LIST "${PARENTHESE_CONTENT}")
|
||||
list(GET PARENTHESE_LIST 0 PARENTHESE_COMMAND)
|
||||
if ("${PARENTHESE_COMMAND}" STREQUAL "get")
|
||||
list(GET PARENTHESE_LIST 1 KEY_QUOTED)
|
||||
string(REGEX MATCH "\\\"([a-zA-Z_${WS}]+)\\\"" KEY_MATCH "${KEY_QUOTED}")
|
||||
if ("${KEY_MATCH}" STREQUAL "")
|
||||
message(FATAL_ERROR "get: empty key")
|
||||
endif()
|
||||
set(KEY "${CMAKE_MATCH_1}")
|
||||
if (DEBUG)
|
||||
message("Get: key=${KEY}")
|
||||
endif()
|
||||
stack_find_key("${STACK}" "${TEMPLATE_PARAMETERS}" "${KEY}" VALUE)
|
||||
if (DEBUG)
|
||||
message("Get key=${KEY} ==> value=${VALUE}")
|
||||
endif()
|
||||
append_output_text("${SUFFICES_FILENAMES}" "${VALUE}" "${WRITE_FILTER}")
|
||||
elseif("${PARENTHESE_COMMAND}" STREQUAL "tpl-file-line")
|
||||
list(GET PARENTHESE_LIST 1 FORMAT_LINE)
|
||||
calculate_line_number("${TEMPLATE_CONTENTS}" "${POSITION}" LINENUMBER)
|
||||
append_output_text("${SUFFICES_FILENAMES}" "${LINENUMBER}" "${WRITE_FILTER}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown parenthese command: ${PARENTHESE_COMMAND}")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown command: ${GROUP_MATCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endwhile()
|
||||
if (NOT "${STACK}" STREQUAL "")
|
||||
message(FATAL_ERROR "STACK was not empty at EOF")
|
||||
endif()
|
||||
output_finish("${SUFFICES_FILENAMES}")
|
||||
endfunction()
|
||||
|
||||
if ("${DEFINITION}" STREQUAL "")
|
||||
message(FATAL_ERROR "Need definition file")
|
||||
endif()
|
||||
if (NOT EXISTS "${DEFINITION}")
|
||||
message(FATAL_ERROR "Definition file does not exist (${DEFINITION})")
|
||||
endif()
|
||||
|
||||
read_definition("${DEFINITION}" TEMPLATE_FILENAME DATA)
|
||||
if (DEBUG)
|
||||
message("${TEMPLATE_FILENAME}")
|
||||
message("${DATA}")
|
||||
endif()
|
||||
|
||||
parse_template("${TEMPLATE_FILENAME}" "${OUTPUTDIR}" "${DATA}")
|
92
lib-src/libsndfile/cmake/ClipMode.cmake
Normal file
92
lib-src/libsndfile/cmake/ClipMode.cmake
Normal file
@@ -0,0 +1,92 @@
|
||||
include (CheckCSourceRuns)
|
||||
include (CMakePushCheckState)
|
||||
|
||||
macro (CLIP_MODE)
|
||||
|
||||
set (CLIP_MODE_POSITIVE_MESSAGE "Target processor clips on positive float to int conversion")
|
||||
set (CLIP_MODE_NEGATIVE_MESSAGE "Target processor clips on negative float to int conversion")
|
||||
|
||||
message (STATUS "Checking processor clipping capabilities...")
|
||||
|
||||
if (CMAKE_CROSSCOMPILING)
|
||||
|
||||
set (CLIP_MSG "disabled")
|
||||
set (CPU_CLIPS_POSITIVE FALSE CACHE BOOL ${CLIP_MODE_POSITIVE_MESSAGE})
|
||||
set (CPU_CLIPS_NEGATIVE FALSE CACHE BOOL ${CLIP_MODE_NEGATIVE_MESSAGE})
|
||||
|
||||
else (NOT CMAKE_CROSSCOMPILING)
|
||||
|
||||
cmake_push_check_state ()
|
||||
|
||||
set (CMAKE_REQUIRED_QUIET TRUE)
|
||||
if (LIBM_REQUIRED)
|
||||
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${M_LIBRARY})
|
||||
endif ()
|
||||
|
||||
check_c_source_runs (
|
||||
"
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = 1.0 * 0x7FFFFFFF ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != 127)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
"
|
||||
CPU_CLIPS_POSITIVE)
|
||||
|
||||
check_c_source_runs (
|
||||
"
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = -8.0 * 0x10000000 ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != -128)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
"
|
||||
CPU_CLIPS_NEGATIVE)
|
||||
|
||||
cmake_pop_check_state ()
|
||||
|
||||
if (CPU_CLIPS_POSITIVE AND (NOT CPU_CLIPS_NEGATIVE))
|
||||
set (CLIP_MSG "positive")
|
||||
elseif (CPU_CLIPS_NEGATIVE AND (NOT CPU_CLIPS_POSITIVE))
|
||||
set (CLIP_MSG "negative")
|
||||
elseif (CPU_CLIPS_POSITIVE AND CPU_CLIPS_NEGATIVE)
|
||||
set (CLIP_MSG "both")
|
||||
else ()
|
||||
set (CLIP_MSG "none")
|
||||
endif ()
|
||||
|
||||
endif (CMAKE_CROSSCOMPILING)
|
||||
|
||||
message (STATUS "Checking processor clipping capabilities... ${CLIP_MSG}")
|
||||
|
||||
endmacro (CLIP_MODE)
|
67
lib-src/libsndfile/cmake/FindFLAC.cmake
Normal file
67
lib-src/libsndfile/cmake/FindFLAC.cmake
Normal file
@@ -0,0 +1,67 @@
|
||||
# - Find FLAC
|
||||
# Find the native FLAC includes and libraries
|
||||
#
|
||||
# FLAC_INCLUDE_DIRS - where to find FLAC headers.
|
||||
# FLAC_LIBRARIES - List of libraries when using libFLAC.
|
||||
# FLAC_FOUND - True if libFLAC found.
|
||||
# FLAC_DEFINITIONS - FLAC compile definitons
|
||||
|
||||
if (FLAC_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (FLAC_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (Ogg QUIET)
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules(PC_FLAC QUIET flac)
|
||||
|
||||
set(FLAC_VERSION ${PC_FLAC_VERSION})
|
||||
|
||||
find_path (FLAC_INCLUDE_DIR FLAC/stream_decoder.h
|
||||
HINTS
|
||||
${PC_FLAC_INCLUDEDIR}
|
||||
${PC_FLAC_INCLUDE_DIRS}
|
||||
${FLAC_ROOT}
|
||||
)
|
||||
|
||||
# MSVC built libraries can name them *_static, which is good as it
|
||||
# distinguishes import libraries from static libraries with the same extension.
|
||||
find_library (FLAC_LIBRARY
|
||||
NAMES
|
||||
FLAC
|
||||
libFLAC
|
||||
libFLAC_dynamic
|
||||
libFLAC_static
|
||||
HINTS
|
||||
${PC_FLAC_LIBDIR}
|
||||
${PC_FLAC_LIBRARY_DIRS}
|
||||
${FLAC_ROOT}
|
||||
)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set FLAC_FOUND to TRUE if
|
||||
# all listed variables are TRUE.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (FLAC
|
||||
REQUIRED_VARS
|
||||
FLAC_LIBRARY
|
||||
FLAC_INCLUDE_DIR
|
||||
OGG_FOUND
|
||||
VERSION_VAR
|
||||
FLAC_VERSION
|
||||
)
|
||||
|
||||
if (FLAC_FOUND)
|
||||
set (FLAC_INCLUDE_DIRS ${FLAC_INCLUDE_DIR})
|
||||
set (FLAC_LIBRARIES ${FLAC_LIBRARY} ${OGG_LIBRARIES})
|
||||
if (NOT TARGET FLAC::FLAC)
|
||||
add_library(FLAC::FLAC UNKNOWN IMPORTED)
|
||||
set_target_properties(FLAC::FLAC PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FLAC_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${FLAC_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Ogg::ogg
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(FLAC_INCLUDE_DIR FLAC_LIBRARY)
|
61
lib-src/libsndfile/cmake/FindOgg.cmake
Normal file
61
lib-src/libsndfile/cmake/FindOgg.cmake
Normal file
@@ -0,0 +1,61 @@
|
||||
# - Find ogg
|
||||
# Find the native ogg includes and libraries
|
||||
#
|
||||
# OGG_INCLUDE_DIRS - where to find ogg.h, etc.
|
||||
# OGG_LIBRARIES - List of libraries when using ogg.
|
||||
# OGG_FOUND - True if ogg found.
|
||||
|
||||
if (OGG_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(OGG_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_OGG QUIET ogg>=1.3.0)
|
||||
|
||||
set (OGG_VERSION ${PC_OGG_VERSION})
|
||||
|
||||
find_path (OGG_INCLUDE_DIR ogg/ogg.h
|
||||
HINTS
|
||||
${PC_OGG_INCLUDEDIR}
|
||||
${PC_OGG_INCLUDE_DIRS}
|
||||
${OGG_ROOT}
|
||||
)
|
||||
# MSVC built ogg may be named ogg_static.
|
||||
# The provided project files name the library with the lib prefix.
|
||||
find_library (OGG_LIBRARY
|
||||
NAMES
|
||||
ogg
|
||||
ogg_static
|
||||
libogg
|
||||
libogg_static
|
||||
HINTS
|
||||
${PC_OGG_LIBDIR}
|
||||
${PC_OGG_LIBRARY_DIRS}
|
||||
${OGG_ROOT}
|
||||
)
|
||||
# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Ogg
|
||||
REQUIRED_VARS
|
||||
OGG_LIBRARY
|
||||
OGG_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
OGG_VERSION
|
||||
)
|
||||
|
||||
if (OGG_FOUND)
|
||||
set (OGG_LIBRARIES ${OGG_LIBRARY})
|
||||
set (OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
|
||||
|
||||
if(NOT TARGET Ogg::ogg)
|
||||
add_library(Ogg::ogg UNKNOWN IMPORTED)
|
||||
set_target_properties(Ogg::ogg PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${OGG_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (OGG_INCLUDE_DIR OGG_LIBRARY)
|
67
lib-src/libsndfile/cmake/FindOpus.cmake
Normal file
67
lib-src/libsndfile/cmake/FindOpus.cmake
Normal file
@@ -0,0 +1,67 @@
|
||||
# - Find opus
|
||||
# Find the native opus includes and libraries
|
||||
#
|
||||
# OPUS_INCLUDE_DIRS - where to find opus.h, etc.
|
||||
# OPUS_LIBRARIES - List of libraries when using opus.
|
||||
# OPUS_FOUND - True if Opus found.
|
||||
|
||||
if (OPUS_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(OPUS_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (Ogg QUIET)
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules(PC_OPUS QUIET opus>=1.1)
|
||||
|
||||
set (OPUS_VERSION ${PC_OPUS_VERSION})
|
||||
|
||||
find_path (OPUS_INCLUDE_DIR opus/opus.h
|
||||
HINTS
|
||||
${PC_OPUS_INCLUDEDIR}
|
||||
${PC_OPUS_INCLUDE_DIRS}
|
||||
${OPUS_ROOT}
|
||||
)
|
||||
|
||||
# MSVC built opus may be named opus_static.
|
||||
# The provided project files name the library with the lib prefix.
|
||||
|
||||
find_library (OPUS_LIBRARY
|
||||
NAMES
|
||||
opus
|
||||
opus_static
|
||||
libopus
|
||||
libopus_static
|
||||
HINTS
|
||||
${PC_OPUS_LIBDIR}
|
||||
${PC_OPUS_LIBRARY_DIRS}
|
||||
${OPUS_ROOT}
|
||||
)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set OPUS_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Opus
|
||||
REQUIRED_VARS
|
||||
OPUS_LIBRARY
|
||||
OPUS_INCLUDE_DIR
|
||||
OGG_FOUND
|
||||
VERSION_VAR
|
||||
OPUS_VERSION
|
||||
)
|
||||
|
||||
if (OPUS_FOUND)
|
||||
set (OPUS_LIBRARIES ${OPUS_LIBRARY})
|
||||
set (OPUS_INCLUDE_DIRS ${OPUS_INCLUDE_DIR})
|
||||
|
||||
if (NOT TARGET Opus::opus)
|
||||
add_library (Opus::opus UNKNOWN IMPORTED)
|
||||
set_target_properties (Opus::opus PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPUS_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${OPUS_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(OPUS_INCLUDE_DIR OPUS_LIBRARY)
|
56
lib-src/libsndfile/cmake/FindSQLite3.cmake
Normal file
56
lib-src/libsndfile/cmake/FindSQLite3.cmake
Normal file
@@ -0,0 +1,56 @@
|
||||
# - Find SQLITE3
|
||||
# Find the native SQLITE3 includes and libraries
|
||||
#
|
||||
# SQLITE3_INCLUDE_DIRS - where to find sqlite.h, etc.
|
||||
# SQLITE3_LIBRARIES - List of libraries when using SQLITE3.
|
||||
# SQLITE3_FOUND - True if SQLITE3 found.
|
||||
|
||||
if (SQLITE3_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (SQLITE3_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_SQLITE3 QUIET sqlite3)
|
||||
|
||||
set (SQLITE3_VERSION ${PC_SQLITE3_VERSION})
|
||||
|
||||
find_path (SQLITE3_INCLUDE_DIR sqlite3.h
|
||||
HINTS
|
||||
${PC_SQLITE3_INCLUDEDIR}
|
||||
${PC_SQLITE3_INCLUDE_DIRS}
|
||||
${SQLITE3_ROOT}
|
||||
)
|
||||
|
||||
find_library (SQLITE3_LIBRARY
|
||||
NAMES
|
||||
sqlite3
|
||||
HINTS
|
||||
${PC_SQLITE3_LIBDIR}
|
||||
${PC_SQLITE3_LIBRARY_DIRS}
|
||||
${SQLITE3_ROOT}
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args (SQLITE3
|
||||
REQUIRED_VARS
|
||||
SQLITE3_LIBRARY
|
||||
SQLITE3_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
SQLITE3_VERSION
|
||||
)
|
||||
|
||||
if (SQLITE3_FOUND)
|
||||
set (SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
|
||||
set (SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
|
||||
if (NOT TARGET SQLite3::SQLite3)
|
||||
add_library (SQLite3::SQLite3 UNKNOWN IMPORTED)
|
||||
set_target_properties (SQLite3::SQLite3 PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SQLITE3_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${SQLITE3_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)
|
61
lib-src/libsndfile/cmake/FindSndio.cmake
Normal file
61
lib-src/libsndfile/cmake/FindSndio.cmake
Normal file
@@ -0,0 +1,61 @@
|
||||
# - Find SoundIO (sndio) includes and libraries
|
||||
#
|
||||
# SNDIO_FOUND - True if SNDIO_INCLUDE_DIR & SNDIO_LIBRARY are
|
||||
# found
|
||||
# SNDIO_LIBRARIES - Set when SNDIO_LIBRARY is found
|
||||
# SNDIO_INCLUDE_DIRS - Set when SNDIO_INCLUDE_DIR is found
|
||||
#
|
||||
# SNDIO_INCLUDE_DIR - where to find sndio.h, etc.
|
||||
# SNDIO_LIBRARY - the sndio library
|
||||
#
|
||||
|
||||
if (SNDIO_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (SNDIO_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_SNDIO QUIET sndio)
|
||||
|
||||
set (SNDIO_VERSION ${PC_SNDIO_VERSION})
|
||||
|
||||
find_path (SNDIO_INCLUDE_DIR
|
||||
NAMES
|
||||
sndio.h
|
||||
HINTS
|
||||
${PC_SNDIO_INCLUDEDIR}
|
||||
${PC_SNDIO_INCLUDE_DIRS}
|
||||
${SNDIO_ROOT}
|
||||
)
|
||||
|
||||
find_library (SNDIO_LIBRARY
|
||||
NAMES
|
||||
sndio
|
||||
HINTS
|
||||
${PC_SNDIO_LIBDIR}
|
||||
${PC_SNDIO_LIBRARY_DIRS}
|
||||
${SNDIO_ROOT}
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Sndio
|
||||
REQUIRED_VARS
|
||||
SNDIO_LIBRARY
|
||||
SNDIO_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
SNDIO_VERSION
|
||||
)
|
||||
|
||||
if (SNDIO_FOUND)
|
||||
set (SNDIO_LIBRARIES ${SNDIO_LIBRARY})
|
||||
set (SNDIO_INCLUDE_DIRS ${SNDIO_INCLUDE_DIR})
|
||||
if (NOT TARGET Sndio::Sndio)
|
||||
add_library (Sndio::Sndio UNKNOWN IMPORTED)
|
||||
set_target_properties (Sndio::Sndio PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SNDIO_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${SNDIO_LIBRARIES}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (SNDIO_INCLUDE_DIR SNDIO_LIBRARY)
|
55
lib-src/libsndfile/cmake/FindSpeex.cmake
Normal file
55
lib-src/libsndfile/cmake/FindSpeex.cmake
Normal file
@@ -0,0 +1,55 @@
|
||||
# - Find Speex
|
||||
# Find the native Speex includes and libraries
|
||||
#
|
||||
# SPEEX_INCLUDE_DIRS - where to find speex.h, etc.
|
||||
# SPEEX_LIBRARIES - List of libraries when using Speex.
|
||||
# SPEEX_FOUND - True if Speex found.
|
||||
|
||||
if (SPEEX_INCLUDE_DIR)
|
||||
set (SPEEX_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_SPEEX QUIET speex)
|
||||
|
||||
set (SPEEX_VERSION ${PC_SPEEX_VERSION})
|
||||
|
||||
find_path (SPEEX_INCLUDE_DIR speex/speex.h
|
||||
HINTS
|
||||
${PC_SPEEX_INCLUDEDIR}
|
||||
${PC_SPEEX_INCLUDE_DIRS}
|
||||
${SPEEX_ROOT}
|
||||
)
|
||||
find_library (SPEEX_LIBRARY
|
||||
NAMES
|
||||
speex
|
||||
libspeex
|
||||
HINTS
|
||||
${PC_SPEEX_LIBDIR}
|
||||
${PC_SPEEX_LIBRARY_DIRS}
|
||||
${SPEEX_ROOT}
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Speex
|
||||
REQUIRED_VARS
|
||||
SPEEX_LIBRARY
|
||||
SPEEX_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
SPEEX_VERSION
|
||||
)
|
||||
|
||||
if (SPEEX_FOUND)
|
||||
set (SPEEX_LIBRARIES ${SPEEX_LIBRARY})
|
||||
set (SPEEX_INCLUDE_DIRS ${SPEEX_INCLUDE_DIR})
|
||||
|
||||
if (NOT TARGET Speex::Speex)
|
||||
add_library (Speex::Speex UNKNOWN IMPORTED)
|
||||
set_target_properties (Speex::Speex PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SPEEX_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${SPEEX_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (SPEEX_INCLUDE_DIR SPEEX_LIBRARY)
|
64
lib-src/libsndfile/cmake/FindVorbis.cmake
Normal file
64
lib-src/libsndfile/cmake/FindVorbis.cmake
Normal file
@@ -0,0 +1,64 @@
|
||||
# - Find vorbisenc
|
||||
# Find the native vorbisenc includes and libraries
|
||||
#
|
||||
# VORBIS_INCLUDE_DIRS - where to find vorbis.h, etc.
|
||||
# VORBIS_LIBRARIES - List of libraries when using vorbis.
|
||||
# VORBIS_FOUND - True if vorbis found.
|
||||
|
||||
if (VORBIS_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (VORBIS_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (Ogg QUIET)
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_VORBIS QUIET vorbis)
|
||||
|
||||
set (VORBIS_VERSION ${PC_VORBIS_VERSION})
|
||||
|
||||
find_path (VORBIS_INCLUDE_DIR vorbis/codec.h
|
||||
HINTS
|
||||
${PC_VORBIS_INCLUDEDIR}
|
||||
${PC_VORBIS_INCLUDE_DIRS}
|
||||
${VORBIS_ROOT}
|
||||
)
|
||||
|
||||
find_library (VORBIS_LIBRARY
|
||||
NAMES
|
||||
vorbis
|
||||
vorbis_static
|
||||
libvorbis
|
||||
libvorbis_static
|
||||
HINTS
|
||||
${PC_VORBIS_LIBDIR}
|
||||
${PC_VORBIS_LIBRARY_DIRS}
|
||||
${VORBIS_ROOT}
|
||||
)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set VORBIS_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Vorbis
|
||||
REQUIRED_VARS
|
||||
VORBIS_LIBRARY
|
||||
VORBIS_INCLUDE_DIR
|
||||
OGG_FOUND
|
||||
VERSION_VAR
|
||||
VORBIS_VERSION
|
||||
)
|
||||
|
||||
if (VORBIS_FOUND)
|
||||
set (VORBIS_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
|
||||
set (VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES})
|
||||
if (NOT TARGET Vorbis::Vorbis)
|
||||
add_library (Vorbis::Vorbis UNKNOWN IMPORTED)
|
||||
set_target_properties (Vorbis::Vorbis PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${VORBIS_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${VORBIS_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Ogg::ogg
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (VORBIS_INCLUDE_DIR VORBIS_LIBRARY)
|
64
lib-src/libsndfile/cmake/FindVorbisEnc.cmake
Normal file
64
lib-src/libsndfile/cmake/FindVorbisEnc.cmake
Normal file
@@ -0,0 +1,64 @@
|
||||
# - Find vorbisenc
|
||||
# Find the native vorbisenc includes and libraries
|
||||
#
|
||||
# VORBISENC_INCLUDE_DIRS - where to find vorbisenc.h, etc.
|
||||
# VORBISENC_LIBRARIES - List of libraries when using vorbisenc.
|
||||
# VORBISENC_FOUND - True if vorbisenc found.
|
||||
|
||||
if (VORBISENC_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (VORBISENC_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (Vorbis QUIET)
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_VORBISENC QUIET vorbisenc)
|
||||
|
||||
set (VORBISENC_VERSION ${PC_VORBISENC_VERSION})
|
||||
|
||||
find_path (VORBISENC_INCLUDE_DIR vorbis/vorbisenc.h
|
||||
HINTS
|
||||
${PC_VORBISENC_INCLUDEDIR}
|
||||
${PC_VORBISENC_INCLUDE_DIRS}
|
||||
${VORBISENC_ROOT}
|
||||
)
|
||||
|
||||
find_library (VORBISENC_LIBRARY
|
||||
NAMES
|
||||
vorbisenc
|
||||
vorbisenc_static
|
||||
libvorbisenc
|
||||
libvorbisenc_static
|
||||
HINTS
|
||||
${PC_VORBISENC_LIBDIR}
|
||||
${PC_VORBISENC_LIBRARY_DIRS}
|
||||
${VORBISENC_ROOT}
|
||||
)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set VORBISENC_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (VorbisEnc
|
||||
REQUIRED_VARS
|
||||
VORBISENC_LIBRARY
|
||||
VORBISENC_INCLUDE_DIR
|
||||
VORBIS_FOUND
|
||||
VERSION_VAR
|
||||
VORBISENC_VERSION
|
||||
)
|
||||
|
||||
if (VORBISENC_FOUND)
|
||||
set (VORBISENC_INCLUDE_DIRS ${VORBISENC_INCLUDE_DIR})
|
||||
set (VORBISENC_LIBRARIES ${VORBISENC_LIBRARY} ${VORBIS_LIBRARIES})
|
||||
if (NOT TARGET Vorbis::VorbisEnc)
|
||||
add_library (Vorbis::VorbisEnc UNKNOWN IMPORTED)
|
||||
set_target_properties (Vorbis::VorbisEnc PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${VORBISENC_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${VORBISENC_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Vorbis::Vorbis
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (VORBISENC_INCLUDE_DIR VORBISENC_LIBRARY)
|
241
lib-src/libsndfile/cmake/SndFileChecks.cmake
Normal file
241
lib-src/libsndfile/cmake/SndFileChecks.cmake
Normal file
@@ -0,0 +1,241 @@
|
||||
include (CheckFunctionExists)
|
||||
include (CheckIncludeFile)
|
||||
include (CheckLibraryExists)
|
||||
include (CheckSymbolExists)
|
||||
include (CheckTypeSize)
|
||||
include (TestBigEndian)
|
||||
|
||||
include (TestInline)
|
||||
include (ClipMode)
|
||||
include(TestLargeFiles)
|
||||
|
||||
test_large_files (_LARGEFILES)
|
||||
|
||||
if (LARGE_FILES_DEFINITIONS)
|
||||
add_definitions(${LARGE_FILES_DEFINITIONS})
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
set(TYPEOF_SF_COUNT_T __int64)
|
||||
else ()
|
||||
set(TYPEOF_SF_COUNT_T int64_t)
|
||||
endif ()
|
||||
set (SF_COUNT_MAX 0x7fffffffffffffffll)
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package (ALSA)
|
||||
find_package (Sndio)
|
||||
endif ()
|
||||
|
||||
find_package(Ogg 1.3)
|
||||
find_package (VorbisEnc)
|
||||
find_package (FLAC)
|
||||
find_package (Opus)
|
||||
if (VORBIS_FOUND AND FLAC_FOUND AND OPUS_FOUND)
|
||||
set (HAVE_EXTERNAL_XIPH_LIBS 1)
|
||||
else ()
|
||||
set (HAVE_EXTERNAL_XIPH_LIBS 0)
|
||||
endif ()
|
||||
|
||||
find_package (Speex)
|
||||
find_package (SQLite3)
|
||||
|
||||
check_include_file (byteswap.h HAVE_BYTESWAP_H)
|
||||
check_include_file (dlfcn.h HAVE_DLFCN_H)
|
||||
check_include_file (direct.h HAVE_DIRECT_H)
|
||||
check_include_file (endian.h HAVE_ENDIAN_H)
|
||||
check_include_file (inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_file (io.h HAVE_IO_H)
|
||||
check_include_file (stdint.h HAVE_STDINT_H)
|
||||
check_include_file (sys/time.h HAVE_SYS_TIME_H)
|
||||
check_include_file (sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file (unistd.h HAVE_UNISTD_H)
|
||||
|
||||
# Never checked
|
||||
# check_include_file (stdlib.h HAVE_STDLIB_H)
|
||||
# check_include_file (string.h HAVE_STRING_H)
|
||||
# check_include_file (strings.h HAVE_STRINGS_H)
|
||||
# check_include_file (sys/stat.h HAVE_SYS_STAT_H)
|
||||
# check_include_file (memory.h HAVE_MEMORY_H)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
check_include_file (locale.h HAVE_LOCALE_H)
|
||||
check_include_file (sys/wait.h HAVE_SYS_WAIT_H)
|
||||
endif ()
|
||||
|
||||
check_type_size (int64_t SIZEOF_INT64_T)
|
||||
check_type_size (long SIZEOF_LONG)
|
||||
check_type_size (long\ long SIZEOF_LONG_LONG)
|
||||
check_type_size (ssize_t SIZEOF_SSIZE_T)
|
||||
check_type_size (wchar_t SIZEOF_WCHAR_T)
|
||||
|
||||
# Never used
|
||||
# check_type_size (loff_t SIZEOF_LOFF_T)
|
||||
# check_type_size (offt64_t SIZEOF_OFF64_T)
|
||||
|
||||
# Never checked
|
||||
# check_type_size (size_t SIZEOF_SIZE_T)
|
||||
|
||||
# Used in configre.ac
|
||||
# check_type_size (double SIZEOF_DOUBLE)
|
||||
# check_type_size (float SIZEOF_FLOAT)
|
||||
# check_type_size (int SIZEOF_INT)
|
||||
# check_type_size (short SIZEOF_SHORT)
|
||||
|
||||
if (ENABLE_TESTING)
|
||||
check_type_size (void* SIZEOF_VOIDP)
|
||||
endif()
|
||||
|
||||
if ((SIZEOF_OFF_T EQUAL 8) OR (SIZEOF_LOFF_T EQUAL 8) OR (SIZEOF_OFF64_T EQUAL 8))
|
||||
set (TYPEOF_SF_COUNT_T "int64_t")
|
||||
set (SF_COUNT_MAX "0x7FFFFFFFFFFFFFFFLL")
|
||||
set (SIZEOF_SF_COUNT_T 8)
|
||||
else ()
|
||||
if (WIN32)
|
||||
set (TYPEOF_SF_COUNT_T "__int64")
|
||||
set (SF_COUNT_MAX "0x7FFFFFFFFFFFFFFFLL")
|
||||
set (SIZEOF_SF_COUNT_T 8)
|
||||
else ()
|
||||
message ("")
|
||||
message ("*** The configure process has determined that this system is capable")
|
||||
message ("*** of Large File Support but has not been able to find a type which")
|
||||
message ("*** is an unambiguous 64 bit file offset.")
|
||||
message ("*** Please contact the author to help resolve this problem.")
|
||||
message ("")
|
||||
message (FATAL_ERROR "Bad file offset type.")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
check_type_size (${TYPEOF_SF_COUNT_T} SIZEOF_SF_COUNT_T)
|
||||
|
||||
if (NOT WIN32)
|
||||
check_library_exists (m floor "" LIBM_REQUIRED)
|
||||
if (LIBM_REQUIRED)
|
||||
list (APPEND CMAKE_REQUIRED_LIBRARIES m)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
check_library_exists (sqlite3 sqlite3_close "" HAVE_SQLITE3)
|
||||
|
||||
check_function_exists (fstat HAVE_FSTAT)
|
||||
check_function_exists (fstat64 HAVE_FSTAT64)
|
||||
check_function_exists (gettimeofday HAVE_GETTIMEOFDAY)
|
||||
check_function_exists (gmtime HAVE_GMTIME)
|
||||
check_function_exists (gmtime_r HAVE_GMTIME_R)
|
||||
check_function_exists (localtime HAVE_LOCALTIME)
|
||||
check_function_exists (localtime_r HAVE_LOCALTIME_R)
|
||||
check_function_exists (lseek HAVE_LSEEK)
|
||||
check_function_exists (open HAVE_OPEN)
|
||||
check_function_exists (read HAVE_READ)
|
||||
check_function_exists (write HAVE_WRITE)
|
||||
check_function_exists (lrint HAVE_LRINT)
|
||||
check_function_exists (lrintf HAVE_LRINTF)
|
||||
|
||||
if (NOT WIN32)
|
||||
check_function_exists (ftruncate HAVE_FTRUNCATE)
|
||||
check_function_exists (fsync HAVE_FSYNC)
|
||||
endif ()
|
||||
|
||||
if (BUILD_TESTING)
|
||||
check_function_exists (pipe HAVE_PIPE)
|
||||
check_function_exists (setlocale HAVE_SETLOCALE)
|
||||
check_function_exists (waitpid HAVE_WAITPID)
|
||||
endif ()
|
||||
|
||||
# Never checked
|
||||
# check_function_exists (calloc HAVE_CALLOC)
|
||||
# check_function_exists (free HAVE_FREE)
|
||||
# check_function_exists (getpagesize HAVE_GETPAGESIZE)
|
||||
# check_function_exists (malloc HAVE_MALLOC)
|
||||
# check_function_exists (realloc HAVE_REALLOC)
|
||||
# check_function_exists (snprintf HAVE_SNPRINTF)
|
||||
# check_function_exists (vsnprintf HAVE_VSNPRINTF)
|
||||
# check_function_exists (floor HAVE_FLOOR)
|
||||
# check_function_exists (fmod HAVE_FMOD)
|
||||
|
||||
# Never used
|
||||
# check_function_exists (mmap HAVE_MMAP)
|
||||
# check_function_exists (ceil HAVE_CEIL)
|
||||
# check_function_exists (lround HAVE_LROUND)
|
||||
# check_function_exists (lseek64 HAVE_LSEEK64)
|
||||
|
||||
|
||||
check_symbol_exists (S_IRGRP sys/stat.h HAVE_DECL_S_IRGRP)
|
||||
|
||||
test_big_endian (WORDS_BIGENDIAN)
|
||||
if (WORDS_BIGENDIAN)
|
||||
set (CPU_IS_BIG_ENDIAN 1)
|
||||
else ()
|
||||
set (CPU_IS_LITTLE_ENDIAN 1)
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
set (OS_IS_WIN32 1)
|
||||
set (USE_WINDOWS_API 1)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set (WIN32_TARGET_DLL 1)
|
||||
endif ()
|
||||
if (MINGW)
|
||||
add_definitions (-D__USE_MINGW_ANSI_STDIO=1)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
set (OS_IS_OPENBSD 1)
|
||||
endif ()
|
||||
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
||||
set (COMPILER_IS_GCC 1)
|
||||
endif ()
|
||||
|
||||
test_inline ()
|
||||
clip_mode ()
|
||||
|
||||
if (MSVC)
|
||||
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
endif (MSVC)
|
||||
|
||||
if (ENABLE_STATIC_RUNTIME)
|
||||
if (MSVC)
|
||||
foreach (flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
if (${flag_var} MATCHES "/MD")
|
||||
string (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif ()
|
||||
endforeach (flag_var)
|
||||
endif (MSVC)
|
||||
if (MINGW)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s")
|
||||
endif (MINGW)
|
||||
elseif (NOT ENABLE_STATIC_RUNTIME)
|
||||
if (MSVC)
|
||||
foreach (flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
if (${flag_var} MATCHES "/MT")
|
||||
string (REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
|
||||
endif (${flag_var} MATCHES "/MT")
|
||||
endforeach (flag_var)
|
||||
endif ()
|
||||
if (MINGW)
|
||||
set (CMAKE_C_FLAGS "")
|
||||
set (CMAKE_CXX_FLAGS "")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
endif ()
|
||||
endif ( )
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
find_package (PythonInterp REQUIRED)
|
||||
endif()
|
30
lib-src/libsndfile/cmake/SndFileConfig.cmake.in
Normal file
30
lib-src/libsndfile/cmake/SndFileConfig.cmake.in
Normal file
@@ -0,0 +1,30 @@
|
||||
set(SndFile_VERSION @PROJECT_VERSION@)
|
||||
set(SndFile_VERSION_MAJOR @PROJECT_VERSION_MAJOR@)
|
||||
set(SndFile_VERSION_MINOR @PROJECT_VERSION_MINOR@)
|
||||
set(SndFile_VERSION_PATCH @PROJECT_VERSION_PATCH@)
|
||||
|
||||
set (SndFile_WITH_EXTERNAL_LIBS @SndFile_WITH_EXTERNAL_LIBS@)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include (CMakeFindDependencyMacro)
|
||||
|
||||
find_dependency (Ogg 1.3)
|
||||
find_dependency (VorbisEnc)
|
||||
find_dependency (FLAC)
|
||||
find_dependency (Opus)
|
||||
|
||||
include (${CMAKE_CURRENT_LIST_DIR}/SndFileTargets.cmake)
|
||||
|
||||
set_and_check (SndFile_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
|
||||
set (SNDFILE_INCLUDE_DIR ${SndFile_INCLUDE_DIR})
|
||||
|
||||
set (SndFile_LIBRARY SndFile::sndfile)
|
||||
set (SNDFILE_LIBRARY SndFile::sndfile)
|
||||
set (SndFile_LIBRARIES SndFile::sndfile)
|
||||
set (SNDFILE_LIBRARIES SndFile::sndfile)
|
||||
|
||||
|
||||
check_required_components(SndFile)
|
||||
|
||||
set (SNDFILE_FOUND 1)
|
10
lib-src/libsndfile/cmake/TestInline.c.in
Normal file
10
lib-src/libsndfile/cmake/TestInline.c.in
Normal file
@@ -0,0 +1,10 @@
|
||||
static @INLINE_KEYWORD@ void test_inline(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
test_inline ();
|
||||
return 0;
|
||||
}
|
54
lib-src/libsndfile/cmake/TestInline.cmake
Normal file
54
lib-src/libsndfile/cmake/TestInline.cmake
Normal file
@@ -0,0 +1,54 @@
|
||||
macro (TEST_INLINE)
|
||||
if (NOT DEFINED INLINE_CODE)
|
||||
message (STATUS "Checking for inline...")
|
||||
set (INLINE_KEYWORD "inline")
|
||||
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
|
||||
try_compile (HAVE_INLINE "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
|
||||
if (HAVE_INLINE)
|
||||
message (STATUS "Checking for inline... supported")
|
||||
else ()
|
||||
message (STATUS "Checking for inline... not supported")
|
||||
|
||||
message (STATUS "Checking for __inline...")
|
||||
set (INLINE_KEYWORD "__inline")
|
||||
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
|
||||
try_compile (HAVE___INLINE "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
|
||||
if (HAVE___INLINE)
|
||||
message (STATUS "Checking for __inline... supported")
|
||||
else ()
|
||||
message (STATUS "Checking for __inline... not supported")
|
||||
|
||||
message (STATUS "Checking for __inline__...")
|
||||
set (INLINE_KEYWORD "__inline__")
|
||||
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c)
|
||||
try_compile (HAVE___INLINE "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
|
||||
if (HAVE___INLINE)
|
||||
message (STATUS "Checking for __inline__... supported")
|
||||
|
||||
message (STATUS "Checking for __inline__...")
|
||||
set (INLINE_KEYWORD "__inline__")
|
||||
configure_file (cmake/TestInline.c.in ${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/cmake/TestInline.c)
|
||||
try_compile (HAVE___INLINE__ "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/TestInline.c")
|
||||
else ()
|
||||
message (STATUS "Checking for __inline__... not supported")
|
||||
set (INLINE_KEYWORD "")
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (HAVE_INLINE)
|
||||
set (INLINE_CODE "/* #undef inline */" CACHE INTERNAL "")
|
||||
elseif (HAVE___INLINE)
|
||||
set (INLINE_CODE "#define inline __inline" CACHE INTERNAL "")
|
||||
elseif (HAVE___INLINE__)
|
||||
set (INLINE_CODE "#define inline __inline__" CACHE INTERNAL "")
|
||||
else ()
|
||||
set (INLINE_CODE "#define inline " CACHE INTERNAL "")
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro (TEST_INLINE)
|
121
lib-src/libsndfile/cmake/TestLargeFiles.cmake
Normal file
121
lib-src/libsndfile/cmake/TestLargeFiles.cmake
Normal file
@@ -0,0 +1,121 @@
|
||||
include (CheckIncludeFile)
|
||||
include (CheckTypeSize)
|
||||
include (CMakePushCheckState)
|
||||
|
||||
macro (TEST_LARGE_FILES VARIABLE)
|
||||
|
||||
if (NOT DEFINED ${VARIABLE})
|
||||
|
||||
cmake_push_check_state()
|
||||
|
||||
message (STATUS "")
|
||||
message (STATUS "")
|
||||
message (STATUS "Checking large files support...")
|
||||
|
||||
if (WIN32)
|
||||
set (${VARIABLE} 1 CACHE INTERNAL "Result of tests for large file support" FORCE)
|
||||
message (STATUS "")
|
||||
message (STATUS "Result of checking large files support: supported with WinAPI")
|
||||
else ()
|
||||
|
||||
message (STATUS "")
|
||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_file(stdint.h HAVE_STDINT_H)
|
||||
check_include_file(stddef.h HAVE_STDDEF_H)
|
||||
message (STATUS "")
|
||||
|
||||
message (STATUS "Checking size of off_t without any definitions:")
|
||||
check_type_size (off_t SIZEOF_OFF_T)
|
||||
message (STATUS "Checking of off_t without any definitions: ${SIZEOF_OFF_T}")
|
||||
if (SIZEOF_OFF_T EQUAL 8)
|
||||
set (LARGE_FILES_DEFINITIONS "" CACHE INTERNAL "64-bit off_t required definitions")
|
||||
set (FILE64 TRUE)
|
||||
else ()
|
||||
unset (HAVE_SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T_CODE CACHE)
|
||||
cmake_pop_check_state()
|
||||
set (FILE64 FALSE)
|
||||
endif ()
|
||||
|
||||
if (NOT FILE64)
|
||||
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_FILE_OFFSET_BITS=64)
|
||||
message (STATUS "")
|
||||
message (STATUS "Checking size of off_t with _FILE_OFFSET_BITS=64:")
|
||||
check_type_size (off_t SIZEOF_OFF_T)
|
||||
message (STATUS "Checking size of off_t with _FILE_OFFSET_BITS=64: ${SIZEOF_OFF_T}")
|
||||
if (SIZEOF_OFF_T EQUAL 8)
|
||||
set (_FILE_OFFSET_BITS 64 CACHE INTERNAL "")
|
||||
set (_FILE_OFFSET_BITS_CODE "#define _FILE_OFFSET_BITS 64" CACHE INTERNAL "")
|
||||
set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_FILE_OFFSET_BITS=64" CACHE INTERNAL "64-bit off_t required definitions")
|
||||
set (FILE64 TRUE)
|
||||
else ()
|
||||
set (_FILE_OFFSET_BITS_CODE "" CACHE INTERNAL "")
|
||||
unset (HAVE_SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T_CODE CACHE)
|
||||
cmake_pop_check_state()
|
||||
set (FILE64 FALSE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT FILE64)
|
||||
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_LARGE_FILES)
|
||||
message (STATUS "")
|
||||
message (STATUS "Checking size of off_t with _LARGE_FILES:")
|
||||
check_type_size (off_t SIZEOF_OFF_T)
|
||||
message (STATUS "Checking size of off_t with _LARGE_FILES: ${SIZEOF_OFF_T}")
|
||||
if (SIZEOF_OFF_T EQUAL 8)
|
||||
set (_LARGE_FILES 1 CACHE INTERNAL "")
|
||||
set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_LARGE_FILES" CACHE INTERNAL "64-bit off_t required definitions")
|
||||
set (FILE64 TRUE)
|
||||
else ()
|
||||
unset (HAVE_SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T_CODE CACHE)
|
||||
cmake_pop_check_state()
|
||||
set (FILE64 FALSE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT FILE64)
|
||||
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} /D_LARGEFILE_SOURCE)
|
||||
unset (HAVE_SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T CACHE)
|
||||
unset (SIZEOF_OFF_T_CODE CACHE)
|
||||
message (STATUS "")
|
||||
message (STATUS "Checking size of off_t with _LARGEFILE_SOURCE:")
|
||||
check_type_size (off_t SIZEOF_OFF_T)
|
||||
message (STATUS "Checking size of off_t with _LARGEFILE_SOURCE: ${SIZEOF_OFF_T}")
|
||||
if (SIZEOF_OFF_T EQUAL 8)
|
||||
set (_LARGEFILE_SOURCE 1 CACHE INTERNAL "")
|
||||
set (LARGE_FILES_DEFINITIONS ${LARGE_FILES_DEFINITIONS} "/D_LARGEFILE_SOURCE" CACHE INTERNAL "64-bit off_t required definitions")
|
||||
set (FILE64 TRUE)
|
||||
else ()
|
||||
cmake_pop_check_state()
|
||||
set (FILE64 FALSE)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
message (STATUS "")
|
||||
if (FILE64)
|
||||
set (${VARIABLE} 1 CACHE INTERNAL "Result of tests for large file support" FORCE)
|
||||
if (NOT SIZEOF_OFF_T_REQURED_DEFINITIONS)
|
||||
message (STATUS "Result of checking large files support: supported")
|
||||
else ()
|
||||
message (STATUS "Result of checking large files support: supported with ${LARGE_FILES_DEFINITIONS}")
|
||||
message (STATUS "Add LARGE_FILES_DEFINITIONS to your compiler definitions or configure with _FILE_OFFSET_BITS,")
|
||||
message (STATUS "_FILE_OFFSET_BITS_CODE, _LARGE_FILES and _LARGEFILE_SOURCE variables.")
|
||||
endif ()
|
||||
else ()
|
||||
message ("Result of checking large files support: not supported")
|
||||
set (${VARIABLE} 0 CACHE INTERNAL "Result of test for large file support" FORCE)
|
||||
endif ()
|
||||
message ("")
|
||||
message ("")
|
||||
|
||||
endif ()
|
||||
|
||||
endif (NOT DEFINED ${VARIABLE})
|
||||
|
||||
endmacro (TEST_LARGE_FILES VARIABLE)
|
Reference in New Issue
Block a user