mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 00:54:54 +00:00
Initial commit
added libraries: opus flac libsndfile updated: libvorbis libogg openal - Everything works as expected for now. Bare in mind libsndfile needed the check for whether or not it could find the xiph libraries removed in order for this to work.
This commit is contained in:
parent
05a083ca6f
commit
a745fc3757
1954 changed files with 431332 additions and 21037 deletions
46
Engine/lib/libsndfile/cmake/CMakeAutoGen.cmake
Normal file
46
Engine/lib/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
Engine/lib/libsndfile/cmake/CMakeAutoGenScript.cmake
Normal file
442
Engine/lib/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}")
|
||||
7
Engine/lib/libsndfile/cmake/CheckCPUArch.c.in
Normal file
7
Engine/lib/libsndfile/cmake/CheckCPUArch.c.in
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
int main(void) {
|
||||
#if @CHECK_CPU_ARCH_DEFINES@
|
||||
return 0;
|
||||
#else
|
||||
fail
|
||||
#endif
|
||||
}
|
||||
23
Engine/lib/libsndfile/cmake/CheckCPUArch.cmake
Normal file
23
Engine/lib/libsndfile/cmake/CheckCPUArch.cmake
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
macro (_CHECK_CPU_ARCH ARCH ARCH_DEFINES VARIABLE)
|
||||
if (NOT DEFINED HAVE_${VARIABLE})
|
||||
message (STATUS "Check CPU architecture is ${ARCH}")
|
||||
set (CHECK_CPU_ARCH_DEFINES ${ARCH_DEFINES})
|
||||
configure_file (${PROJECT_SOURCE_DIR}/cmake/CheckCPUArch.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY)
|
||||
try_compile (HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}"
|
||||
"${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c")
|
||||
if(HAVE_${VARIABLE})
|
||||
message (STATUS "Check CPU architecture is ${ARCH} - yes")
|
||||
set (${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_CPU_ARCH_X64" FORCE)
|
||||
else ()
|
||||
message (STATUS "Check CPU architecture is ${ARCH} - no")
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro (_CHECK_CPU_ARCH)
|
||||
|
||||
macro (CHECK_CPU_ARCH_X64 VARIABLE)
|
||||
_CHECK_CPU_ARCH (x64 "defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" ${VARIABLE})
|
||||
endmacro (CHECK_CPU_ARCH_X64)
|
||||
|
||||
macro (CHECK_CPU_ARCH_X86 VARIABLE)
|
||||
_CHECK_CPU_ARCH (x86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" ${VARIABLE})
|
||||
endmacro (CHECK_CPU_ARCH_X86)
|
||||
92
Engine/lib/libsndfile/cmake/ClipMode.cmake
Normal file
92
Engine/lib/libsndfile/cmake/ClipMode.cmake
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
include (CheckCSourceRuns)
|
||||
include (CMakePushCheckState)
|
||||
|
||||
macro (CLIP_MODE)
|
||||
if ((NOT DEFINED CPU_CLIPS_NEGATIVE) AND (NOT DEFINED CPU_CLIPS_POSITIVE))
|
||||
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}")
|
||||
endif ()
|
||||
endmacro (CLIP_MODE)
|
||||
67
Engine/lib/libsndfile/cmake/FindFLAC.cmake
Normal file
67
Engine/lib/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
Engine/lib/libsndfile/cmake/FindOgg.cmake
Normal file
61
Engine/lib/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
Engine/lib/libsndfile/cmake/FindOpus.cmake
Normal file
67
Engine/lib/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)
|
||||
61
Engine/lib/libsndfile/cmake/FindSndio.cmake
Normal file
61
Engine/lib/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
Engine/lib/libsndfile/cmake/FindSpeex.cmake
Normal file
55
Engine/lib/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)
|
||||
210
Engine/lib/libsndfile/cmake/FindVorbis.cmake
Normal file
210
Engine/lib/libsndfile/cmake/FindVorbis.cmake
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
#[=======================================================================[.rst:
|
||||
FindVorbis
|
||||
----------
|
||||
|
||||
Finds the native vorbis, vorbisenc amd vorbisfile includes and libraries.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module provides the following imported targets, if found:
|
||||
|
||||
``Vorbis::vorbis``
|
||||
The Vorbis library
|
||||
``Vorbis::vorbisenc``
|
||||
The VorbisEnc library
|
||||
``Vorbis::vorbisfile``
|
||||
The VorbisFile library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables:
|
||||
|
||||
``Vorbis_Vorbis_INCLUDE_DIRS``
|
||||
List of include directories when using vorbis.
|
||||
``Vorbis_Enc_INCLUDE_DIRS``
|
||||
List of include directories when using vorbisenc.
|
||||
``Vorbis_File_INCLUDE_DIRS``
|
||||
List of include directories when using vorbisfile.
|
||||
``Vorbis_Vorbis_LIBRARIES``
|
||||
List of libraries when using vorbis.
|
||||
``Vorbis_Enc_LIBRARIES``
|
||||
List of libraries when using vorbisenc.
|
||||
``Vorbis_File_LIBRARIES``
|
||||
List of libraries when using vorbisfile.
|
||||
``Vorbis_FOUND``
|
||||
True if vorbis and requested components found.
|
||||
``Vorbis_Vorbis_FOUND``
|
||||
True if vorbis found.
|
||||
``Vorbis_Enc_FOUND``
|
||||
True if vorbisenc found.
|
||||
``Vorbis_Enc_FOUND``
|
||||
True if vorbisfile found.
|
||||
|
||||
Cache variables
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
The following cache variables may also be set:
|
||||
|
||||
``Vorbis_Vorbis_INCLUDE_DIR``
|
||||
The directory containing ``vorbis/vorbis.h``.
|
||||
``Vorbis_Enc_INCLUDE_DIR``
|
||||
The directory containing ``vorbis/vorbisenc.h``.
|
||||
``Vorbis_File_INCLUDE_DIR``
|
||||
The directory containing ``vorbis/vorbisenc.h``.
|
||||
``Vorbis_Vorbis_LIBRARY``
|
||||
The path to the vorbis library.
|
||||
``Vorbis_Enc_LIBRARY``
|
||||
The path to the vorbisenc library.
|
||||
``Vorbis_File_LIBRARY``
|
||||
The path to the vorbisfile library.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
A user may set ``Vorbis_ROOT`` to a vorbis installation root to tell this module where to look.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
if (Vorbis_Vorbis_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set (Vorbis_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
set (Vorbis_Vorbis_FIND_QUIETLY TRUE)
|
||||
set (Vorbis_Enc_FIND_QUIETLY TRUE)
|
||||
set (Vorbis_File_FIND_QUIETLY TRUE)
|
||||
|
||||
find_package (Ogg QUIET)
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules (PC_Vorbis_Vorbis QUIET vorbis)
|
||||
pkg_check_modules (PC_Vorbis_Enc QUIET vorbisenc)
|
||||
pkg_check_modules (PC_Vorbis_File QUIET vorbisfile)
|
||||
|
||||
set (Vorbis_VERSION ${PC_Vorbis_Vorbis_VERSION})
|
||||
|
||||
find_path (Vorbis_Vorbis_INCLUDE_DIR vorbis/codec.h
|
||||
HINTS
|
||||
${PC_Vorbis_Vorbis_INCLUDEDIR}
|
||||
${PC_Vorbis_Vorbis_INCLUDE_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_path (Vorbis_Enc_INCLUDE_DIR vorbis/vorbisenc.h
|
||||
HINTS
|
||||
${PC_Vorbis_Enc_INCLUDEDIR}
|
||||
${PC_Vorbis_Enc_INCLUDE_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_path (Vorbis_File_INCLUDE_DIR vorbis/vorbisfile.h
|
||||
HINTS
|
||||
${PC_Vorbis_File_INCLUDEDIR}
|
||||
${PC_Vorbis_File_INCLUDE_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_library (Vorbis_Vorbis_LIBRARY
|
||||
NAMES
|
||||
vorbis
|
||||
vorbis_static
|
||||
libvorbis
|
||||
libvorbis_static
|
||||
HINTS
|
||||
${PC_Vorbis_Vorbis_LIBDIR}
|
||||
${PC_Vorbis_Vorbis_LIBRARY_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_library (Vorbis_Enc_LIBRARY
|
||||
NAMES
|
||||
vorbisenc
|
||||
vorbisenc_static
|
||||
libvorbisenc
|
||||
libvorbisenc_static
|
||||
HINTS
|
||||
${PC_Vorbis_Enc_LIBDIR}
|
||||
${PC_Vorbis_Enc_LIBRARY_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
find_library (Vorbis_File_LIBRARY
|
||||
NAMES
|
||||
vorbisfile
|
||||
vorbisfile_static
|
||||
libvorbisfile
|
||||
libvorbisfile_static
|
||||
HINTS
|
||||
${PC_Vorbis_File_LIBDIR}
|
||||
${PC_Vorbis_File_LIBRARY_DIRS}
|
||||
${Vorbis_ROOT}
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
if (Vorbis_Vorbis_LIBRARY AND Vorbis_Vorbis_INCLUDE_DIR AND Ogg_FOUND)
|
||||
set (Vorbis_Vorbis_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
if (Vorbis_Enc_LIBRARY AND Vorbis_Enc_INCLUDE_DIR AND Vorbis_Vorbis_FOUND)
|
||||
set (Vorbis_Enc_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
if (Vorbis_Vorbis_FOUND AND Vorbis_File_LIBRARY AND Vorbis_File_INCLUDE_DIR)
|
||||
set (Vorbis_File_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
find_package_handle_standard_args (Vorbis
|
||||
REQUIRED_VARS
|
||||
Vorbis_Vorbis_LIBRARY
|
||||
Vorbis_Vorbis_INCLUDE_DIR
|
||||
Ogg_FOUND
|
||||
HANDLE_COMPONENTS
|
||||
VERSION_VAR Vorbis_VERSION)
|
||||
|
||||
|
||||
if (Vorbis_Vorbis_FOUND)
|
||||
set (Vorbis_Vorbis_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
|
||||
set (Vorbis_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_Vorbis_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${Vorbis_Vorbis_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Ogg::ogg
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (Vorbis_Enc_FOUND)
|
||||
set (Vorbis_Enc_INCLUDE_DIRS ${Vorbis_Enc_INCLUDE_DIR})
|
||||
set (Vorbis_Enc_LIBRARIES ${Vorbis_Enc_LIBRARY} ${Vorbis_Enc_LIBRARIES})
|
||||
if (NOT TARGET Vorbis::vorbisenc)
|
||||
add_library (Vorbis::vorbisenc UNKNOWN IMPORTED)
|
||||
set_target_properties (Vorbis::vorbisenc PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Enc_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${Vorbis_Enc_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Vorbis::vorbis
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (Vorbis_File_FOUND)
|
||||
set (Vorbis_File_INCLUDE_DIRS ${Vorbis_File_INCLUDE_DIR})
|
||||
set (Vorbis_File_LIBRARIES ${Vorbis_File_LIBRARY} ${Vorbis_File_LIBRARIES})
|
||||
if (NOT TARGET Vorbis::vorbisfile)
|
||||
add_library (Vorbis::vorbisfile UNKNOWN IMPORTED)
|
||||
set_target_properties (Vorbis::vorbisfile PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_File_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${Vorbis_File_LIBRARY}"
|
||||
INTERFACE_LINK_LIBRARIES Vorbis::vorbis
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (Vorbis_Vorbis_INCLUDE_DIR Vorbis_Vorbis_LIBRARY)
|
||||
mark_as_advanced (Vorbis_Enc_INCLUDE_DIR Vorbis_Enc_LIBRARY)
|
||||
mark_as_advanced (Vorbis_File_INCLUDE_DIR Vorbis_File_LIBRARY)
|
||||
67
Engine/lib/libsndfile/cmake/Findmp3lame.cmake
Normal file
67
Engine/lib/libsndfile/cmake/Findmp3lame.cmake
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# - Find lame
|
||||
# Find the native lame includes and libraries
|
||||
#
|
||||
# MP3LAME_INCLUDE_DIRS - where to find lame.h, etc.
|
||||
# MP3LAME_LIBRARIES - List of libraries when using lame.
|
||||
# MP3LAME_FOUND - True if Lame found.
|
||||
|
||||
if (MP3LAME_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(MP3LAME_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_path (MP3LAME_INCLUDE_DIR lame/lame.h
|
||||
HINTS
|
||||
${LAME_ROOT}
|
||||
)
|
||||
|
||||
# MSVC built lame may be named mp3lame_static.
|
||||
# The provided project files name the library with the lib prefix.
|
||||
|
||||
find_library (MP3LAME_LIBRARY
|
||||
NAMES
|
||||
mp3lame
|
||||
mp3lame_static
|
||||
libmp3lame
|
||||
libmp3lame_static
|
||||
libmp3lame-static
|
||||
HINTS
|
||||
${MP3LAME_ROOT}
|
||||
)
|
||||
|
||||
find_library (MP3LAME_HIP_LIBRARY
|
||||
NAMES
|
||||
mpghip-static
|
||||
libmpghip-static
|
||||
HINTS
|
||||
${MP3LAME_ROOT}
|
||||
)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set LAME_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (mp3lame
|
||||
REQUIRED_VARS
|
||||
MP3LAME_LIBRARY
|
||||
MP3LAME_INCLUDE_DIR
|
||||
)
|
||||
|
||||
if (MP3LAME_FOUND)
|
||||
set (MP3LAME_LIBRARIES ${MP3LAME_LIBRARY} ${MP3LAME_HIP_LIBRARY})
|
||||
set (MP3LAME_INCLUDE_DIRS ${MP3LAME_INCLUDE_DIR})
|
||||
|
||||
if (NOT TARGET mp3lame::mp3lame)
|
||||
add_library (mp3lame::mp3lame UNKNOWN IMPORTED)
|
||||
set_target_properties (mp3lame::mp3lame PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${MP3LAME_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${MP3LAME_LIBRARY}"
|
||||
)
|
||||
if (MP3LAME_HIP_LIBRARY AND (NOT TARGET mp3lame::mpghip))
|
||||
add_library (mp3lame::mpghip STATIC IMPORTED)
|
||||
set_property (mp3lame::mpghip PROPERTY IMPORTED_LOCATION "${MP3LAME_HIP_LIBRARY}")
|
||||
set_property (TARGET mp3lame::mp3lame PROPERTY INTERFACE_LINK_LIBRARIES "mp3lame::mpghip")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(MP3LAME_INCLUDE_DIR MP3LAME_LIBRARY MP3LAME_HIP_LIBRARY)
|
||||
95
Engine/lib/libsndfile/cmake/Findmpg123.cmake
Normal file
95
Engine/lib/libsndfile/cmake/Findmpg123.cmake
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#[=======================================================================[.rst:
|
||||
Findmpg123
|
||||
-------
|
||||
|
||||
Finds the mpg123 library.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module provides the following imported targets, if found:
|
||||
|
||||
``MPG123::libmpg123``
|
||||
The mpg123 library
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables:
|
||||
|
||||
``mpg123_FOUND``
|
||||
True if the system has the mpg123 package.
|
||||
``mpg123_VERSION``
|
||||
The version of mpg123 that was found on the system.
|
||||
|
||||
Cache Variables
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
The following cache variables may also be set:
|
||||
|
||||
``mpg123_INCLUDE_DIR``
|
||||
The directory containing ``mpg123.h``.
|
||||
``mpg123_LIBRARY``
|
||||
The path to the mpg123 library.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
if (mpg123_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
set(mpg123_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_package (PkgConfig QUIET)
|
||||
pkg_check_modules(PC_MPG123 QUIET libmpg123>=1.25.10)
|
||||
|
||||
find_path (mpg123_INCLUDE_DIR mpg123.h
|
||||
HINTS
|
||||
${PC_MPG123_INCLUDEDIR}
|
||||
${PC_MPG123_INCLUDE_DIRS}
|
||||
${mpg123_ROOT}
|
||||
)
|
||||
|
||||
# MSVC built mpg123 may be named mpg123_static.
|
||||
# The provided project files name the library with the lib prefix.
|
||||
|
||||
find_library (mpg123_LIBRARY
|
||||
NAMES
|
||||
mpg123
|
||||
mpg123_static
|
||||
libmpg123
|
||||
libmpg123_static
|
||||
HINTS
|
||||
${PC_MPG123_LIBDIR}
|
||||
${PC_MPG123_LIBRARY_DIRS}
|
||||
${mpg123_ROOT}
|
||||
)
|
||||
|
||||
if (PC_MPG123_FOUND)
|
||||
set (mpg123_VERSION ${PC_MPG123_VERSION})
|
||||
elseif (mpg123_INCLUDE_DIR)
|
||||
file (READ "${mpg123_INCLUDE_DIR}/mpg123.h" _mpg123_h)
|
||||
string (REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" _mpg123_version_re "${_mpg123_h}")
|
||||
set (mpg123_VERSION "${_mpg123_version_re}")
|
||||
endif ()
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set mpg123_FOUND
|
||||
# to TRUE if all listed variables are TRUE.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (mpg123
|
||||
REQUIRED_VARS
|
||||
mpg123_LIBRARY
|
||||
mpg123_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
mpg123_VERSION
|
||||
)
|
||||
|
||||
if (mpg123_FOUND AND 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_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(mpg123_INCLUDE_DIR mpg123_LIBRARY)
|
||||
56
Engine/lib/libsndfile/cmake/SetupABIVersions.cmake
Normal file
56
Engine/lib/libsndfile/cmake/SetupABIVersions.cmake
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# Inspiration: https://github.com/ros2-dotnet/Fast-RTPS
|
||||
|
||||
macro (SETUP_ABI_VERSIONS)
|
||||
|
||||
file (STRINGS ${PROJECT_SOURCE_DIR}/configure.ac CONFIGURE_AC_CONTENT)
|
||||
file (STRINGS
|
||||
configure.ac
|
||||
SNDFILE_LT_CURRENT_TMP
|
||||
REGEX "^m4_define\\(\\[?lt_current\\]?, *\\[?[0-9]+\\]?\\)"
|
||||
)
|
||||
string (REGEX REPLACE "m4_define\\(\\[?lt_current\\]?, *\\[?([0-9]+)\\]?\\)"
|
||||
"\\1"
|
||||
SNDFILE_LT_CURRENT
|
||||
${SNDFILE_LT_CURRENT_TMP}
|
||||
)
|
||||
|
||||
file (STRINGS
|
||||
configure.ac
|
||||
SNDFILE_LT_REVISION_TMP
|
||||
REGEX "^m4_define\\(\\[?lt_revision\\]?, *\\[?[0-9]+\\]?\\)"
|
||||
)
|
||||
string (REGEX REPLACE "m4_define\\(\\[?lt_revision\\]?, *\\[?([0-9]+)\\]?\\)"
|
||||
"\\1"
|
||||
SNDFILE_LT_REVISION
|
||||
${SNDFILE_LT_REVISION_TMP}
|
||||
)
|
||||
|
||||
file (STRINGS
|
||||
configure.ac
|
||||
SNDFILE_LT_AGE_TMP
|
||||
REGEX "^m4_define\\(\\[?lt_age\\]?, *\\[?[0-9]+\\]?\\)"
|
||||
)
|
||||
string (REGEX REPLACE "m4_define\\(\\[?lt_age\\]?, *\\[?([0-9]+)\\]?\\)"
|
||||
"\\1"
|
||||
SNDFILE_LT_AGE
|
||||
${SNDFILE_LT_AGE_TMP}
|
||||
)
|
||||
|
||||
#
|
||||
# Calculate CMake compatible ABI version from libtool version.
|
||||
#
|
||||
|
||||
math (EXPR SNDFILE_ABI_VERSION_MAJOR "${SNDFILE_LT_CURRENT} - ${SNDFILE_LT_AGE}")
|
||||
set (SNDFILE_ABI_VERSION_MINOR ${SNDFILE_LT_AGE})
|
||||
set (SNDFILE_ABI_VERSION_PATCH ${SNDFILE_LT_REVISION})
|
||||
set (SNDFILE_ABI_VERSION "${SNDFILE_ABI_VERSION_MAJOR}.${SNDFILE_ABI_VERSION_MINOR}.${SNDFILE_ABI_VERSION_PATCH}")
|
||||
|
||||
#
|
||||
# Apple platform current and compatibility versions.
|
||||
#
|
||||
|
||||
math (EXPR SNDFILE_MACHO_CURRENT_VERSION_MAJOR "${SNDFILE_ABI_VERSION_MAJOR} + ${SNDFILE_ABI_VERSION_MINOR} + 1")
|
||||
set (SNDFILE_MACHO_CURRENT_VERSION "${SNDFILE_MACHO_CURRENT_VERSION_MAJOR}.${SNDFILE_ABI_VERSION_PATCH}.0")
|
||||
set (SNDFILE_MACHO_COMPATIBILITY_VERSION "${SNDFILE_MACHO_CURRENT_VERSION_MAJOR}.0.0")
|
||||
|
||||
endmacro (SETUP_ABI_VERSIONS)
|
||||
256
Engine/lib/libsndfile/cmake/SndFileChecks.cmake
Normal file
256
Engine/lib/libsndfile/cmake/SndFileChecks.cmake
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
include (CheckFunctionExists)
|
||||
include (CheckIncludeFile)
|
||||
include (CheckLibraryExists)
|
||||
include (CheckSymbolExists)
|
||||
include (CheckTypeSize)
|
||||
include (TestBigEndian)
|
||||
|
||||
include (TestInline)
|
||||
include (ClipMode)
|
||||
include (TestLargeFiles)
|
||||
include (CheckCPUArch)
|
||||
|
||||
test_large_files (_LARGEFILES)
|
||||
|
||||
if (LARGE_FILES_DEFINITIONS)
|
||||
add_definitions(${LARGE_FILES_DEFINITIONS})
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
find_package (Sndio)
|
||||
elseif (NOT WIN32)
|
||||
find_package (ALSA)
|
||||
endif ()
|
||||
|
||||
if (VCPKG_TOOLCHAIN AND (NOT CMAKE_VERSION VERSION_LESS 3.15))
|
||||
set (CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_FIND_PACKAGE_PREFER_CONFIG)
|
||||
find_package (Ogg 1.3 CONFIG)
|
||||
find_package (Vorbis CONFIG COMPONENTS Enc)
|
||||
find_package (FLAC CONFIG)
|
||||
find_package (Opus CONFIG)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (Ogg CONFIG_MODE)
|
||||
find_package_handle_standard_args (Vorbis CONFIG_MODE)
|
||||
find_package_handle_standard_args (FLAC CONFIG_MODE)
|
||||
find_package_handle_standard_args (Opus CONFIG_MODE)
|
||||
else ()
|
||||
find_package (Ogg 1.3)
|
||||
find_package (Vorbis COMPONENTS Enc)
|
||||
find_package (FLAC)
|
||||
find_package (Opus)
|
||||
endif ()
|
||||
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 (mp3lame)
|
||||
find_package (mpg123 1.25.10)
|
||||
if (TARGET mp3lame::mp3lame AND (TARGET MPG123::libmpg123))
|
||||
set (HAVE_MPEG_LIBS 1)
|
||||
else ()
|
||||
set (HAVE_MPEG_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)
|
||||
check_include_file (immintrin.h HAVE_IMMINTRIN_H)
|
||||
check_include_file (stdbool.h HAVE_STDBOOL_H)
|
||||
|
||||
check_cpu_arch_x86 (CPU_IS_X86)
|
||||
check_cpu_arch_x64 (CPU_IS_X64)
|
||||
if ((CPU_IS_X86 OR CPU_IS_X64) AND HAVE_IMMINTRIN_H)
|
||||
set (HAVE_SSE2 1)
|
||||
endif ()
|
||||
|
||||
# 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 (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 (DEFINED ENABLE_STATIC_RUNTIME)
|
||||
if (MSVC)
|
||||
if (ENABLE_STATIC_RUNTIME)
|
||||
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)
|
||||
else ()
|
||||
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 ( )
|
||||
elseif (MINGW)
|
||||
if (ENABLE_STATIC_RUNTIME)
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL GNU)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++ -s")
|
||||
endif ()
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL Clang)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static")
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static")
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
message (AUTHOR_WARNING "ENABLE_STATIC_RUNTIME option is for MSVC or MinGW only.")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
find_package (PythonInterp REQUIRED)
|
||||
endif()
|
||||
46
Engine/lib/libsndfile/cmake/SndFileConfig.cmake.in
Normal file
46
Engine/lib/libsndfile/cmake/SndFileConfig.cmake.in
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
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@)
|
||||
set (SndFile_WITH_MPEG @SndFile_WITH_MPEG@)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include (CMakeFindDependencyMacro)
|
||||
|
||||
if (NOT @BUILD_SHARED_LIBS@)
|
||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif ()
|
||||
|
||||
if (SndFile_WITH_EXTERNAL_LIBS AND NOT @BUILD_SHARED_LIBS@)
|
||||
find_dependency (Ogg 1.3)
|
||||
find_dependency (Vorbis)
|
||||
find_dependency (FLAC)
|
||||
find_dependency (Opus)
|
||||
endif ()
|
||||
|
||||
if (SndFile_WITH_MPEG AND NOT @BUILD_SHARED_LIBS@)
|
||||
find_dependency (mp3lame)
|
||||
find_dependency (mpg123)
|
||||
endif ()
|
||||
|
||||
if (NOT @BUILD_SHARED_LIBS@)
|
||||
list (REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif ()
|
||||
|
||||
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
Engine/lib/libsndfile/cmake/TestInline.c.in
Normal file
10
Engine/lib/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
Engine/lib/libsndfile/cmake/TestInline.cmake
Normal file
54
Engine/lib/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
Engine/lib/libsndfile/cmake/TestLargeFiles.cmake
Normal file
121
Engine/lib/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)
|
||||
56
Engine/lib/libsndfile/cmake/sqlite/FindSQLite3.cmake
Normal file
56
Engine/lib/libsndfile/cmake/sqlite/FindSQLite3.cmake
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# - Find SQLite3
|
||||
# Find the native SQLite3 includes and libraries
|
||||
#
|
||||
# SQLite3_INCLUDE_DIRS - where to find sqlite3.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 SQLite::SQLite3)
|
||||
add_library (SQLite::SQLite3 UNKNOWN IMPORTED)
|
||||
set_target_properties (SQLite::SQLite3 PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${SQLite3_LIBRARIES}"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced (SQLite3_INCLUDE_DIR SQLite3_LIBRARY)
|
||||
Loading…
Add table
Add a link
Reference in a new issue