freebsd-ports/audio/zita-resampler/files/patch-CMakeLists.txt
Daniel Engberg 26141c14cb audio/zita-resampler: Update to 1.10.1
Respect CXXFLAGS and make -ffast-math optional

Changelog:
* Fixed dithering of clipped signals.
* Fixed constructor parameter range tests.

PR:		269674
Reviewed by:	Goran Mekić <meka@tilda.center> (maintainer)
2023-02-20 16:10:31 +01:00

73 lines
2.6 KiB
Text

From d0fe1bf362820e49594477a5d4c0369f0e2b6c60 Mon Sep 17 00:00:00 2001
From: Daniel Engberg <daniel.engberg.lists@pyret.net>
Date: Fri, 8 Jan 2021 03:03:05 +0100
Subject: [PATCH] cmake
cmake
Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
--- CMakeLists.txt.orig 2023-02-19 00:41:59 UTC
+++ CMakeLists.txt
@@ -0,0 +1,62 @@
+cmake_minimum_required(VERSION 3.5)
+
+project(zita-resampler LANGUAGES CXX)
+
+option(ZITA_RESAMPLER_ENABLE_SHARED "Build as a shared library" ON)
+option(ZITA_RESAMPLER_ENABLE_STATIC "Build as a static library" OFF)
+
+set(ZITA_RESAMPLER_SOURCES
+ "source/cresampler.cc"
+ "source/resampler.cc"
+ "source/resampler-table.cc"
+ "source/vresampler.cc")
+
+find_package(Threads REQUIRED)
+
+set(ZITA_RESAMPLER_TARGETS)
+
+macro(extract_version file setting_name)
+ file(STRINGS ${file} VERSION_NUMBER REGEX "^${setting_name}")
+ string(REPLACE "= " ";" VERSION_NUMBER_LIST ${VERSION_NUMBER})
+ list(GET VERSION_NUMBER_LIST 1 ${setting_name})
+endmacro(extract_version)
+
+extract_version(source/Makefile MAJVERS)
+extract_version(source/Makefile MINVERS)
+
+set(PROJECT_VERSION "${MAJVERS}.${MINVERS}")
+
+string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION})
+list(GET VERSION_LIST 0 PROJECT_VERSION_MAJOR)
+list(GET VERSION_LIST 1 PROJECT_VERSION_MINOR)
+# list(GET VERSION_LIST 2 PROJECT_VERSION_PATCH)
+
+set(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DZITA_RESAMPLER_MAJOR_VERSION=${MAJVERS} -DZITA_RESAMPLER_MINOR_VERSION=${MINVERS} -fPIC")
+
+if(ZITA_RESAMPLER_ENABLE_SHARED)
+ add_library(zita-resampler SHARED ${ZITA_RESAMPLER_SOURCES})
+ target_include_directories(zita-resampler
+ PUBLIC "${PROJECT_SOURCE_DIR}/source")
+ target_link_libraries(zita-resampler PUBLIC ${CMAKE_THREAD_LIBS_INIT})
+ set_target_properties(zita-resampler PROPERTIES
+ VERSION "${PROJECT_VERSION}"
+ SOVERSION "${PROJECT_VERSION_MAJOR}")
+ list(APPEND ZITA_RESAMPLER_TARGETS zita-resampler)
+endif()
+
+if(ZITA_RESAMPLER_ENABLE_STATIC)
+ add_library(zita-resampler-static STATIC ${ZITA_RESAMPLER_SOURCES})
+ target_include_directories(zita-resampler-static
+ PUBLIC "${PROJECT_SOURCE_DIR}/source")
+ target_link_libraries(zita-resampler-static PUBLIC ${CMAKE_THREAD_LIBS_INIT})
+ set_target_properties(zita-resampler-static PROPERTIES
+ OUTPUT_NAME "zita-resampler")
+ list(APPEND ZITA_RESAMPLER_TARGETS zita-resampler-static)
+endif()
+
+install(TARGETS ${ZITA_RESAMPLER_TARGETS}
+ LIBRARY DESTINATION "lib"
+ ARCHIVE DESTINATION "lib"
+ RUNTIME DESTINATION "bin")
+install(DIRECTORY "source/zita-resampler"
+ DESTINATION "include")