diff --git a/.gitignore b/.gitignore index e85a6563db..693d320cc7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ __pycache__/ /build/ /out/ /tools/out/ +/CMakeLists.txt.user diff --git a/.gitmodules b/.gitmodules index 0e762eb7cd..d9ff8484bf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,10 +1,9 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -[submodule "vcpkg"] - path = vcpkg - url = https://github.com/microsoft/vcpkg.git - fetchRecurseSubmodules = false [submodule "llvm-project"] path = llvm-project url = https://github.com/llvm/llvm-project.git +[submodule "boost-math"] + path = boost-math + url = https://github.com/boostorg/math.git diff --git a/.vscode/settings.json b/.vscode/settings.json index 5312b7ed5b..ed78450048 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,7 +12,7 @@ "files.exclude": { "llvm-project": true, "stl/msbuild": true, - "vcpkg": true + "boost-math": true }, "files.insertFinalNewline": true, "files.trimFinalNewlines": true, diff --git a/CMakeLists.txt b/CMakeLists.txt index a184fff2bc..5f2fcd7c77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,21 +1,10 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -if (NOT DEFINED CMAKE_TOOLCHAIN_FILE AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake") - set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake") -endif() - cmake_minimum_required(VERSION 3.20) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(msvc_standard_libraries LANGUAGES CXX) -find_package(Boost REQUIRED) - -set(VCLIBS_MIN_BOOST_VERSION 1.76.0) -if("${Boost_VERSION}" VERSION_LESS "${VCLIBS_MIN_BOOST_VERSION}") - message(FATAL_ERROR "Detected Boost version is too old (older than ${VCLIBS_MIN_BOOST_VERSION}).") -endif() - option(BUILD_TESTING "Enable testing" ON) set(VCLIBS_SUFFIX "_oss" CACHE STRING "suffix for built DLL names to avoid conflicts with distributed DLLs") @@ -90,6 +79,7 @@ get_filename_component(TOOLSET_ROOT_DIR "${TOOLSET_ROOT_DIR}" DIRECTORY) # $\VC\ set(TOOLSET_LIB "${TOOLSET_ROOT_DIR}/lib/${VCLIBS_X86_OR_X64}") +add_subdirectory(boost-math) add_subdirectory(stl) if(BUILD_TESTING) diff --git a/README.md b/README.md index 1e67331f70..1d6b5db83a 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,6 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With The Visual Studio IDE -The STL uses boost-math headers to provide P0226R1 Mathematical Special Functions. We recommend using [vcpkg][] to -acquire this dependency. - 1. Install Visual Studio 2022 17.0 Preview 3 or later. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja. @@ -152,10 +149,8 @@ acquire this dependency. 2. Open Visual Studio, and choose the "Clone or check out code" option. Enter the URL of this repository, `https://github.com/microsoft/STL`. 3. Open a terminal in the IDE with `` Ctrl + ` `` (by default) or press on "View" in the top bar, and then "Terminal". -4. In the terminal, invoke `git submodule update --init --progress llvm-project vcpkg` -5. In the terminal, invoke `.\vcpkg\bootstrap-vcpkg.bat` -6. In the terminal, invoke `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows` -7. Choose the architecture you wish to build in the IDE, and build as you would any other project. All necessary CMake +4. In the terminal, invoke `git submodule update --init --progress llvm-project boost-math` +5. Choose the architecture you wish to build in the IDE, and build as you would any other project. All necessary CMake settings are set by `CMakeSettings.json`. # How To Build With A Native Tools Command Prompt @@ -169,9 +164,6 @@ acquire this dependency. 2. Open a command prompt. 3. Change directories to a location where you'd like a clone of this STL repository. 4. `git clone https://github.com/microsoft/STL --recurse-submodules` -5. `cd STL` -6. `.\vcpkg\bootstrap-vcpkg.bat` -7. `.\vcpkg\vcpkg.exe install boost-math:x86-windows boost-math:x64-windows` To build the x86 target: @@ -476,5 +468,4 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception [lit result codes]: https://llvm.org/docs/CommandGuide/lit.html#test-status-results [opencode@microsoft.com]: mailto:opencode@microsoft.com [redistributables]: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads -[vcpkg]: https://github.com/microsoft/vcpkg [natvis documentation]: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects diff --git a/azure-devops/checkout-sources.yml b/azure-devops/checkout-sources.yml index 916f72572f..ccd9f172b4 100644 --- a/azure-devops/checkout-sources.yml +++ b/azure-devops/checkout-sources.yml @@ -2,12 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception parameters: -- name: vcpkgSHAVar - type: string - default: vcpkgSHA - name: llvmSHAVar type: string default: llvmSHA +- name: boostMathSHAVar + type: string + default: boostMathSHA steps: - checkout: self clean: true @@ -22,8 +22,8 @@ steps: $regexSubmoduleSHA = '^[ \-+]([0-9a-f]+) .*$' $llvmSHA = git submodule status --cached llvm-project | %{$_ -replace $regexSubmoduleSHA, '$1'} Write-Host "##vso[task.setvariable variable=${{ parameters.llvmSHAVar }};]$llvmSHA" - $vcpkgSHA = git submodule status --cached vcpkg | %{$_ -replace $regexSubmoduleSHA, '$1'} - Write-Host "##vso[task.setvariable variable=${{ parameters.vcpkgSHAVar }};]$vcpkgSHA" + $boostMathSHA = git submodule status --cached boost-math | %{$_ -replace $regexSubmoduleSHA, '$1'} + Write-Host "##vso[task.setvariable variable=${{ parameters.boostMathSHAVar }};]$boostMathSHA" - script: | cd $(Build.SourcesDirectory) if not exist "llvm-project" ( @@ -50,22 +50,22 @@ steps: displayName: "Checkout LLVM source" - script: | cd $(Build.SourcesDirectory) - if not exist "vcpkg" ( - mkdir vcpkg + if not exist "boost-math" ( + mkdir boost-math ) - cd vcpkg + cd boost-math if not exist ".git" ( del /S /Q * git init ) - git remote get-url vcpkg + git remote get-url boostorg if errorlevel 1 ( - git remote add vcpkg https://github.com/Microsoft/vcpkg.git - git config --local extensions.partialClone vcpkg + git remote add boostorg https://github.com/boostorg/math.git + git config --local extensions.partialClone boostorg ) - git fetch --filter=tree:0 --depth=1 vcpkg $(${{ parameters.vcpkgSHAVar }}) + git fetch --filter=tree:0 --depth=1 boostorg $(${{ parameters.boostMathSHAVar }}) git checkout -f FETCH_HEAD - displayName: "Checkout vcpkg source" + displayName: "Checkout boost-math source" diff --git a/azure-devops/cmake-configure-build.yml b/azure-devops/cmake-configure-build.yml index b0231930b9..e868e80c37 100644 --- a/azure-devops/cmake-configure-build.yml +++ b/azure-devops/cmake-configure-build.yml @@ -6,9 +6,6 @@ parameters: type: string - name: targetArch type: string -- name: vcpkgLocationVar - type: string - default: vcpkgLocation - name: targetPlatform type: string - name: buildOutputLocationVar @@ -33,8 +30,6 @@ steps: call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^ -host_arch=${{ parameters.hostArch }} -arch=${{ parameters.targetArch }} -no_logo cmake ${{ parameters.cmakeAdditionalFlags}} -G Ninja ^ - -DCMAKE_TOOLCHAIN_FILE=$(${{ parameters.vcpkgLocationVar }})\scripts\buildsystems\vcpkg.cmake ^ - -DVCPKG_TARGET_TRIPLET=${{ parameters.targetPlatform }}-windows ^ -DCMAKE_CXX_COMPILER=cl ^ -DCMAKE_BUILD_TYPE=Release ^ -DLIT_FLAGS=$(litFlags) ^ diff --git a/azure-devops/cross-build.yml b/azure-devops/cross-build.yml index 6cbcb08adb..0083c39462 100644 --- a/azure-devops/cross-build.yml +++ b/azure-devops/cross-build.yml @@ -33,9 +33,6 @@ jobs: displayName: 'Setup TMP Directory' - template: checkout-sources.yml - - template: vcpkg-dependencies.yml - parameters: - targetPlatform: ${{ parameters.targetPlatform }} - template: cmake-configure-build.yml parameters: targetPlatform: ${{ parameters.targetPlatform }} diff --git a/azure-devops/native-build-test.yml b/azure-devops/native-build-test.yml index 17fa03732a..25bdb0e1c7 100644 --- a/azure-devops/native-build-test.yml +++ b/azure-devops/native-build-test.yml @@ -30,9 +30,6 @@ jobs: displayName: 'Setup TMP Directory' - template: checkout-sources.yml - - template: vcpkg-dependencies.yml - parameters: - targetPlatform: ${{ parameters.targetPlatform }} - template: cmake-configure-build.yml parameters: targetPlatform: ${{ parameters.targetPlatform }} diff --git a/azure-devops/vcpkg-dependencies.yml b/azure-devops/vcpkg-dependencies.yml deleted file mode 100644 index bd22c161de..0000000000 --- a/azure-devops/vcpkg-dependencies.yml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -parameters: -- name: targetPlatform - type: string -- name: vcpkgLocationVar - type: string - default: vcpkgLocation -- name: vcpkgSHAVar - type: string - default: vcpkgSHA -steps: -- task: Cache@2 - displayName: vcpkg/installed Caching - timeoutInMinutes: 10 - inputs: - key: '"${{ parameters.targetPlatform }}" | "$(${{ parameters.vcpkgSHAVar }})" | "2020-03-01.01"' - path: '$(${{ parameters.vcpkgLocationVar }})/installed' - cacheHitVar: CACHE_RESTORED -- task: run-vcpkg@0 - displayName: 'Run vcpkg to Install boost-build' - condition: ne(variables.CACHE_RESTORED, 'true') - timeoutInMinutes: 10 - inputs: - doNotUpdateVcpkg: true - vcpkgArguments: 'boost-build' - vcpkgDirectory: '$(${{ parameters.vcpkgLocationVar }})' - vcpkgTriplet: 'x86-windows' -- task: run-vcpkg@0 - displayName: 'Run vcpkg to Install boost-math' - condition: ne(variables.CACHE_RESTORED, 'true') - timeoutInMinutes: 10 - inputs: - doNotUpdateVcpkg: true - vcpkgArguments: 'boost-math' - vcpkgDirectory: '$(${{ parameters.vcpkgLocationVar }})' - vcpkgTriplet: '${{ parameters.targetPlatform }}-windows' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3614037de9..0287f4c367 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,7 +6,6 @@ variables: tmpDir: 'D:\Temp' buildOutputLocation: 'D:\build' - vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg' pool: 'StlBuild-2021-08-11' diff --git a/boost-math b/boost-math new file mode 160000 index 0000000000..88c4b8d661 --- /dev/null +++ b/boost-math @@ -0,0 +1 @@ +Subproject commit 88c4b8d661dbe15be7317f04f1eccae0c9c39980 diff --git a/stl/CMakeLists.txt b/stl/CMakeLists.txt index c08cb31cb9..a0232ab12e 100644 --- a/stl/CMakeLists.txt +++ b/stl/CMakeLists.txt @@ -478,7 +478,7 @@ function(add_stl_dlls D_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPILE_OPTIO add_library(msvcp_2${D_SUFFIX}_objects OBJECT ${SOURCES_SATELLITE_2}) target_compile_definitions(msvcp_2${D_SUFFIX}_objects PRIVATE "_BUILDING_SATELLITE_2;_DLL;${THIS_CONFIG_DEFINITIONS}") target_compile_options(msvcp_2${D_SUFFIX}_objects PRIVATE "${THIS_CONFIG_COMPILE_OPTIONS};${GL_FLAG};/EHsc") - target_link_libraries(msvcp_2${D_SUFFIX}_objects PRIVATE Boost::headers Boost::disable_autolinking) + target_link_libraries(msvcp_2${D_SUFFIX}_objects PRIVATE Boost::math) add_library(msvcp_2${D_SUFFIX} SHARED) target_link_libraries(msvcp_2${D_SUFFIX} PRIVATE msvcp_2${D_SUFFIX}_objects msvcp${D_SUFFIX}_satellite_objects msvcp${D_SUFFIX}_implib_objects std_init_once_begin_initialize std_init_once_complete "msvcp${D_SUFFIX}" "${TOOLSET_LIB}/vcruntime${D_SUFFIX}.lib" "${TOOLSET_LIB}/msvcrt${D_SUFFIX}.lib" "ucrt${D_SUFFIX}.lib") @@ -540,7 +540,7 @@ function(add_stl_statics FLAVOR_SUFFIX THIS_CONFIG_DEFINITIONS THIS_CONFIG_COMPI add_library(libcpmt${FLAVOR_SUFFIX} STATIC ${HEADERS} ${IMPLIB_SOURCES} ${SOURCES} ${STATIC_SOURCES}) target_compile_definitions(libcpmt${FLAVOR_SUFFIX} PRIVATE "${THIS_CONFIG_DEFINITIONS}") target_compile_options(libcpmt${FLAVOR_SUFFIX} PRIVATE "${THIS_CONFIG_COMPILE_OPTIONS};/EHsc") - target_link_libraries(libcpmt${FLAVOR_SUFFIX} PRIVATE Boost::headers Boost::disable_autolinking libcpmt${FLAVOR_SUFFIX}_eha std_init_once_begin_initialize std_init_once_complete) + target_link_libraries(libcpmt${FLAVOR_SUFFIX} PRIVATE Boost::math libcpmt${FLAVOR_SUFFIX}_eha std_init_once_begin_initialize std_init_once_complete) endfunction() add_stl_statics("" "_ITERATOR_DEBUG_LEVEL=0" "${VCLIBS_RELEASE_OPTIONS}") diff --git a/tools/validate/validate.cpp b/tools/validate/validate.cpp index 192a43833f..1491f1f3d1 100644 --- a/tools/validate/validate.cpp +++ b/tools/validate/validate.cpp @@ -191,10 +191,10 @@ int main() { L".vs"sv, L".vscode"sv, L"__pycache__"sv, + L"boost-math"sv, L"build"sv, L"llvm-project"sv, L"out"sv, - L"vcpkg"sv, }; static constexpr array skipped_extensions{ diff --git a/vcpkg b/vcpkg deleted file mode 160000 index 1257354a3a..0000000000 --- a/vcpkg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1257354a3ab0bebd8abe95281ca561537853578c