Leave crt linkage and build type in vcpkges hands and add some verbosity to build options

This commit is contained in:
bagong 2017-06-06 11:02:33 +02:00
parent 93ebc6c746
commit 485f7cf426
2 changed files with 71 additions and 2 deletions

View File

@ -0,0 +1,61 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,32 +10,32 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# project. If this is part of a larger project (i.e. the CMakeLists.txt has
# been imported by some other CMakeLists.txt), we don't want to trump over
# the top of that project's global settings.
-IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
- IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
- MESSAGE(STATUS "Setting CMAKE_BUILD_TYPE type to 'Debug' as none was specified.")
- SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
- SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
- ENDIF()
-
- PROJECT(portaudio)
-
- SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
-
- IF(WIN32 AND MSVC)
- OPTION(PA_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON)
- IF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
- FOREACH(flag_var
- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
- CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
- CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
- IF(${flag_var} MATCHES "/MD")
- STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
- ENDIF()
- ENDFOREACH()
- ENDIF()
- ENDIF()
-ENDIF()
+# IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
+ # IF(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ # MESSAGE(STATUS "Setting CMAKE_BUILD_TYPE type to 'Debug' as none was specified.")
+ # SET(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
+ # SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
+ # ENDIF()
+
+ # PROJECT(portaudio)
+
+ # SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
+
+ # IF(WIN32 AND MSVC)
+ # OPTION(PA_DLL_LINK_WITH_STATIC_RUNTIME "Link with static runtime libraries (minimizes runtime dependencies)" ON)
+ # IF(PA_DLL_LINK_WITH_STATIC_RUNTIME)
+ # FOREACH(flag_var
+ # CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+ # CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
+ # CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+ # CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ # IF(${flag_var} MATCHES "/MD")
+ # STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+ # ENDIF()
+ # ENDFOREACH()
+ # ENDIF()
+ # ENDIF()
+# ENDIF()
SET(PA_PKGCONFIG_VERSION 19)

View File

@ -19,18 +19,26 @@ vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/cmakelists-install.patch
${CMAKE_CURRENT_LIST_DIR}/find_dsound.patch)
${CMAKE_CURRENT_LIST_DIR}/find_dsound.patch
${CMAKE_CURRENT_LIST_DIR}/crt_linkage_build_config.patch)
# NOTE: the ASIO backend will be built automatically if the ASIO-SDK is provided
# in a sibling folder of the portaudio source in vcpkg/buildtrees/portaudio/src
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DPA_USE_DS=ON
-DPA_USE_WASAPI=ON
-DPA_USE_WDMKS=ON
-DPA_USE_WMME=ON
)
vcpkg_install_cmake()
# Remove static builds from dynamic builds and otherwise
# Remove x86 and x64 from resulting files
if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file (REMOVE ${CURRENT_PACKAGES_DIR}/lib/portaudio_static_${VCPKG_TARGET_ARCHITECTURE}.lib)
file (REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/portaudio_static_${VCPKG_TARGET_ARCHITECTURE}.lib)