diff --git a/CHANGELOG.md b/CHANGELOG.md index 103417bad..3380cd074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +vcpkg (0.0.70) +-------------- + * Add ports: + - fltk 1.3.4-1 + - glib 2.50.2 + - lzo 2.09 + - uvatlas sept2016 + * Update ports: + - dx 1.0.0 -> 1.0.1 + - libmysql 5.7.16 -> 5.7.17 + * Add support for Visual Studio 2017 + - Previously, you could use Visual Studio 2017 for your own application and `vcpkg` integration would work, but you needed to have Visual Studio 2015 to build `vcpkg` itself as well as the libraries. This requirement has now been removed + - If both Visual Studio 2015 and Visual Studio 2017 are installed, Visual Studio 2017 tools will be preferred over those of Visual Studio 2015 + * Bump required version & auto-downloaded version of `cmake` to 3.7.2 (was 3.5.x), which includes generators for Visual Studio 2017 + * Bump auto-downloaded version of `nuget` to 3.5.0 (was 3.4.3) + * Bump auto-downloaded version of `git` to 2.11.0 (was 2.8.3) + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team MON, 23 Jan 2017 19:50:00 -0800 + + vcpkg (0.0.67) -------------- * Add ports: diff --git a/ports/libmysql/0001_cmake.patch b/ports/libmysql/0001_cmake.patch deleted file mode 100644 index 9defe7fc1..000000000 --- a/ports/libmysql/0001_cmake.patch +++ /dev/null @@ -1,378 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 44842d3..e89eed9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -118,7 +118,7 @@ IF(DEFINED MYSQL_PROJECT_NAME) - SET(MYSQL_PROJECT_NAME ${MYSQL_PROJECT_NAME} CACHE STRING - ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE) - ELSE() -- SET(MYSQL_PROJECT_NAME "MySQL" CACHE STRING -+ SET(MYSQL_PROJECT_NAME "LibMySQL" CACHE STRING - ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE) - MARK_AS_ADVANCED(MYSQL_PROJECT_NAME) - ENDIF() -@@ -132,6 +132,9 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug" OR WITH_DEBUG) - ENDIF() - ENDIF() - -+OPTION(FORCE_UNSUPPORTED_COMPILER "Disable compiler version checks" ON) -+MARK_AS_ADVANCED(FORCE_UNSUPPORTED_COMPILER) -+ - OPTION(WITH_DEFAULT_COMPILER_OPTIONS - "Use flags from cmake/build_configurations/compiler_options.cmake" - ON) -@@ -193,46 +196,30 @@ ENDIF() - INCLUDE(character_sets) - INCLUDE(cpu_info) - INCLUDE(zlib) --INCLUDE(lz4) --INCLUDE(libevent) - INCLUDE(ssl) --INCLUDE(readline) --INCLUDE(protobuf) - INCLUDE(mysql_version) - INCLUDE(libutils) - INCLUDE(dtrace) --INCLUDE(plugin) - INCLUDE(install_macros) - INCLUDE(install_layout) - INCLUDE(mysql_add_executable) - - # Handle options --IF(EXISTS ${CMAKE_SOURCE_DIR}/rapid) -- OPTION(WITH_RAPID -- "Build additonal code(plugins) that is located in rapid directory" ON) --ELSE() -- OPTION(WITH_RAPID -- "Build additonal code(plugins) that is located in rapid directory" OFF) --ENDIF() - OPTION(DISABLE_SHARED - "Don't build shared libraries, compile code as position-dependent" OFF) -+MARK_AS_ADVANCED(DISABLE_SHARED) - IF(DISABLE_SHARED) - SET(WITHOUT_DYNAMIC_PLUGINS 1) - ENDIF() - OPTION(ENABLED_PROFILING "Enable profiling" ON) --OPTION(WITHOUT_SERVER OFF) -+SET(WITHOUT_SERVER ON) - IF(UNIX) - OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF) - ENDIF() - IF(WIN32) - OPTION(WITH_MSCRT_DEBUG "MS Visual Studio Debug CRT instrumentation" OFF) - ENDIF() --IF(NOT WITHOUT_SERVER) -- OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) --ENDIF() --OPTION(FORCE_UNSUPPORTED_COMPILER "Disable compiler version checks" OFF) --MARK_AS_ADVANCED(WITHOUT_SERVER DISABLE_SHARED FORCE_UNSUPPORTED_COMPILER) -- -+OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" OFF) - - include(CheckCSourceCompiles) - include(CheckCXXSourceCompiles) -@@ -452,18 +439,8 @@ ELSE() - SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") - ENDIF() - --INCLUDE(cmake/boost.cmake) -- --IF (CMAKE_SYSTEM_NAME MATCHES "Linux") -- OPTION(WITH_SYSTEMD "Enable installation of systemd support files" OFF) -- IF (WITH_SYSTEMD) -- INCLUDE(cmake/systemd.cmake) -- ENDIF() --ELSE() -- IF (WITH_SYSTEMD) -- MESSAGE(FATAL_ERROR "Installation of systemd support files not supported") -- ENDIF() --ENDIF() -+# Boost is not needed to build libmysql (yet) -+#INCLUDE(cmake/boost.cmake) - - # Run platform tests - INCLUDE(configure.cmake) -@@ -479,76 +456,6 @@ INCLUDE_DIRECTORIES( - MYSQL_CHECK_ZLIB_WITH_COMPRESS() - # Add bundled yassl/taocrypt or system openssl. - MYSQL_CHECK_SSL() --# Add system/bundled editline. --MYSQL_CHECK_EDITLINE() --# Add libevent --MYSQL_CHECK_LIBEVENT() --# Add lz4 library --MYSQL_CHECK_LZ4() --# Add protoc and libprotobuf --IF(NOT WITHOUT_SERVER) -- MYSQL_CHECK_PROTOBUF() --ENDIF() -- --# Check for SYS_thread_selfid system call --CHECK_C_SOURCE_COMPILES(" --#include --#include --#include --int main(int ac, char **av) --{ -- unsigned long long tid = syscall(SYS_thread_selfid); -- return (tid != 0 ? 0 : 1); --}" --HAVE_SYS_THREAD_SELFID) -- --# Check for gettid() system call --CHECK_C_SOURCE_COMPILES(" --#include --#include --#include --int main(int ac, char **av) --{ -- unsigned long long tid = syscall(SYS_gettid); -- return (tid != 0 ? 0 : 1); --}" --HAVE_SYS_GETTID) -- --IF(CMAKE_SYSTEM_NAME MATCHES "Linux") -- # Check for pthread_setname_np -- CHECK_C_SOURCE_COMPILES(" -- #include -- int main(int ac, char **av) -- { -- const char *thread_name= 0; -- int ret = pthread_setname_np(pthread_self(), thread_name); -- return ret; -- }" -- HAVE_PTHREAD_SETNAME_NP) --ENDIF() -- --# Check for pthread_getthreadid_np() --CHECK_C_SOURCE_COMPILES(" --#include --int main(int ac, char **av) --{ -- unsigned long long tid = pthread_getthreadid_np(); -- return (tid != 0 ? 0 : 1); --}" --HAVE_PTHREAD_GETTHREADID_NP) -- --# Check for pthread_self() returning an integer type --CHECK_C_SOURCE_COMPILES(" --#include --#include --int main(int ac, char **av) --{ -- unsigned long long tid = pthread_self(); -- return (tid != 0 ? 0 : 1); --}" --HAVE_INTEGER_PTHREAD_SELF --FAIL_REGEX "warning: incompatible pointer to integer conversion" --) - - # - # Setup maintainer mode options by the end. Platform checks are -@@ -563,18 +470,15 @@ OPTION(MYSQL_MAINTAINER_MODE - - INCLUDE(maintainer) - --IF(WITH_UNIT_TESTS) -+IF(0) #WITH_UNIT_TESTS) - ENABLE_TESTING() - ENDIF() - --IF(NOT WITHOUT_SERVER) -+IF(0) #NOT WITHOUT_SERVER) - SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") - SET (MYSQLD_STATIC_EMBEDDED_PLUGIN_LIBS "" CACHE INTERNAL "") - # Add storage engines and plugins. - CONFIGURE_PLUGINS() --ELSE() -- # We may still want Cluster client libraries, use -DWITH_NDBCLUSTER=1 -- ADD_SUBDIRECTORY(storage/ndb) - ENDIF() - - ADD_SUBDIRECTORY(include) -@@ -588,61 +492,18 @@ ADD_SUBDIRECTORY(libmysql) - ADD_SUBDIRECTORY(libbinlogevents) - ADD_SUBDIRECTORY(libbinlogstandalone) - --IF(WITH_UNIT_TESTS) -- # Visual Studio 11 needs this extra flag in order to compile gmock. -- IF(WIN32) -- ADD_DEFINITIONS( /D _VARIADIC_MAX=10 ) -- ENDIF() -- # libc++ doesn't have tuple in tr1 -- IF(HAVE_LLVM_LIBCPP) -- ADD_DEFINITIONS(-DGTEST_USE_OWN_TR1_TUPLE=1) -- ENDIF() - -- ADD_SUBDIRECTORY(unittest) -- ADD_SUBDIRECTORY(unittest/examples) -- ADD_SUBDIRECTORY(unittest/mytap) -- ADD_SUBDIRECTORY(unittest/mytap/t) -- IF(WITH_RAPID AND EXISTS ${CMAKE_SOURCE_DIR}/rapid/unittest/gunit) -- ADD_SUBDIRECTORY(rapid/unittest/gunit) -- ENDIF() --ENDIF() - -+SET(WITH_INNOBASE_STORAGE_ENGINE 0) - ADD_SUBDIRECTORY(extra) --ADD_SUBDIRECTORY(client) - ADD_SUBDIRECTORY(sql/share) --ADD_SUBDIRECTORY(libservices) -- --IF(UNIX) -- ADD_SUBDIRECTORY(man) --ENDIF() -- --IF(NOT WITHOUT_SERVER) -- ADD_SUBDIRECTORY(testclients) -- ADD_SUBDIRECTORY(sql) -- OPTION (WITH_EMBEDDED_SERVER "Compile MySQL with embedded server" OFF) -- IF(WITH_EMBEDDED_SERVER) -- ADD_SUBDIRECTORY(libmysqld) -- ADD_SUBDIRECTORY(libmysqld/examples) -- ENDIF(WITH_EMBEDDED_SERVER) --ENDIF() -- --# scripts/mysql_config depends on client and server targets loaded above. --# It is referenced by some of the directories below, so we insert it here. - ADD_SUBDIRECTORY(scripts) -+ADD_SUBDIRECTORY(support-files) - --IF(NOT WITHOUT_SERVER) -- ADD_SUBDIRECTORY(mysql-test) -- ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess) -- ADD_SUBDIRECTORY(support-files) -- IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt) -- ADD_SUBDIRECTORY(internal) -- ENDIF() -- ADD_SUBDIRECTORY(packaging/rpm-oel) -- ADD_SUBDIRECTORY(packaging/rpm-fedora) -- ADD_SUBDIRECTORY(packaging/rpm-sles) -- ADD_SUBDIRECTORY(packaging/rpm-docker) -- ADD_SUBDIRECTORY(packaging/deb-in) --ENDIF() -+# -+# Directory where error message database is generated (GenError target) -+# -+FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/sql/share) - - INCLUDE(cmake/abi_check.cmake) - INCLUDE(cmake/tags.cmake) -@@ -680,11 +541,7 @@ ELSE() - SET(CPACK_GENERATOR "TGZ") - ENDIF() - ADD_SUBDIRECTORY(packaging/WiX) --ADD_SUBDIRECTORY(packaging/solaris) - --IF(UNIX) -- INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info) --ENDIF() - # - # RPM installs documentation directly from the source tree - # -diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt -index 3adf988..9e0ba30 100644 ---- a/extra/CMakeLists.txt -+++ b/extra/CMakeLists.txt -@@ -70,87 +70,4 @@ ADD_DEFINITIONS(-DMUTEX_EVENT) - COPY_OPENSSL_DLLS(copy_openssl_extra) - IF (WIN32 AND WITH_SSL_PATH AND HAVE_CRYPTO_DLL) - ADD_DEPENDENCIES(GenError copy_openssl_extra) --ENDIF() -- -- --MYSQL_ADD_EXECUTABLE(my_print_defaults my_print_defaults.c) --TARGET_LINK_LIBRARIES(my_print_defaults mysys mysys_ssl) --SET_TARGET_PROPERTIES(my_print_defaults PROPERTIES LINKER_LANGUAGE CXX) -- --MYSQL_ADD_EXECUTABLE(perror perror.c) --ADD_DEPENDENCIES(perror GenError) --TARGET_LINK_LIBRARIES(perror mysys mysys_ssl) --SET_TARGET_PROPERTIES(perror PROPERTIES LINKER_LANGUAGE CXX) -- --MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) --TARGET_LINK_LIBRARIES(resolveip mysys mysys_ssl) --SET_TARGET_PROPERTIES(resolveip PROPERTIES LINKER_LANGUAGE CXX) --IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") -- INCLUDE(CheckFunctionExists) -- INCLUDE(CheckLibraryExists) -- MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL) -- TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL}) --ENDIF() -- -- --MYSQL_ADD_EXECUTABLE(replace replace.c) --TARGET_LINK_LIBRARIES(replace mysys) -- --MYSQL_ADD_EXECUTABLE(lz4_decompress lz4_decompress.cc) --TARGET_LINK_LIBRARIES(lz4_decompress ${LZ4_LIBRARY}) -- --MYSQL_ADD_EXECUTABLE(zlib_decompress zlib_decompress.cc) --TARGET_LINK_LIBRARIES(zlib_decompress ${ZLIB_LIBRARY}) -- --IF(WITH_INNOBASE_STORAGE_ENGINE) -- -- IF(LZ4_INCLUDE_DIR AND LZ4_LIBRARY) -- ADD_DEFINITIONS(-DHAVE_LZ4=1) -- INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR}) -- ENDIF() -- -- # Add path to the InnoDB headers -- INCLUDE_DIRECTORIES( -- ${CMAKE_SOURCE_DIR}/storage/innobase/include -- ${CMAKE_SOURCE_DIR}/sql -- ) -- # We use the InnoDB code directly in case the code changes. -- ADD_DEFINITIONS("-DUNIV_INNOCHECKSUM") -- SET(INNOBASE_SOURCES -- ../storage/innobase/buf/buf0checksum.cc -- ../storage/innobase/ut/ut0crc32.cc -- ../storage/innobase/ut/ut0ut.cc -- ../storage/innobase/buf/buf0buf.cc -- ../storage/innobase/page/page0zip.cc -- ../storage/innobase/os/os0file.cc -- ) -- -- # Avoid generating Hardware Capabilities due to crc32 instructions -- IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND -- CMAKE_SYSTEM_PROCESSOR MATCHES "i386") -- INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) -- MY_CHECK_CXX_COMPILER_FLAG("-Wa,-nH" HAVE_WA_NH) -- IF(HAVE_WA_NH) -- ADD_COMPILE_FLAGS( -- ../storage/innobase/ut/ut0crc32.cc -- COMPILE_FLAGS "-Wa,-nH" -- ) -- ENDIF() -- ENDIF() -- -- MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.cc ${INNOBASE_SOURCES}) -- TARGET_LINK_LIBRARIES(innochecksum mysys mysys_ssl ${LZ4_LIBRARY}) -- ADD_DEPENDENCIES(innochecksum GenError) --ENDIF() -- --IF(UNIX) -- MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.cc) -- TARGET_LINK_LIBRARIES(resolve_stack_dump mysys mysys_ssl) --ENDIF() -- --# In published release builds on Solaris, we need to bundle gcc source. --# PB2 will take care of putting it in extra/ when needed --IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/gcc-4.8.1.tar.bz2) -- INSTALL(FILES gcc-4.8.1.tar.bz2 -- DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Development) --ENDIF() -+ENDIF() -\ No newline at end of file -diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h -index 8b7a554..4353037 100644 ---- a/mysys/mysys_priv.h -+++ b/mysys/mysys_priv.h -@@ -18,6 +18,7 @@ - - #include "my_global.h" - #include "mysql/psi/mysql_thread.h" -+#include "my_sys.h" - - #ifdef HAVE_PSI_INTERFACE - diff --git a/ports/libmysql/CONTROL b/ports/libmysql/CONTROL index 504f14bbb..4e5564972 100644 --- a/ports/libmysql/CONTROL +++ b/ports/libmysql/CONTROL @@ -1,3 +1,3 @@ -Source: libmysql -Version: 5.7.16 +Source: libmysql +Version: 5.7.17 Description: A MySQL client library for C development. \ No newline at end of file diff --git a/ports/libmysql/boost_and_build.patch b/ports/libmysql/boost_and_build.patch new file mode 100644 index 000000000..7fce8ffc5 --- /dev/null +++ b/ports/libmysql/boost_and_build.patch @@ -0,0 +1,44 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 44842d3..e34ab24 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -452,7 +452,7 @@ ELSE() + SET(DEFAULT_TMPDIR "\"${TMPDIR}\"") + ENDIF() + +-INCLUDE(cmake/boost.cmake) ++#INCLUDE(cmake/boost.cmake) + + IF (CMAKE_SYSTEM_NAME MATCHES "Linux") + OPTION(WITH_SYSTEMD "Enable installation of systemd support files" OFF) +diff --git a/client/dump/CMakeLists.txt b/client/dump/CMakeLists.txt +index bae2ce7..4e11516 100644 +--- a/client/dump/CMakeLists.txt ++++ b/client/dump/CMakeLists.txt +@@ -21,12 +21,12 @@ INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/dump + ) + +-IF (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") ++#IF (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") + IF (WITHOUT_SERVER) + MESSAGE(STATUS "Not building mysqlpump") + RETURN() + ENDIF() +-ENDIF() ++#ENDIF() + + # Prevent Boost from including external precompiled Boost libraries, use + # threading (not implemented for older Solaris Studio compilers) +diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h +index 8b7a554..4353037 100644 +--- a/mysys/mysys_priv.h ++++ b/mysys/mysys_priv.h +@@ -18,6 +18,7 @@ + + #include "my_global.h" + #include "mysql/psi/mysql_thread.h" ++#include "my_sys.h" + + #ifdef HAVE_PSI_INTERFACE + diff --git a/ports/libmysql/portfile.cmake b/ports/libmysql/portfile.cmake index 48412ccc7..592482544 100644 --- a/ports/libmysql/portfile.cmake +++ b/ports/libmysql/portfile.cmake @@ -1,70 +1,82 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mysql-server-mysql-5.7.16) - -if (EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql.h") - message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.") -endif() - -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/mysql/mysql-server/archive/mysql-5.7.16.tar.gz" - FILENAME "mysql-server-mysql-5.7.16.tar.gz" - SHA512 30a3c55ebb15f18ededf814b66c108f18b2ced9c39e08319cdc9559ccf38d494ad9322098f2b04418ddf557e46d9d727be0e514be0ae982ac4f5186aa295b9c6 -) -vcpkg_extract_source_archive(${ARCHIVE}) - -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch -) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} -) - -vcpkg_install_cmake() - -# delete debug headers -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/debug/include) - -# delete useless vcruntime/scripts/bin/msg file -file(REMOVE_RECURSE - ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/debug/share - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin - ${CURRENT_PACKAGES_DIR}/lib/debug) - -file(MAKE_DIRECTORY - ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin) - -# remove misc files -file(REMOVE - ${CURRENT_PACKAGES_DIR}/COPYING - ${CURRENT_PACKAGES_DIR}/my-default.ini - ${CURRENT_PACKAGES_DIR}/README - ${CURRENT_PACKAGES_DIR}/debug/COPYING - ${CURRENT_PACKAGES_DIR}/debug/my-default.ini - ${CURRENT_PACKAGES_DIR}/debug/README) - -# remove mysqlclient.lib -file(REMOVE - ${CURRENT_PACKAGES_DIR}/lib/mysqlclient.lib - ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlclient.lib) - -# correct the dll directory -file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/bin/libmysql.dll) -file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.dll) -file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/bin/libmysql.pdb) -file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.pdb) - -# copy license -file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmysql) +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mysql-server-mysql-5.7.17) + +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/mysql/mysql-server/archive/mysql-5.7.17.tar.gz" + FILENAME "mysql-server-mysql-5.7.17.tar.gz" + SHA512 511027f28f0705f59a08ec369b1ebe5d9a77eb839d545898631f1ebbcb6b4b800f5b88511d3ae5d231c04e09a2d7b2b2d178264d36aeb2bc602cc1b0b248cfba +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/boost_and_build.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DWITHOUT_SERVER=ON + -DWITH_UNIT_TESTS=OFF + -DENABLED_PROFILING=OFF +) + +vcpkg_install_cmake() + +# delete debug headers +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/debug/include) + +# switch mysql into /mysql +file(RENAME ${CURRENT_PACKAGES_DIR}/include ${CURRENT_PACKAGES_DIR}/include2) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/include) +file(RENAME ${CURRENT_PACKAGES_DIR}/include2 ${CURRENT_PACKAGES_DIR}/include/mysql) + +## delete useless vcruntime/scripts/bin/msg file +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/share + ${CURRENT_PACKAGES_DIR}/debug/share + ${CURRENT_PACKAGES_DIR}/bin + ${CURRENT_PACKAGES_DIR}/debug/bin + ${CURRENT_PACKAGES_DIR}/docs + ${CURRENT_PACKAGES_DIR}/debug/docs + ${CURRENT_PACKAGES_DIR}/lib/debug) + +# remove misc files +file(REMOVE + ${CURRENT_PACKAGES_DIR}/COPYING + ${CURRENT_PACKAGES_DIR}/README + ${CURRENT_PACKAGES_DIR}/debug/COPYING + ${CURRENT_PACKAGES_DIR}/debug/README) + +# remove not-related libs +file (REMOVE + ${CURRENT_PACKAGES_DIR}/lib/mysqlservices.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlservices.lib) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(REMOVE + ${CURRENT_PACKAGES_DIR}/lib/libmysql.lib + ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll + ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb + ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll + ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb) +else() + file(REMOVE + ${CURRENT_PACKAGES_DIR}/lib/mysqlclient.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/mysqlclient.lib) + + # correct the dll directory + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) + file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/bin/libmysql.dll) + file (RENAME ${CURRENT_PACKAGES_DIR}/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/bin/libmysql.pdb) + file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.dll ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.dll) + file (RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libmysql.pdb ${CURRENT_PACKAGES_DIR}/debug/bin/libmysql.pdb) +endif() + +# copy license +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmysql) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libmysql/COPYING ${CURRENT_PACKAGES_DIR}/share/libmysql/copyright) \ No newline at end of file diff --git a/ports/lzo/CONTROL b/ports/lzo/CONTROL new file mode 100644 index 000000000..afc3540d2 --- /dev/null +++ b/ports/lzo/CONTROL @@ -0,0 +1,3 @@ +Source: lzo +Version: 2.09 +Description: Lossless data compression library diff --git a/ports/lzo/do-not-declare-setargv.patch b/ports/lzo/do-not-declare-setargv.patch new file mode 100644 index 000000000..48ae31514 --- /dev/null +++ b/ports/lzo/do-not-declare-setargv.patch @@ -0,0 +1,17 @@ +diff --git a/src/lzo_supp.h b/src/lzo_supp.h +index 87307f9..f94a6b0 100644 +--- a/src/lzo_supp.h ++++ b/src/lzo_supp.h +@@ -3643,9 +3643,9 @@ LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } + #endif + #if (LZO_OS_WIN32 || LZO_OS_WIN64) + #if (LZO_CC_INTELC || LZO_CC_MSC) +-LZO_EXTERN_C int __lzo_cdecl __setargv(void); +-LZO_EXTERN_C int __lzo_cdecl _setargv(void); +-LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } ++// LZO_EXTERN_C int __lzo_cdecl __setargv(void); ++// LZO_EXTERN_C int __lzo_cdecl _setargv(void); ++// LZO_EXTERN_C int __lzo_cdecl _setargv(void) { return __setargv(); } + #endif + #endif + #if (LZO_OS_EMX) diff --git a/ports/lzo/portfile.cmake b/ports/lzo/portfile.cmake new file mode 100644 index 000000000..6df36269c --- /dev/null +++ b/ports/lzo/portfile.cmake @@ -0,0 +1,44 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lzo-2.09) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz" + FILENAME "lzo-2.09.tar.gz" + SHA512 7c64e5e7d2050d75ac8c59d613f6f7230b74746b1d207666755b07450053c8b73980f12f8a1ec59d2af0bada02beec126aaacb675b8088b5fe65e97ff7e6bfc7 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/do-not-declare-setargv.patch" +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +# Handle copyright +file(COPY ${CURRENT_BUILDTREES_DIR}/src/lzo-2.09/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/lzo) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/lzo/COPYING ${CURRENT_PACKAGES_DIR}/share/lzo/copyright) diff --git a/ports/mpir/CONTROL b/ports/mpir/CONTROL index 6d8646f93..0a1f1601b 100644 --- a/ports/mpir/CONTROL +++ b/ports/mpir/CONTROL @@ -1,3 +1,3 @@ -Source: mpir -Version: 2.7.2 +Source: mpir +Version: 2.7.2-1 Description: Multiple Precision Integers and Rationals. \ No newline at end of file diff --git a/ports/mpir/portfile.cmake b/ports/mpir/portfile.cmake index a3a704407..a57c53328 100644 --- a/ports/mpir/portfile.cmake +++ b/ports/mpir/portfile.cmake @@ -1,53 +1,73 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2) -vcpkg_download_distfile(ARCHIVE_FILE - URLS "http://mpir.org/mpir-2.7.2.tar.lz" - FILENAME "mpir-2.7.2.tar.lz" - SHA512 2635c167ddbba99364ec741373768e0675d34f94fad8912d5433b95e6fbfdb0510f5e94a707acc42048254bc658c52c6671bb0c0dac31267c4b82b00c3e74efa -) -vcpkg_extract_source_archive(${ARCHIVE_FILE}) - -vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj -) - -IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") - SET(BUILD_ARCH "Win32") -ELSE() - SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) -ENDIF() - -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/gmp.h - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/gmpxx.h - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.h - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpirxx.h - DESTINATION ${CURRENT_PACKAGES_DIR}/include -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.dll - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.dll - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/bin -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib -) -file(INSTALL - ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib -) - -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright) - -vcpkg_copy_pdbs() -message(STATUS "Installing done") +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpir-2.7.2) +vcpkg_download_distfile(ARCHIVE_FILE + URLS "http://mpir.org/mpir-2.7.2.tar.bz2" + FILENAME "mpir-2.7.2.tar.bz2" + SHA512 8436a0123201f9e30130ea340331c5a6445dddb58ce1f6c6a3a8303c310ac5b3c279c83b5c520a757cba82c2b14e92da44583e0eec287090cf69cbb29d516a9c +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_build_msbuild( + PROJECT_PATH ${SOURCE_PATH}/build.vc14/dll_mpir_gc/dll_mpir_gc.vcxproj + ) +else() + vcpkg_build_msbuild( + PROJECT_PATH ${SOURCE_PATH}/build.vc14/lib_mpir_gc/lib_mpir_gc.vcxproj + ) +endif() + +IF (TRIPLET_SYSTEM_ARCH MATCHES "x86") + SET(BUILD_ARCH "Win32") +ELSE() + SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) +ENDIF() + +if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + file(INSTALL + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/gmp.h + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/gmpxx.h + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.h + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpirxx.h + DESTINATION ${CURRENT_PACKAGES_DIR}/include + ) + file(INSTALL + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.dll + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin + ) + file(INSTALL + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.dll + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/bin + ) + file(INSTALL + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib + ) + file(INSTALL + ${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/lib + ) + file(INSTALL ${SOURCE_PATH}/COPYING.lib DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright) + vcpkg_copy_pdbs() +else() + file(INSTALL + ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/gmp.h + ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/gmpxx.h + ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/mpir.h + ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/mpirxx.h + DESTINATION ${CURRENT_PACKAGES_DIR}/include + ) + file(INSTALL + ${SOURCE_PATH}/lib/${BUILD_ARCH}/Debug/mpir.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib + ) + file(INSTALL + ${SOURCE_PATH}/lib/${BUILD_ARCH}/Release/mpir.lib + DESTINATION ${CURRENT_PACKAGES_DIR}/lib + ) + file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright) +endif() + +message(STATUS "Installing done") diff --git a/ports/wt/CONTROL b/ports/wt/CONTROL index fc71d9aaf..1a89dd378 100644 --- a/ports/wt/CONTROL +++ b/ports/wt/CONTROL @@ -1,4 +1,4 @@ Source: wt -Version: 3.3.6 +Version: 3.3.6-2 Description: Wt is a C++ library for developing web applications Build-Depends: boost, openssl diff --git a/ports/wt/add-disable-boost-autolink-option.patch b/ports/wt/add-disable-boost-autolink-option.patch new file mode 100644 index 000000000..57cb3ed99 --- /dev/null +++ b/ports/wt/add-disable-boost-autolink-option.patch @@ -0,0 +1,26 @@ +diff --git a/cmake/WtFindBoost-cmake.txt b/cmake/WtFindBoost-cmake.txt +index b66741f..377cede 100644 +--- a/cmake/WtFindBoost-cmake.txt ++++ b/cmake/WtFindBoost-cmake.txt +@@ -99,7 +99,7 @@ IF (Boost_FOUND) + SET(BOOST_WTHTTP_MT_FOUND TRUE) + SET(BOOST_WTHTTP_FOUND TRUE) + +- IF(MSVC) ++ IF(MSVC AND NOT DISABLE_BOOST_AUTOLINK) + # use autolink + SET(BOOST_WT_LIBRARIES "") + SET(BOOST_WTHTTP_LIBRARIES "") +diff --git a/src/wt/Dbo/CMakeLists.txt b/src/wt/Dbo/CMakeLists.txt +index 64d3af2..f9c31e0 100644 +--- a/src/wt/Dbo/CMakeLists.txt ++++ b/src/wt/Dbo/CMakeLists.txt +@@ -31,7 +31,7 @@ IF(ENABLE_LIBWTDBO) + StringStream.C + ) + +- IF(MSVC) ++ IF(MSVC AND NOT DISABLE_BOOST_AUTOLINK) + #win32 links automatically against boost libs; specifying too much causes + #trouble + IF(MULTI_THREADED_BUILD) diff --git a/ports/wt/portfile.cmake b/ports/wt/portfile.cmake index 66b1d5a33..f762eface 100644 --- a/ports/wt/portfile.cmake +++ b/ports/wt/portfile.cmake @@ -8,9 +8,13 @@ vcpkg_download_distfile(ARCHIVE_FILE ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) -file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-disable-boost-autolink-option.patch +) + vcpkg_configure_cmake( -SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DSHARED_LIBS=ON -DENABLE_SSL=ON @@ -20,6 +24,8 @@ SOURCE_PATH ${SOURCE_PATH} -DENABLE_MYSQL=OFF -DENABLE_QT4=OFF -DBOOST_DYNAMIC=ON + -DDISABLE_BOOST_AUTOLINK=ON + -DENABLE_LIBWTTEST=OFF ) vcpkg_install_cmake() diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index bcb570b39..a37ed99aa 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -23,7 +23,10 @@ if (!(Test-Path $vcpkgSourcesPath)) try{ pushd $vcpkgSourcesPath - cmd /c "$env:VS140COMNTOOLS..\..\VC\vcvarsall.bat" x86 "&" msbuild "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /m + $msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1 + $msbuildExe = $msbuildExeWithPlatformToolset[0] + $platformToolset = $msbuildExeWithPlatformToolset[1] + & $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /m Write-Verbose("Placing vcpkg.exe in the correct location") diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1 index 46981fad5..55680c1f6 100644 --- a/scripts/buildsystems/msbuild/applocal.ps1 +++ b/scripts/buildsystems/msbuild/applocal.ps1 @@ -2,7 +2,14 @@ param([string]$targetBinary, [string]$installedDir, [string]$tlogFile) function resolve($targetBinary) { - $targetBinaryPath = Resolve-Path $targetBinary + try + { + $targetBinaryPath = Resolve-Path $targetBinary -erroraction stop + } + catch [System.Management.Automation.ItemNotFoundException] + { + return + } $targetBinaryDir = Split-Path $targetBinaryPath -parent $a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" }) diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index 912cf6b8e..26a524ca3 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -57,12 +57,14 @@ Lines="^$(OutputPath)$(TargetName).$(OutputType);" Encoding="Unicode"/> + ConsoleToMSBuild="true" + StandardOutputImportance="Normal"> + ConsoleToMSBuild="true" + StandardOutputImportance="Normal"> diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 179703172..128782075 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -4,20 +4,33 @@ function(vcpkg_configure_cmake) if(_csc_GENERATOR) set(GENERATOR ${_csc_GENERATOR}) - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 ARM") # elseif(NOT vcpkg_configure_cmake_NINJA MATCHES "NOTFOUND") # set(GENERATOR "Ninja") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") - set(GENERATOR "Visual Studio 14 2015 ARM") + set(GENERATOR "Visual Studio 14 2015 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 Win64") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 ARM") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 Win64") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") + set(GENERATOR "Visual Studio 15 2017 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") endif() file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) @@ -33,7 +46,7 @@ function(vcpkg_configure_cmake) elseif(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL static) list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=OFF) endif() - + list(APPEND _csc_OPTIONS "-DCMAKE_CXX_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc" diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 2f3d992ba..b56bf1087 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -51,12 +51,12 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { return } - + $title = "Download " + $Dependency $message = ("No suitable version of " + $Dependency + " was found (requires $requiredVersion or higher). Download portable version?") $yesDescription = "Downloads " + $Dependency + " v" + $downloadVersion +" app-locally." - $noDescription = "Does not download " + $Dependency + "." - + $noDescription = "Does not download " + $Dependency + "." + $userAllowedDownload = promptForDownload $title $message $yesDescription $noDescription if (!$userAllowedDownload) { @@ -86,10 +86,10 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $ExtractionType_NO_EXTRACTION_REQUIRED = 0 $ExtractionType_ZIP = 1 $ExtractionType_SELF_EXTRACTING_7Z = 2 - - + + # Using this to wait for the execution to finish - function Invoke-Command() + function Invoke-Command() { param ( [string]$program = $(throw "Please specify a program" ), [string]$argumentString = "", @@ -99,7 +99,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $psi.FileName = $program $psi.Arguments = $argumentString $proc = [Diagnostics.Process]::Start($psi) - if ( $waitForExit ) + if ( $waitForExit ) { $proc.WaitForExit(); } @@ -120,33 +120,33 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if($Dependency -eq "cmake") { - $requiredVersion = "3.5.0" - $downloadVersion = "3.5.2" - $url = "https://cmake.org/files/v3.5/cmake-3.5.2-win32-x86.zip" - $downloadName = "cmake-3.5.2-win32-x86.zip" - $expectedDownloadedFileHash = "671073aee66b3480a564d0736792e40570a11e861bb34819bb7ae7858bbdfb80" - $executableFromDownload = "$downloadsDir\cmake-3.5.2-win32-x86\bin\cmake.exe" + $requiredVersion = "3.7.2" + $downloadVersion = "3.7.2" + $url = "https://cmake.org/files/v3.7/cmake-3.7.2-win32-x86.zip" + $downloadPath = "$downloadsDir\cmake-3.7.2-win32-x86.zip" + $expectedDownloadedFileHash = "ec5e299d412e0272e01d4de5bf07718f42c96361f83d51cc39f91bf49cc3e5c3" + $executableFromDownload = "$downloadsDir\cmake-3.7.2-win32-x86\bin\cmake.exe" $extractionType = $ExtractionType_ZIP } elseif($Dependency -eq "nuget") { - $requiredVersion = "1.0.0" - $downloadVersion = "3.4.3" - $url = "https://dist.nuget.org/win-x86-commandline/v3.4.3/nuget.exe" - $downloadName = "nuget.exe" - $expectedDownloadedFileHash = "3B1EA72943968D7AF6BACDB4F2F3A048A25AFD14564EF1D8B1C041FDB09EBB0A" - $executableFromDownload = "$downloadsDir\nuget.exe" + $requiredVersion = "3.3.0" + $downloadVersion = "3.5.0" + $url = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe" + $downloadPath = "$downloadsDir\nuget-3.5.0\nuget.exe" + $expectedDownloadedFileHash = "399ec24c26ed54d6887cde61994bb3d1cada7956c1b19ff880f06f060c039918" + $executableFromDownload = $downloadPath $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED } elseif($Dependency -eq "git") { $requiredVersion = "2.0.0" - $downloadVersion = "2.8.3" - $url = "https://github.com/git-for-windows/git/releases/download/v2.8.3.windows.1/PortableGit-2.8.3-32-bit.7z.exe" # We choose the 32-bit version - $downloadName = "PortableGit-2.8.3-32-bit.7z.exe" - $expectedDownloadedFileHash = "DE52D070219E9C4EC1DB179F2ADBF4B760686C3180608F0382A1F8C7031E72AD" + $downloadVersion = "2.11.0" + $url = "https://github.com/git-for-windows/git/releases/download/v2.11.0.windows.3/PortableGit-2.11.0.3-32-bit.7z.exe" # We choose the 32-bit version + $downloadPath = "$downloadsDir\PortableGit-2.11.0.3-32-bit.7z.exe" + $expectedDownloadedFileHash = "8bf3769c37945e991903dd1b988c6b1d97bbf0f3afc9851508974f38bf94dc01" # There is another copy of git.exe in PortableGit\bin. However, an installed version of git add the cmd dir to the PATH. - # Therefore, choosing the cmd dir here as well. + # Therefore, choosing the cmd dir here as well. $executableFromDownload = "$downloadsDir\PortableGit\cmd\git.exe" $extractionType = $ExtractionType_SELF_EXTRACTING_7Z } @@ -155,7 +155,12 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) throw "Unknown program requested" } - $downloadPath = "$downloadsDir\$downloadName" + $downloadSubdir = Split-path $downloadPath -Parent + if (!(Test-Path $downloadSubdir)) + { + New-Item -ItemType Directory -Path $downloadSubdir | Out-Null + } + performDownload $Dependency $url $downloadsDir $downloadPath $downloadVersion $requiredVersion #calculating the hash @@ -186,7 +191,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if (-not (Test-Path $executableFromDownload)) { Invoke-Command $downloadPath "-y" -waitForExit:$true - } + } } else { @@ -197,6 +202,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { throw [System.IO.FileNotFoundException] ("Could not detect or download " + $Dependency) } + + return $downloadPath } SelectProgram $Dependency \ No newline at end of file diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 new file mode 100644 index 000000000..1be4a4e6d --- /dev/null +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -0,0 +1,32 @@ +[CmdletBinding()] +param( + +) + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition + +# VS2017 +$VisualStudio2017InstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1 +foreach ($instance in $VisualStudio2017InstallationInstances) +{ + $VCFolder= "$instance\VC\Tools\MSVC\" + + if (Test-Path $VCFolder) + { + return "$instance\MSBuild\15.0\Bin\MSBuild.exe","v141" + } +} + +# VS2015 +$CandidateProgramFiles = "${env:PROGRAMFILES(X86)}", "${env:PROGRAMFILES}" +foreach ($ProgramFiles in $CandidateProgramFiles) +{ + $clExe= "$ProgramFiles\Microsoft Visual Studio 14.0\\VC\bin\cl.exe" + + if (Test-Path $clExe) + { + return "$ProgramFiles\MSBuild\14.0\Bin\MSBuild.exe","v140" + } +} + +throw "Could not find MSBuild with C++ support. VS2015 or above with C++ support need to be installed." \ No newline at end of file diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 new file mode 100644 index 000000000..d5faa57d3 --- /dev/null +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -0,0 +1,40 @@ +[CmdletBinding()] +param( + +) + +Import-Module BitsTransfer + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition +$vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root + +$downloadsDir = "$vcpkgRootDir\downloads" + +$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" +$nugetPackageDir = "$downloadsDir\nuget-packages" + +$SetupAPIVersion = "1.3.269-rc" +$url = "https://api.nuget.org/packages/microsoft.visualstudio.setup.configuration.native.$SetupAPIVersion.nupkg" +$downloadName = "microsoft.visualstudio.setup.configuration.native.$SetupAPIVersion.nupkg" +$downloadPath = "$downloadsDir\$downloadName" + +if (!(Test-Path $downloadPath)) +{ + Start-BitsTransfer -Source $url -Destination $downloadPath #-ErrorAction SilentlyContinue +} + +$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Pre -Source $downloadsDir -OutputDirectory $nugetPackageDir 2>&1 + +$SetupConsoleExe = "$nugetPackageDir\Microsoft.VisualStudio.Setup.Configuration.Native.$SetupAPIVersion\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Console.exe" + +if (!(Test-Path $SetupConsoleExe)) +{ + throw $nugetOutput +} + +$consoleOutput = & $SetupConsoleExe 2>&1 + +$key = "InstallationPath = " +$paths = $consoleOutput | Select-String -SimpleMatch $key +$paths = $paths -replace $key, "" +return $paths \ No newline at end of file diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 8afb66b09..1759b863b 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.67" \ No newline at end of file +"0.0.70" \ No newline at end of file diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index 1e8624d89..e4dd47472 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -14,4 +14,14 @@ namespace vcpkg::Environment ensure_cmake_on_path(paths); ensure_git_on_path(paths); } + + const fs::path& get_dumpbin_exe(const vcpkg_paths& paths); + + struct vcvarsall_and_platform_toolset + { + fs::path path; + std::wstring platform_toolset; + }; + + const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths); } diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 28853cb5d..cb5d2334c 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -75,4 +75,6 @@ namespace vcpkg::Strings std::string trimmed(const std::string& s); void trim_all_and_remove_whitespace_strings(std::vector* strings); + + std::vector split(const std::string& s, const std::string& delimiter); } diff --git a/toolsrc/include/vcpkg_paths.h b/toolsrc/include/vcpkg_paths.h index a2932070d..ba6defb9f 100644 --- a/toolsrc/include/vcpkg_paths.h +++ b/toolsrc/include/vcpkg_paths.h @@ -24,6 +24,7 @@ namespace vcpkg fs::path ports; fs::path installed; fs::path triplets; + fs::path scripts; fs::path buildsystems; fs::path buildsystems_msbuild_targets; diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 72ebb264b..e7e005100 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -30,10 +30,13 @@ namespace vcpkg::Commands::Build const triplet& target_triplet = spec.target_triplet(); const fs::path ports_cmake_script_path = paths.ports_cmake; - const std::wstring command = Strings::wformat(LR"("%%VS140COMNTOOLS%%..\..\VC\vcvarsall.bat" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", + const Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths); + const std::wstring command = Strings::wformat(LR"("%s" %s >nul 2>&1 && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s -DVCPKG_PLATFORM_TOOLSET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", + vcvarsall_bat.path.native(), Strings::utf8_to_utf16(target_triplet.architecture()), Strings::utf8_to_utf16(source_paragraph.name), Strings::utf8_to_utf16(target_triplet.canonical_name()), + vcvarsall_bat.platform_toolset, port_dir.generic_wstring(), ports_cmake_script_path.generic_wstring()); diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp index 1fca3a2f6..af76b7963 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/post_build_lint.cpp @@ -3,6 +3,7 @@ #include "vcpkg_Files.h" #include #include "vcpkg_System.h" +#include "vcpkg_Environment.h" #include "coff_file_reader.h" #include "BuildInfo.h" #include @@ -15,8 +16,6 @@ namespace vcpkg::PostBuildLint ERROR_DETECTED = 1 }; - static const fs::path DUMPBIN_EXE = R"(%VS140COMNTOOLS%\..\..\VC\bin\dumpbin.exe)"; - static lint_status check_for_files_in_include_directory(const fs::path& package_dir) { const fs::path include_dir = package_dir / "include"; @@ -185,12 +184,12 @@ namespace vcpkg::PostBuildLint return lint_status::SUCCESS; } - static lint_status check_exports_of_dlls(const std::vector& dlls) + static lint_status check_exports_of_dlls(const std::vector& dlls, const fs::path& dumpbin_exe) { std::vector dlls_with_no_exports; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /exports "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /exports "%s")", dumpbin_exe.native(), dll.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -211,7 +210,7 @@ namespace vcpkg::PostBuildLint return lint_status::SUCCESS; } - static lint_status check_uwp_bit_of_dlls(const std::string& expected_system_name, const std::vector& dlls) + static lint_status check_uwp_bit_of_dlls(const std::string& expected_system_name, const std::vector& dlls, const fs::path dumpbin_exe) { if (expected_system_name != "uwp") { @@ -221,7 +220,7 @@ namespace vcpkg::PostBuildLint std::vector dlls_with_improper_uwp_bit; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s")", dumpbin_exe.native(), dll.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -459,7 +458,7 @@ namespace vcpkg::PostBuildLint BuildType build_type; }; - static lint_status check_crt_linkage_of_libs(const BuildType& expected_build_type, const std::vector& libs) + static lint_status check_crt_linkage_of_libs(const BuildType& expected_build_type, const std::vector& libs, const fs::path dumpbin_exe) { std::vector bad_build_types = BuildType::values(); bad_build_types.erase(std::remove(bad_build_types.begin(), bad_build_types.end(), expected_build_type), bad_build_types.end()); @@ -468,7 +467,7 @@ namespace vcpkg::PostBuildLint for (const fs::path& lib : libs) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /directives "%s")", DUMPBIN_EXE.native(), lib.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /directives "%s")", dumpbin_exe.native(), lib.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -505,7 +504,7 @@ namespace vcpkg::PostBuildLint OutdatedDynamicCrt outdated_crt; }; - static lint_status check_outdated_crt_linkage_of_dlls(const std::vector& dlls) + static lint_status check_outdated_crt_linkage_of_dlls(const std::vector& dlls, const fs::path dumpbin_exe) { const std::vector& outdated_crts = OutdatedDynamicCrt::values(); @@ -513,7 +512,7 @@ namespace vcpkg::PostBuildLint for (const fs::path& dll : dlls) { - const std::wstring cmd_line = Strings::wformat(LR"("%s" /dependents "%s")", DUMPBIN_EXE.native(), dll.native()); + const std::wstring cmd_line = Strings::wformat(LR"("%s" /dependents "%s")", dumpbin_exe.native(), dll.native()); System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); @@ -575,6 +574,8 @@ namespace vcpkg::PostBuildLint void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) { + const fs::path dumpbin_exe = Environment::get_dumpbin_exe(paths); + System::println("-- Performing post-build validation"); BuildInfo build_info = read_build_info(paths.build_info_file_path(spec)); @@ -623,11 +624,11 @@ namespace vcpkg::PostBuildLint dlls.insert(dlls.cend(), debug_dlls.cbegin(), debug_dlls.cend()); dlls.insert(dlls.cend(), release_dlls.cbegin(), release_dlls.cend()); - error_count += check_exports_of_dlls(dlls); - error_count += check_uwp_bit_of_dlls(spec.target_triplet().system(), dlls); + error_count += check_exports_of_dlls(dlls, dumpbin_exe); + error_count += check_uwp_bit_of_dlls(spec.target_triplet().system(), dlls, dumpbin_exe); error_count += check_dll_architecture(spec.target_triplet().architecture(), dlls); - error_count += check_outdated_crt_linkage_of_dlls(dlls); + error_count += check_outdated_crt_linkage_of_dlls(dlls, dumpbin_exe); break; } case LinkageType::STATIC: @@ -638,8 +639,8 @@ namespace vcpkg::PostBuildLint error_count += check_bin_folders_are_not_present_in_static_build(package_dir); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, linkage_type_value_of(build_info.crt_linkage)), debug_libs); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, linkage_type_value_of(build_info.crt_linkage)), release_libs); + error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, linkage_type_value_of(build_info.crt_linkage)), debug_libs, dumpbin_exe); + error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, linkage_type_value_of(build_info.crt_linkage)), release_libs, dumpbin_exe); break; } case LinkageType::UNKNOWN: diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index c7eec3bd0..66d33edeb 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -4,6 +4,8 @@ #include "vcpkg_Commands.h" #include "metrics.h" #include "vcpkg_System.h" +#include "vcpkg_Strings.h" +#include "vcpkg_Files.h" namespace vcpkg::Environment { @@ -12,7 +14,7 @@ namespace vcpkg::Environment static const fs::path default_git_installation_dir = "C:/Program Files/git/cmd"; static const fs::path default_git_installation_dir_x86 = "C:/Program Files (x86)/git/cmd"; - static void ensure_on_path(const std::array& version, const wchar_t* version_check_cmd, const wchar_t* install_cmd) + static void ensure_on_path(const std::array& version, const std::wstring& version_check_cmd, const std::wstring& install_cmd) { System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(version_check_cmd); if (ec_data.exit_code == 0) @@ -44,6 +46,13 @@ namespace vcpkg::Environment } } + static std::wstring create_default_install_cmd(const vcpkg_paths& paths, const std::wstring& tool_name) + { + const fs::path script = paths.scripts / "fetchDependency.ps1"; + // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned + return Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency %s", script.native(), tool_name); + } + void ensure_git_on_path(const vcpkg_paths& paths) { const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; @@ -55,13 +64,14 @@ namespace vcpkg::Environment _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array git_version = {2,0,0}; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(git_version, L"git --version 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency git"); + static const std::wstring version_check_cmd = L"git --version 2>&1"; + const std::wstring install_cmd = create_default_install_cmd(paths, L"git"); + ensure_on_path(git_version, version_check_cmd, install_cmd); } void ensure_cmake_on_path(const vcpkg_paths& paths) { - const fs::path downloaded_cmake = paths.downloads / "cmake-3.5.2-win32-x86" / "bin"; + const fs::path downloaded_cmake = paths.downloads / "cmake-3.7.2-win32-x86" / "bin"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_cmake.native(), System::wdupenv_str(L"PATH"), @@ -69,18 +79,131 @@ namespace vcpkg::Environment default_cmake_installation_dir_x86.native()); _wputenv_s(L"PATH", path_buf.c_str()); - static constexpr std::array cmake_version = {3,5,0}; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(cmake_version, L"cmake --version 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency cmake"); + static constexpr std::array cmake_version = {3,7,2}; + static const std::wstring version_check_cmd = L"cmake --version 2>&1"; + const std::wstring install_cmd = create_default_install_cmd(paths, L"cmake"); + ensure_on_path(cmake_version, version_check_cmd, install_cmd); } void ensure_nuget_on_path(const vcpkg_paths& paths) { - const std::wstring path_buf = Strings::wformat(L"%s;%s", paths.downloads.native(), System::wdupenv_str(L"PATH")); + const fs::path downloaded_nuget = paths.downloads / "nuget-3.5.0"; + const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::wdupenv_str(L"PATH")); _wputenv_s(L"PATH", path_buf.c_str()); - static constexpr std::array nuget_version = {1,0,0}; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(nuget_version, L"nuget 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency nuget"); + static constexpr std::array nuget_version = {3,3,0}; + static const std::wstring version_check_cmd = L"nuget 2>&1"; + const std::wstring install_cmd = create_default_install_cmd(paths, L"nuget"); + ensure_on_path(nuget_version, version_check_cmd, install_cmd); + } + + static std::vector get_VS2017_installation_instances(const vcpkg_paths& paths) + { + const fs::path script = paths.scripts / "findVisualStudioInstallationInstances.ps1"; + const std::wstring cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s", script.native()); + System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd); + Checks::check_exit(ec_data.exit_code == 0, "Could not run script to detect VS 2017 instances"); + return Strings::split(ec_data.output, "\n"); + } + + static const fs::path& get_VS2015_installation_instance() + { + static const fs::path vs2015_cmntools = fs::path(System::wdupenv_str(L"VS140COMNTOOLS")).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash + static const fs::path vs2015_path = vs2015_cmntools.parent_path().parent_path(); + return vs2015_path; + } + + static fs::path find_dumpbin_exe(const vcpkg_paths& paths) + { + const std::vector vs2017_installation_instances = get_VS2017_installation_instances(paths); + std::vector paths_examined; + + // VS2017 + for (const std::string& instance : vs2017_installation_instances) + { + const fs::path msvc_path = Strings::format(R"(%s\VC\Tools\MSVC)", instance); + std::vector msvc_subdirectories; + Files::non_recursive_find_matching_paths_in_dir(msvc_path, [&](const fs::path& current) + { + return fs::is_directory(current); + }, &msvc_subdirectories); + + // Sort them so that latest comes first + std::sort(msvc_subdirectories.begin(), msvc_subdirectories.end(), [&](const fs::path& left, const fs::path& right) + { + return left.filename() > right.filename(); + }); + + for (const fs::path& subdir : msvc_subdirectories) + { + const fs::path dumpbin_path = subdir / "bin" / "HostX86" / "x86" / "dumpbin.exe"; + paths_examined.push_back(dumpbin_path); + if (fs::exists(dumpbin_path)) + { + return dumpbin_path; + } + } + } + + // VS2015 + const fs::path vs2015_dumpbin_exe = get_VS2015_installation_instance() / "VC" / "bin" / "dumpbin.exe"; + paths_examined.push_back(vs2015_dumpbin_exe); + if (fs::exists(vs2015_dumpbin_exe)) + { + return vs2015_dumpbin_exe; + } + + System::println(System::color::error, "Could not detect dumpbin.exe."); + System::println("The following paths were examined:"); + for (const fs::path& path : paths_examined) + { + System::println(" %s", path.generic_string()); + } + exit(EXIT_FAILURE); + } + + const fs::path& get_dumpbin_exe(const vcpkg_paths& paths) + { + static const fs::path dumpbin_exe = find_dumpbin_exe(paths); + return dumpbin_exe; + } + + static vcvarsall_and_platform_toolset find_vcvarsall_bat(const vcpkg_paths& paths) + { + const std::vector vs2017_installation_instances = get_VS2017_installation_instances(paths); + std::vector paths_examined; + + // VS2017 + for (const fs::path& instance : vs2017_installation_instances) + { + const fs::path vcvarsall_bat = instance / "VC" / "Auxiliary" / "Build" / "vcvarsall.bat"; + paths_examined.push_back(vcvarsall_bat); + if (fs::exists(vcvarsall_bat)) + { + return { vcvarsall_bat , L"v141"}; + } + } + + // VS2015 + const fs::path vs2015_vcvarsall_bat = get_VS2015_installation_instance() / "VC" / "vcvarsall.bat"; + paths_examined.push_back(vs2015_vcvarsall_bat); + if (fs::exists(vs2015_vcvarsall_bat)) + { + return { vs2015_vcvarsall_bat, L"v140" }; + } + + System::println(System::color::error, "Could not detect vccarsall.bat."); + System::println("The following paths were examined:"); + for (const fs::path& path : paths_examined) + { + System::println(" %s",path.generic_string()); + } + exit(EXIT_FAILURE); + } + + const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths) + { + static const vcvarsall_and_platform_toolset vcvarsall_bat = find_vcvarsall_bat(paths); + return vcvarsall_bat; } } diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index cf7d3b0ee..b974b0a06 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -119,4 +119,24 @@ namespace vcpkg::Strings return s == ""; }), strings->end()); } + + std::vector split(const std::string& s, const std::string& delimiter) + { + std::vector output; + + size_t i = 0; + for (size_t pos = s.find(delimiter); pos != std::string::npos; pos = s.find(delimiter, pos)) + { + output.push_back(s.substr(i, pos - i)); + i = ++pos; + } + + // Add the rest of the string after the last delimiter, unless there is nothing after it + if (i != s.length()) + { + output.push_back(s.substr(i, s.length())); + } + + return output; + } } diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp index b7e716307..39e4c8986 100644 --- a/toolsrc/src/vcpkg_paths.cpp +++ b/toolsrc/src/vcpkg_paths.cpp @@ -31,8 +31,9 @@ namespace vcpkg paths.ports = paths.root / "ports"; paths.installed = paths.root / "installed"; paths.triplets = paths.root / "triplets"; + paths.scripts = paths.root / "scripts"; - paths.buildsystems = paths.root / "scripts" / "buildsystems"; + paths.buildsystems = paths.scripts / "buildsystems"; paths.buildsystems_msbuild_targets = paths.buildsystems / "msbuild" / "vcpkg.targets"; paths.vcpkg_dir = paths.installed / "vcpkg"; @@ -40,7 +41,7 @@ namespace vcpkg paths.vcpkg_dir_info = paths.vcpkg_dir / "info"; paths.vcpkg_dir_updates = paths.vcpkg_dir / "updates"; - paths.ports_cmake = paths.root / "scripts" / "ports.cmake"; + paths.ports_cmake = paths.scripts / "ports.cmake"; return paths; } diff --git a/toolsrc/vcpkg/vcpkg.vcxproj b/toolsrc/vcpkg/vcpkg.vcxproj index bcec048f5..15673e048 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj +++ b/toolsrc/vcpkg/vcpkg.vcxproj @@ -22,31 +22,28 @@ {34671B80-54F9-46F5-8310-AC429C11D4FB} vcpkg 8.1 + v140 Application true - v140 MultiByte Application false - v140 true MultiByte Application true - v140 MultiByte Application false - v140 true MultiByte diff --git a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj index c0d108602..2504a0227 100644 --- a/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj +++ b/toolsrc/vcpkgcommon/vcpkgcommon.vcxproj @@ -22,31 +22,28 @@ {7129F242-F20C-43E7-BBEC-4E15B71890B2} vcpkgcommon 8.1 + v140 StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 10cc32935..561b22477 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -22,31 +22,28 @@ {B98C92B7-2874-4537-9D46-D14E5C237F04} vcpkglib 8.1 + v140 StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte diff --git a/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj b/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj index 7b7fe89ed..66cf52232 100644 --- a/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj +++ b/toolsrc/vcpkgmetrics/vcpkgmetrics.vcxproj @@ -22,31 +22,28 @@ {7226078C-1D2A-4123-9EF1-8DF2B722B8F1} vcpkgmetrics 8.1 + v140 StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte StaticLibrary true - v140 MultiByte StaticLibrary false - v140 true MultiByte diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj index 1e2a85087..dc666c19e 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj @@ -22,31 +22,28 @@ {7D6FDEEB-B299-4A23-85EE-F67C4DED47BE} vcpkgmetricsuploader 8.1 + v140 Application true - v140 MultiByte Application false - v140 true MultiByte Application true - v140 MultiByte Application false - v140 true MultiByte diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index d14f86745..a68d77b46 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -38,19 +38,18 @@ Win32Proj vcpkgtest 8.1 + v140 DynamicLibrary true - v140 Unicode false DynamicLibrary false - v140 true Unicode false @@ -58,14 +57,12 @@ DynamicLibrary true - v140 Unicode false DynamicLibrary false - v140 true Unicode false