Skip to content

Commit

Permalink
remove vcpkg in favor of boostorg/math standalone (#2151)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
Michael Herwig and StephanTLavavej authored Aug 27, 2021
1 parent 967479d commit 78ff461
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 94 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ __pycache__/
/build/
/out/
/tools/out/
/CMakeLists.txt.user
7 changes: 3 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"files.exclude": {
"llvm-project": true,
"stl/msbuild": true,
"vcpkg": true
"boost-math": true
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
Expand Down
12 changes: 1 addition & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")

Expand Down Expand Up @@ -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)
Expand Down
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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:

Expand Down Expand Up @@ -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
[[email protected]]: mailto:[email protected]
[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
26 changes: 13 additions & 13 deletions azure-devops/checkout-sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" (
Expand All @@ -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"
5 changes: 0 additions & 5 deletions azure-devops/cmake-configure-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ parameters:
type: string
- name: targetArch
type: string
- name: vcpkgLocationVar
type: string
default: vcpkgLocation
- name: targetPlatform
type: string
- name: buildOutputLocationVar
Expand All @@ -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) ^
Expand Down
3 changes: 0 additions & 3 deletions azure-devops/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 0 additions & 3 deletions azure-devops/native-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
38 changes: 0 additions & 38 deletions azure-devops/vcpkg-dependencies.yml

This file was deleted.

1 change: 0 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
variables:
tmpDir: 'D:\Temp'
buildOutputLocation: 'D:\build'
vcpkgLocation: '$(Build.SourcesDirectory)/vcpkg'

pool: 'StlBuild-2021-08-11'

Expand Down
1 change: 1 addition & 0 deletions boost-math
Submodule boost-math added at 88c4b8
4 changes: 2 additions & 2 deletions stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion tools/validate/validate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
1 change: 0 additions & 1 deletion vcpkg
Submodule vcpkg deleted from 125735

0 comments on commit 78ff461

Please sign in to comment.