Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libmysofa: add package #6076

Open
wants to merge 21 commits into
base: dev
Choose a base branch
from
82 changes: 82 additions & 0 deletions packages/l/libmysofa/patches/v1.3.2/fix-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dcaa92a..c62d79b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -13,21 +13,23 @@ use_c99()
configure_file(config.h.in config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})

+find_package(ZLIB REQUIRED)
if(NOT MSVC)
if(NOT WIN32)
find_library(MATH m)
else()
set(MATH "")
endif()
- include(FindZLIB)
else()
set(MATH "")
+ if(0)
find_program(NUGET nuget)
if(NUGET)
execute_process(COMMAND ${NUGET} install zlib)
endif()
include_directories(
${PROJECT_SOURCE_DIR}/windows/third-party/zlib-1.2.11/include/)
+ endif()
endif()

if(NOT MSVC)
@@ -36,12 +38,11 @@ if(NOT MSVC)
else()
set(MATH "")
endif()
- include(FindZLIB)
- include_directories(${ZLIB_INCLUDE_DIRS})
set(PKG_CONFIG_PRIVATELIBS "-lm ${PKG_CONFIG_PRIVATELIBS}")
set(PKG_CONFIG_PRIVATELIBS "-lz ${PKG_CONFIG_PRIVATELIBS}")
else()
set(MATH "")
+ if(0)
find_program(NUGET nuget)
if(NOT NUGET)
message(
@@ -53,6 +54,7 @@ else()
endif()
include_directories(
${PROJECT_SOURCE_DIR}/windows/third-party/zlib-1.2.11/include/)
+ endif()
endif()

set(libsrc
@@ -80,6 +82,7 @@ set(libsrc
set(public-headers
hrtf/mysofa.h
)
+install(FILES "${public-headers}" DESTINATION include)

if(BUILD_STATIC_LIBS)
add_library(mysofa-static STATIC ${libsrc})
@@ -88,11 +91,11 @@ target_include_directories(mysofa-static
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/hrtf>"
$<INSTALL_INTERFACE:include/>
)
-target_link_libraries(mysofa-static LINK_PRIVATE ${MATH} ${ZLIB_LIBRARIES})
+target_link_libraries(mysofa-static LINK_PRIVATE ${MATH} ZLIB::ZLIB)
set_target_properties(
mysofa-static
PROPERTIES OUTPUT_NAME mysofa CLEAN_DIRECT_OUTPUT 1 POSITION_INDEPENDENT_CODE
- ${BUILD_SHARED_LIBS})
+ OFF)
set_target_properties( mysofa-static PROPERTIES PUBLIC_HEADER "${public-headers}" )
install(TARGETS mysofa-static
EXPORT mysofa_exports
@@ -113,7 +116,7 @@ install(TARGETS mysofa-static
endif()
endif()

-if(BUILD_SHARED_LIBS)
+if(NOT(BUILD_STATIC_LIBS))
add_library(mysofa-shared SHARED ${libsrc})
target_include_directories(mysofa-shared
PUBLIC
25 changes: 25 additions & 0 deletions packages/l/libmysofa/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package("libmysofa")
set_homepage("https://github.com/hoene/libmysofa")
set_description("Reader for AES SOFA files to get better HRTFs")
set_license("BSD-3-Clause")

add_urls("https://github.com/hoene/libmysofa/archive/refs/tags/$(version).tar.gz",
"https://github.com/hoene/libmysofa.git")

add_versions("v1.3.2", "6c5224562895977e87698a64cb7031361803d136057bba35ed4979b69ab4ba76")

add_patches("v1.3.2", "patches/v1.3.2/fix-build.patch", "beb93eaaea535ca69669f5f77dbf96e42ab35e66f25c6889ac1a53c56da30528")

add_deps("cmake", "zlib")

on_install(function (package)
os.rm("share/default.sofa")
os.cp("share/MIT_KEMAR_normal_pinna.sofa", "share/default.sofa")
local configs = {"-DBUILD_TESTS=OFF"}
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
luadebug marked this conversation as resolved.
Show resolved Hide resolved
import("package.tools.cmake").install(package, configs)
end)

on_test(function (package)
assert(package:has_cfuncs("mysofa_open", {includes = "mysofa.h"}))
end)
Loading