Skip to content

Commit

Permalink
revise
Browse files Browse the repository at this point in the history
  • Loading branch information
luadebug committed Dec 27, 2024
1 parent b9ff099 commit 84119fb
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 6 deletions.
106 changes: 106 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,106 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dcaa92a..ed966e6 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,15 +82,16 @@ set(libsrc
set(public-headers
hrtf/mysofa.h
)
+install(FILES "${public-headers}" DESTINATION include)

-if(BUILD_STATIC_LIBS)
+if(NOT(BUILD_SHARED_LIBS))
add_library(mysofa-static STATIC ${libsrc})
target_include_directories(mysofa-static
PUBLIC
"$<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
@@ -120,7 +123,7 @@ if(BUILD_SHARED_LIBS)
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/hrtf>"
$<INSTALL_INTERFACE:include/>
)
- target_link_libraries(mysofa-shared PRIVATE ${MATH} ${ZLIB_LIBRARIES})
+ target_link_libraries(mysofa-shared PRIVATE ${MATH} ZLIB::ZLIB)
set_target_properties(mysofa-shared
PROPERTIES OUTPUT_NAME mysofa CLEAN_DIRECT_OUTPUT 1)
# Rename the Windows import library (stub) of the DLL to prevent a name clash
@@ -171,7 +174,7 @@ endif()

if(BUILD_TESTS)
add_executable(mysofa2json tests/sofa2json.c tests/json.c)
- if(BUILD_STATIC_LIBS)
+ if(NOT(BUILD_SHARED_LIBS))
target_link_libraries(mysofa2json mysofa-static)
else()
target_link_libraries(mysofa2json mysofa-shared)
@@ -192,7 +195,7 @@ if(BUILD_TESTS)
tests/cache.c
tests/json.c
tests/user_defined_variable.c)
- if(BUILD_STATIC_LIBS)
+ if(NOT(BUILD_SHARED_LIBS))
target_link_libraries(external mysofa-static ${CUNIT_LIBRARIES})
else()
target_link_libraries(external mysofa-shared ${CUNIT_LIBRARIES} m)
@@ -210,7 +213,7 @@ if(BUILD_TESTS)
COMMAND internal)

add_executable(multithread tests/multithread.c)
- if(BUILD_STATIC_LIBS)
+ if(NOT(BUILD_SHARED_LIBS))
target_link_libraries(multithread mysofa-static pthread)
else()
target_link_libraries(multithread mysofa-shared pthread m)
10 changes: 4 additions & 6 deletions packages/l/libmysofa/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
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", "4080272c7b77d41f629bee1abf3b8bfc8ddc76b315761cca89971c0460990b76")

add_deps("cmake", "zlib")

on_install(function (package)
local configs = {"-DBUILD_TESTS=OFF"}
if package:config("shared") then
table.insert(configs, "-DBUILD_STATIC_LIBS=ON")
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
else
table.insert(configs, "-DBUILD_SHARED_LIBS=OFF")
end
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)

Expand Down

0 comments on commit 84119fb

Please sign in to comment.