[libflac] initial commit

This commit is contained in:
codicodi 2016-12-06 12:14:31 +01:00 committed by GitHub
parent a710f67e52
commit 175bb41f82
3 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,74 @@
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0005 NEW) # do not escape preprocessor defines
project(libflac)
if(NOT DEFINED LIBFLAC_OGG_LIB OR NOT DEFINED LIBFLAC_OGG_INCLUDES)
message(FATAL_ERROR "Ogg library required")
endif()
if(NOT DEFINED LIBFLAC_ARCHITECTURE)
message(FATAL_ERROR "Target architecture not specified")
endif()
file(GLOB LIBFLAC_SOURCES
${PROJECT_SOURCE_DIR}/src/libFLAC/*.c
${PROJECT_SOURCE_DIR}/src/share/win_utf8_io/win_utf8_io.c)
file(GLOB LIBFLACXX_SOURCES
${PROJECT_SOURCE_DIR}/src/libFLAC++/*.cpp)
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/src/libFLAC/include)
include_directories(${LIBFLAC_OGG_INCLUDES})
if(NOT LIBFLAC_ARCHITECTURE MATCHES arm)
add_definitions(-DFLAC__SSE_OS)
add_definitions(-DFLAC__HAS_X86INTRIN)
endif()
if(LIBFLAC_ARCHITECTURE MATCHES x86)
add_definitions(-DFLAC__CPU_IA32)
elseif(LIBFLAC_ARCHITECTURE MATCHES x64)
add_definitions(-DFLAC__CPU_X86_64)
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-DFLAC__OVERFLOW_DETECT)
endif()
add_definitions(-DVERSION="1.3.1")
add_definitions(-DFLAC__HAS_OGG)
add_definitions(-DFLAC__ALIGN_MALLOC_DATA) # 32 byte boundary
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
add_library(libFLAC ${LIBFLAC_SOURCES})
add_library(libFLACXX ${LIBFLACXX_SOURCES})
set_target_properties(libFLAC PROPERTIES OUTPUT_NAME flac)
set_target_properties(libFLACXX PROPERTIES OUTPUT_NAME flac++)
target_link_libraries(libFLAC ${LIBFLAC_OGG_LIB})
target_link_libraries(libFLACXX libFLAC)
if(BUILD_SHARED_LIBS)
set_target_properties(libFLACXX PROPERTIES COMPILE_FLAGS -DFLACPP_API_EXPORTS)
set_target_properties(libFLAC PROPERTIES COMPILE_FLAGS -DFLAC_API_EXPORTS)
else()
add_definitions(-DFLAC__NO_DLL)
endif()
install(TARGETS libFLAC libFLACXX
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
if(NOT DEFINED LIBFLAC_SKIP_HEADERS)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/FLAC/
DESTINATION include/FLAC
FILES_MATCHING PATTERN "*.h")
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/FLAC++/
DESTINATION include/FLAC++
FILES_MATCHING PATTERN "*.h")
endif()

4
ports/libflac/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: libflac
Version: 1.3.1
Description: Library for manipulating FLAC files
Build-Depends: libogg

View File

@ -0,0 +1,32 @@
# libFLAC uses winapi functons not avalible in WindowsStore
if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
message(FATAL_ERROR "Error: UWP builds are currently not supported.")
endif()
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/flac-1.3.1)
vcpkg_download_distfile(ARCHIVE
URLS "http://downloads.xiph.org/releases/flac/flac-1.3.1.tar.xz"
FILENAME "flac-1.3.1.tar.xz"
SHA512 923cd0ffe2155636febf2b4633791bc83370d57080461b97ebb69ea21a4b1be7c0ff376c7fc8ca3979af4714e761112114a24b49ff6c80228b58b929db6e96d5)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DLIBFLAC_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}
-DLIBFLAC_OGG_LIB=${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/lib/ogg.lib
-DLIBFLAC_OGG_INCLUDES=${VCPKG_ROOT_DIR}/installed/${TARGET_TRIPLET}/include
OPTIONS_DEBUG
-DLIBFLAC_SKIP_HEADERS=ON)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
# This license (BSD) is relevant only for library - if someone would want to install
# FLAC cmd line tools as well additional license (GPL) should be included
file(COPY ${SOURCE_PATH}/COPYING.Xiph DESTINATION ${CURRENT_PACKAGES_DIR}/share/libflac)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libflac/COPYING.Xiph ${CURRENT_PACKAGES_DIR}/share/libflac/copyright)