Skip to content

Commit

Permalink
[wavpack] arm support (#21790)
Browse files Browse the repository at this point in the history
* [osx] set CMAKE_SYSTEM_PROCESSOR from VCPKG_TARGET_ARCHITECTURE on osx

* [linux] Set CMAKE_ASM_COMPILER and CMAKE_ASM-ATT_COMPILER in case of crosscompile

* [wavpack] migrate to vcpkg_cmake_install

* [wavpack] enable arm builds

* [wavpack] Add  license field to vcpkg.json

* [OSX] don't default to 86_64
  • Loading branch information
daschuer authored Apr 29, 2022
1 parent 9ccd693 commit 8ca9b2b
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 11 deletions.
9 changes: 4 additions & 5 deletions ports/wavpack/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ vcpkg_from_github(
fix-symbol-exports.patch
)

vcpkg_configure_cmake(
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
-DWAVPACK_INSTALL_DOCS=OFF
-DWAVPACK_BUILD_PROGRAMS=OFF
Expand All @@ -21,12 +20,12 @@ vcpkg_configure_cmake(
-DWAVPACK_BUILD_DOCS=OFF
)

vcpkg_install_cmake()
vcpkg_cmake_install()

if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
vcpkg_cmake_config_fixup(CONFIG_PATH cmake)
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/WavPack)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/WavPack)
endif()

vcpkg_copy_pdbs()
Expand Down
15 changes: 13 additions & 2 deletions ports/wavpack/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"name": "wavpack",
"version": "5.4.0",
"port-version": 1,
"port-version": 2,
"description": "WavPack encode/decode library, command-line programs, and several plugins",
"homepage": "https://github.com/dbry/WavPack",
"supports": "!(arm | arm64)"
"license": "BSD-3-Clause",
"supports": "!(windows & arm)",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
12 changes: 12 additions & 0 deletions scripts/toolchains/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
if(NOT DEFINED CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
endif()
if(NOT DEFINED CMAKE_ASM_COMPILER)
set(CMAKE_ASM_COMPILER "arm-linux-gnueabihf-gcc")
endif()
if(NOT DEFINED CMAKE_ASM-ATT_COMPILER)
set(CMAKE_ASM-ATT_COMPILER "arm-linux-gnueabihf-as")
endif()
message(STATUS "Cross compiling arm on host x86_64, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
Expand All @@ -30,6 +36,12 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
if(NOT DEFINED CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
endif()
if(NOT DEFINED CMAKE_ASM_COMPILER)
set(CMAKE_ASM_COMPILER "aarch64-linux-gnu-gcc")
endif()
if(NOT DEFINED CMAKE_ASM-ATT_COMPILER)
set(CMAKE_ASM-ATT_COMPILER "aarch64-linux-gnu-as")
endif()
message(STATUS "Cross compiling arm64 on host x86_64, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
endif()
Expand Down
15 changes: 12 additions & 3 deletions scripts/toolchains/osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@ if(NOT _VCPKG_OSX_TOOLCHAIN)
set(_VCPKG_OSX_TOOLCHAIN 1)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")

set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}" CACHE STRING "")
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE STRING "")
else()
set(CMAKE_SYSTEM_VERSION "17.0.0" CACHE STRING "")
set(CMAKE_SYSTEM_PROCESSOR "x86_64" CACHE STRING "")
endif()
set(CMAKE_SYSTEM_NAME Darwin CACHE STRING "")

set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")

if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR x86_64 CACHE STRING "")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(CMAKE_SYSTEM_PROCESSOR x86 CACHE STRING "")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR arm64 CACHE STRING "")
else()
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE STRING "")
endif()
endif()

get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
if(NOT _CMAKE_IN_TRY_COMPILE)
string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7438,7 +7438,7 @@
},
"wavpack": {
"baseline": "5.4.0",
"port-version": 1
"port-version": 2
},
"websocketpp": {
"baseline": "0.8.2",
Expand Down
5 changes: 5 additions & 0 deletions versions/w-/wavpack.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "39c514f313b4bc2fc7af0f3a889425bb78aca9e3",
"version": "5.4.0",
"port-version": 2
},
{
"git-tree": "77b8c9ab85776abb2d049d562db7350525ddf7e2",
"version": "5.4.0",
Expand Down

0 comments on commit 8ca9b2b

Please sign in to comment.