aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-03-24 15:00:47 -0700
committerRobert Schumacher <roschuma@microsoft.com>2018-03-24 15:00:47 -0700
commit21909157e28363480a02d2e30697e8c3d5f36e53 (patch)
tree6a8dd981daeda37aefd38e3d15690d8112bea9da
parente8d1666d9c88ff1ccce3b388ea09f500735f17b7 (diff)
downloadvcpkg-21909157e28363480a02d2e30697e8c3d5f36e53.tar.gz
vcpkg-21909157e28363480a02d2e30697e8c3d5f36e53.zip
[soundtouch] Use CMake
-rw-r--r--ports/soundtouch/CMakeLists.txt32
-rw-r--r--ports/soundtouch/CONTROL2
-rw-r--r--ports/soundtouch/portfile.cmake56
3 files changed, 44 insertions, 46 deletions
diff --git a/ports/soundtouch/CMakeLists.txt b/ports/soundtouch/CMakeLists.txt
new file mode 100644
index 000000000..a15daefe4
--- /dev/null
+++ b/ports/soundtouch/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.5)
+project(soundtouch CXX)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(ARCH_SUFFIX _x64)
+else()
+ set(ARCH_SUFFIX)
+endif()
+
+if(BUILD_SHARED_LIBS)
+ set(TYPE_SUFFIX Dll)
+else()
+ set(TYPE_SUFFIX $<$<Config:Debug>:D>)
+endif()
+
+file(GLOB SOUNDTOUCH_SOURCES source/SoundTouch/*.cpp)
+add_library(libsoundtouch ${SOUNDTOUCH_SOURCES})
+target_include_directories(libsoundtouch PUBLIC include)
+set_target_properties(libsoundtouch PROPERTIES OUTPUT_NAME SoundTouch${TYPE_SUFFIX}${ARCH_SUFFIX})
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(libsoundtouch PRIVATE -DDLL_EXPORTS)
+ target_sources(libsoundtouch PRIVATE
+ source/SoundTouchDLL/SoundTouchDLL.cpp
+ source/SoundTouchDLL/SoundTouchDLL.rc
+ )
+endif()
+
+install(TARGETS libsoundtouch
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
diff --git a/ports/soundtouch/CONTROL b/ports/soundtouch/CONTROL
index cc37ea89f..7ae158b88 100644
--- a/ports/soundtouch/CONTROL
+++ b/ports/soundtouch/CONTROL
@@ -1,4 +1,4 @@
Source: soundtouch
-Version: 2.0.0
+Version: 2.0.0-1
Description: SoundTouch is an open-source audio processing library for changing the Tempo, Pitch and Playback Rates of audio streams or audio files.
Build-Depends: atlmfc
diff --git a/ports/soundtouch/portfile.cmake b/ports/soundtouch/portfile.cmake
index cadf5e705..b7fb1fb45 100644
--- a/ports/soundtouch/portfile.cmake
+++ b/ports/soundtouch/portfile.cmake
@@ -1,11 +1,15 @@
include(vcpkg_common_functions)
# NOTE: SoundTouch has a static c++ version too, but entirely different headers, api, etc
-if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
message(STATUS "Warning: Static building not supported. Building dynamic.")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
+if(VCPKG_CRT_LINKAGE STREQUAL "static")
+ message(FATAL_ERROR "Refusing to build DLL with static CRT linkage.")
+endif()
+
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "WindowsStore not supported")
endif()
@@ -18,56 +22,18 @@ vcpkg_download_distfile(ARCHIVE
FILENAME "soundtouch-${VERSION}.zip"
SHA512 50ef36b6cd21c16e235b908c5518e29b159b11f658a014c47fe767d3d8acebaefefec0ce253b4ed322cbd26387c69c0ed464ddace0c098e61d56d55c198117a5
)
-
-# MSBuild performs in-source builds, so to ensure reliability we must clear them each time
-file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src)
-
vcpkg_extract_source_archive(${ARCHIVE})
-vcpkg_execute_required_process(
- COMMAND "devenv.exe"
- "SoundTouchDLL.sln"
- /Upgrade
- WORKING_DIRECTORY ${SOURCE_PATH}/source/SoundTouchDLL
- LOGNAME upgrade-Packet-${TARGET_TRIPLET}
-)
-
-IF (TRIPLET_SYSTEM_ARCH MATCHES "x64")
- # There is no x64 Debug target
- SET(BUILD_RELEASE_CONFIGURATION "ReleaseX64")
- SET(BUILD_DEBUG_CONFIGURATION "ReleaseX64")
-ELSE()
- SET(BUILD_RELEASE_CONFIGURATION "Release")
- SET(BUILD_DEBUG_CONFIGURATION "Debug")
-ENDIF()
-
-SET(BUILD_ARCH "Win32")
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
-vcpkg_build_msbuild(
- PROJECT_PATH ${SOURCE_PATH}/source/SoundTouchDLL/SoundTouchDLL.sln
- PLATFORM ${BUILD_ARCH}
- RELEASE_CONFIGURATION ${BUILD_RELEASE_CONFIGURATION}
- DEBUG_CONFIGURATION ${BUILD_DEBUG_CONFIGURATION}
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
)
-file(INSTALL ${SOURCE_PATH}/source/SoundTouchDLL/SoundTouchDLL.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
+vcpkg_install_cmake()
-# Handle libraries
-IF (BUILD_RELEASE_CONFIGURATION STREQUAL ReleaseX64)
- file(INSTALL ${SOURCE_PATH}/lib/SoundTouch_x64.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
- file(INSTALL ${SOURCE_PATH}/lib/SoundTouchDll_x64.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
-ELSE()
- file(INSTALL ${SOURCE_PATH}/lib/SoundTouch.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
- file(INSTALL ${SOURCE_PATH}/lib/SoundTouchDll.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
-ENDIF()
-
-IF (BUILD_DEBUG_CONFIGURATION STREQUAL ReleaseX64)
- file(INSTALL ${SOURCE_PATH}/lib/SoundTouch_x64.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
- file(INSTALL ${SOURCE_PATH}/lib/SoundTouchDll_x64.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
-ELSE()
- file(INSTALL ${SOURCE_PATH}/lib/SoundTouchD.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
- file(INSTALL ${SOURCE_PATH}/lib/SoundTouchDllD.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
-ENDIF()
+file(INSTALL ${SOURCE_PATH}/source/SoundTouchDLL/SoundTouchDLL.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
file(COPY ${SOURCE_PATH}/COPYING.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/soundtouch)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/soundtouch/COPYING.TXT ${CURRENT_PACKAGES_DIR}/share/soundtouch/copyright)