aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcodicodi <rob.ceglinski@gmail.com>2016-12-06 12:14:31 +0100
committerGitHub <noreply@github.com>2016-12-06 12:14:31 +0100
commit175bb41f822891eb3a69795eb132c85f5b869a4b (patch)
treed14f16ac2a77c2ce321dc00766d20274d8972d63
parenta710f67e5281480ab22d0ef372d376696f5fc8ab (diff)
downloadvcpkg-175bb41f822891eb3a69795eb132c85f5b869a4b.tar.gz
vcpkg-175bb41f822891eb3a69795eb132c85f5b869a4b.zip
[libflac] initial commit
-rw-r--r--ports/libflac/CMakeLists.txt74
-rw-r--r--ports/libflac/CONTROL4
-rw-r--r--ports/libflac/portfile.cmake32
3 files changed, 110 insertions, 0 deletions
diff --git a/ports/libflac/CMakeLists.txt b/ports/libflac/CMakeLists.txt
new file mode 100644
index 000000000..2f3dedbdb
--- /dev/null
+++ b/ports/libflac/CMakeLists.txt
@@ -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()
diff --git a/ports/libflac/CONTROL b/ports/libflac/CONTROL
new file mode 100644
index 000000000..557b30123
--- /dev/null
+++ b/ports/libflac/CONTROL
@@ -0,0 +1,4 @@
+Source: libflac
+Version: 1.3.1
+Description: Library for manipulating FLAC files
+Build-Depends: libogg
diff --git a/ports/libflac/portfile.cmake b/ports/libflac/portfile.cmake
new file mode 100644
index 000000000..bb7daae72
--- /dev/null
+++ b/ports/libflac/portfile.cmake
@@ -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)