├── .github ├── dependabot.yml └── workflows │ ├── vcpkg_ci_amd64.yml │ ├── vcpkg_ci_mac.yml │ ├── vcpkg_ci_windows.yml │ ├── vcpkg_docker.yml │ └── vcpkg_release.yml ├── .gitignore ├── .gitmodules ├── CODEOWNERS ├── LICENSE ├── README.md ├── build_dependencies.sh ├── dependencies.txt ├── docker ├── .dockerignore ├── Dockerfile.ubuntu.vcpkg └── build.sh ├── overlays.txt ├── ports ├── glog │ ├── fix_cplusplus_macro.patch │ ├── fix_crosscompile_symbolize.patch │ ├── fix_glog_CMAKE_MODULE_PATH.patch │ ├── fix_logstream_linker_error.patch │ ├── glog_disable_debug_postfix.patch │ ├── portfile.cmake │ └── vcpkg.json ├── llvm-16 │ ├── 0001-Fix-install-paths.patch │ ├── 0006-Fix-libffi.patch │ ├── 0007-Fix-install-bolt.patch │ ├── 0020-fix-FindZ3.cmake.patch │ ├── 0021-fix-find_dependency.patch │ ├── 0026-fix-prefix-path-calc.patch │ ├── 0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch │ ├── clang_usage │ ├── flang_usage │ ├── lld_usage │ ├── llvm_usage │ ├── mlir_usage │ ├── portfile.cmake │ └── vcpkg.json ├── llvm-17 │ ├── 0001-Fix-install-paths.patch │ ├── 0006-Fix-libffi.patch │ ├── 0020-fix-FindZ3.cmake.patch │ ├── 0021-fix-find_dependency.patch │ ├── 0026-fix-prefix-path-calc.patch │ ├── 0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch │ ├── clang_usage │ ├── flang_usage │ ├── lld_usage │ ├── llvm_usage │ ├── mlir_usage │ ├── portfile.cmake │ └── vcpkg.json ├── protobuf │ ├── compile_options.patch │ ├── fix-default-proto-file-path.patch │ ├── fix-static-build.patch │ ├── portfile.cmake │ ├── protobuf-targets-vcpkg-protoc.cmake │ ├── vcpkg-cmake-wrapper.cmake │ └── vcpkg.json ├── re2c │ ├── portfile.cmake │ └── vcpkg.json ├── xed │ ├── 0001-mbuild-remove-m64.patch │ ├── XEDConfig.cmake │ ├── portfile.cmake │ ├── usage │ └── vcpkg.json └── z3 │ ├── fix-install-path.patch │ ├── portfile.cmake │ ├── remove-flag-overrides.patch │ └── vcpkg.json ├── scripts ├── assert_arch.sh └── assert_asan.sh ├── toolchain └── vcpkg_unix_sanitizer_toolchain.cmake ├── triplets ├── arm64-linux-rel.cmake ├── arm64-osx-asan.cmake ├── arm64-osx-rel.cmake ├── x64-linux-asan.cmake ├── x64-linux-rel-asan.cmake ├── x64-linux-rel.cmake ├── x64-osx-asan.cmake ├── x64-osx-rel-asan.cmake ├── x64-osx-rel.cmake ├── x64-windows-static-md-rel.cmake └── x64-windows-static-md.cmake └── vcpkg_info.txt /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | # Maintain dependencies for GitHub Actions 5 | - package-ecosystem: "github-actions" 6 | directory: "/" 7 | schedule: 8 | interval: "daily" 9 | 10 | # Maintain dependencies for GitHub Actions 11 | # NOTE(ekilmer): Disabled because dependabot needs access to GHA secrets and 12 | # the submodule updates aren't super critical right now 13 | # - package-ecosystem: "gitsubmodule" 14 | # directory: "/" 15 | # schedule: 16 | # interval: "weekly" 17 | -------------------------------------------------------------------------------- /.github/workflows/vcpkg_ci_amd64.yml: -------------------------------------------------------------------------------- 1 | name: Linux CI 2 | 3 | env: 4 | # "Source" is set in the vcpkg install step 5 | VCPKG_BINARY_SOURCES: 'clear;nuget,Source,readwrite;nugettimeout,3601' 6 | # Self-hosted runners can hopefully reuse already downloaded packages 7 | VCPKG_USE_NUGET_CACHE: 1 8 | VCPKG_DEFAULT_HOST_TRIPLET: 'x64-linux-rel' 9 | 10 | on: 11 | release: 12 | types: 13 | - published 14 | pull_request: 15 | paths-ignore: 16 | - 'docker/**' 17 | - '.github/**' 18 | - '**.md' 19 | - '!.github/workflows/vcpkg_ci_amd64*' 20 | push: 21 | paths-ignore: 22 | - 'docker/**' 23 | - '.github/**' 24 | - '**.md' 25 | - '!.github/workflows/vcpkg_ci_amd64*' 26 | tags-ignore: 27 | - 'v*' 28 | branches: 29 | - 'master' 30 | 31 | concurrency: 32 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 33 | cancel-in-progress: true 34 | 35 | jobs: 36 | build: 37 | strategy: 38 | fail-fast: false 39 | matrix: 40 | image: 41 | # 'name' is Docker image name whereas 'os' is more generic 42 | - { os: 'ubuntu', name: 'ubuntu-v2', tag: '22.04' } 43 | llvm: [ 44 | 'llvm-16', 45 | 'llvm-17', 46 | 'llvm-17[liftingbits-llvm]' 47 | ] 48 | target_arch: [ 'x64', 'arm64' ] 49 | 50 | container: 51 | image: docker.pkg.github.com/lifting-bits/cxx-common/vcpkg-builder-${{ matrix.image.name }}:${{ matrix.image.tag }} 52 | volumes: 53 | - /:/gha-runner 54 | credentials: 55 | username: ${{ github.actor }} 56 | password: ${{ secrets.GITHUB_TOKEN }} 57 | 58 | name: ${{matrix.image.os}}-${{matrix.image.tag}} ${{matrix.llvm}} ${{matrix.target_arch}} 59 | runs-on: ubuntu-latest # run the job on the newly created runner 60 | steps: 61 | - name: Free Disk Space 62 | run: | 63 | df -h 64 | rm -rf /gha-runner/usr/local/lib/android 65 | rm -rf /gha-runner/usr/local/share/boost 66 | df -h 67 | 68 | - name: Set Artifact Name 69 | run: | 70 | # Need to fix because paths with brackets cause issues 71 | NAME="$(echo 'vcpkg_${{ matrix.image.os }}-${{ matrix.image.tag }}_${{ matrix.llvm }}_${{ matrix.target_arch == 'x64' && 'amd64' || matrix.target_arch }}' | tr '[' '-' | tr -d ']')" 72 | echo "ARTIFACT_NAME=${NAME}" >> "$GITHUB_ENV" 73 | 74 | - uses: actions/checkout@v4 75 | with: 76 | submodules: recursive 77 | fetch-depth: 2 78 | 79 | # Used to get commit message since PRs are on a merge commit 80 | - name: Get commit message 81 | shell: bash 82 | run: | 83 | git config --global --add safe.directory /__w/cxx-common/cxx-common 84 | echo 'COMMIT_MESSAGE<> "$GITHUB_ENV" 85 | if [[ '${{ github.event_name }}' == 'push' ]]; then 86 | echo "$(git log --format=%B -n 1 HEAD)" >> "$GITHUB_ENV" 87 | elif [[ '${{ github.event_name }}' == 'pull_request' ]]; then 88 | echo "$(git log --format=%B -n 1 HEAD^2)" >> "$GITHUB_ENV" 89 | fi 90 | echo "EOF" >> "$GITHUB_ENV" 91 | 92 | - name: Clear prior vcpkg directory 93 | run: | 94 | rm -rf "${{ github.workspace }}/vcpkg" 95 | 96 | - name: Initialize vcpkg 97 | shell: bash 98 | run: | 99 | { read -r vcpkg_repo_url && read -r vcpkg_commit; } <./vcpkg_info.txt || exit 1 100 | git clone "${vcpkg_repo_url}" 101 | git -C vcpkg checkout "${vcpkg_commit}" 102 | export VCPKG_DISABLE_METRICS=1 103 | ./vcpkg/bootstrap-vcpkg.sh 104 | echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV 105 | 106 | - name: 'vcpkg install dependencies' 107 | shell: 'bash' 108 | run: | 109 | export VCPKG_DISABLE_METRICS=1 110 | 111 | # Setup NuGet authentication 112 | mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" sources add \ 113 | -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ 114 | -storepasswordincleartext \ 115 | -name "Source" \ 116 | -username "${{ github.repository_owner }}" \ 117 | -password "${{ secrets.GITHUB_TOKEN }}" || true 118 | 119 | mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" sources update \ 120 | -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ 121 | -storepasswordincleartext \ 122 | -name "Source" \ 123 | -username "${{ github.repository_owner }}" \ 124 | -password "${{ secrets.GITHUB_TOKEN }}" 125 | 126 | mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" setapikey \ 127 | -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ 128 | "${{ secrets.GITHUB_TOKEN }}" 129 | 130 | ./build_dependencies.sh --release --target-arch ${{ matrix.target_arch }} --export-dir ./${{ env.ARTIFACT_NAME }} --clean-after-build --debug 131 | 132 | rm -rf vcpkg/downloads 133 | rm -rf ~/.nuget/packages 134 | echo "Check space..." 135 | df -h 136 | echo "DONE." 137 | 138 | ./build_dependencies.sh --release --target-arch ${{ matrix.target_arch }} --export-dir ./${{ env.ARTIFACT_NAME }} ${{ matrix.llvm }} --clean-after-build --debug 139 | 140 | echo "VCPKG_ROOT=$(pwd)/${{ env.ARTIFACT_NAME }}" >> $GITHUB_ENV 141 | echo "TARGET_TRIPLET=${{ matrix.target_arch }}-linux-rel" >> $GITHUB_ENV 142 | 143 | - name: Check space 144 | if: failure() 145 | run: | 146 | echo "## Space left" 147 | df -h 148 | echo "" 149 | echo "## Storage in working directory" 150 | du -hs * 151 | echo "" 152 | echo "## Storage in vcpkg" 153 | du -hs vcpkg/* 154 | echo "" 155 | echo "## Storage in nuget" 156 | du -hs ~/.nuget/* 157 | 158 | - name: Upload CMake logs on error 159 | if: failure() 160 | uses: actions/upload-artifact@v4 161 | with: 162 | name: ${{ env.ARTIFACT_NAME }}_logs 163 | path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log 164 | 165 | - name: Cleanup 166 | shell: 'bash' 167 | run: | 168 | echo "Space left" 169 | df -h 170 | 171 | echo "Cleaning up..." 172 | rm -rf vcpkg || true 173 | rm -rf ~/.nuget || true 174 | 175 | echo "Space left" 176 | df -h 177 | 178 | - name: 'Export Packages' 179 | if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release 180 | shell: 'bash' 181 | run: | 182 | apt-get update 183 | apt-get install -y pixz 184 | tar --use-compress-program pixz -cf "${{ env.ARTIFACT_NAME }}.tar.xz" ./${{ env.ARTIFACT_NAME }} 185 | 186 | - name: Publish Release Assets 187 | if: github.event.release 188 | uses: softprops/action-gh-release@v2 189 | with: 190 | files: ${{ env.ARTIFACT_NAME }}.tar.xz 191 | prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }} 192 | token: ${{ secrets.RELEASE_TOKEN }} 193 | 194 | - uses: actions/upload-artifact@v4 195 | if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release 196 | with: 197 | name: ${{ env.ARTIFACT_NAME }}.tar.xz 198 | path: ${{ env.ARTIFACT_NAME }}.tar.xz 199 | 200 | - name: Prepare ccache 201 | id: ccache_prep 202 | shell: bash 203 | run: | 204 | echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV 205 | echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV 206 | echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV 207 | echo "CMAKE_C_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV 208 | echo "CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV 209 | echo "timestamp=$(date +"%Y-%m-%d-%H:%M:%S" --utc)" >> ${GITHUB_OUTPUT} 210 | 211 | - name: ccache cache files 212 | uses: actions/cache@v4 213 | with: 214 | path: ${{ github.workspace }}/.ccache 215 | key: ccache-${{ matrix.image.name }}-${{ matrix.image.tag }}-${{ matrix.target_arch }}-${{ matrix.llvm }}-${{ steps.ccache_prep.outputs.timestamp }} 216 | restore-keys: | 217 | ccache-${{ matrix.image.name }}-${{ matrix.image.tag }}-${{ matrix.target_arch }}-${{ matrix.llvm }}- 218 | 219 | - name: ccache Initial stats 220 | shell: bash 221 | run: | 222 | ccache --show-stats 223 | 224 | - name: 'Rellic build' 225 | shell: 'bash' 226 | working-directory: rellic 227 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 228 | run: | 229 | # Does not compile with gcc 230 | export CC="$(which clang)" 231 | export CXX="$(which clang++)" 232 | cmake -G Ninja \ 233 | -DCMAKE_VERBOSE_MAKEFILE=ON \ 234 | "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ 235 | -DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ 236 | -DVCPKG_HOST_TRIPLET=${VCPKG_DEFAULT_HOST_TRIPLET} \ 237 | "-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ 238 | -S . -B build 239 | cmake --build build 240 | cmake --build build --target install 241 | - name: 'Rellic test' 242 | shell: 'bash' 243 | working-directory: rellic 244 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 245 | run: | 246 | cmake --build build --target test 247 | 248 | - name: 'Remill dependencies' 249 | shell: 'bash' 250 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 251 | working-directory: remill 252 | run: | 253 | python3 -m pip install poetry 254 | python3 -m pip install --user ./scripts/diff_tester_export_insns 255 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 256 | git config --global user.name "github-actions[bot]" 257 | 258 | - name: 'Remill build' 259 | shell: 'bash' 260 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 261 | working-directory: remill 262 | run: | 263 | cmake -G Ninja \ 264 | -DCMAKE_VERBOSE_MAKEFILE=ON \ 265 | "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ 266 | -DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ 267 | -DVCPKG_HOST_TRIPLET=${VCPKG_DEFAULT_HOST_TRIPLET} \ 268 | "-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ 269 | -S . -B build 270 | cmake --build build 271 | cmake --install build 272 | cmake --build build --target test_dependencies 273 | - name: 'Remill test' 274 | shell: 'bash' 275 | working-directory: remill/build 276 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 277 | run: | 278 | # Some tests fail on ubuntu 22.04 279 | env CTEST_OUTPUT_ON_FAILURE=1 ctest . || true 280 | 281 | - name: 'Anvill build' 282 | shell: 'bash' 283 | working-directory: anvill 284 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 285 | run: | 286 | # TODO: Does not support compilation with gcc 287 | export CC="$(which clang)" 288 | export CXX="$(which clang++)" 289 | 290 | cmake -G Ninja \ 291 | -DCMAKE_VERBOSE_MAKEFILE=ON \ 292 | "-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ 293 | "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ 294 | -DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ 295 | -DVCPKG_HOST_TRIPLET=${VCPKG_DEFAULT_HOST_TRIPLET} \ 296 | -DANVILL_ENABLE_TESTS=true \ 297 | -DANVILL_ENABLE_INSTALL=true \ 298 | -DANVILL_ENABLE_PYTHON3_LIBS=OFF \ 299 | "-Dremill_DIR=$(pwd)/../remill/install/lib/cmake/remill" \ 300 | "-Dsleigh_DIR=$(pwd)/../remill/install/lib/cmake/sleigh" \ 301 | -S . -B build 302 | cmake --build build 303 | cmake --install build 304 | - name: 'Anvill test' 305 | shell: 'bash' 306 | working-directory: anvill 307 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 308 | run: | 309 | cmake --build build --target test 310 | 311 | - name: Cache cleanup and reporting 312 | shell: 'bash' 313 | run: | 314 | rm -rf vcpkg/{buildtrees,installed,packages} 315 | ccache --show-stats 316 | df -h 317 | -------------------------------------------------------------------------------- /.github/workflows/vcpkg_ci_mac.yml: -------------------------------------------------------------------------------- 1 | name: MacOS Continuous Integration 2 | 3 | env: 4 | # "Source" is set in the setup-dotnet action 5 | VCPKG_BINARY_SOURCES: 'clear;nuget,Source,readwrite;nugettimeout,3601' 6 | VCPKG_DEFAULT_HOST_TRIPLET: 'x64-osx-rel' 7 | 8 | on: 9 | release: 10 | types: 11 | - published 12 | pull_request: 13 | paths-ignore: 14 | - 'docker/**' 15 | - '.github/**' 16 | - '**.md' 17 | - '!.github/workflows/vcpkg_ci_mac.yml' 18 | push: 19 | paths-ignore: 20 | - 'docker/**' 21 | - '.github/**' 22 | - '**.md' 23 | - '!.github/workflows/vcpkg_ci_mac.yml' 24 | tags-ignore: 25 | - 'v*' 26 | branches: 27 | - 'master' 28 | 29 | concurrency: 30 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 31 | cancel-in-progress: true 32 | 33 | jobs: 34 | build: 35 | strategy: 36 | fail-fast: false 37 | matrix: 38 | os: 39 | - { runner: 'macos-13', xcode: '15.0' } 40 | llvm: [ 41 | 'llvm-16', 42 | 'llvm-17', 43 | 'llvm-17[liftingbits-llvm]' 44 | ] 45 | target_arch: [ 'x64', 'arm64' ] 46 | 47 | runs-on: ${{ matrix.os.runner }} 48 | 49 | steps: 50 | - name: Set Artifact Name 51 | run: | 52 | # Need to fix because paths with brackets cause issues 53 | NAME="$(echo 'vcpkg_${{ matrix.os.runner }}_${{ matrix.llvm }}_xcode-${{ matrix.os.xcode }}_${{ matrix.target_arch == 'x64' && 'amd64' || matrix.target_arch }}' | tr '[' '-' | tr -d ']')" 54 | echo "ARTIFACT_NAME=${NAME}" >> "$GITHUB_ENV" 55 | 56 | - uses: actions/checkout@v4 57 | with: 58 | submodules: recursive 59 | fetch-depth: 2 60 | 61 | # Used to get commit message since PRs are on a merge commit 62 | - name: Get commit message 63 | run: | 64 | echo 'COMMIT_MESSAGE<> "$GITHUB_ENV" 65 | if [[ '${{ github.event_name }}' == 'push' ]]; then 66 | echo "$(git log --format=%B -n 1 HEAD)" >> "$GITHUB_ENV" 67 | elif [[ '${{ github.event_name }}' == 'pull_request' ]]; then 68 | echo "$(git log --format=%B -n 1 HEAD^2)" >> "$GITHUB_ENV" 69 | fi 70 | echo "EOF" >> "$GITHUB_ENV" 71 | 72 | - uses: actions/setup-dotnet@v4 73 | with: 74 | dotnet-version: '3.1.x' # SDK Version to use. 75 | # Sets as "Source" 76 | source-url: https://nuget.pkg.github.com/lifting-bits/index.json 77 | env: 78 | NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 79 | 80 | - name: Select the XCode version 81 | run: | 82 | echo "Selecting XCode Version ${{ matrix.os.xcode }}" 83 | sudo xcode-select -s /Applications/Xcode_${{ matrix.os.xcode }}.app/Contents/Developer 84 | 85 | - name: Initialize vcpkg 86 | shell: bash 87 | run: | 88 | { read -r vcpkg_repo_url && read -r vcpkg_commit; } <./vcpkg_info.txt || exit 1 89 | git clone "${vcpkg_repo_url}" 90 | git -C vcpkg checkout "${vcpkg_commit}" 91 | export VCPKG_DISABLE_METRICS=1 92 | ./vcpkg/bootstrap-vcpkg.sh 93 | echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV 94 | 95 | - name: 'vcpkg install dependencies' 96 | shell: 'bash' 97 | run: | 98 | export VCPKG_DISABLE_METRICS=1 99 | brew install bash ninja cmake 100 | 101 | # Setup NuGet authentication 102 | mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" setapikey \ 103 | -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ 104 | "${{ secrets.GITHUB_TOKEN }}" 105 | 106 | ./build_dependencies.sh --release --target-arch ${{ matrix.target_arch }} --export-dir ./${{ env.ARTIFACT_NAME }} ${{ matrix.llvm }} --clean-after-build --debug 107 | 108 | echo "VCPKG_ROOT=$(pwd)/${{ env.ARTIFACT_NAME }}" >> $GITHUB_ENV 109 | echo "TARGET_TRIPLET=${{ matrix.target_arch }}-osx-rel" >> $GITHUB_ENV 110 | 111 | - name: Upload CMake logs on error 112 | if: failure() 113 | uses: actions/upload-artifact@v4 114 | with: 115 | name: ${{ env.ARTIFACT_NAME }}_logs 116 | path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log 117 | 118 | - name: 'Adhoc codesign' 119 | shell: 'bash' 120 | run: | 121 | find ./${{ env.ARTIFACT_NAME }} \( -path '**/bin/*' -or -path '**/libexec/*' -or -path '**/tools/*' \) -type f -perm +111 -exec codesign --force -s - \{\} \; 122 | 123 | - name: 'Export Packages' 124 | if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release 125 | shell: 'bash' 126 | run: | 127 | brew install pixz 128 | tar --use-compress-program pixz -cf "${{ env.ARTIFACT_NAME }}.tar.xz" ./${{ env.ARTIFACT_NAME }} 129 | 130 | - name: Publish Release Assets 131 | if: github.event.release 132 | uses: softprops/action-gh-release@v2 133 | with: 134 | files: ${{ env.ARTIFACT_NAME }}.tar.xz 135 | prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }} 136 | token: ${{ secrets.RELEASE_TOKEN }} 137 | 138 | - uses: actions/upload-artifact@v4 139 | if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release 140 | with: 141 | name: ${{ env.ARTIFACT_NAME }}.tar.xz 142 | path: ${{ env.ARTIFACT_NAME }}.tar.xz 143 | 144 | - name: 'Install build dependencies' 145 | shell: 'bash' 146 | run: | 147 | brew install ninja ccache 148 | 149 | - name: Prepare ccache 150 | id: ccache_prep 151 | shell: bash 152 | run: | 153 | echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV 154 | echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV 155 | echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV 156 | echo "CMAKE_C_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV 157 | echo "CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV 158 | echo "timestamp=$(python -c 'from datetime import datetime; print(datetime.utcnow().strftime("%Y-%m-%d-%H:%M:%S"))')" >> ${GITHUB_OUTPUT} 159 | 160 | - name: ccache cache files 161 | uses: actions/cache@v4 162 | with: 163 | path: ${{ github.workspace }}/.ccache 164 | key: ccache-${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}-${{ matrix.target_arch }}-${{ steps.ccache_prep.outputs.timestamp }} 165 | restore-keys: | 166 | ccache-${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}-$${{ matrix.target_arch }} 167 | 168 | - name: ccache Initial stats 169 | shell: bash 170 | run: | 171 | ccache --show-stats 172 | 173 | - name: 'Rellic build' 174 | shell: 'bash' 175 | working-directory: rellic 176 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 177 | run: | 178 | cmake -G Ninja \ 179 | -DCMAKE_VERBOSE_MAKEFILE=ON \ 180 | "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ 181 | -DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ 182 | -DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \ 183 | -DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \ 184 | "-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ 185 | -S . -B build 186 | cmake --build build 187 | cmake --install build 188 | - name: 'Rellic test' 189 | shell: 'bash' 190 | working-directory: rellic 191 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 192 | run: | 193 | cmake --build build --target test 194 | 195 | - name: 'Remill dependencies' 196 | shell: 'bash' 197 | working-directory: remill 198 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 199 | run: | 200 | python3 -m pip install poetry 201 | python3 -m pip install --user ./scripts/diff_tester_export_insns 202 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 203 | git config --global user.name "github-actions[bot]" 204 | 205 | - name: 'Remill build' 206 | shell: 'bash' 207 | working-directory: remill 208 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 209 | run: | 210 | cmake -G Ninja \ 211 | -DCMAKE_VERBOSE_MAKEFILE=ON \ 212 | "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ 213 | -DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ 214 | -DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \ 215 | -DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \ 216 | "-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ 217 | -S . -B build 218 | cmake --build build 219 | cmake --install build 220 | cmake --build build --target test_dependencies 221 | - name: 'Remill test' 222 | shell: 'bash' 223 | working-directory: remill/build 224 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 225 | run: | 226 | # Only run test on x64 227 | env CTEST_OUTPUT_ON_FAILURE=1 ctest . 228 | 229 | - name: 'Anvill build' 230 | shell: 'bash' 231 | working-directory: anvill 232 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 233 | run: | 234 | cmake -G Ninja \ 235 | -DCMAKE_VERBOSE_MAKEFILE=ON \ 236 | "-DCMAKE_INSTALL_PREFIX=$(pwd)/install" \ 237 | "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" \ 238 | -DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET} \ 239 | -DVCPKG_HOST_TRIPLET=${TARGET_TRIPLET} \ 240 | -DCMAKE_OSX_ARCHITECTURES=${{ matrix.target_arch == 'x64' && 'x86_64' || matrix.target_arch }} \ 241 | -DANVILL_ENABLE_TESTS=true \ 242 | -DANVILL_ENABLE_INSTALL=true \ 243 | -DANVILL_ENABLE_PYTHON3_LIBS=OFF \ 244 | "-Dremill_DIR=$(pwd)/../remill/install/lib/cmake/remill" \ 245 | "-Dsleigh_DIR=$(pwd)/../remill/install/lib/cmake/sleigh" \ 246 | -S . -B build 247 | cmake --build build 248 | cmake --install build 249 | - name: 'Anvill test' 250 | shell: 'bash' 251 | working-directory: anvill 252 | if: matrix.target_arch == 'x64' && startswith(matrix.llvm, 'llvm-16') 253 | run: | 254 | cmake --build build --target test 255 | 256 | - name: Cache cleanup and reporting 257 | shell: 'bash' 258 | run: | 259 | rm -rf vcpkg/{buildtrees,installed,packages} 260 | ccache --show-stats 261 | -------------------------------------------------------------------------------- /.github/workflows/vcpkg_ci_windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows Continuous Integration 2 | 3 | env: 4 | # "Source" is set in the setup-dotnet action 5 | VCPKG_BINARY_SOURCES: 'clear;nuget,Source,readwrite;nugettimeout,3601' 6 | TRIPLET: 'x64-windows-static-md-rel' 7 | VCPKG_DEFAULT_HOST_TRIPLET: 'x64-windows-static-md-rel' 8 | 9 | on: 10 | release: 11 | types: 12 | - published 13 | pull_request: 14 | paths-ignore: 15 | - 'docker/**' 16 | - '.github/**' 17 | - '**.md' 18 | - 'old/**' 19 | - '!.github/workflows/vcpkg_ci_windows.yml' 20 | push: 21 | paths-ignore: 22 | - 'docker/**' 23 | - '.github/**' 24 | - '**.md' 25 | - 'old/**' 26 | - '!.github/workflows/vcpkg_ci_windows.yml' 27 | tags-ignore: 28 | - 'v*' 29 | branches: 30 | - 'master' 31 | 32 | concurrency: 33 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 34 | cancel-in-progress: true 35 | 36 | jobs: 37 | build: 38 | strategy: 39 | fail-fast: false 40 | matrix: 41 | llvm: [ 42 | 'llvm-15', 43 | 'llvm-16' 44 | ] 45 | 46 | runs-on: ['self-hosted', 'Windows', 'X64'] 47 | 48 | env: 49 | ARTIFACT_NAME: vcpkg_windows-vs2019_${{ matrix.llvm }}_amd64 50 | 51 | steps: 52 | - uses: actions/checkout@v4 53 | with: 54 | ref: ${{ github.event.after }} 55 | submodules: false 56 | - name: Get commit message 57 | run: | 58 | Add-Content -Path $env:GITHUB_ENV -Encoding UTF8 -Value 'COMMIT_MESSAGE<> ${GITHUB_OUTPUT} 80 | echo "commit=${vcpkg_commit}" >> ${GITHUB_OUTPUT} 81 | 82 | # Setup Visual Studio Dev Environment (x64, default version/toolset) 83 | - uses: ilammy/msvc-dev-cmd@v1.13.0 84 | 85 | - name: Clear prior vcpkg directory 86 | run: | 87 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "${{ github.workspace }}\vcpkg" 88 | Add-Content -Path $env:GITHUB_ENV -Encoding UTF8 -Value 'VCPKG_ROOT=${{ github.workspace }}\vcpkg' 89 | 90 | - name: 'Checkout and Bootstrap vcpkg' 91 | run: | 92 | git clone ${{ steps.vcpkg_info.outputs.repo_url }} "${env:VCPKG_ROOT}" 93 | git -C "${env:VCPKG_ROOT}" checkout ${{ steps.vcpkg_info.outputs.commit }} 94 | & "${env:VCPKG_ROOT}\bootstrap-vcpkg.bat" 95 | env: 96 | VCPKG_DISABLE_METRICS: 1 97 | 98 | # Omit this step if using manifests 99 | - name: 'vcpkg install dependencies' 100 | env: 101 | VCPKG_DISABLE_METRICS: 1 102 | run: | 103 | # Setup NuGet authentication 104 | & "$(& "${env:VCPKG_ROOT}\vcpkg.exe" fetch nuget | select -last 1)" setapikey ` 105 | -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" ` 106 | "${{ secrets.GITHUB_TOKEN }}" 107 | 108 | & "${env:VCPKG_ROOT}\vcpkg.exe" install ` 109 | --triplet "${env:TRIPLET}" ` 110 | --debug ` 111 | ${{ matrix.llvm }} ` 112 | "@overlays.txt" ` 113 | "@dependencies.txt" 114 | 115 | - name: 'Export Packages' 116 | if: contains(env.COMMIT_MESSAGE, 'debug artifacts') || github.event.release 117 | run: | 118 | & "${env:VCPKG_ROOT}\vcpkg.exe" export ` 119 | --x-all-installed ` 120 | --debug ` 121 | "@overlays.txt" ` 122 | --7zip ` 123 | --output=${{ env.ARTIFACT_NAME }} 124 | 125 | - name: Publish Release Assets 126 | if: github.event.release 127 | uses: softprops/action-gh-release@v2 128 | with: 129 | files: ${{ env.ARTIFACT_NAME }} 130 | prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }} 131 | token: ${{ secrets.RELEASE_TOKEN }} 132 | 133 | - uses: actions/upload-artifact@v4 134 | if: contains(env.COMMIT_MESSAGE, 'debug artifacts') 135 | with: 136 | name: ${{ env.ARTIFACT_NAME }}.7z 137 | path: ${{ env.VCPKG_ROOT }}/${{ env.ARTIFACT_NAME }}.7z 138 | 139 | - name: 'Test rellic build' 140 | if: ${{ matrix.llvm == 'llvm-15' }} 141 | run: | 142 | cd rellic 143 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue .\build 144 | New-Item -Path .\build -ItemType Directory 145 | cd build 146 | cmake -T ClangCl ` 147 | -DCMAKE_VERBOSE_MAKEFILE=ON ` 148 | -DVCPKG_ROOT="${env:VCPKG_ROOT}" ` 149 | -DCMAKE_INSTALL_PREFIX="$(pwd)\install" ` 150 | .. 151 | cmake --build . --config Release -j 152 | cmake --build . --config Release --target install 153 | 154 | # TODO Testing on Windows 155 | # python ../scripts/roundtrip.py ( Get-ChildItem tools | Where-Object {$_.name -match "rellic-decomp.exe"} ) ..\tests\tools\decomp "${env:VCPKG_ROOT}\installed\${env:TRIPLET}\tools\${{ matrix.llvm }}\clang.exe" 156 | 157 | - name: 'Test remill build' 158 | run: | 159 | cd remill 160 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue .\build 161 | New-Item -Path .\build -ItemType Directory 162 | cd build 163 | cmake -T ClangCl ` 164 | -DCMAKE_VERBOSE_MAKEFILE=ON ` 165 | -DVCPKG_ROOT="${env:VCPKG_ROOT}" ` 166 | -DCMAKE_INSTALL_PREFIX="$(pwd)\install" ` 167 | .. 168 | cmake --build . --config Release -j 169 | cmake --build . --config Release --target install 170 | 171 | & ( Get-ChildItem install\bin | Where-Object {$_.name -match "remill-lift-.*.exe"} ) --arch amd64 --ir_out CON --bytes c704ba01000000 172 | & ( Get-ChildItem install\bin | Where-Object {$_.name -match "remill-lift-.*.exe"} ) --arch aarch64 --ir_out CON --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6 173 | & ( Get-ChildItem install\bin | Where-Object {$_.name -match "remill-lift-.*.exe"} ) --arch aarch32 -ir_out CON --bytes 0cd04de208008de504108de500208de508309de504009de500109de5903122e0c20fa0e110109fe5001091e5002081e5040081e50cd08de21eff2fe14000000000000000 174 | 175 | # TODO Testing with CMake on Windows 176 | # cmake --build . --target test_dependencies 177 | # env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test || true 178 | 179 | - name: 'Anvill build' 180 | if: ${{ matrix.llvm == 'llvm-15' }} 181 | run: | 182 | cd anvill 183 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue .\build 184 | New-Item -Path .\build -ItemType Directory 185 | cd build 186 | cmake -T ClangCl ` 187 | -DCMAKE_VERBOSE_MAKEFILE=ON ` 188 | -DCMAKE_INSTALL_PREFIX="$(pwd)\install" ` 189 | -DVCPKG_ROOT="${env:VCPKG_ROOT}" ` 190 | -DANVILL_ENABLE_INSTALL_TARGET=ON ` 191 | -DANVILL_ENABLE_PYTHON3_LIBS=OFF ` 192 | -Dremill_DIR="$(pwd)\..\..\remill\build\install\lib\cmake\remill" ` 193 | .. 194 | cmake --build . --config Release -j 195 | cmake --build . --config Release --target install 196 | 197 | & ( Get-ChildItem install\bin | Where-Object {$_.name -match "anvill-decompile-json.exe"} ) -spec ..\bin\Decompile\tests\specs\ret0.json -bc_out ret0.bc -ir_out ret0.ir 198 | 199 | - name: Cache cleanup 200 | run: | 201 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "${env:VCPKG_ROOT}\buildtrees" 202 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "${env:VCPKG_ROOT}\installed" 203 | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "${env:VCPKG_ROOT}\packages" 204 | -------------------------------------------------------------------------------- /.github/workflows/vcpkg_docker.yml: -------------------------------------------------------------------------------- 1 | name: Docker Build Images 2 | 3 | # Based on https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners 4 | 5 | on: 6 | schedule: 7 | # Once every Wednesday at 00:00 8 | - cron: '0 0 * * 3' 9 | push: 10 | branches: 11 | - master 12 | paths: 13 | - 'docker/**' 14 | - '.github/workflows/vcpkg_docker.yml' 15 | pull_request: 16 | paths: 17 | - 'docker/**' 18 | - '.github/workflows/vcpkg_docker.yml' 19 | 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | build: 26 | runs-on: ubuntu-latest 27 | env: 28 | # This needs to be the same as in the `merge` job 29 | # Also remember to change the 'docker/build.sh' script 30 | REGISTRY_IMAGE: ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-v2 31 | strategy: 32 | fail-fast: false 33 | matrix: 34 | platform: 35 | - linux/amd64 36 | - linux/arm64 37 | ubuntu_version: 38 | - 22.04 39 | - 24.04 40 | steps: 41 | - name: Prepare 42 | run: | 43 | platform="${{ matrix.platform }}" 44 | echo "PLATFORM_PAIR=${platform//\//-}" >> "${GITHUB_ENV}" 45 | 46 | - name: Checkout 47 | uses: actions/checkout@v4 48 | 49 | - name: Set up QEMU 50 | uses: docker/setup-qemu-action@v3 51 | 52 | - name: Set up Docker Buildx 53 | uses: docker/setup-buildx-action@v3 54 | 55 | - name: Login to GHCR 56 | uses: docker/login-action@v3 57 | with: 58 | registry: ghcr.io 59 | username: ${{ github.repository_owner }} 60 | password: ${{ secrets.GITHUB_TOKEN }} 61 | 62 | # BEGIN Copied to the next job 63 | - name: Generate Tag 64 | env: 65 | BRANCH_NAME: ${{ github.head_ref || github.ref_name }} 66 | run: | 67 | test_tag="" 68 | if [[ "${GITHUB_REF}" != "refs/heads/${{ github.event.repository.default_branch }}" ]] ; then 69 | test_tag="test-${BRANCH_NAME////_}-" 70 | fi 71 | echo "TEST_TAG=${test_tag}" >> "${GITHUB_ENV}" 72 | 73 | - name: Docker meta 74 | id: meta 75 | uses: docker/metadata-action@v5 76 | with: 77 | images: ${{ env.REGISTERY_IMAGE }} 78 | flavor: | 79 | latest=false 80 | tags: | 81 | type=raw,value=${{ env.TEST_TAG }}${{ matrix.ubuntu_version }} 82 | # END Copied to the next job 83 | 84 | - name: Build and push by digest 85 | id: build 86 | uses: docker/build-push-action@v5 87 | with: 88 | context: docker 89 | file: docker/Dockerfile.ubuntu.vcpkg 90 | platforms: ${{ matrix.platform }} 91 | labels: ${{ steps.meta.outputs.labels }} 92 | outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true 93 | 94 | - name: Export digest 95 | run: | 96 | mkdir -p /tmp/digests 97 | digest="${{ steps.build.outputs.digest }}" 98 | touch "/tmp/digests/${digest#sha256:}" 99 | 100 | - name: Upload digest 101 | uses: actions/upload-artifact@v4 102 | with: 103 | name: digests-${{ matrix.ubuntu_version }}-${{ env.PLATFORM_PAIR }} 104 | path: /tmp/digests/* 105 | if-no-files-found: error 106 | retention-days: 1 107 | 108 | merge: 109 | runs-on: ubuntu-latest 110 | needs: 111 | - build 112 | env: 113 | # This needs to be the same as in the `build` job 114 | REGISTRY_IMAGE: ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-v2 115 | strategy: 116 | fail-fast: false 117 | matrix: 118 | ubuntu_version: 119 | - 22.04 120 | - 24.04 121 | steps: 122 | - name: Download digests 123 | uses: actions/download-artifact@v4 124 | with: 125 | path: /tmp/digests 126 | pattern: digests-${{ matrix.ubuntu_version }}-* 127 | merge-multiple: true 128 | 129 | - name: Set up Docker Buildx 130 | uses: docker/setup-buildx-action@v3 131 | 132 | - name: Login to GHCR 133 | uses: docker/login-action@v3 134 | with: 135 | registry: ghcr.io 136 | username: ${{ github.repository_owner }} 137 | password: ${{ secrets.GITHUB_TOKEN }} 138 | 139 | # BEGIN Copied to the previous job 140 | - name: Generate Tag 141 | env: 142 | BRANCH_NAME: ${{ github.head_ref || github.ref_name }} 143 | run: | 144 | test_tag="" 145 | if [[ "${GITHUB_REF}" != "refs/heads/${{ github.event.repository.default_branch }}" ]] ; then 146 | test_tag="test-${BRANCH_NAME////_}-" 147 | fi 148 | echo "TEST_TAG=${test_tag}" >> "${GITHUB_ENV}" 149 | 150 | - name: Docker meta 151 | id: meta 152 | uses: docker/metadata-action@v5 153 | with: 154 | images: ${{ env.REGISTRY_IMAGE }} 155 | flavor: | 156 | latest=false 157 | tags: | 158 | type=raw,value=${{ env.TEST_TAG }}${{ matrix.ubuntu_version }} 159 | # END Copied from the previous job 160 | 161 | - name: Create manifest list and push 162 | working-directory: /tmp/digests 163 | run: | 164 | docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ 165 | $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) 166 | 167 | - name: Inspect image 168 | run: | 169 | docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} 170 | -------------------------------------------------------------------------------- /.github/workflows/vcpkg_release.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | tags: 4 | - 'v*' 5 | 6 | name: release 7 | 8 | jobs: 9 | release: 10 | name: Publish Release on GitHub 11 | runs-on: ubuntu-22.04 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Create Release 15 | id: create_release 16 | uses: softprops/action-gh-release@v2 17 | with: 18 | prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }} 19 | token: ${{ secrets.RELEASE_TOKEN }} 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vcpkg 2 | 3 | /old/build 4 | /old/repository 5 | /old/sources 6 | /old/temp 7 | *.pyc 8 | .vscode 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "remill"] 2 | path = remill 3 | url = https://github.com/lifting-bits/remill.git 4 | branch = master 5 | [submodule "anvill"] 6 | path = anvill 7 | url = https://github.com/lifting-bits/anvill.git 8 | branch = master 9 | [submodule "rellic"] 10 | path = rellic 11 | url = https://github.com/lifting-bits/rellic.git 12 | branch = master 13 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @ekilmer @Ninja3047 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VCPKG Ports for lifting-bits C/C++ projects 2 | 3 | Curated dependencies that are compatible with the [lifting-bits](https://github.com/lifting-bits) tools. 4 | 5 | ## Pre-built 6 | 7 | Every [release](https://github.com/lifting-bits/cxx-common/releases), we publish compressed archives of the pre-built dependencies built by [vcpkg](https://github.com/microsoft/vcpkg) with the CMake `Release` build type. 8 | 9 | We only officially support and test the libraries built for the OSs that appear in CI. If an OS or architecture is not listed in a release, please open an issue so that we can track potential support. 10 | 11 | To use the dependencies, just download the compressed file and decompress it. The resulting directory _does not require_ installation of anything other than a C++ compiler and recent version of CMake to use with a project. 12 | 13 | For example: 14 | 15 | ```bash 16 | curl -LO https://github.com/lifting-bits/cxx-common/releases/latest/download/vcpkg_ubuntu-22.04_llvm-16_amd64.tar.xz 17 | tar -xJf vcpkg_ubuntu-22.04_llvm-16_amd64.tar.xz 18 | ``` 19 | 20 | Will produce a directory, and then you'll have to set the following during your CMake configure command to use these dependencies! 21 | 22 | ```text 23 | -DCMAKE_TOOLCHAIN_FILE="<...>/vcpkg_ubuntu-22.04_llvm-16_amd64/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-linux-rel 24 | ``` 25 | 26 | Replace `x64-linux-rel` with `x64-osx-rel` if using the macOS pre-built download. 27 | 28 | ## Building from source 29 | 30 | If you aren't running a supported operating system, or you want to have dependencies with a build type other than `Release`, you can build everything from source using the `./build_dependencies.sh` script (pass `--help` to see available options). 31 | 32 | By default, the script will install the dependencies listed in [`dependencies.txt`](./dependencies.txt), which doesn't include an LLVM version, so passing an `llvm-16` string as an argument will actually be passed to [`vcpkg install`](https://github.com/microsoft/vcpkg/blob/master/docs/examples/installing-and-using-packages.md#install). Any other strings not matching the script's own options are also passed to the `vcpkg install` command. Furthermore, without specifying any other build script options, vcpkg determine determine the best triplet for your operating system, which means building _both_ `Debug` and `Release` build types (see the [vcpkg triplet docs](https://github.com/microsoft/vcpkg/blob/master/docs/users/triplets.md) for more info). 33 | 34 | You can customize the features that a particular package is built with by specifying the feature name between brackets, i.e. `llvm-16[target-all]` (build all target backends), to ensure non-default features are also installed along with all default features. The list of features can be found in the target port's `vcpkg.json` file. Please read the [vcpkg docs](https://github.com/microsoft/vcpkg/blob/master/docs/users/selecting-library-features.md#installing-additional-features) for more information about specifying additional features. 35 | 36 | ```bash 37 | ./build_dependencies.sh llvm-16 38 | ``` 39 | 40 | Note that vcpkg will use binary caching to store built dependency packages (usually at `~/.cache/vcpkg` or manually set with environment variable `VCPKG_DEFAULT_BINARY_CACHE`) so that upon reinstallation/rebuilding (re-running the script) you likely won't have to rebuild everything from scratch, unless the package itself has been updated, you are using a different vcpkg triplet, your compiler has been changed/update, or any of the vcpkg scripts have changed (updated vcpkg repo). If you'd like to turn off [binary caching](https://github.com/microsoft/vcpkg/blob/master/docs/users/binarycaching.md) (not recommended), then you can either pass `--no-binarycaching` to the build script after the main options listed in or add `-binarycaching` to the `VCPKG_FEATURE_FLAGS` environment variable. 41 | 42 | **ATTENTION**: If you are having issues it is best to start fresh. Delete all of the created `vcpkg` directory. If you have binary caching on and nothing has changed, then you should be able to quickly reuse your previously built dependencies. 43 | 44 | ### Export Directories 45 | 46 | Passing `--export-dir ` to the `./build_dependencies.sh` script, you can install the chosen dependencies in a separate directory. Otherwise, the built dependencies will be stored within the vcpkg repo directory itself (`vcpkg/installed` relative path if in the root of this repo). Separate export directories are required to keep track of different LLVM versions, since they cannot coexist within the same export (read: installation) directory. 47 | 48 | ```bash 49 | ./build_dependencies.sh --export-dir vcpkg-llvm-16-install llvm-16 50 | ``` 51 | 52 | will build all of the dependencies listed in `dependencies.txt` _and_ LLVM 15 and install into a local directory named `vcpkg-llvm-16-install`. 53 | 54 | Furthermore, you are able to install additional dependencies into an existing exported directory created by this script by setting the `--export-dir ` to the same path: 55 | 56 | ```bash 57 | ./build_dependencies.sh --release --export-dir "<...>/vcpkg_ubuntu-22.04_llvm-16_amd64" spdlog 58 | ``` 59 | 60 | When reusing the pre-built export directory downloaded from GitHub, you must specify `--release` (see the 'Debug and Release Builds' section below) to build only release binaries. You cannot use dependencies from different triplets. 61 | 62 | ### Debug and Release Builds 63 | 64 | To build both debug and release versions with llvm-16, just run the following 65 | 66 | ```bash 67 | ./build_dependencies.sh llvm-16 68 | ``` 69 | 70 | The script will be verbose about what it is doing and will clone the correct version of vcpkg (found in `vcpkg_info.txt`) and build everything in the `vcpkg` directory in the root of this repo. 71 | 72 | At the end it will print how to use the library: 73 | 74 | ```bash 75 | $ ./build_dependencies.sh --export-dir example-export-dir 76 | ... 77 | [+] Set the following in your CMake configure command to use these dependencies! 78 | [+] -DCMAKE_TOOLCHAIN_FILE="/Users/ekilmer/src/cxx-common/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-osx -DVCPKG_HOST_TRIPLET=x64-osx 79 | ``` 80 | 81 | ## Just release builds 82 | 83 | If you don't want to compile a debug version of the tools, just pass `--release` to the script. 84 | 85 | ```bash 86 | $ ./build_dependencies.sh --release llvm-16 87 | ... 88 | [+] Set the following in your CMake configure command to use these dependencies! 89 | [+] -DCMAKE_TOOLCHAIN_FILE="/Users/ekilmer/src/cxx-common/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-osx-rel -DVCPKG_HOST_TRIPLET=x64-osx-rel 90 | ``` 91 | 92 | ### Address Sanitizer 93 | 94 | :warning: **Not tested on all vcpkg packages.** Open an issue if a tool's dependency cannot be built with sanitizers. 95 | 96 | There is experimental support for compiling dependencies with address sanitizer using the `*-asan` suffix for `osx` and `linux` triplets. 97 | 98 | These dependencies can be built with the script by passing `--asan` to the script, and it should work whether building only Release or both Debug and Release: 99 | 100 | ```bash 101 | ./build_dependencies.sh [--release] --asan llvm-16 102 | ``` 103 | 104 | Just because your dependencies were built with a sanitizer, you'll still need to manually add support for sanitizer usage within your own project. A quick and dirty way involves specifying the extra compilation flags during CMake configure: 105 | 106 | ```bash 107 | $ cmake \ 108 | -DVCPKG_ROOT="" \ 109 | -DVCPKG_TARGET_TRIPLET=x64-linux-rel-asan \ 110 | -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections" \ 111 | -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections" \ 112 | -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" \ 113 | -DCMAKE_SHARED_LINKER_FLAGS="-fsanitize=address" \ 114 | -DCMAKE_STATIC_LINKER_FLAGS="-fsanitize=address" \ 115 | -DCMAKE_MODULE_LINKER_FLAGS="-fsanitize=address" \ 116 | ... 117 | ``` 118 | 119 | **NOTE:** it is important to specify the `VCPKG_TARGET_TRIPLET` based on what platform and build configuration was used while compiling your dependencies with the sanitizers (look for the usage message that the script outputs at the end). 120 | 121 | ## Dependency Versioning 122 | 123 | The version of each dependency is influenced by the git checkout of vcpkg, contained in `vcpkg_info.txt`. Currently, the only way to upgrade is to push the commit in that file up, **_or_** to create (likely copy) a port definition for the required version and place it in our local `ports` ([overlay](https://github.com/microsoft/vcpkg/blob/master/docs/specifications/ports-overlay.md)) directory. While we do support multiple LLVM versions, it is not easy or well-supported (yet) to have different versions installed simultaneously. 124 | 125 | See [the vcpkg docs](https://github.com/microsoft/vcpkg/blob/master/docs/examples/packaging-github-repos.md) for how to package a new library. 126 | 127 | ### Updating Dependencies 128 | 129 | Installing additional dependencies will not update any existing dependencies by default. We do not update/upgrade by default because this could cause unexpected rebuilds that could potentially take hours (in the case of LLVM). To update dependencies, pass the `--upgrade-ports` option to the build script along with the respective options affecting vcpkg triplet selection (like `--release`). 130 | 131 | You must specify the exact package/ports you want to upgrade. If the port does not exist, this will fail. 132 | 133 | ## Useful manual vcpkg commands 134 | 135 | Sometimes it is useful to run vcpkg commands manually for testing a single package. Ideally, someone who wants to do this would read the [vcpkg documentation](https://github.com/microsoft/vcpkg/tree/master/docs), but below we list some commonly used commands. Inspecting the output of the build script will also show all of the vcpkg commands executed. 136 | 137 | The following commands should be run from the root of this repo, and they do not apply if you have downloaded pre-built packages. 138 | 139 | ### Installing 140 | 141 | Remember, you must know the triplet you would like to build with if you are using an existing installation after running the build script. 142 | 143 | ```sh 144 | ./vcpkg/vcpkg install --triplet=x64-osx-rel @overlays.txt --debug grpc --x-install-root=<...>/installed 145 | ``` 146 | 147 | This command will 148 | * `install` the `grpc` package 149 | * using the `x64-osx-rel` triplet to only build x86-64 Release builds for Mac 150 | * in the context of `@overlays.txt`, which sets up vcpkg package paths using normal vcpkg commands (look at the file if you're interested) 151 | * tell vcpkg to print out `--debug` information 152 | * and use the `install-root` of `<...>/installed` where `<...>` is a path to your export directory or the local `vcpkg` repo. 153 | 154 | ### Uninstalling 155 | 156 | Remember, you must know the triplet you would like to build with if you are using an existing installation after running the build script. 157 | 158 | ```sh 159 | ./vcpkg/vcpkg remove --triplet=x64-osx-rel @overlays.txt --debug grpc --x-install-root=<...>/installed 160 | ``` 161 | 162 | This command will do similar things as the above command, except it will `remove` the package from the installation directory instead of installing. 163 | 164 | ## LICENSING 165 | 166 | This repo is under the Apache-2.0 LICENSE, unless where specified. See below. 167 | 168 | The LLVM version port directories (ports/llvm-{15,16}) were initially copied from the upstream [vcpkg](https://github.com/microsoft/vcpkg) repo as a starting point. Eventually, we plan to submit the relevant patches for upstream when we have thoroughly tested these changes. More info can be found in the respective `LICENSE` and `NOTICE` files in those directories. 169 | -------------------------------------------------------------------------------- /build_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | function msg { 5 | echo "[+]" "$@" 6 | } 7 | 8 | function die { 9 | echo "[!]" "$@" 10 | exit 1 11 | } 12 | 13 | function Help 14 | { 15 | echo "Usage: ./build_dependencies.sh [--release] [--target-arch ARCH] [--asan] [--upgrade-ports] [--export-dir DIR] [...]" 16 | echo "" 17 | echo "Options:" 18 | echo " --verbose" 19 | echo " Print more verbose information from vcpkg during installation" 20 | echo " --release" 21 | echo " Build only release versions with triplet as detected in" 22 | echo " this script" 23 | echo " --target-arch " 24 | echo " Override target triplet architecture for cross compilation" 25 | echo " --asan" 26 | echo " Build with ASAN triplet as detected in this script" 27 | echo " --upgrade-ports" 28 | echo " Upgrade any outdated packages in the chosen install/export" 29 | echo " directory. Warning, this could cause long rebuild times if your" 30 | echo " compiler has changed or your installation directory hasn't been" 31 | echo " updated in a while." 32 | echo " --export-dir " 33 | echo " Export built dependencies to directory path" 34 | echo " [...]" 35 | echo " Extra args to pass to 'vcpkg install'. Like LLVM version," 36 | echo " other ports, vcpkg-specific options, etc." 37 | } 38 | 39 | if [[ -n "${VCPKG_ROOT+unset}" ]]; then 40 | unset VCPKG_ROOT 41 | fi 42 | 43 | RELEASE="false" 44 | ASAN="false" 45 | EXPORT_DIR="" 46 | UPGRADE_PORTS="false" 47 | VCPKG_ARGS=() 48 | while [[ $# -gt 0 ]] ; do 49 | key="$1" 50 | 51 | case $key in 52 | -h|--help) 53 | Help 54 | exit 0 55 | ;; 56 | --verbose) 57 | VCPKG_ARGS+=("--debug") 58 | ;; 59 | --upgrade-ports) 60 | UPGRADE_PORTS="true" 61 | msg "Upgrading any outdated ports" 62 | ;; 63 | --release) 64 | RELEASE="true" 65 | msg "Building Release-only binaries" 66 | ;; 67 | --target-arch) 68 | shift 69 | TARGET_ARCH=${1} 70 | ;; 71 | --asan) 72 | ASAN="true" 73 | msg "Building ASAN binaries" 74 | ;; 75 | --export-dir) 76 | EXPORT_DIR=$(python3 -c "import os; import sys; sys.stdout.write(os.path.abspath('${2}'))") 77 | echo "[+] Exporting to directory ${EXPORT_DIR}" 78 | shift # past argument 79 | ;; 80 | *) 81 | VCPKG_ARGS+=("$1") 82 | esac 83 | shift 84 | done 85 | msg "Passing extra args to vcpkg:" 86 | msg " " "${VCPKG_ARGS[@]}" 87 | 88 | function die_if_not_installed { 89 | if ! type "$1" &>/dev/null; then 90 | die "Please install the package providing [${1}] command for your OS" 91 | fi 92 | } 93 | 94 | for pkg in git zip unzip cmake python3 curl tar pkg-config 95 | do 96 | die_if_not_installed ${pkg} 97 | done 98 | 99 | if [[ "$(uname -m)" = "aarch64" ]]; then 100 | export VCPKG_FORCE_SYSTEM_BINARIES=1 101 | fi 102 | 103 | # Disable metrics upload to Microsoft 104 | export VCPKG_DISABLE_METRICS=1 105 | 106 | msg "Building dependencies from source" 107 | 108 | target_triplet="" 109 | extra_vcpkg_args=() 110 | extra_cmake_usage_args=() 111 | 112 | # System triplet info 113 | os="$(uname -s)" 114 | arch="$(uname -m)" 115 | # default to linux on amd64 116 | triplet_os="linux" 117 | triplet_arch="x64" 118 | 119 | if [[ "${arch}" = "aarch64" || "${arch}" = "arm64" ]]; then 120 | triplet_arch="arm64" 121 | elif [[ "${arch}" = "x86_64" ]]; then 122 | triplet_arch="x64" 123 | else 124 | die "Unknown system architecture: ${arch}" 125 | fi 126 | 127 | if [[ "${os}" = "Linux" ]]; then 128 | msg "Detected Linux OS" 129 | triplet_os="linux" 130 | elif [[ "${os}" = "Darwin" ]]; then 131 | msg "Detected Darwin OS" 132 | triplet_os="osx" 133 | else 134 | die "Could not detect OS. OS detection required for release-only builds." 135 | fi 136 | 137 | host_triplet="${triplet_arch}-${triplet_os}-rel" 138 | if [[ -n ${TARGET_ARCH+unset} ]]; then 139 | triplet_arch=${TARGET_ARCH} 140 | fi 141 | target_triplet="${triplet_arch}-${triplet_os}" 142 | 143 | # Build-Type triplet 144 | if [[ ${RELEASE} == "true" ]]; then 145 | msg "Only building release versions" 146 | target_triplet="${target_triplet}-rel" 147 | else 148 | msg "Building Release and Debug versions" 149 | fi 150 | 151 | # ASAN triplet 152 | if [[ ${ASAN} == "true" ]]; then 153 | msg "Building with asan" 154 | target_triplet="${target_triplet}-asan" 155 | fi 156 | 157 | repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 158 | vcpkg_dir=${repo_dir:?}/vcpkg 159 | 160 | if [[ -z ${EXPORT_DIR} ]]; then 161 | # Set default export directory variable. Used for printing end message 162 | EXPORT_DIR=${vcpkg_dir} 163 | fi 164 | 165 | extra_vcpkg_args+=("--triplet=${target_triplet}" "--host-triplet=${host_triplet}" "--x-install-root=${EXPORT_DIR}/installed") 166 | 167 | extra_cmake_usage_args+=("-DVCPKG_TARGET_TRIPLET=${target_triplet}" "-DVCPKG_HOST_TRIPLET=${host_triplet}") 168 | 169 | repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 170 | vcpkg_info_file="${repo_dir}/vcpkg_info.txt" 171 | 172 | # Read vcpkg cloning info 173 | { read -r vcpkg_repo_url && read -r vcpkg_commit; } <"${vcpkg_info_file}" || die "line ${LINENO}: Could not parse vcpkg info file '${vcpkg_info_file}'" 174 | 175 | msg "Using vcpkg repo URL '${vcpkg_repo_url}'" 176 | msg "Using vcpkg commit '${vcpkg_commit}'" 177 | 178 | if [ ! -d "${vcpkg_dir}" ]; then 179 | msg "Cloning to '${vcpkg_dir}'" 180 | git clone https://github.com/microsoft/vcpkg.git "${vcpkg_dir}" 181 | fi 182 | 183 | ( 184 | cd "${vcpkg_dir}" && git remote set-url origin "${vcpkg_repo_url}" && git fetch origin && git checkout "${vcpkg_commit}" 185 | ) 186 | 187 | msg "Boostrapping vcpkg" 188 | ( 189 | set -x 190 | if command -v ccache &> /dev/null 191 | then 192 | export "CMAKE_C_COMPILER_LAUNCHER=$(which ccache)" 193 | export "CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)" 194 | fi 195 | 196 | "${vcpkg_dir}/bootstrap-vcpkg.sh" 197 | ) 198 | 199 | # Copy required buildsystem scripts to export directory (this is what the 200 | # `vcpkg export` command does). 201 | # See the following `export_integration_files` function for the list of files. 202 | # This should be updated when that is updated. 203 | # https://github.com/microsoft/vcpkg-tool/blob/1533e9db90da0571e29e7ef85c7d5343c7fb7616/src/vcpkg/export.cpp#L259-L279 204 | if [[ "${EXPORT_DIR}" != "${vcpkg_dir}" ]]; then 205 | msg "Copying required vcpkg files to export directory" 206 | mkdir -p "${EXPORT_DIR}" 207 | touch "${EXPORT_DIR}/.vcpkg-root" 208 | integration_files=( 209 | "scripts/buildsystems/msbuild/applocal.ps1" 210 | "scripts/buildsystems/msbuild/vcpkg.targets" 211 | "scripts/buildsystems/msbuild/vcpkg.props" 212 | "scripts/buildsystems/msbuild/vcpkg-general.xml" 213 | "scripts/buildsystems/osx/applocal.py" 214 | "scripts/buildsystems/vcpkg.cmake" 215 | "scripts/cmake/vcpkg_get_windows_sdk.cmake" 216 | ) 217 | for f in "${integration_files[@]}" 218 | do 219 | cmake -E copy_if_different "${vcpkg_dir}/${f}" "${EXPORT_DIR}/${f}" 220 | done 221 | fi 222 | 223 | msg "Building dependencies" 224 | msg "Passing extra args to 'vcpkg install':" 225 | msg " " "${VCPKG_ARGS[@]}" 226 | 227 | overlays=() 228 | if [ -f "${repo_dir}/overlays.txt" ] ; then 229 | readarray -t overlays < <(cat "${repo_dir}/overlays.txt") 230 | fi 231 | 232 | # Check if we should upgrade ports 233 | if [[ ${UPGRADE_PORTS} == "true" ]]; then 234 | echo "" 235 | msg "Checking and upgrading outdated ports" 236 | ( 237 | cd "${repo_dir}" 238 | ( 239 | set -x 240 | "${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" "${overlays[@]}" --allow-unsupported "${VCPKG_ARGS[@]}" || true 241 | 242 | set +x 243 | read -p "Are you sure? If so, enter 'y' " -n 1 -r 244 | echo "" 245 | if [[ $REPLY =~ ^[Yy]$ ]] 246 | then 247 | set -x 248 | "${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" "${overlays[@]}" --no-dry-run --allow-unsupported "${VCPKG_ARGS[@]}" || exit 1 249 | fi 250 | ) 251 | ) 252 | exit 0 253 | fi 254 | 255 | deps=() 256 | if [ -f "${repo_dir}/dependencies.txt" ] ; then 257 | readarray -t deps < <(cat "${repo_dir}/dependencies.txt") 258 | fi 259 | 260 | # Run the vcpkg installation of our packages 261 | ( 262 | cd "${repo_dir}" 263 | ( 264 | set -x 265 | 266 | "${vcpkg_dir}/vcpkg" install "${extra_vcpkg_args[@]}" "${overlays[@]}" "${deps[@]}" "${VCPKG_ARGS[@]}" 267 | ) 268 | ) || exit 1 269 | 270 | echo "" 271 | msg "Investigate the following directory to discover all packages available to you:" 272 | msg " ${EXPORT_DIR}/installed/vcpkg" 273 | echo "" 274 | msg "Set the following in your CMake configure command to use these dependencies!" 275 | msg " -DCMAKE_TOOLCHAIN_FILE=\"${EXPORT_DIR}/scripts/buildsystems/vcpkg.cmake\" ${extra_cmake_usage_args[*]}" 276 | 277 | if [[ "$(uname -m)" = "aarch64" ]]; then 278 | echo "" 279 | msg "On aarch64, you also need to set:" 280 | msg " export VCPKG_FORCE_SYSTEM_BINARIES=1" 281 | fi 282 | -------------------------------------------------------------------------------- /dependencies.txt: -------------------------------------------------------------------------------- 1 | xed 2 | z3 3 | glog 4 | re2c 5 | gtest 6 | gflags 7 | protobuf 8 | abseil 9 | grpc[codegen] 10 | flatbuffers 11 | roaring 12 | capnproto 13 | cpp-httplib 14 | re2 15 | zstd 16 | lz4 17 | doctest 18 | fmt 19 | spdlog 20 | sqlite3[fts5] 21 | -------------------------------------------------------------------------------- /docker/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /docker/Dockerfile.ubuntu.vcpkg: -------------------------------------------------------------------------------- 1 | ARG UBUNTU_VERSION=22.04 2 | ARG LLVM_VERSION=16 3 | 4 | FROM ubuntu:${UBUNTU_VERSION} as base 5 | ARG UBUNTU_VERSION 6 | ARG LLVM_VERSION 7 | 8 | # All build dependencies for vcpkg packages 9 | # First row is build dependencies for lifting tools 10 | # Second row is toolchain and build programs 11 | # Third row is vcpkg library build-time dependencies 12 | RUN export DEBIAN_FRONTEND=noninteractive && \ 13 | if [ "$(uname -m)" = "aarch64" ]; then dpkg --add-architecture armhf; fi && \ 14 | apt-get update && apt-get install --yes apt-utils && apt-get upgrade --yes && \ 15 | apt-get install --yes --no-install-recommends apt-transport-https software-properties-common gnupg ca-certificates wget && \ 16 | apt-add-repository ppa:git-core/ppa --yes && \ 17 | wget "https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1-linux-$(uname -m).sh" && \ 18 | /bin/bash cmake-*.sh --skip-license --prefix=/usr/local && rm cmake-*.sh && \ 19 | \ 20 | if [ "${UBUNTU_VERSION}" != "24.04" ] ; then \ 21 | wget https://apt.llvm.org/llvm.sh && \ 22 | chmod +x llvm.sh && \ 23 | ./llvm.sh ${LLVM_VERSION} clang lld ; \ 24 | fi && \ 25 | \ 26 | apt-get update && apt-get upgrade --yes && \ 27 | apt-get install --yes --no-install-recommends \ 28 | libtinfo-dev libzstd-dev python3-pip python3-setuptools \ 29 | build-essential binutils-multiarch g++ gcc clang lld clang-${LLVM_VERSION} lld-${LLVM_VERSION} ninja-build \ 30 | pixz xz-utils make rpm curl unzip tar git zip python3 pkg-config && \ 31 | apt-get install --yes --no-install-recommends \ 32 | $( [ "$(uname -m)" = "x86_64" ] && echo crossbuild-essential-i386 crossbuild-essential-arm64 linux-libc-dev-amd64-cross) \ 33 | "$( [ "$(uname -m)" = "aarch64" ] && echo "libstdc++-$(gcc -dumpversion | cut -f1 -d.)-dev:armhf")" && \ 34 | \ 35 | apt-get clean --yes && \ 36 | rm -rf /var/lib/apt/lists/* && \ 37 | \ 38 | cd ~ && mkdir build && cd build && \ 39 | curl -s https://api.github.com/repos/ccache/ccache/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i- -O - | tar -xz && \ 40 | cd ccache-ccache-* && \ 41 | cmake -S . -B build -G Ninja -DREDIS_STORAGE_BACKEND=OFF -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Release && \ 42 | cmake --build build --target install && \ 43 | cd .. && rm -rf ccache-ccache-* 44 | 45 | # Much heavier installation due to mono dependency for NuGet 46 | FROM base as caching 47 | RUN export DEBIAN_FRONTEND=noninteractive && \ 48 | apt-get update && \ 49 | apt-get install --yes mono-devel && \ 50 | apt-get clean --yes && \ 51 | rm -rf /var/lib/apt/lists/* 52 | -------------------------------------------------------------------------------- /docker/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | # Builds base images with all required dependencies to bootstrap vcpkg and 6 | # build vcpkg libraries as well as all lifting-bits tools 7 | 8 | # Ubuntu versions to build 9 | UBUNTU_VERSION_MATRIX=( "22.04" "24.04" ) 10 | 11 | for ubuntu_version in "${UBUNTU_VERSION_MATRIX[@]}"; do 12 | # Always pull from upstream 13 | docker pull "ubuntu:${ubuntu_version}" 14 | 15 | # Image identification. "v2" Image version is to identify big changes to the 16 | # build toolchain like LLVM version 17 | # Also remember to change the '.github/workflows/vcpkg_docker.yml' variable 18 | image="vcpkg-builder-ubuntu-v2" 19 | 20 | # Build 21 | docker build \ 22 | -f Dockerfile.ubuntu.vcpkg \ 23 | --no-cache \ 24 | --build-arg "UBUNTU_VERSION=${ubuntu_version}" \ 25 | -t "${image}:${ubuntu_version}" \ 26 | . 27 | done 28 | -------------------------------------------------------------------------------- /overlays.txt: -------------------------------------------------------------------------------- 1 | --overlay-ports=./ports 2 | --overlay-triplets=./triplets 3 | -------------------------------------------------------------------------------- /ports/glog/fix_cplusplus_macro.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index d145517..e8e1c90 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -669,6 +669,10 @@ if (CYGWIN OR WIN32) 6 | target_compile_definitions (glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES) 7 | endif (CYGWIN OR WIN32) 8 | 9 | +if ((MSVC) AND (MSVC_VERSION GREATER_EQUAL 1914)) 10 | + target_compile_options(glog INTERFACE "$<$>:/Zc:__cplusplus>") 11 | +endif() 12 | + 13 | if (WITH_CUSTOM_PREFIX) 14 | target_compile_definitions (glog PUBLIC GLOG_CUSTOM_PREFIX_SUPPORT) 15 | endif (WITH_CUSTOM_PREFIX) 16 | -------------------------------------------------------------------------------- /ports/glog/fix_crosscompile_symbolize.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index d314abe..d145517 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -450,6 +450,9 @@ endif (HAVE_CXX11_ATOMIC) 6 | 7 | if (WITH_SYMBOLIZE) 8 | if (WIN32 OR CYGWIN) 9 | + if(CMAKE_CROSSCOMPILING) 10 | + set(HAVE_SYMBOLIZE 0) 11 | + else() 12 | cmake_push_check_state (RESET) 13 | set (CMAKE_REQUIRED_LIBRARIES DbgHelp) 14 | 15 | @@ -480,6 +483,7 @@ if (WITH_SYMBOLIZE) 16 | ]=] HAVE_SYMBOLIZE) 17 | 18 | cmake_pop_check_state () 19 | + endif() 20 | 21 | if (HAVE_SYMBOLIZE) 22 | set (HAVE_STACKTRACE 1) 23 | -------------------------------------------------------------------------------- /ports/glog/fix_glog_CMAKE_MODULE_PATH.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 846b444..20441d1 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -1027,7 +1027,7 @@ write_basic_package_version_file ( 6 | 7 | export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake) 8 | export (PACKAGE glog) 9 | - 10 | +if(0) 11 | get_filename_component (_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) 12 | 13 | # Directory containing the find modules relative to the config install 14 | @@ -1063,6 +1063,7 @@ file (INSTALL 15 | " 16 | COMPONENT Development 17 | ) 18 | +endif() 19 | 20 | install (FILES 21 | ${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake 22 | diff --git a/glog-config.cmake.in b/glog-config.cmake.in 23 | index 5c5c9c0..31fac52 100644 24 | --- a/glog-config.cmake.in 25 | +++ b/glog-config.cmake.in 26 | @@ -5,7 +5,6 @@ endif (CMAKE_VERSION VERSION_LESS @glog_CMake_VERSION@) 27 | @PACKAGE_INIT@ 28 | 29 | include (CMakeFindDependencyMacro) 30 | -include (${CMAKE_CURRENT_LIST_DIR}/glog-modules.cmake) 31 | 32 | @gflags_DEPENDENCY@ 33 | @Unwind_DEPENDENCY@ 34 | -------------------------------------------------------------------------------- /ports/glog/fix_logstream_linker_error.patch: -------------------------------------------------------------------------------- 1 | From 674d45068454718433aa46a40bd553bcbb142f71 Mon Sep 17 00:00:00 2001 2 | From: Eric Kilmer 3 | Date: Tue, 16 May 2023 14:34:53 -0400 4 | Subject: [PATCH] logging: Prevent LogStream constructor from being discarded 5 | 6 | Fixes linker error reported in https://github.com/google/glog/issues/922 7 | --- 8 | src/glog/logging.h.in | 9 +++++++++ 9 | 1 file changed, 9 insertions(+) 10 | 11 | diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in 12 | index e8e6c41..ad25a65 100644 13 | --- a/src/glog/logging.h.in 14 | +++ b/src/glog/logging.h.in 15 | @@ -1344,6 +1344,15 @@ GLOG_MSVC_PUSH_DISABLE_WARNING(4275) 16 | class GLOG_EXPORT LogStream : public std::ostream { 17 | GLOG_MSVC_POP_WARNING() 18 | public: 19 | +#if defined __has_attribute 20 | +# if __has_attribute (used) 21 | + // In some cases, like when compiling glog as a static library with GCC and 22 | + // linking against a Clang-built executable, this constructor will be 23 | + // removed by the linker. We use this attribute to prevent the linker from 24 | + // discarding it. 25 | + __attribute__ ((used)) 26 | +# endif 27 | +#endif 28 | LogStream(char *buf, int len, int64 ctr) 29 | : std::ostream(NULL), 30 | streambuf_(buf, len), 31 | -- 32 | 2.40.1 33 | 34 | -------------------------------------------------------------------------------- /ports/glog/glog_disable_debug_postfix.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 20441d1..d314abe 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -65,7 +65,7 @@ set (CMAKE_CXX_VISIBILITY_PRESET hidden) 6 | set (CMAKE_POSITION_INDEPENDENT_CODE ON) 7 | set (CMAKE_VISIBILITY_INLINES_HIDDEN ON) 8 | 9 | -set (CMAKE_DEBUG_POSTFIX d) 10 | +#set (CMAKE_DEBUG_POSTFIX d) 11 | set (CMAKE_THREAD_PREFER_PTHREAD 1) 12 | 13 | find_package (GTest NO_MODULE) 14 | -------------------------------------------------------------------------------- /ports/glog/portfile.cmake: -------------------------------------------------------------------------------- 1 | vcpkg_from_github( 2 | OUT_SOURCE_PATH SOURCE_PATH 3 | REPO google/glog 4 | REF v0.6.0 5 | SHA512 fd2c42583d0dd72c790a8cf888f328a64447c5fb9d99b2e2a3833d70c102cb0eb9ae874632c2732424cc86216c8a076a3e24b23a793eaddb5da8a1dc52ba9226 6 | HEAD_REF master 7 | PATCHES 8 | fix_glog_CMAKE_MODULE_PATH.patch 9 | glog_disable_debug_postfix.patch 10 | fix_crosscompile_symbolize.patch 11 | fix_cplusplus_macro.patch 12 | fix_logstream_linker_error.patch 13 | ) 14 | 15 | vcpkg_check_features( 16 | OUT_FEATURE_OPTIONS FEATURE_OPTIONS 17 | FEATURES 18 | unwind WITH_UNWIND 19 | customprefix WITH_CUSTOM_PREFIX 20 | ) 21 | file(REMOVE "${SOURCE_PATH}/glog-modules.cmake.in") 22 | 23 | vcpkg_cmake_configure( 24 | SOURCE_PATH "${SOURCE_PATH}" 25 | OPTIONS 26 | -DBUILD_TESTING=OFF 27 | ${FEATURE_OPTIONS} 28 | ) 29 | 30 | vcpkg_cmake_install() 31 | vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/glog) 32 | 33 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") 34 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") 35 | 36 | vcpkg_copy_pdbs() 37 | vcpkg_fixup_pkgconfig() 38 | 39 | file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) 40 | -------------------------------------------------------------------------------- /ports/glog/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "glog", 3 | "version": "0.6.0", 4 | "port-version": 3, 5 | "description": "C++ implementation of the Google logging module", 6 | "homepage": "https://github.com/google/glog", 7 | "license": "BSD-3-Clause", 8 | "dependencies": [ 9 | "gflags", 10 | { 11 | "name": "vcpkg-cmake", 12 | "host": true 13 | }, 14 | { 15 | "name": "vcpkg-cmake-config", 16 | "host": true 17 | } 18 | ], 19 | "features": { 20 | "customprefix": { 21 | "description": "Enable support for user-generated message prefixes" 22 | }, 23 | "unwind": { 24 | "description": "Enable libunwind support", 25 | "supports": "linux" 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ports/llvm-16/0001-Fix-install-paths.patch: -------------------------------------------------------------------------------- 1 | diff --git a/openmp/tools/Modules/CMakeLists.txt b/openmp/tools/Modules/CMakeLists.txt 2 | index 22d818eea72d..75aacc4468d4 100644 3 | --- a/openmp/tools/Modules/CMakeLists.txt 4 | +++ b/openmp/tools/Modules/CMakeLists.txt 5 | @@ -12,4 +12,4 @@ 6 | 7 | 8 | install(FILES "FindOpenMPTarget.cmake" 9 | - DESTINATION "${OPENMP_INSTALL_LIBDIR}/cmake/openmp") 10 | + DESTINATION "share/openmp") 11 | -------------------------------------------------------------------------------- /ports/llvm-16/0006-Fix-libffi.patch: -------------------------------------------------------------------------------- 1 | llvm/cmake/modules/FindFFI.cmake | 2 +- 2 | 1 file changed, 1 insertion(+), 1 deletion(-) 3 | 4 | diff --git a/llvm/cmake/modules/FindFFI.cmake b/llvm/cmake/modules/FindFFI.cmake 5 | index b0d859af8959..a756d0c8fdb0 100644 6 | --- a/llvm/cmake/modules/FindFFI.cmake 7 | +++ b/llvm/cmake/modules/FindFFI.cmake 8 | @@ -34,7 +34,7 @@ else() 9 | endif() 10 | endif() 11 | 12 | -find_library(FFI_LIBRARIES ffi PATHS ${FFI_LIBRARY_DIR}) 13 | +find_library(FFI_LIBRARIES ffi libffi PATHS ${FFI_LIBRARY_DIR}) 14 | 15 | if(FFI_LIBRARIES) 16 | include(CMakePushCheckState) 17 | -------------------------------------------------------------------------------- /ports/llvm-16/0007-Fix-install-bolt.patch: -------------------------------------------------------------------------------- 1 | bolt/tools/driver/CMakeLists.txt | 7 ------- 2 | 1 file changed, 7 deletions(-) 3 | 4 | diff --git a/bolt/tools/driver/CMakeLists.txt b/bolt/tools/driver/CMakeLists.txt 5 | index e56be15dbcff..85b078e2e761 100644 6 | --- a/bolt/tools/driver/CMakeLists.txt 7 | +++ b/bolt/tools/driver/CMakeLists.txt 8 | @@ -35,13 +35,6 @@ set(BOLT_DEPENDS 9 | ) 10 | 11 | add_custom_target(bolt DEPENDS ${BOLT_DEPENDS}) 12 | -install(PROGRAMS 13 | - ${CMAKE_BINARY_DIR}/bin/llvm-bolt 14 | - ${CMAKE_BINARY_DIR}/bin/perf2bolt 15 | - ${CMAKE_BINARY_DIR}/bin/llvm-boltdiff 16 | - DESTINATION ${CMAKE_INSTALL_BINDIR} 17 | - COMPONENT bolt 18 | - ) 19 | add_llvm_install_targets(install-bolt DEPENDS bolt COMPONENT bolt) 20 | set_target_properties(bolt PROPERTIES FOLDER "BOLT") 21 | set_target_properties(install-bolt PROPERTIES FOLDER "BOLT") 22 | -------------------------------------------------------------------------------- /ports/llvm-16/0020-fix-FindZ3.cmake.patch: -------------------------------------------------------------------------------- 1 | diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake 2 | index 118b1eac3b32..455bbf28facc 100644 3 | --- a/llvm/cmake/modules/FindZ3.cmake 4 | +++ b/llvm/cmake/modules/FindZ3.cmake 5 | @@ -1,3 +1,22 @@ 6 | +# Try first to find Z3 using its upstream cmake files (included in newer version) 7 | +# unless the user has provided a hint that would assume skipping the CONFIG 8 | +# option 9 | +if (NOT DEFINED Z3_ROOT AND NOT LLVM_Z3_INSTALL_DIR) 10 | + find_package(Z3 QUIET CONFIG) 11 | +endif() 12 | + 13 | +# If we found with CONFIG mode, then set up the compatible variables 14 | +if (Z3_FOUND) 15 | + set(Z3_VERSION "${Z3_VERSION_STRING}") 16 | + set(Z3_LIBRARIES z3::libz3) 17 | + get_property(Z3_INCLUDE_DIR 18 | + TARGET z3::libz3 PROPERTY 19 | + INTERFACE_INCLUDE_DIRECTORIES 20 | + ) 21 | + find_package_handle_standard_args(Z3 CONFIG_MODE) 22 | + 23 | +else() 24 | + 25 | INCLUDE(CheckCXXSourceRuns) 26 | 27 | # Function to check Z3's version 28 | @@ -123,3 +142,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3 29 | VERSION_VAR Z3_VERSION_STRING) 30 | 31 | mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES) 32 | + 33 | +endif() 34 | -------------------------------------------------------------------------------- /ports/llvm-16/0021-fix-find_dependency.patch: -------------------------------------------------------------------------------- 1 | diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in 2 | index 2d90512bfb06..97aacd6f9c0f 100644 3 | --- a/llvm/cmake/modules/LLVMConfig.cmake.in 4 | +++ b/llvm/cmake/modules/LLVMConfig.cmake.in 5 | @@ -51,16 +51,18 @@ set(LLVM_ENABLE_ASSERTIONS @LLVM_ENABLE_ASSERTIONS@) 6 | 7 | set(LLVM_ENABLE_EH @LLVM_ENABLE_EH@) 8 | 9 | +include(CMakeFindDependencyMacro) 10 | + 11 | set(LLVM_ENABLE_FFI @LLVM_ENABLE_FFI@) 12 | if(LLVM_ENABLE_FFI) 13 | - find_package(FFI) 14 | + find_dependency(FFI) 15 | endif() 16 | 17 | set(LLVM_ENABLE_RTTI @LLVM_ENABLE_RTTI@) 18 | 19 | set(LLVM_ENABLE_TERMINFO @LLVM_ENABLE_TERMINFO@) 20 | if(LLVM_ENABLE_TERMINFO) 21 | - find_package(Terminfo) 22 | + find_dependency(Terminfo) 23 | endif() 24 | 25 | set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@) 26 | @@ -70,25 +72,28 @@ set(LLVM_ENABLE_UNWIND_TABLES @LLVM_ENABLE_UNWIND_TABLES@) 27 | set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@) 28 | if(LLVM_ENABLE_ZLIB) 29 | set(ZLIB_ROOT @ZLIB_ROOT@) 30 | - find_package(ZLIB) 31 | + find_dependency(ZLIB) 32 | endif() 33 | 34 | set(LLVM_ENABLE_ZSTD @LLVM_ENABLE_ZSTD@) 35 | if(LLVM_ENABLE_ZSTD) 36 | - find_package(zstd) 37 | + find_dependency(zstd) 38 | endif() 39 | 40 | set(LLVM_ENABLE_LIBXML2 @LLVM_ENABLE_LIBXML2@) 41 | if(LLVM_ENABLE_LIBXML2) 42 | - find_package(LibXml2) 43 | + find_dependency(LibXml2) 44 | endif() 45 | 46 | set(LLVM_ENABLE_CURL @LLVM_ENABLE_CURL@) 47 | if(LLVM_ENABLE_CURL) 48 | - find_package(CURL) 49 | + find_dependency(CURL) 50 | endif() 51 | 52 | set(LLVM_WITH_Z3 @LLVM_WITH_Z3@) 53 | +if(LLVM_WITH_Z3) 54 | + find_dependency(Z3 4.7.1) 55 | +endif() 56 | 57 | set(LLVM_ENABLE_DIA_SDK @LLVM_ENABLE_DIA_SDK@) 58 | 59 | -------------------------------------------------------------------------------- /ports/llvm-16/0026-fix-prefix-path-calc.patch: -------------------------------------------------------------------------------- 1 | diff --git a/cmake/Modules/FindPrefixFromConfig.cmake b/cmake/Modules/FindPrefixFromConfig.cmake 2 | index 22211e4b72f2..c83e99c21556 100644 3 | --- a/cmake/Modules/FindPrefixFromConfig.cmake 4 | +++ b/cmake/Modules/FindPrefixFromConfig.cmake 5 | @@ -39,7 +39,7 @@ function(find_prefix_from_config out_var prefix_var path_to_leave) 6 | # install prefix, and avoid hard-coding any absolute paths. 7 | set(config_code 8 | "# Compute the installation prefix from this LLVMConfig.cmake file location." 9 | - "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") 10 | + "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_DIR}\" PATH)") 11 | # Construct the proper number of get_filename_component(... PATH) 12 | # calls to compute the installation prefix. 13 | string(REGEX REPLACE "/" ";" _count "${path_to_leave}") 14 | -------------------------------------------------------------------------------- /ports/llvm-16/0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch: -------------------------------------------------------------------------------- 1 | From efcdeb698fe6a475d1eb0a8f4770ef974cefb0e1 Mon Sep 17 00:00:00 2001 2 | From: 2over12 3 | Date: Wed, 31 May 2023 08:57:45 -0400 4 | Subject: [PATCH] Do not attempt to find macro expansions if there is invalid 5 | source info for a decl 6 | 7 | --- 8 | clang/lib/AST/Expr.cpp | 4 ++++ 9 | 1 file changed, 4 insertions(+) 10 | 11 | diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp 12 | index e45ae68cd5fe..59a7d50d8ad3 100644 13 | --- a/clang/lib/AST/Expr.cpp 14 | +++ b/clang/lib/AST/Expr.cpp 15 | @@ -263,6 +263,10 @@ bool Expr::isFlexibleArrayMemberLike( 16 | TypeSourceInfo *TInfo = FD->getTypeSourceInfo(); 17 | while (TInfo) { 18 | TypeLoc TL = TInfo->getTypeLoc(); 19 | + if (TL.getSourceRange().isInvalid()) { 20 | + break; 21 | + } 22 | + 23 | // Look through typedefs. 24 | if (TypedefTypeLoc TTL = TL.getAsAdjusted()) { 25 | const TypedefNameDecl *TDL = TTL.getTypedefNameDecl(); 26 | -- 27 | 2.39.2 (Apple Git-143) 28 | 29 | -------------------------------------------------------------------------------- /ports/llvm-16/clang_usage: -------------------------------------------------------------------------------- 1 | The package clang provides CMake targets: 2 | 3 | find_package(Clang CONFIG REQUIRED) 4 | target_include_directories(main PRIVATE ${CLANG_INCLUDE_DIRS}) 5 | target_link_libraries(main PRIVATE clangBasic clangLex clangParse clangAST ...) 6 | -------------------------------------------------------------------------------- /ports/llvm-16/flang_usage: -------------------------------------------------------------------------------- 1 | The package flang provides CMake targets: 2 | 3 | find_package(Flang CONFIG REQUIRED) 4 | target_include_directories(main PRIVATE ${FLANG_INCLUDE_DIRS}) 5 | target_link_libraries(main PRIVATE flangFrontend flangFrontendTool ...) 6 | -------------------------------------------------------------------------------- /ports/llvm-16/lld_usage: -------------------------------------------------------------------------------- 1 | The package lld provides CMake targets: 2 | 3 | find_package(LLD CONFIG REQUIRED) 4 | target_include_directories(main PRIVATE ${LLD_INCLUDE_DIRS}) 5 | target_link_libraries(main PRIVATE lldCommon lldCore lldDriver ...) 6 | -------------------------------------------------------------------------------- /ports/llvm-16/llvm_usage: -------------------------------------------------------------------------------- 1 | The package llvm provides CMake targets: 2 | 3 | find_package(LLVM CONFIG REQUIRED) 4 | 5 | list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") 6 | include(HandleLLVMOptions) 7 | add_definitions(${LLVM_DEFINITIONS}) 8 | 9 | target_include_directories(main PRIVATE ${LLVM_INCLUDE_DIRS}) 10 | 11 | # Find the libraries that correspond to the LLVM components that we wish to use 12 | llvm_map_components_to_libnames(llvm_libs Support Core IRReader ...) 13 | 14 | # Link against LLVM libraries 15 | target_link_libraries(main PRIVATE ${llvm_libs}) 16 | -------------------------------------------------------------------------------- /ports/llvm-16/mlir_usage: -------------------------------------------------------------------------------- 1 | The package lld provides CMake targets: 2 | 3 | find_package(MLIR CONFIG REQUIRED) 4 | target_include_directories(main PRIVATE ${MLIR_INCLUDE_DIRS}) 5 | target_link_libraries(main PRIVATE MLIRIR MLIRParser MLIRPass MLIRSupport ...) 6 | -------------------------------------------------------------------------------- /ports/llvm-16/portfile.cmake: -------------------------------------------------------------------------------- 1 | set(LLVM_VERSION "16.0.5") 2 | 3 | vcpkg_check_linkage(ONLY_STATIC_LIBRARY) 4 | 5 | vcpkg_from_github( 6 | OUT_SOURCE_PATH SOURCE_PATH 7 | REPO llvm/llvm-project 8 | REF llvmorg-${LLVM_VERSION} 9 | SHA512 efa2c42ce1ecd86e8a62aac6e7b79f0993a7c772070156610bd444ac99e329f2886b2d2f3a6ffac7b124e5b2c41ad172ad22d7fbcf067a621d739efcd0816578 10 | HEAD_REF release/16.x 11 | PATCHES 12 | 0001-Fix-install-paths.patch 13 | 0006-Fix-libffi.patch 14 | 0007-Fix-install-bolt.patch 15 | 0020-fix-FindZ3.cmake.patch 16 | 0021-fix-find_dependency.patch 17 | 0026-fix-prefix-path-calc.patch 18 | 0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch 19 | ) 20 | 21 | string(REPLACE "." ";" VERSION_LIST ${LLVM_VERSION}) 22 | list(GET VERSION_LIST 0 LLVM_VERSION_MAJOR) 23 | list(GET VERSION_LIST 1 LLVM_VERSION_MINOR) 24 | list(GET VERSION_LIST 2 LLVM_VERSION_PATCH) 25 | # Remove anything after the first patch number (removes suffix like `-rc3`) 26 | if("${LLVM_VERSION_PATCH}" MATCHES "^([0-9]+).*") 27 | set(LLVM_VERSION_PATCH "${CMAKE_MATCH_1}") 28 | endif() 29 | 30 | vcpkg_check_features( 31 | OUT_FEATURE_OPTIONS FEATURE_OPTIONS 32 | FEATURES 33 | tools LLVM_BUILD_TOOLS 34 | tools LLVM_INCLUDE_TOOLS 35 | utils LLVM_BUILD_UTILS 36 | utils LLVM_INCLUDE_UTILS 37 | utils LLVM_INSTALL_UTILS 38 | enable-rtti LLVM_ENABLE_RTTI 39 | enable-ffi LLVM_ENABLE_FFI 40 | enable-terminfo LLVM_ENABLE_TERMINFO 41 | enable-threads LLVM_ENABLE_THREADS 42 | enable-ios COMPILER_RT_ENABLE_IOS 43 | enable-eh LLVM_ENABLE_EH 44 | enable-bindings LLVM_ENABLE_BINDINGS 45 | enable-z3 LLVM_ENABLE_Z3_SOLVER 46 | ) 47 | 48 | vcpkg_cmake_get_vars(cmake_vars_file) 49 | include("${cmake_vars_file}") 50 | 51 | # Linking with gold is better than /bin/ld 52 | # Linking with lld is better than gold 53 | # MacOS just has LLD, so only set explicit linker on Linux 54 | if(VCPKG_TARGET_IS_LINUX) 55 | # NOTE(ekilmer): This should probably be a vcpkg utility function 56 | file(READ "${CURRENT_BUILDTREES_DIR}/../detect_compiler/config-${TARGET_TRIPLET}-rel-err.log" _compiler_info) 57 | string(REGEX MATCH "#COMPILER_CXX_ID#([^\r\n]*)" _ ${_compiler_info}) 58 | set(VCPKG_DETECTED_CXX_COMPILER_ID ${CMAKE_MATCH_1}) 59 | # ENDNOTE 60 | 61 | message(STATUS "Detected Compiler ID: '${VCPKG_DETECTED_CXX_COMPILER_ID}'") 62 | if (VCPKG_DETECTED_CXX_COMPILER_ID MATCHES "Clang") 63 | list(APPEND FEATURE_OPTIONS 64 | -DLLVM_USE_LINKER=lld 65 | ) 66 | message(STATUS "Using lld for linking") 67 | # Use GNU Gold when building with not clang (likely, g++) 68 | else() 69 | list(APPEND FEATURE_OPTIONS 70 | -DLLVM_USE_LINKER=gold 71 | # Cross compiling to arm with gcc doesn't work naturally because gcc 72 | # has different executables for each architecture unlike clang, which 73 | # is a native crosscompilation toolchain 74 | "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:STRING=-DCMAKE_C_COMPILER=gcc\\;-DCMAKE_CXX_COMPILER=g++" 75 | ) 76 | message(STATUS "Using (default) gold linker for linking") 77 | endif() 78 | endif() 79 | 80 | if(VCPKG_USE_SANITIZER) 81 | list(APPEND FEATURE_OPTIONS 82 | -DLLVM_USE_SANITIZER=${VCPKG_USE_SANITIZER} 83 | ) 84 | endif() 85 | 86 | # LLVM generates CMake error due to Visual Studio version 16.4 is known to miscompile part of LLVM. 87 | # LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON disables this error. 88 | # See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html 89 | # and thread "[llvm-dev] Longstanding failing tests - clang-tidy, MachO, Polly" on llvm-dev Jan 21-23 2020. 90 | list(APPEND FEATURE_OPTIONS 91 | -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON 92 | ) 93 | 94 | # Force enable or disable external libraries 95 | set(llvm_external_libraries 96 | zlib 97 | zstd 98 | libxml2 99 | ) 100 | foreach(external_library IN LISTS llvm_external_libraries) 101 | string(TOLOWER "enable-${external_library}" feature_name) 102 | string(TOUPPER "LLVM_ENABLE_${external_library}" define_name) 103 | if(feature_name IN_LIST FEATURES) 104 | list(APPEND FEATURE_OPTIONS 105 | -D${define_name}=FORCE_ON 106 | ) 107 | else() 108 | list(APPEND FEATURE_OPTIONS 109 | -D${define_name}=OFF 110 | ) 111 | endif() 112 | endforeach() 113 | 114 | # By default assertions are enabled for Debug configuration only. 115 | if("enable-assertions" IN_LIST FEATURES) 116 | # Force enable assertions for all configurations. 117 | list(APPEND FEATURE_OPTIONS 118 | -DLLVM_ENABLE_ASSERTIONS=ON 119 | ) 120 | elseif("disable-assertions" IN_LIST FEATURES) 121 | # Force disable assertions for all configurations. 122 | list(APPEND FEATURE_OPTIONS 123 | -DLLVM_ENABLE_ASSERTIONS=OFF 124 | ) 125 | endif() 126 | 127 | # LLVM_ABI_BREAKING_CHECKS can be WITH_ASSERTS (default), FORCE_ON or FORCE_OFF. 128 | # By default in LLVM, abi-breaking checks are enabled if assertions are enabled. 129 | # however, this breaks linking with the debug versions, since the option is 130 | # baked into the header files; thus, we always turn off LLVM_ABI_BREAKING_CHECKS 131 | # unless the user asks for it 132 | if("enable-abi-breaking-checks" IN_LIST FEATURES) 133 | # Force enable abi-breaking checks. 134 | list(APPEND FEATURE_OPTIONS 135 | -DLLVM_ABI_BREAKING_CHECKS=FORCE_ON 136 | ) 137 | else() 138 | # Force disable abi-breaking checks. 139 | list(APPEND FEATURE_OPTIONS 140 | -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF 141 | ) 142 | endif() 143 | 144 | set(LLVM_ENABLE_PROJECTS) 145 | if("bolt" IN_LIST FEATURES) 146 | list(APPEND LLVM_ENABLE_PROJECTS "bolt") 147 | endif() 148 | if("clang" IN_LIST FEATURES OR "clang-tools-extra" IN_LIST FEATURES) 149 | list(APPEND LLVM_ENABLE_PROJECTS "clang") 150 | if("disable-clang-static-analyzer" IN_LIST FEATURES) 151 | list(APPEND FEATURE_OPTIONS 152 | # Disable ARCMT 153 | -DCLANG_ENABLE_ARCMT=OFF 154 | # Disable static analyzer 155 | -DCLANG_ENABLE_STATIC_ANALYZER=OFF 156 | ) 157 | endif() 158 | endif() 159 | if("clang-tools-extra" IN_LIST FEATURES) 160 | list(APPEND LLVM_ENABLE_PROJECTS "clang-tools-extra") 161 | endif() 162 | if("flang" IN_LIST FEATURES) 163 | if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") 164 | message(FATAL_ERROR "Building Flang with MSVC is not supported on x86. Disable it until issues are fixed.") 165 | endif() 166 | list(APPEND LLVM_ENABLE_PROJECTS "flang") 167 | list(APPEND FEATURE_OPTIONS 168 | # Flang requires C++17 169 | -DCMAKE_CXX_STANDARD=17 170 | ) 171 | endif() 172 | if("libclc" IN_LIST FEATURES) 173 | list(APPEND LLVM_ENABLE_PROJECTS "libclc") 174 | endif() 175 | if("lld" IN_LIST FEATURES) 176 | list(APPEND LLVM_ENABLE_PROJECTS "lld") 177 | endif() 178 | if("lldb" IN_LIST FEATURES) 179 | list(APPEND LLVM_ENABLE_PROJECTS "lldb") 180 | list(APPEND FEATURE_OPTIONS 181 | -DLLDB_ENABLE_CURSES=OFF 182 | ) 183 | endif() 184 | if("mlir" IN_LIST FEATURES) 185 | list(APPEND LLVM_ENABLE_PROJECTS "mlir") 186 | endif() 187 | if("openmp" IN_LIST FEATURES) 188 | list(APPEND LLVM_ENABLE_PROJECTS "openmp") 189 | # Perl is required for the OpenMP run-time 190 | vcpkg_find_acquire_program(PERL) 191 | get_filename_component(PERL_PATH ${PERL} DIRECTORY) 192 | vcpkg_add_to_path(${PERL_PATH}) 193 | # Skip post-build check 194 | set(VCPKG_POLICY_SKIP_DUMPBIN_CHECKS enabled) 195 | endif() 196 | if("polly" IN_LIST FEATURES) 197 | list(APPEND LLVM_ENABLE_PROJECTS "polly") 198 | endif() 199 | if("pstl" IN_LIST FEATURES) 200 | if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 201 | message(FATAL_ERROR "Building pstl with MSVC is not supported. Disable it until issues are fixed.") 202 | endif() 203 | list(APPEND LLVM_ENABLE_PROJECTS "pstl") 204 | endif() 205 | 206 | set(LLVM_ENABLE_RUNTIMES) 207 | if("libcxx" IN_LIST FEATURES) 208 | if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 209 | message(FATAL_ERROR "Building libcxx with MSVC is not supported, as cl doesn't support the #include_next extension.") 210 | endif() 211 | list(APPEND LLVM_ENABLE_RUNTIMES "libcxx") 212 | endif() 213 | if("libcxxabi" IN_LIST FEATURES) 214 | if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 215 | message(FATAL_ERROR "Building libcxxabi with MSVC is not supported. Disable it until issues are fixed.") 216 | endif() 217 | list(APPEND LLVM_ENABLE_RUNTIMES "libcxxabi") 218 | endif() 219 | if("compiler-rt" IN_LIST FEATURES) 220 | list(APPEND LLVM_ENABLE_RUNTIMES "compiler-rt") 221 | endif() 222 | if("libunwind" IN_LIST FEATURES) 223 | list(APPEND LLVM_ENABLE_RUNTIMES "libunwind") 224 | endif() 225 | 226 | # this is for normal targets 227 | set(known_llvm_targets 228 | AArch64 229 | AMDGPU 230 | ARM 231 | AVR 232 | BPF 233 | Hexagon 234 | Lanai 235 | Mips 236 | MSP430 237 | NVPTX 238 | PowerPC 239 | RISCV 240 | Sparc 241 | SystemZ 242 | VE 243 | WebAssembly 244 | X86 245 | XCore 246 | ) 247 | 248 | set(LLVM_TARGETS_TO_BUILD "") 249 | foreach(llvm_target IN LISTS known_llvm_targets) 250 | string(TOLOWER "target-${llvm_target}" feature_name) 251 | if(feature_name IN_LIST FEATURES) 252 | list(APPEND LLVM_TARGETS_TO_BUILD "${llvm_target}") 253 | endif() 254 | endforeach() 255 | 256 | # this is for experimental targets 257 | set(known_llvm_experimental_targets 258 | SPRIV 259 | ) 260 | 261 | set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "") 262 | foreach(llvm_target IN LISTS known_llvm_experimental_targets) 263 | string(TOLOWER "target-${llvm_target}" feature_name) 264 | if(feature_name IN_LIST FEATURES) 265 | list(APPEND LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "${llvm_target}") 266 | endif() 267 | endforeach() 268 | 269 | vcpkg_find_acquire_program(PYTHON3) 270 | get_filename_component(PYTHON3_DIR ${PYTHON3} DIRECTORY) 271 | vcpkg_add_to_path(${PYTHON3_DIR}) 272 | 273 | set(LLVM_LINK_JOBS 2) 274 | 275 | # Cross compilation 276 | if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") 277 | set(arch "aarch64") 278 | elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") 279 | set(arch "arm") 280 | elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") 281 | set(arch "x86_64") 282 | endif() 283 | if (VCPKG_TARGET_IS_OSX) 284 | set(LLVM_HOST_TRIPLE "${arch}-apple-darwin") 285 | elseif (VCPKG_TARGET_IS_LINUX) 286 | set(LLVM_HOST_TRIPLE "${arch}-linux-gnu") 287 | elseif (VCPKG_TARGET_IS_WINDOWS) 288 | set(LLVM_HOST_TRIPLE "${arch}-windows-msvc") 289 | else() 290 | message(WARNING "Could not determine LLVM Host triple") 291 | endif() 292 | list(APPEND OPTIONS "-DLLVM_HOST_TRIPLE=${LLVM_HOST_TRIPLE}") 293 | if("compiler-rt" IN_LIST FEATURES) 294 | list(APPEND OPTIONS "-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${LLVM_HOST_TRIPLE}") 295 | endif() 296 | message(STATUS "Default host triple '${LLVM_HOST_TRIPLE}'") 297 | 298 | if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") 299 | set(LLVM_TARGET_ARCH "AArch64") 300 | elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") 301 | set(LLVM_TARGET_ARCH "ARM") 302 | elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") 303 | set(LLVM_TARGET_ARCH "X86") 304 | else() 305 | message(FATAL_ERROR "Target Architecture not supported.") 306 | endif() 307 | 308 | vcpkg_cmake_configure( 309 | SOURCE_PATH ${SOURCE_PATH}/llvm 310 | OPTIONS 311 | ${FEATURE_OPTIONS} 312 | ${OPTIONS} 313 | -DLLVM_INCLUDE_EXAMPLES=OFF 314 | -DLLVM_BUILD_EXAMPLES=OFF 315 | -DLLVM_INCLUDE_DOCS=OFF 316 | -DLLVM_BUILD_DOCS=OFF 317 | -DLLVM_INCLUDE_TESTS=OFF 318 | -DLLVM_BUILD_TESTS=OFF 319 | -DLLVM_INCLUDE_BENCHMARKS=OFF 320 | -DLLVM_BUILD_BENCHMARKS=OFF 321 | "-DLLVM_TARGET_ARCH=${LLVM_TARGET_ARCH}" 322 | # Force TableGen to be built with optimization. This will significantly improve build time. 323 | -DLLVM_OPTIMIZED_TABLEGEN=ON 324 | "-DLLVM_ENABLE_PROJECTS=${LLVM_ENABLE_PROJECTS}" 325 | "-DLLVM_ENABLE_RUNTIMES=${LLVM_ENABLE_RUNTIMES}" 326 | "-DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}" 327 | "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}" 328 | -DPACKAGE_VERSION=${LLVM_VERSION} 329 | # Limit the maximum number of concurrent link jobs to 1. This should fix low amount of memory issue for link. 330 | "-DLLVM_PARALLEL_LINK_JOBS=${LLVM_LINK_JOBS}" 331 | -DCMAKE_INSTALL_PACKAGEDIR:STRING=share 332 | "-DRUNTIMES_CMAKE_ARGS=-DCMAKE_PREFIX_PATH=${CURRENT_INSTALLED_DIR}" 333 | ) 334 | 335 | vcpkg_cmake_install(ADD_BIN_TO_PATH) 336 | 337 | # 'package_name' should be the case of the package used in CMake 'find_package' 338 | # 'FEATURE_NAME' should be the name of the vcpkg port feature 339 | function(llvm_cmake_package_config_fixup package_name) 340 | cmake_parse_arguments("arg" "DO_NOT_DELETE_PARENT_CONFIG_PATH" "FEATURE_NAME" "" ${ARGN}) 341 | string(TOUPPER "${package_name}" upper_package) 342 | string(TOLOWER "${package_name}" lower_package) 343 | if(NOT DEFINED arg_FEATURE_NAME) 344 | set(arg_FEATURE_NAME ${lower_package}) 345 | endif() 346 | if("${lower_package}" STREQUAL "llvm" OR "${arg_FEATURE_NAME}" IN_LIST FEATURES) 347 | set(args) 348 | # Maintains case even if package_name name is case-sensitive 349 | list(APPEND args PACKAGE_NAME "${lower_package}") 350 | if(arg_DO_NOT_DELETE_PARENT_CONFIG_PATH) 351 | list(APPEND args "DO_NOT_DELETE_PARENT_CONFIG_PATH") 352 | endif() 353 | vcpkg_cmake_config_fixup(${args}) 354 | file(INSTALL "${SOURCE_PATH}/${lower_package}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${lower_package}" RENAME copyright) 355 | 356 | # Remove last parent directory 357 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${lower_package}/${package_name}Config.cmake" "get_filename_component(${upper_package}_INSTALL_PREFIX \"\${${upper_package}_INSTALL_PREFIX}\" PATH)\n\n" "\n") 358 | 359 | if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${lower_package}_usage") 360 | file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/${lower_package}_usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${lower_package}" RENAME usage) 361 | endif() 362 | endif() 363 | endfunction() 364 | 365 | llvm_cmake_package_config_fixup("Clang" DO_NOT_DELETE_PARENT_CONFIG_PATH) 366 | llvm_cmake_package_config_fixup("Flang" DO_NOT_DELETE_PARENT_CONFIG_PATH) 367 | llvm_cmake_package_config_fixup("LLD" DO_NOT_DELETE_PARENT_CONFIG_PATH) 368 | llvm_cmake_package_config_fixup("MLIR" DO_NOT_DELETE_PARENT_CONFIG_PATH) 369 | llvm_cmake_package_config_fixup("OpenMP" DO_NOT_DELETE_PARENT_CONFIG_PATH) 370 | llvm_cmake_package_config_fixup("Polly" DO_NOT_DELETE_PARENT_CONFIG_PATH) 371 | llvm_cmake_package_config_fixup("ParallelSTL" FEATURE_NAME "pstl" DO_NOT_DELETE_PARENT_CONFIG_PATH) 372 | llvm_cmake_package_config_fixup("LLVM") 373 | 374 | # Needed because we are doing versioned ports 375 | file(INSTALL "${SOURCE_PATH}/llvm/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) 376 | 377 | set(empty_dirs) 378 | 379 | if("clang-tools-extra" IN_LIST FEATURES) 380 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/clang-tidy/plugin") 381 | endif() 382 | 383 | if("flang" IN_LIST FEATURES) 384 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Config") 385 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/CMakeFiles") 386 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/CMakeFiles") 387 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/CodeGen/CMakeFiles") 388 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/Dialect/CMakeFiles") 389 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/Transforms/CMakeFiles") 390 | endif() 391 | 392 | if(empty_dirs) 393 | foreach(empty_dir IN LISTS empty_dirs) 394 | if(NOT EXISTS "${empty_dir}") 395 | message(SEND_ERROR "Directory '${empty_dir}' is not exist. Please remove it from the checking.") 396 | else() 397 | file(GLOB_RECURSE files_in_dir "${empty_dir}/*") 398 | if(files_in_dir) 399 | message(SEND_ERROR "Directory '${empty_dir}' is not empty. Please remove it from the checking.") 400 | else() 401 | file(REMOVE_RECURSE "${empty_dir}") 402 | endif() 403 | endif() 404 | endforeach() 405 | endif() 406 | 407 | if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") 408 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" 409 | "${CURRENT_PACKAGES_DIR}/debug/include" 410 | "${CURRENT_PACKAGES_DIR}/debug/share" 411 | "${CURRENT_PACKAGES_DIR}/debug/lib/clang" 412 | ) 413 | endif() 414 | 415 | # Use 'bin' instead of 'tools/llvm' 416 | file(GLOB_RECURSE release_targets 417 | "${CURRENT_PACKAGES_DIR}/share/*/*Targets-*.cmake" 418 | "${CURRENT_PACKAGES_DIR}/share/*/*Exports-*.cmake" 419 | ) 420 | foreach(release_target IN LISTS release_targets) 421 | file(READ "${release_target}" contents) 422 | string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" contents "${contents}") 423 | string(REGEX REPLACE 424 | "\\\${_IMPORT_PREFIX}/tools/llvm-16/([^ \"]+${EXECUTABLE_SUFFIX})" 425 | "\${_IMPORT_PREFIX}/bin/\\1" 426 | contents "${contents}") 427 | file(WRITE "${release_target}" "${contents}") 428 | endforeach() 429 | 430 | if("mlir" IN_LIST FEATURES) 431 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/mlir/MLIRConfig.cmake" "set(MLIR_MAIN_SRC_DIR \"${SOURCE_PATH}/mlir\")" "") 432 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/mlir/MLIRConfig.cmake" "${CURRENT_BUILDTREES_DIR}" "\${MLIR_INCLUDE_DIRS}") 433 | endif() 434 | 435 | # LLVM still generates a few DLLs in the static build: 436 | # * LLVM-C.dll 437 | # * libclang.dll 438 | # * LTO.dll 439 | # * Remarks.dll 440 | set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) 441 | -------------------------------------------------------------------------------- /ports/llvm-16/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "llvm-16", 3 | "version": "16.0.5", 4 | "description": "The LLVM Compiler Infrastructure.", 5 | "homepage": "https://llvm.org", 6 | "license": "Apache-2.0", 7 | "supports": "!uwp & !(arm & windows)", 8 | "dependencies": [ 9 | { 10 | "name": "vcpkg-cmake", 11 | "host": true 12 | }, 13 | { 14 | "name": "vcpkg-cmake-config", 15 | "host": true 16 | }, 17 | { 18 | "name": "vcpkg-cmake-get-vars", 19 | "host": true 20 | } 21 | ], 22 | "default-features": [ 23 | "clang", 24 | "compiler-rt", 25 | "cxx-common-targets", 26 | "default-options", 27 | "lld", 28 | "mlir", 29 | "tools", 30 | "utils" 31 | ], 32 | "features": { 33 | "bolt": { 34 | "description": "BOLT is a post-link optimizer developed to speed up large applications.", 35 | "dependencies": [ 36 | { 37 | "name": "llvm-16", 38 | "default-features": false, 39 | "features": [ 40 | "tools" 41 | ] 42 | } 43 | ] 44 | }, 45 | "clang": { 46 | "description": "Include C Language Family Front-end.", 47 | "dependencies": [ 48 | { 49 | "name": "llvm-16", 50 | "default-features": false, 51 | "features": [ 52 | "compiler-rt", 53 | "tools" 54 | ] 55 | } 56 | ] 57 | }, 58 | "clang-tools-extra": { 59 | "description": "Include Clang tools." 60 | }, 61 | "compiler-rt": { 62 | "description": "Include compiler's runtime libraries." 63 | }, 64 | "cxx-common-targets": { 65 | "description": "Build with cxx-common target set", 66 | "dependencies": [ 67 | { 68 | "name": "llvm-16", 69 | "default-features": false, 70 | "features": [ 71 | "target-aarch64", 72 | "target-arm", 73 | "target-nvptx", 74 | "target-sparc", 75 | "target-webassembly", 76 | "target-x86" 77 | ] 78 | } 79 | ] 80 | }, 81 | "default-options": { 82 | "description": "Build with default options.", 83 | "dependencies": [ 84 | { 85 | "name": "llvm-16", 86 | "default-features": false, 87 | "features": [ 88 | "enable-assertions", 89 | "enable-bindings", 90 | "enable-eh", 91 | "enable-threads", 92 | "enable-z3", 93 | "enable-zlib", 94 | "enable-zstd" 95 | ] 96 | } 97 | ] 98 | }, 99 | "default-targets": { 100 | "description": "Build with platform-specific default targets.", 101 | "dependencies": [ 102 | { 103 | "name": "llvm-16", 104 | "default-features": false, 105 | "features": [ 106 | "target-aarch64" 107 | ], 108 | "platform": "arm64" 109 | }, 110 | { 111 | "name": "llvm-16", 112 | "default-features": false, 113 | "features": [ 114 | "target-x86" 115 | ], 116 | "platform": "x86 | x64" 117 | }, 118 | { 119 | "name": "llvm-16", 120 | "default-features": false, 121 | "features": [ 122 | "target-arm" 123 | ], 124 | "platform": "arm & !arm64" 125 | }, 126 | { 127 | "name": "llvm-16", 128 | "default-features": false, 129 | "features": [ 130 | "target-all" 131 | ], 132 | "platform": "!x86 & !x64 & !arm & !arm64" 133 | } 134 | ] 135 | }, 136 | "disable-assertions": { 137 | "description": "Build LLVM without assertions." 138 | }, 139 | "disable-clang-static-analyzer": { 140 | "description": "Build without static analyzer." 141 | }, 142 | "enable-abi-breaking-checks": { 143 | "description": "Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON." 144 | }, 145 | "enable-assertions": { 146 | "description": "Build LLVM with assertions." 147 | }, 148 | "enable-bindings": { 149 | "description": "Build bindings." 150 | }, 151 | "enable-eh": { 152 | "description": "Build LLVM with exception handler.", 153 | "dependencies": [ 154 | { 155 | "name": "llvm-16", 156 | "default-features": false, 157 | "features": [ 158 | "enable-rtti" 159 | ] 160 | } 161 | ] 162 | }, 163 | "enable-ffi": { 164 | "description": "Build LLVM with FFI.", 165 | "dependencies": [ 166 | "libffi" 167 | ] 168 | }, 169 | "enable-ios": { 170 | "description": "Build compiler-rt for iOS SDK.", 171 | "dependencies": [ 172 | "target-arm" 173 | ] 174 | }, 175 | "enable-libxml2": { 176 | "description": "Build with LibXml2.", 177 | "dependencies": [ 178 | "libxml2" 179 | ] 180 | }, 181 | "enable-rtti": { 182 | "description": "Build LLVM with run-time type information." 183 | }, 184 | "enable-terminfo": { 185 | "description": "Use terminfo database if available." 186 | }, 187 | "enable-threads": { 188 | "description": "Use threads if available." 189 | }, 190 | "enable-z3": { 191 | "description": "Compile with Z3 SMT solver support for Clang static analyzer.", 192 | "dependencies": [ 193 | { 194 | "name": "llvm-16", 195 | "default-features": false, 196 | "features": [ 197 | "clang" 198 | ] 199 | }, 200 | "z3" 201 | ] 202 | }, 203 | "enable-zlib": { 204 | "description": "Build with ZLib.", 205 | "dependencies": [ 206 | "zlib" 207 | ] 208 | }, 209 | "enable-zstd": { 210 | "description": "Build with ZSTD.", 211 | "dependencies": [ 212 | "zstd" 213 | ] 214 | }, 215 | "flang": { 216 | "description": "Include Fortran front end.", 217 | "dependencies": [ 218 | { 219 | "name": "llvm-16", 220 | "default-features": false, 221 | "features": [ 222 | "clang", 223 | "mlir", 224 | "tools" 225 | ] 226 | } 227 | ] 228 | }, 229 | "libclc": { 230 | "description": "Include OpenCL library." 231 | }, 232 | "libcxx": { 233 | "description": "Include libcxx library.", 234 | "dependencies": [ 235 | { 236 | "name": "llvm-16", 237 | "default-features": false, 238 | "features": [ 239 | "libcxxabi" 240 | ] 241 | } 242 | ] 243 | }, 244 | "libcxxabi": { 245 | "description": "Include libcxxabi library." 246 | }, 247 | "libunwind": { 248 | "description": "Include libunwind library." 249 | }, 250 | "lld": { 251 | "description": "Include LLVM linker.", 252 | "dependencies": [ 253 | { 254 | "name": "llvm-16", 255 | "default-features": false, 256 | "features": [ 257 | "tools" 258 | ] 259 | } 260 | ] 261 | }, 262 | "lldb": { 263 | "description": "Include LLVM debugger.", 264 | "dependencies": [ 265 | { 266 | "name": "llvm-16", 267 | "default-features": false, 268 | "features": [ 269 | "tools" 270 | ] 271 | } 272 | ] 273 | }, 274 | "mlir": { 275 | "description": "Include MLIR (Multi-Level IR Compiler Framework) project.", 276 | "dependencies": [ 277 | { 278 | "name": "llvm-16", 279 | "default-features": false, 280 | "features": [ 281 | "tools" 282 | ] 283 | } 284 | ] 285 | }, 286 | "openmp": { 287 | "description": "Include LLVM OpenMP libraries.", 288 | "dependencies": [ 289 | { 290 | "name": "llvm-16", 291 | "default-features": false, 292 | "features": [ 293 | "utils" 294 | ] 295 | } 296 | ] 297 | }, 298 | "polly": { 299 | "description": "Include Polly (Polyhedral optimizations for LLVM) project.", 300 | "dependencies": [ 301 | { 302 | "name": "llvm-16", 303 | "default-features": false, 304 | "features": [ 305 | "tools", 306 | "utils" 307 | ] 308 | }, 309 | "target-ve" 310 | ] 311 | }, 312 | "pstl": { 313 | "description": "Include pstl (Parallel STL) library." 314 | }, 315 | "target-aarch64": { 316 | "description": "Build with AArch64 backend." 317 | }, 318 | "target-all": { 319 | "description": "Build with all backends.", 320 | "dependencies": [ 321 | { 322 | "name": "llvm-16", 323 | "default-features": false, 324 | "features": [ 325 | "target-aarch64", 326 | "target-amdgpu", 327 | "target-arm", 328 | "target-avr", 329 | "target-bpf", 330 | "target-hexagon", 331 | "target-lanai", 332 | "target-mips", 333 | "target-msp430", 334 | "target-nvptx", 335 | "target-powerpc", 336 | "target-riscv", 337 | "target-sparc", 338 | "target-spirv", 339 | "target-systemz", 340 | "target-ve", 341 | "target-webassembly", 342 | "target-x86", 343 | "target-xcore" 344 | ] 345 | } 346 | ] 347 | }, 348 | "target-amdgpu": { 349 | "description": "Build with AMDGPU backend." 350 | }, 351 | "target-arm": { 352 | "description": "Build with ARM backend." 353 | }, 354 | "target-avr": { 355 | "description": "Build with AVR backend." 356 | }, 357 | "target-bpf": { 358 | "description": "Build with BPF backend." 359 | }, 360 | "target-hexagon": { 361 | "description": "Build with Hexagon backend." 362 | }, 363 | "target-lanai": { 364 | "description": "Build with Lanai backend." 365 | }, 366 | "target-mips": { 367 | "description": "Build with Mips backend." 368 | }, 369 | "target-msp430": { 370 | "description": "Build with MSP430 backend." 371 | }, 372 | "target-nvptx": { 373 | "description": "Build with NVPTX backend." 374 | }, 375 | "target-powerpc": { 376 | "description": "Build with PowerPC backend." 377 | }, 378 | "target-riscv": { 379 | "description": "Build with RISC-V backend." 380 | }, 381 | "target-sparc": { 382 | "description": "Build with Sparc backend." 383 | }, 384 | "target-spirv": { 385 | "description": "Build with Spriv backend." 386 | }, 387 | "target-systemz": { 388 | "description": "Build with SystemZ backend." 389 | }, 390 | "target-ve": { 391 | "description": "Build with VE backend." 392 | }, 393 | "target-webassembly": { 394 | "description": "Build with WebAssembly backend." 395 | }, 396 | "target-x86": { 397 | "description": "Build with X86 backend." 398 | }, 399 | "target-xcore": { 400 | "description": "Build with XCore backend." 401 | }, 402 | "tools": { 403 | "description": "Build LLVM tools.", 404 | "dependencies": [ 405 | { 406 | "name": "llvm-16", 407 | "default-features": false, 408 | "features": [ 409 | "enable-threads" 410 | ] 411 | } 412 | ] 413 | }, 414 | "utils": { 415 | "description": "Build LLVM utils." 416 | } 417 | } 418 | } 419 | -------------------------------------------------------------------------------- /ports/llvm-17/0001-Fix-install-paths.patch: -------------------------------------------------------------------------------- 1 | diff --git a/openmp/tools/Modules/CMakeLists.txt b/openmp/tools/Modules/CMakeLists.txt 2 | index 22d818eea72d..75aacc4468d4 100644 3 | --- a/openmp/tools/Modules/CMakeLists.txt 4 | +++ b/openmp/tools/Modules/CMakeLists.txt 5 | @@ -12,4 +12,4 @@ 6 | 7 | 8 | install(FILES "FindOpenMPTarget.cmake" 9 | - DESTINATION "${OPENMP_INSTALL_LIBDIR}/cmake/openmp") 10 | + DESTINATION "share/openmp") 11 | -------------------------------------------------------------------------------- /ports/llvm-17/0006-Fix-libffi.patch: -------------------------------------------------------------------------------- 1 | llvm/cmake/modules/FindFFI.cmake | 2 +- 2 | 1 file changed, 1 insertion(+), 1 deletion(-) 3 | 4 | diff --git a/llvm/cmake/modules/FindFFI.cmake b/llvm/cmake/modules/FindFFI.cmake 5 | index b0d859af8959..a756d0c8fdb0 100644 6 | --- a/llvm/cmake/modules/FindFFI.cmake 7 | +++ b/llvm/cmake/modules/FindFFI.cmake 8 | @@ -34,7 +34,7 @@ else() 9 | endif() 10 | endif() 11 | 12 | -find_library(FFI_LIBRARIES ffi PATHS ${FFI_LIBRARY_DIR}) 13 | +find_library(FFI_LIBRARIES ffi libffi PATHS ${FFI_LIBRARY_DIR}) 14 | 15 | if(FFI_LIBRARIES) 16 | include(CMakePushCheckState) 17 | -------------------------------------------------------------------------------- /ports/llvm-17/0020-fix-FindZ3.cmake.patch: -------------------------------------------------------------------------------- 1 | diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake 2 | index 118b1eac3b32..455bbf28facc 100644 3 | --- a/llvm/cmake/modules/FindZ3.cmake 4 | +++ b/llvm/cmake/modules/FindZ3.cmake 5 | @@ -1,3 +1,22 @@ 6 | +# Try first to find Z3 using its upstream cmake files (included in newer version) 7 | +# unless the user has provided a hint that would assume skipping the CONFIG 8 | +# option 9 | +if (NOT DEFINED Z3_ROOT AND NOT LLVM_Z3_INSTALL_DIR) 10 | + find_package(Z3 QUIET CONFIG) 11 | +endif() 12 | + 13 | +# If we found with CONFIG mode, then set up the compatible variables 14 | +if (Z3_FOUND) 15 | + set(Z3_VERSION "${Z3_VERSION_STRING}") 16 | + set(Z3_LIBRARIES z3::libz3) 17 | + get_property(Z3_INCLUDE_DIR 18 | + TARGET z3::libz3 PROPERTY 19 | + INTERFACE_INCLUDE_DIRECTORIES 20 | + ) 21 | + find_package_handle_standard_args(Z3 CONFIG_MODE) 22 | + 23 | +else() 24 | + 25 | INCLUDE(CheckCXXSourceRuns) 26 | 27 | # Function to check Z3's version 28 | @@ -123,3 +142,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3 29 | VERSION_VAR Z3_VERSION_STRING) 30 | 31 | mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES) 32 | + 33 | +endif() 34 | -------------------------------------------------------------------------------- /ports/llvm-17/0021-fix-find_dependency.patch: -------------------------------------------------------------------------------- 1 | llvm/cmake/modules/LLVMConfig.cmake.in | 19 ++++++++++++------- 2 | 1 file changed, 12 insertions(+), 7 deletions(-) 3 | 4 | diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in 5 | index 42dfd607f7e6..af2aa990f0e9 100644 6 | --- a/llvm/cmake/modules/LLVMConfig.cmake.in 7 | +++ b/llvm/cmake/modules/LLVMConfig.cmake.in 8 | @@ -51,21 +51,23 @@ set(LLVM_ENABLE_ASSERTIONS @LLVM_ENABLE_ASSERTIONS@) 9 | 10 | set(LLVM_ENABLE_EH @LLVM_ENABLE_EH@) 11 | 12 | +include(CMakeFindDependencyMacro) 13 | + 14 | set(LLVM_ENABLE_FFI @LLVM_ENABLE_FFI@) 15 | if(LLVM_ENABLE_FFI) 16 | - find_package(FFI) 17 | + find_dependency(FFI) 18 | endif() 19 | 20 | set(LLVM_ENABLE_RTTI @LLVM_ENABLE_RTTI@) 21 | 22 | set(LLVM_ENABLE_LIBEDIT @HAVE_LIBEDIT@) 23 | if(LLVM_ENABLE_LIBEDIT) 24 | - find_package(LibEdit) 25 | + find_dependency(LibEdit) 26 | endif() 27 | 28 | set(LLVM_ENABLE_TERMINFO @LLVM_ENABLE_TERMINFO@) 29 | if(LLVM_ENABLE_TERMINFO) 30 | - find_package(Terminfo) 31 | + find_dependency(Terminfo) 32 | endif() 33 | 34 | set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@) 35 | @@ -75,25 +77,28 @@ set(LLVM_ENABLE_UNWIND_TABLES @LLVM_ENABLE_UNWIND_TABLES@) 36 | set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@) 37 | if(LLVM_ENABLE_ZLIB) 38 | set(ZLIB_ROOT @ZLIB_ROOT@) 39 | - find_package(ZLIB) 40 | + find_dependency(ZLIB) 41 | endif() 42 | 43 | set(LLVM_ENABLE_ZSTD @LLVM_ENABLE_ZSTD@) 44 | if(LLVM_ENABLE_ZSTD) 45 | - find_package(zstd) 46 | + find_dependency(zstd) 47 | endif() 48 | 49 | set(LLVM_ENABLE_LIBXML2 @LLVM_ENABLE_LIBXML2@) 50 | if(LLVM_ENABLE_LIBXML2) 51 | - find_package(LibXml2) 52 | + find_dependency(LibXml2) 53 | endif() 54 | 55 | set(LLVM_ENABLE_CURL @LLVM_ENABLE_CURL@) 56 | if(LLVM_ENABLE_CURL) 57 | - find_package(CURL) 58 | + find_dependency(CURL) 59 | endif() 60 | 61 | set(LLVM_WITH_Z3 @LLVM_WITH_Z3@) 62 | +if(LLVM_WITH_Z3) 63 | + find_dependency(Z3 4.7.1) 64 | +endif() 65 | 66 | set(LLVM_ENABLE_DIA_SDK @LLVM_ENABLE_DIA_SDK@) 67 | 68 | -------------------------------------------------------------------------------- /ports/llvm-17/0026-fix-prefix-path-calc.patch: -------------------------------------------------------------------------------- 1 | diff --git a/cmake/Modules/FindPrefixFromConfig.cmake b/cmake/Modules/FindPrefixFromConfig.cmake 2 | index 22211e4b72f2..c83e99c21556 100644 3 | --- a/cmake/Modules/FindPrefixFromConfig.cmake 4 | +++ b/cmake/Modules/FindPrefixFromConfig.cmake 5 | @@ -39,7 +39,7 @@ function(find_prefix_from_config out_var prefix_var path_to_leave) 6 | # install prefix, and avoid hard-coding any absolute paths. 7 | set(config_code 8 | "# Compute the installation prefix from this LLVMConfig.cmake file location." 9 | - "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") 10 | + "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_DIR}\" PATH)") 11 | # Construct the proper number of get_filename_component(... PATH) 12 | # calls to compute the installation prefix. 13 | string(REGEX REPLACE "/" ";" _count "${path_to_leave}") 14 | -------------------------------------------------------------------------------- /ports/llvm-17/0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch: -------------------------------------------------------------------------------- 1 | From efcdeb698fe6a475d1eb0a8f4770ef974cefb0e1 Mon Sep 17 00:00:00 2001 2 | From: 2over12 3 | Date: Wed, 31 May 2023 08:57:45 -0400 4 | Subject: [PATCH] Do not attempt to find macro expansions if there is invalid 5 | source info for a decl 6 | 7 | --- 8 | clang/lib/AST/Expr.cpp | 4 ++++ 9 | 1 file changed, 4 insertions(+) 10 | 11 | diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp 12 | index e45ae68cd5fe..59a7d50d8ad3 100644 13 | --- a/clang/lib/AST/Expr.cpp 14 | +++ b/clang/lib/AST/Expr.cpp 15 | @@ -263,6 +263,10 @@ bool Expr::isFlexibleArrayMemberLike( 16 | TypeSourceInfo *TInfo = FD->getTypeSourceInfo(); 17 | while (TInfo) { 18 | TypeLoc TL = TInfo->getTypeLoc(); 19 | + if (TL.getSourceRange().isInvalid()) { 20 | + break; 21 | + } 22 | + 23 | // Look through typedefs. 24 | if (TypedefTypeLoc TTL = TL.getAsAdjusted()) { 25 | const TypedefNameDecl *TDL = TTL.getTypedefNameDecl(); 26 | -- 27 | 2.39.2 (Apple Git-143) 28 | 29 | -------------------------------------------------------------------------------- /ports/llvm-17/clang_usage: -------------------------------------------------------------------------------- 1 | The package clang provides CMake targets: 2 | 3 | find_package(Clang CONFIG REQUIRED) 4 | target_include_directories(main PRIVATE ${CLANG_INCLUDE_DIRS}) 5 | target_link_libraries(main PRIVATE clangBasic clangLex clangParse clangAST ...) 6 | -------------------------------------------------------------------------------- /ports/llvm-17/flang_usage: -------------------------------------------------------------------------------- 1 | The package flang provides CMake targets: 2 | 3 | find_package(Flang CONFIG REQUIRED) 4 | target_include_directories(main PRIVATE ${FLANG_INCLUDE_DIRS}) 5 | target_link_libraries(main PRIVATE flangFrontend flangFrontendTool ...) 6 | -------------------------------------------------------------------------------- /ports/llvm-17/lld_usage: -------------------------------------------------------------------------------- 1 | The package lld provides CMake targets: 2 | 3 | find_package(LLD CONFIG REQUIRED) 4 | target_include_directories(main PRIVATE ${LLD_INCLUDE_DIRS}) 5 | target_link_libraries(main PRIVATE lldCommon lldCore lldDriver ...) 6 | -------------------------------------------------------------------------------- /ports/llvm-17/llvm_usage: -------------------------------------------------------------------------------- 1 | The package llvm provides CMake targets: 2 | 3 | find_package(LLVM CONFIG REQUIRED) 4 | 5 | list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") 6 | include(HandleLLVMOptions) 7 | add_definitions(${LLVM_DEFINITIONS}) 8 | 9 | target_include_directories(main PRIVATE ${LLVM_INCLUDE_DIRS}) 10 | 11 | # Find the libraries that correspond to the LLVM components that we wish to use 12 | llvm_map_components_to_libnames(llvm_libs Support Core IRReader ...) 13 | 14 | # Link against LLVM libraries 15 | target_link_libraries(main PRIVATE ${llvm_libs}) 16 | -------------------------------------------------------------------------------- /ports/llvm-17/mlir_usage: -------------------------------------------------------------------------------- 1 | The package lld provides CMake targets: 2 | 3 | find_package(MLIR CONFIG REQUIRED) 4 | target_include_directories(main PRIVATE ${MLIR_INCLUDE_DIRS}) 5 | target_link_libraries(main PRIVATE MLIRIR MLIRParser MLIRPass MLIRSupport ...) 6 | -------------------------------------------------------------------------------- /ports/llvm-17/portfile.cmake: -------------------------------------------------------------------------------- 1 | vcpkg_check_linkage(ONLY_STATIC_LIBRARY) 2 | 3 | 4 | if("liftingbits-llvm" IN_LIST FEATURES) 5 | vcpkg_from_github( 6 | OUT_SOURCE_PATH SOURCE_PATH 7 | REPO trail-of-forks/llvm-project 8 | REF da128b13b3d8b94b90ef30efaa56bbaeb624d49f 9 | SHA512 2e5f661314778a8e3f0aa6ad240eef219d7e1d2b1cd6f37357f1a909886da15f7a1c104f5dda8c897b7df47d2da30608a307f1f494e4045830365f388246ac25 10 | HEAD_REF main 11 | PATCHES 12 | 0001-Fix-install-paths.patch 13 | 0006-Fix-libffi.patch 14 | 0020-fix-FindZ3.cmake.patch 15 | 0021-fix-find_dependency.patch 16 | 0026-fix-prefix-path-calc.patch 17 | 0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch 18 | ) 19 | else() 20 | vcpkg_from_github( 21 | OUT_SOURCE_PATH SOURCE_PATH 22 | REPO llvm/llvm-project 23 | REF llvmorg-${VERSION} 24 | SHA512 5300a452e706c1b6183ba300233804d97e4468d2588c2c2e0cf59e56ee5c83f20b7e03f5c0782198c34c63653b3e12d7407e4e8bb8214bae7e6532fa22730443 25 | HEAD_REF release/17.x 26 | PATCHES 27 | 0001-Fix-install-paths.patch 28 | 0006-Fix-libffi.patch 29 | 0020-fix-FindZ3.cmake.patch 30 | 0021-fix-find_dependency.patch 31 | 0026-fix-prefix-path-calc.patch 32 | 0029-Do-not-attempt-macro-expansion-on-invalid-sourceloc.patch 33 | ) 34 | endif() 35 | 36 | string(REPLACE "." ";" VERSION_LIST ${VERSION}) 37 | list(GET VERSION_LIST 0 LLVM_VERSION_MAJOR) 38 | list(GET VERSION_LIST 1 LLVM_VERSION_MINOR) 39 | list(GET VERSION_LIST 2 LLVM_VERSION_PATCH) 40 | # Remove anything after the first patch number (removes suffix like `-rc3`) 41 | if("${LLVM_VERSION_PATCH}" MATCHES "^([0-9]+).*") 42 | set(LLVM_VERSION_PATCH "${CMAKE_MATCH_1}") 43 | endif() 44 | 45 | vcpkg_check_features( 46 | OUT_FEATURE_OPTIONS FEATURE_OPTIONS 47 | FEATURES 48 | tools LLVM_BUILD_TOOLS 49 | tools LLVM_INCLUDE_TOOLS 50 | utils LLVM_BUILD_UTILS 51 | utils LLVM_INCLUDE_UTILS 52 | utils LLVM_INSTALL_UTILS 53 | enable-rtti LLVM_ENABLE_RTTI 54 | enable-ffi LLVM_ENABLE_FFI 55 | enable-terminfo LLVM_ENABLE_TERMINFO 56 | enable-threads LLVM_ENABLE_THREADS 57 | enable-ios COMPILER_RT_ENABLE_IOS 58 | enable-eh LLVM_ENABLE_EH 59 | enable-bindings LLVM_ENABLE_BINDINGS 60 | enable-z3 LLVM_ENABLE_Z3_SOLVER 61 | ) 62 | 63 | vcpkg_cmake_get_vars(cmake_vars_file) 64 | include("${cmake_vars_file}") 65 | 66 | # Linking with gold is better than /bin/ld 67 | # Linking with lld is better than gold 68 | # MacOS just has LLD, so only set explicit linker on Linux 69 | if(VCPKG_TARGET_IS_LINUX) 70 | # NOTE(ekilmer): This should probably be a vcpkg utility function 71 | file(READ "${CURRENT_BUILDTREES_DIR}/../detect_compiler/config-${TARGET_TRIPLET}-rel-err.log" _compiler_info) 72 | string(REGEX MATCH "#COMPILER_CXX_ID#([^\r\n]*)" _ ${_compiler_info}) 73 | set(VCPKG_DETECTED_CXX_COMPILER_ID ${CMAKE_MATCH_1}) 74 | # ENDNOTE 75 | 76 | message(STATUS "Detected Compiler ID: '${VCPKG_DETECTED_CXX_COMPILER_ID}'") 77 | if (VCPKG_DETECTED_CXX_COMPILER_ID MATCHES "Clang") 78 | list(APPEND FEATURE_OPTIONS 79 | -DLLVM_USE_LINKER=lld 80 | ) 81 | message(STATUS "Using lld for linking") 82 | # Use GNU Gold when building with not clang (likely, g++) 83 | else() 84 | list(APPEND FEATURE_OPTIONS 85 | -DLLVM_USE_LINKER=gold 86 | # Cross compiling to arm with gcc doesn't work naturally because gcc 87 | # has different executables for each architecture unlike clang, which 88 | # is a native crosscompilation toolchain 89 | "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:STRING=-DCMAKE_C_COMPILER=gcc\\;-DCMAKE_CXX_COMPILER=g++" 90 | ) 91 | message(STATUS "Using (default) gold linker for linking") 92 | endif() 93 | endif() 94 | 95 | if(VCPKG_USE_SANITIZER) 96 | list(APPEND FEATURE_OPTIONS 97 | -DLLVM_USE_SANITIZER=${VCPKG_USE_SANITIZER} 98 | ) 99 | endif() 100 | 101 | # LLVM generates CMake error due to Visual Studio version 16.4 is known to miscompile part of LLVM. 102 | # LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON disables this error. 103 | # See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html 104 | # and thread "[llvm-dev] Longstanding failing tests - clang-tidy, MachO, Polly" on llvm-dev Jan 21-23 2020. 105 | list(APPEND FEATURE_OPTIONS 106 | -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON 107 | ) 108 | 109 | # Force enable or disable external libraries 110 | set(llvm_external_libraries 111 | zlib 112 | zstd 113 | libxml2 114 | ) 115 | foreach(external_library IN LISTS llvm_external_libraries) 116 | string(TOLOWER "enable-${external_library}" feature_name) 117 | string(TOUPPER "LLVM_ENABLE_${external_library}" define_name) 118 | if(feature_name IN_LIST FEATURES) 119 | list(APPEND FEATURE_OPTIONS 120 | -D${define_name}=FORCE_ON 121 | ) 122 | else() 123 | list(APPEND FEATURE_OPTIONS 124 | -D${define_name}=OFF 125 | ) 126 | endif() 127 | endforeach() 128 | 129 | # By default assertions are enabled for Debug configuration only. 130 | if("enable-assertions" IN_LIST FEATURES) 131 | # Force enable assertions for all configurations. 132 | list(APPEND FEATURE_OPTIONS 133 | -DLLVM_ENABLE_ASSERTIONS=ON 134 | ) 135 | elseif("disable-assertions" IN_LIST FEATURES) 136 | # Force disable assertions for all configurations. 137 | list(APPEND FEATURE_OPTIONS 138 | -DLLVM_ENABLE_ASSERTIONS=OFF 139 | ) 140 | endif() 141 | 142 | # LLVM_ABI_BREAKING_CHECKS can be WITH_ASSERTS (default), FORCE_ON or FORCE_OFF. 143 | # By default in LLVM, abi-breaking checks are enabled if assertions are enabled. 144 | # however, this breaks linking with the debug versions, since the option is 145 | # baked into the header files; thus, we always turn off LLVM_ABI_BREAKING_CHECKS 146 | # unless the user asks for it 147 | if("enable-abi-breaking-checks" IN_LIST FEATURES) 148 | # Force enable abi-breaking checks. 149 | list(APPEND FEATURE_OPTIONS 150 | -DLLVM_ABI_BREAKING_CHECKS=FORCE_ON 151 | ) 152 | else() 153 | # Force disable abi-breaking checks. 154 | list(APPEND FEATURE_OPTIONS 155 | -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF 156 | ) 157 | endif() 158 | 159 | set(LLVM_ENABLE_PROJECTS) 160 | if("bolt" IN_LIST FEATURES) 161 | list(APPEND LLVM_ENABLE_PROJECTS "bolt") 162 | endif() 163 | if("clang" IN_LIST FEATURES OR "clang-tools-extra" IN_LIST FEATURES) 164 | list(APPEND LLVM_ENABLE_PROJECTS "clang") 165 | if("disable-clang-static-analyzer" IN_LIST FEATURES) 166 | list(APPEND FEATURE_OPTIONS 167 | # Disable ARCMT 168 | -DCLANG_ENABLE_ARCMT=OFF 169 | # Disable static analyzer 170 | -DCLANG_ENABLE_STATIC_ANALYZER=OFF 171 | ) 172 | endif() 173 | endif() 174 | if("clang-tools-extra" IN_LIST FEATURES) 175 | list(APPEND LLVM_ENABLE_PROJECTS "clang-tools-extra") 176 | endif() 177 | if("flang" IN_LIST FEATURES) 178 | if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") 179 | message(FATAL_ERROR "Building Flang with MSVC is not supported on x86. Disable it until issues are fixed.") 180 | endif() 181 | list(APPEND LLVM_ENABLE_PROJECTS "flang") 182 | list(APPEND FEATURE_OPTIONS 183 | # Flang requires C++17 184 | -DCMAKE_CXX_STANDARD=17 185 | ) 186 | endif() 187 | if("libclc" IN_LIST FEATURES) 188 | list(APPEND LLVM_ENABLE_PROJECTS "libclc") 189 | endif() 190 | if("lld" IN_LIST FEATURES) 191 | list(APPEND LLVM_ENABLE_PROJECTS "lld") 192 | endif() 193 | if("lldb" IN_LIST FEATURES) 194 | list(APPEND LLVM_ENABLE_PROJECTS "lldb") 195 | list(APPEND FEATURE_OPTIONS 196 | -DLLDB_ENABLE_CURSES=OFF 197 | ) 198 | endif() 199 | if("mlir" IN_LIST FEATURES) 200 | list(APPEND LLVM_ENABLE_PROJECTS "mlir") 201 | endif() 202 | if("openmp" IN_LIST FEATURES) 203 | list(APPEND LLVM_ENABLE_PROJECTS "openmp") 204 | # Perl is required for the OpenMP run-time 205 | vcpkg_find_acquire_program(PERL) 206 | get_filename_component(PERL_PATH ${PERL} DIRECTORY) 207 | vcpkg_add_to_path(${PERL_PATH}) 208 | # Skip post-build check 209 | set(VCPKG_POLICY_SKIP_DUMPBIN_CHECKS enabled) 210 | endif() 211 | if("polly" IN_LIST FEATURES) 212 | list(APPEND LLVM_ENABLE_PROJECTS "polly") 213 | endif() 214 | if("pstl" IN_LIST FEATURES) 215 | if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 216 | message(FATAL_ERROR "Building pstl with MSVC is not supported. Disable it until issues are fixed.") 217 | endif() 218 | list(APPEND LLVM_ENABLE_PROJECTS "pstl") 219 | endif() 220 | 221 | set(LLVM_ENABLE_RUNTIMES) 222 | if("libcxx" IN_LIST FEATURES) 223 | if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 224 | message(FATAL_ERROR "Building libcxx with MSVC is not supported, as cl doesn't support the #include_next extension.") 225 | endif() 226 | list(APPEND LLVM_ENABLE_RUNTIMES "libcxx") 227 | endif() 228 | if("libcxxabi" IN_LIST FEATURES) 229 | if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 230 | message(FATAL_ERROR "Building libcxxabi with MSVC is not supported. Disable it until issues are fixed.") 231 | endif() 232 | list(APPEND LLVM_ENABLE_RUNTIMES "libcxxabi") 233 | endif() 234 | if("compiler-rt" IN_LIST FEATURES) 235 | list(APPEND LLVM_ENABLE_RUNTIMES "compiler-rt") 236 | endif() 237 | if("libunwind" IN_LIST FEATURES) 238 | list(APPEND LLVM_ENABLE_RUNTIMES "libunwind") 239 | endif() 240 | 241 | # this is for normal targets 242 | set(known_llvm_targets 243 | AArch64 244 | AMDGPU 245 | ARM 246 | AVR 247 | BPF 248 | Hexagon 249 | Lanai 250 | LoongArch 251 | Mips 252 | MSP430 253 | NVPTX 254 | PowerPC 255 | RISCV 256 | Sparc 257 | SystemZ 258 | VE 259 | WebAssembly 260 | X86 261 | XCore 262 | ) 263 | 264 | set(LLVM_TARGETS_TO_BUILD "") 265 | foreach(llvm_target IN LISTS known_llvm_targets) 266 | string(TOLOWER "target-${llvm_target}" feature_name) 267 | if(feature_name IN_LIST FEATURES) 268 | list(APPEND LLVM_TARGETS_TO_BUILD "${llvm_target}") 269 | endif() 270 | endforeach() 271 | 272 | # this is for experimental targets 273 | set(known_llvm_experimental_targets 274 | ARC 275 | CSKY 276 | DirectX 277 | M68k 278 | SPIRV 279 | Xtensa 280 | ) 281 | 282 | set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "") 283 | foreach(llvm_target IN LISTS known_llvm_experimental_targets) 284 | string(TOLOWER "target-${llvm_target}" feature_name) 285 | if(feature_name IN_LIST FEATURES) 286 | list(APPEND LLVM_EXPERIMENTAL_TARGETS_TO_BUILD "${llvm_target}") 287 | endif() 288 | endforeach() 289 | 290 | vcpkg_find_acquire_program(PYTHON3) 291 | get_filename_component(PYTHON3_DIR ${PYTHON3} DIRECTORY) 292 | vcpkg_add_to_path(${PYTHON3_DIR}) 293 | 294 | set(LLVM_LINK_JOBS 2) 295 | 296 | # Cross compilation 297 | if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") 298 | set(arch "aarch64") 299 | elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") 300 | set(arch "arm") 301 | elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") 302 | set(arch "x86_64") 303 | endif() 304 | if (VCPKG_TARGET_IS_OSX) 305 | set(LLVM_HOST_TRIPLE "${arch}-apple-darwin") 306 | elseif (VCPKG_TARGET_IS_LINUX) 307 | set(LLVM_HOST_TRIPLE "${arch}-linux-gnu") 308 | elseif (VCPKG_TARGET_IS_WINDOWS) 309 | set(LLVM_HOST_TRIPLE "${arch}-windows-msvc") 310 | else() 311 | message(WARNING "Could not determine LLVM Host triple") 312 | endif() 313 | list(APPEND OPTIONS "-DLLVM_HOST_TRIPLE=${LLVM_HOST_TRIPLE}") 314 | if("compiler-rt" IN_LIST FEATURES) 315 | list(APPEND OPTIONS "-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=${LLVM_HOST_TRIPLE}") 316 | endif() 317 | message(STATUS "Default host triple '${LLVM_HOST_TRIPLE}'") 318 | 319 | if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") 320 | set(LLVM_TARGET_ARCH "AArch64") 321 | elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") 322 | set(LLVM_TARGET_ARCH "ARM") 323 | elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") 324 | set(LLVM_TARGET_ARCH "X86") 325 | else() 326 | message(FATAL_ERROR "Target Architecture not supported.") 327 | endif() 328 | 329 | vcpkg_cmake_configure( 330 | SOURCE_PATH ${SOURCE_PATH}/llvm 331 | OPTIONS 332 | ${FEATURE_OPTIONS} 333 | ${OPTIONS} 334 | -DLLVM_INCLUDE_EXAMPLES=OFF 335 | -DLLVM_BUILD_EXAMPLES=OFF 336 | -DLLVM_INCLUDE_DOCS=OFF 337 | -DLLVM_BUILD_DOCS=OFF 338 | -DLLVM_INCLUDE_TESTS=OFF 339 | -DLLVM_BUILD_TESTS=OFF 340 | -DLLVM_INCLUDE_BENCHMARKS=OFF 341 | -DLLVM_BUILD_BENCHMARKS=OFF 342 | "-DLLVM_TARGET_ARCH=${LLVM_TARGET_ARCH}" 343 | # Force TableGen to be built with optimization. This will significantly improve build time. 344 | -DLLVM_OPTIMIZED_TABLEGEN=ON 345 | "-DLLVM_ENABLE_PROJECTS=${LLVM_ENABLE_PROJECTS}" 346 | "-DLLVM_ENABLE_RUNTIMES=${LLVM_ENABLE_RUNTIMES}" 347 | "-DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}" 348 | "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}" 349 | -DPACKAGE_VERSION=${VERSION} 350 | # Limit the maximum number of concurrent link jobs to 1. This should fix low amount of memory issue for link. 351 | "-DLLVM_PARALLEL_LINK_JOBS=${LLVM_LINK_JOBS}" 352 | -DCMAKE_INSTALL_PACKAGEDIR:STRING=share 353 | "-DRUNTIMES_CMAKE_ARGS=-DCMAKE_PREFIX_PATH=${CURRENT_INSTALLED_DIR}" 354 | ) 355 | 356 | vcpkg_cmake_install(ADD_BIN_TO_PATH) 357 | 358 | # 'package_name' should be the case of the package used in CMake 'find_package' 359 | # 'FEATURE_NAME' should be the name of the vcpkg port feature 360 | function(llvm_cmake_package_config_fixup package_name) 361 | cmake_parse_arguments("arg" "DO_NOT_DELETE_PARENT_CONFIG_PATH" "FEATURE_NAME" "" ${ARGN}) 362 | string(TOUPPER "${package_name}" upper_package) 363 | string(TOLOWER "${package_name}" lower_package) 364 | if(NOT DEFINED arg_FEATURE_NAME) 365 | set(arg_FEATURE_NAME ${lower_package}) 366 | endif() 367 | if("${lower_package}" STREQUAL "llvm" OR "${arg_FEATURE_NAME}" IN_LIST FEATURES) 368 | set(args) 369 | # Maintains case even if package_name name is case-sensitive 370 | list(APPEND args PACKAGE_NAME "${lower_package}") 371 | if(arg_DO_NOT_DELETE_PARENT_CONFIG_PATH) 372 | list(APPEND args "DO_NOT_DELETE_PARENT_CONFIG_PATH") 373 | endif() 374 | vcpkg_cmake_config_fixup(${args}) 375 | file(INSTALL "${SOURCE_PATH}/${lower_package}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${lower_package}" RENAME copyright) 376 | 377 | # Remove last parent directory 378 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${lower_package}/${package_name}Config.cmake" "get_filename_component(${upper_package}_INSTALL_PREFIX \"\${${upper_package}_INSTALL_PREFIX}\" PATH)\n\n" "\n") 379 | 380 | if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${lower_package}_usage") 381 | file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/${lower_package}_usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${lower_package}" RENAME usage) 382 | endif() 383 | endif() 384 | endfunction() 385 | 386 | llvm_cmake_package_config_fixup("Clang" DO_NOT_DELETE_PARENT_CONFIG_PATH) 387 | llvm_cmake_package_config_fixup("Flang" DO_NOT_DELETE_PARENT_CONFIG_PATH) 388 | llvm_cmake_package_config_fixup("LLD" DO_NOT_DELETE_PARENT_CONFIG_PATH) 389 | llvm_cmake_package_config_fixup("MLIR" DO_NOT_DELETE_PARENT_CONFIG_PATH) 390 | llvm_cmake_package_config_fixup("OpenMP" DO_NOT_DELETE_PARENT_CONFIG_PATH) 391 | llvm_cmake_package_config_fixup("Polly" DO_NOT_DELETE_PARENT_CONFIG_PATH) 392 | llvm_cmake_package_config_fixup("ParallelSTL" FEATURE_NAME "pstl" DO_NOT_DELETE_PARENT_CONFIG_PATH) 393 | llvm_cmake_package_config_fixup("LLVM") 394 | 395 | # Needed because we are doing versioned ports 396 | file(INSTALL "${SOURCE_PATH}/llvm/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) 397 | 398 | set(empty_dirs) 399 | 400 | if("clang-tools-extra" IN_LIST FEATURES) 401 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/clang-tidy/plugin") 402 | endif() 403 | 404 | if("flang" IN_LIST FEATURES) 405 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Config") 406 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/CMakeFiles") 407 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/CMakeFiles") 408 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/CodeGen/CMakeFiles") 409 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/Dialect/CMakeFiles") 410 | list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/Transforms/CMakeFiles") 411 | endif() 412 | 413 | if(empty_dirs) 414 | foreach(empty_dir IN LISTS empty_dirs) 415 | if(NOT EXISTS "${empty_dir}") 416 | message(SEND_ERROR "Directory '${empty_dir}' is not exist. Please remove it from the checking.") 417 | else() 418 | file(GLOB_RECURSE files_in_dir "${empty_dir}/*") 419 | if(files_in_dir) 420 | message(SEND_ERROR "Directory '${empty_dir}' is not empty. Please remove it from the checking.") 421 | else() 422 | file(REMOVE_RECURSE "${empty_dir}") 423 | endif() 424 | endif() 425 | endforeach() 426 | endif() 427 | 428 | if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") 429 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" 430 | "${CURRENT_PACKAGES_DIR}/debug/include" 431 | "${CURRENT_PACKAGES_DIR}/debug/share" 432 | "${CURRENT_PACKAGES_DIR}/debug/lib/clang" 433 | ) 434 | endif() 435 | 436 | # Use 'bin' instead of 'tools/llvm' 437 | file(GLOB_RECURSE release_targets 438 | "${CURRENT_PACKAGES_DIR}/share/*/*Targets-*.cmake" 439 | "${CURRENT_PACKAGES_DIR}/share/*/*Exports-*.cmake" 440 | ) 441 | foreach(release_target IN LISTS release_targets) 442 | file(READ "${release_target}" contents) 443 | string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" contents "${contents}") 444 | string(REGEX REPLACE 445 | "\\\${_IMPORT_PREFIX}/tools/llvm-17/([^ \"]+${EXECUTABLE_SUFFIX})" 446 | "\${_IMPORT_PREFIX}/bin/\\1" 447 | contents "${contents}") 448 | file(WRITE "${release_target}" "${contents}") 449 | endforeach() 450 | 451 | if("mlir" IN_LIST FEATURES) 452 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/mlir/MLIRConfig.cmake" "set(MLIR_MAIN_SRC_DIR \"${SOURCE_PATH}/mlir\")" "") 453 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/mlir/MLIRConfig.cmake" "${CURRENT_BUILDTREES_DIR}" "\${MLIR_INCLUDE_DIRS}") 454 | endif() 455 | 456 | # LLVM still generates a few DLLs in the static build: 457 | # * LLVM-C.dll 458 | # * libclang.dll 459 | # * LTO.dll 460 | # * Remarks.dll 461 | set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) 462 | -------------------------------------------------------------------------------- /ports/llvm-17/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "llvm-17", 3 | "version": "17.0.6", 4 | "description": "The LLVM Compiler Infrastructure.", 5 | "homepage": "https://llvm.org", 6 | "license": "Apache-2.0", 7 | "supports": "!uwp & !(arm & windows)", 8 | "port-version": 2, 9 | "dependencies": [ 10 | { 11 | "name": "vcpkg-cmake", 12 | "host": true 13 | }, 14 | { 15 | "name": "vcpkg-cmake-config", 16 | "host": true 17 | }, 18 | { 19 | "name": "vcpkg-cmake-get-vars", 20 | "host": true 21 | } 22 | ], 23 | "default-features": [ 24 | "clang", 25 | "compiler-rt", 26 | "cxx-common-targets", 27 | "default-options", 28 | "lld", 29 | "mlir", 30 | "tools", 31 | "utils" 32 | ], 33 | "features": { 34 | "liftingbits-llvm": { 35 | "description": "Custom llvm source tree that allows for custom calling convention registration. These custom calling conventions allow for specifying binary level compatibility.", 36 | "dependencies": [ 37 | { 38 | "name": "llvm-17", 39 | "default-features": false, 40 | "features": [ 41 | "libunwind", 42 | "enable-rtti" 43 | ] 44 | } 45 | ] 46 | }, 47 | "bolt": { 48 | "description": "BOLT is a post-link optimizer developed to speed up large applications.", 49 | "dependencies": [ 50 | { 51 | "name": "llvm-17", 52 | "default-features": false, 53 | "features": [ 54 | "tools" 55 | ] 56 | } 57 | ] 58 | }, 59 | "clang": { 60 | "description": "Include C Language Family Front-end.", 61 | "dependencies": [ 62 | { 63 | "name": "llvm-17", 64 | "default-features": false, 65 | "features": [ 66 | "compiler-rt", 67 | "tools" 68 | ] 69 | } 70 | ] 71 | }, 72 | "clang-tools-extra": { 73 | "description": "Include Clang tools." 74 | }, 75 | "compiler-rt": { 76 | "description": "Include compiler's runtime libraries." 77 | }, 78 | "cxx-common-targets": { 79 | "description": "Build with cxx-common target set", 80 | "dependencies": [ 81 | { 82 | "name": "llvm-17", 83 | "default-features": false, 84 | "features": [ 85 | "target-aarch64", 86 | "target-arm", 87 | "target-nvptx", 88 | "target-sparc", 89 | "target-webassembly", 90 | "target-x86", 91 | "target-powerpc" 92 | ] 93 | } 94 | ] 95 | }, 96 | "default-options": { 97 | "description": "Build with default options.", 98 | "dependencies": [ 99 | { 100 | "name": "llvm-17", 101 | "default-features": false, 102 | "features": [ 103 | "enable-assertions", 104 | "enable-bindings", 105 | "enable-eh", 106 | "enable-threads", 107 | "enable-z3", 108 | "enable-zlib", 109 | "enable-zstd" 110 | ] 111 | } 112 | ] 113 | }, 114 | "default-targets": { 115 | "description": "Build with platform-specific default targets.", 116 | "dependencies": [ 117 | { 118 | "name": "llvm-17", 119 | "default-features": false, 120 | "features": [ 121 | "target-aarch64" 122 | ], 123 | "platform": "arm64" 124 | }, 125 | { 126 | "name": "llvm-17", 127 | "default-features": false, 128 | "features": [ 129 | "target-x86" 130 | ], 131 | "platform": "x86 | x64" 132 | }, 133 | { 134 | "name": "llvm-17", 135 | "default-features": false, 136 | "features": [ 137 | "target-arm" 138 | ], 139 | "platform": "arm & !arm64" 140 | }, 141 | { 142 | "name": "llvm-17", 143 | "default-features": false, 144 | "features": [ 145 | "target-all" 146 | ], 147 | "platform": "!x86 & !x64 & !arm & !arm64" 148 | } 149 | ] 150 | }, 151 | "disable-assertions": { 152 | "description": "Build LLVM without assertions." 153 | }, 154 | "disable-clang-static-analyzer": { 155 | "description": "Build without static analyzer." 156 | }, 157 | "enable-abi-breaking-checks": { 158 | "description": "Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON." 159 | }, 160 | "enable-assertions": { 161 | "description": "Build LLVM with assertions." 162 | }, 163 | "enable-bindings": { 164 | "description": "Build bindings." 165 | }, 166 | "enable-eh": { 167 | "description": "Build LLVM with exception handler.", 168 | "dependencies": [ 169 | { 170 | "name": "llvm-17", 171 | "default-features": false, 172 | "features": [ 173 | "enable-rtti" 174 | ] 175 | } 176 | ] 177 | }, 178 | "enable-ffi": { 179 | "description": "Build LLVM with FFI.", 180 | "dependencies": [ 181 | "libffi" 182 | ] 183 | }, 184 | "enable-ios": { 185 | "description": "Build compiler-rt for iOS SDK.", 186 | "dependencies": [ 187 | "target-arm" 188 | ] 189 | }, 190 | "enable-libxml2": { 191 | "description": "Build with LibXml2.", 192 | "dependencies": [ 193 | "libxml2" 194 | ] 195 | }, 196 | "enable-rtti": { 197 | "description": "Build LLVM with run-time type information." 198 | }, 199 | "enable-terminfo": { 200 | "description": "Use terminfo database if available." 201 | }, 202 | "enable-threads": { 203 | "description": "Use threads if available." 204 | }, 205 | "enable-z3": { 206 | "description": "Compile with Z3 SMT solver support for Clang static analyzer.", 207 | "dependencies": [ 208 | { 209 | "name": "llvm-17", 210 | "default-features": false, 211 | "features": [ 212 | "clang" 213 | ] 214 | }, 215 | "z3" 216 | ] 217 | }, 218 | "enable-zlib": { 219 | "description": "Build with ZLib.", 220 | "dependencies": [ 221 | "zlib" 222 | ] 223 | }, 224 | "enable-zstd": { 225 | "description": "Build with ZSTD.", 226 | "dependencies": [ 227 | "zstd" 228 | ] 229 | }, 230 | "flang": { 231 | "description": "Include Fortran front end.", 232 | "dependencies": [ 233 | { 234 | "name": "llvm-17", 235 | "default-features": false, 236 | "features": [ 237 | "clang", 238 | "mlir", 239 | "tools" 240 | ] 241 | } 242 | ] 243 | }, 244 | "libclc": { 245 | "description": "Include OpenCL library." 246 | }, 247 | "libcxx": { 248 | "description": "Include libcxx library.", 249 | "dependencies": [ 250 | { 251 | "name": "llvm-17", 252 | "default-features": false, 253 | "features": [ 254 | "libcxxabi" 255 | ] 256 | } 257 | ] 258 | }, 259 | "libcxxabi": { 260 | "description": "Include libcxxabi library." 261 | }, 262 | "libunwind": { 263 | "description": "Include libunwind library." 264 | }, 265 | "lld": { 266 | "description": "Include LLVM linker.", 267 | "dependencies": [ 268 | { 269 | "name": "llvm-17", 270 | "default-features": false, 271 | "features": [ 272 | "tools" 273 | ] 274 | } 275 | ] 276 | }, 277 | "lldb": { 278 | "description": "Include LLVM debugger.", 279 | "dependencies": [ 280 | { 281 | "name": "llvm-17", 282 | "default-features": false, 283 | "features": [ 284 | "tools" 285 | ] 286 | } 287 | ] 288 | }, 289 | "mlir": { 290 | "description": "Include MLIR (Multi-Level IR Compiler Framework) project.", 291 | "dependencies": [ 292 | { 293 | "name": "llvm-17", 294 | "default-features": false, 295 | "features": [ 296 | "tools" 297 | ] 298 | } 299 | ] 300 | }, 301 | "openmp": { 302 | "description": "Include LLVM OpenMP libraries.", 303 | "dependencies": [ 304 | { 305 | "name": "llvm-17", 306 | "default-features": false, 307 | "features": [ 308 | "utils" 309 | ] 310 | } 311 | ] 312 | }, 313 | "polly": { 314 | "description": "Include Polly (Polyhedral optimizations for LLVM) project.", 315 | "dependencies": [ 316 | { 317 | "name": "llvm-17", 318 | "default-features": false, 319 | "features": [ 320 | "tools", 321 | "utils" 322 | ] 323 | }, 324 | "target-ve" 325 | ] 326 | }, 327 | "pstl": { 328 | "description": "Include pstl (Parallel STL) library." 329 | }, 330 | "target-aarch64": { 331 | "description": "Build with AArch64 backend." 332 | }, 333 | "target-all": { 334 | "description": "Build with all backends.", 335 | "dependencies": [ 336 | { 337 | "name": "llvm-17", 338 | "default-features": false, 339 | "features": [ 340 | "target-aarch64", 341 | "target-amdgpu", 342 | "target-arc", 343 | "target-arm", 344 | "target-avr", 345 | "target-bpf", 346 | "target-csky", 347 | "target-directx", 348 | "target-hexagon", 349 | "target-lanai", 350 | "target-loongarch", 351 | "target-m68k", 352 | "target-mips", 353 | "target-msp430", 354 | "target-nvptx", 355 | "target-powerpc", 356 | "target-riscv", 357 | "target-sparc", 358 | "target-spirv", 359 | "target-systemz", 360 | "target-ve", 361 | "target-webassembly", 362 | "target-x86", 363 | "target-xcore", 364 | "target-xtensa" 365 | ] 366 | } 367 | ] 368 | }, 369 | "target-amdgpu": { 370 | "description": "Build with AMDGPU backend." 371 | }, 372 | "target-arc": { 373 | "description": "Build with ARC backend (experimental)." 374 | }, 375 | "target-arm": { 376 | "description": "Build with ARM backend." 377 | }, 378 | "target-avr": { 379 | "description": "Build with AVR backend." 380 | }, 381 | "target-bpf": { 382 | "description": "Build with BPF backend." 383 | }, 384 | "target-csky": { 385 | "description": "Build with CSKY backend (experimental)." 386 | }, 387 | "target-directx": { 388 | "description": "Build with DirectX backend (experimental)." 389 | }, 390 | "target-hexagon": { 391 | "description": "Build with Hexagon backend." 392 | }, 393 | "target-lanai": { 394 | "description": "Build with Lanai backend." 395 | }, 396 | "target-loongarch": { 397 | "description": "Build with LoongArch backend." 398 | }, 399 | "target-m68k": { 400 | "description": "Build with M68k backend (experimental)." 401 | }, 402 | "target-mips": { 403 | "description": "Build with Mips backend." 404 | }, 405 | "target-msp430": { 406 | "description": "Build with MSP430 backend." 407 | }, 408 | "target-nvptx": { 409 | "description": "Build with NVPTX backend." 410 | }, 411 | "target-powerpc": { 412 | "description": "Build with PowerPC backend." 413 | }, 414 | "target-riscv": { 415 | "description": "Build with RISC-V backend." 416 | }, 417 | "target-sparc": { 418 | "description": "Build with Sparc backend." 419 | }, 420 | "target-spirv": { 421 | "description": "Build with SPIRV backend (experimental)." 422 | }, 423 | "target-systemz": { 424 | "description": "Build with SystemZ backend." 425 | }, 426 | "target-ve": { 427 | "description": "Build with VE backend." 428 | }, 429 | "target-webassembly": { 430 | "description": "Build with WebAssembly backend." 431 | }, 432 | "target-x86": { 433 | "description": "Build with X86 backend." 434 | }, 435 | "target-xcore": { 436 | "description": "Build with XCore backend." 437 | }, 438 | "target-xtensa": { 439 | "description": "Build with Xtensa backend (experimental)." 440 | }, 441 | "tools": { 442 | "description": "Build LLVM tools.", 443 | "dependencies": [ 444 | { 445 | "name": "llvm-17", 446 | "default-features": false, 447 | "features": [ 448 | "enable-threads" 449 | ] 450 | } 451 | ] 452 | }, 453 | "utils": { 454 | "description": "Build LLVM utils." 455 | } 456 | } 457 | } 458 | -------------------------------------------------------------------------------- /ports/protobuf/compile_options.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 04cb3303a..608c580be 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -242,12 +242,12 @@ endif (protobuf_BUILD_SHARED_LIBS) 6 | if (MSVC) 7 | if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 8 | # Build with multiple processes 9 | - add_definitions(/MP) 10 | + add_compile_options(/MP) 11 | endif() 12 | # Set source file and execution character sets to UTF-8 13 | - add_definitions(/utf-8) 14 | + add_compile_options(/utf-8) 15 | # MSVC warning suppressions 16 | - add_definitions( 17 | + add_compile_options( 18 | /wd4065 # switch statement contains 'default' but no 'case' labels 19 | /wd4244 # 'conversion' conversion from 'type1' to 'type2', possible loss of data 20 | /wd4251 # 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' 21 | @@ -262,23 +262,17 @@ if (MSVC) 22 | /wd4996 # The compiler encountered a deprecated declaration. 23 | ) 24 | # Allow big object 25 | - add_definitions(/bigobj) 26 | + add_compile_options(/bigobj) 27 | string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR}) 28 | string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR}) 29 | string(REPLACE "." "," protobuf_RC_FILEVERSION "${protobuf_VERSION}") 30 | configure_file(${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in extract_includes.bat) 31 | 32 | # Suppress linker warnings about files with no symbols defined. 33 | - set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") 34 | + string(APPEND CMAKE_STATIC_LINKER_FLAGS " /ignore:4221") 35 | 36 | - if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 37 | - # Configure Resource Compiler 38 | - enable_language(RC) 39 | - # use English language (0x409) in resource compiler 40 | - set(rc_flags "/l0x409") 41 | - # fix rc.exe invocations because of usage of add_definitions() 42 | - set(CMAKE_RC_COMPILE_OBJECT " ${rc_flags} /fo ") 43 | - endif() 44 | + # use English language (0x409) in resource compiler 45 | + string(APPEND CMAKE_RC_FLAGS " -l0x409") 46 | 47 | # Generate the version.rc file used elsewhere. 48 | configure_file(${protobuf_SOURCE_DIR}/cmake/version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY) 49 | -------------------------------------------------------------------------------- /ports/protobuf/fix-default-proto-file-path.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc 2 | index 5e9a2c4..8eaa6e0 100644 3 | --- a/src/google/protobuf/compiler/command_line_interface.cc 4 | +++ b/src/google/protobuf/compiler/command_line_interface.cc 5 | @@ -261,12 +261,15 @@ void AddDefaultProtoPaths( 6 | std::pair("", path + "/include")); 7 | return; 8 | } 9 | - // Check if the upper level directory has an "include" subdirectory. 10 | + // change "'$/bin' is next to 'include'" assumption to "'$/bin/tools' is next to 'include'" 11 | + for (int i = 0; i < 2; i++) 12 | + { 13 | pos = path.find_last_of("/\\"); 14 | if (pos == std::string::npos || pos == 0) { 15 | return; 16 | } 17 | path = path.substr(0, pos); 18 | + } 19 | if (IsInstalledProtoPath(path + "/include")) { 20 | paths->push_back( 21 | std::pair("", path + "/include")); 22 | -------------------------------------------------------------------------------- /ports/protobuf/fix-static-build.patch: -------------------------------------------------------------------------------- 1 | diff --git a/cmake/install.cmake b/cmake/install.cmake 2 | index 825cb25..4f453d6 100644 3 | --- a/cmake/install.cmake 4 | +++ b/cmake/install.cmake 5 | @@ -32,7 +32,7 @@ if (protobuf_BUILD_PROTOC_BINARIES) 6 | install(TARGETS protoc EXPORT protobuf-targets 7 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc 8 | BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) 9 | - if (UNIX AND NOT APPLE) 10 | + if (UNIX AND NOT APPLE AND NOT protobuf_MSVC_STATIC_RUNTIME) 11 | set_property(TARGET protoc 12 | PROPERTY INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") 13 | elseif (APPLE) 14 | -------------------------------------------------------------------------------- /ports/protobuf/portfile.cmake: -------------------------------------------------------------------------------- 1 | vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION} 2 | 3 | vcpkg_from_github( 4 | OUT_SOURCE_PATH SOURCE_PATH 5 | REPO protocolbuffers/protobuf 6 | REF v3.21.12 7 | SHA512 152f8441c325e808b942153c15e82fdb533d5273b50c25c28916ec568ada880f79242bb61ee332ac5fb0d20f21239ed6f8de02ef6256cc574b1fc354d002c6b0 8 | HEAD_REF master 9 | PATCHES 10 | fix-static-build.patch 11 | fix-default-proto-file-path.patch 12 | compile_options.patch 13 | ) 14 | 15 | # Always build binaries 16 | set(protobuf_BUILD_PROTOC_BINARIES ON) 17 | string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" protobuf_BUILD_SHARED_LIBS) 18 | string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" protobuf_MSVC_STATIC_RUNTIME) 19 | 20 | vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS 21 | FEATURES 22 | zlib protobuf_WITH_ZLIB 23 | ) 24 | 25 | if(VCPKG_TARGET_IS_UWP) 26 | set(protobuf_BUILD_LIBPROTOC OFF) 27 | else() 28 | set(protobuf_BUILD_LIBPROTOC ON) 29 | endif() 30 | 31 | if (VCPKG_DOWNLOAD_MODE) 32 | # download PKGCONFIG in download mode which is used in `vcpkg_fixup_pkgconfig()` at the end of this script. 33 | # download it here because `vcpkg_cmake_configure()` halts execution in download mode when running configure process. 34 | vcpkg_find_acquire_program(PKGCONFIG) 35 | endif() 36 | 37 | vcpkg_cmake_configure( 38 | SOURCE_PATH "${SOURCE_PATH}" 39 | OPTIONS 40 | -Dprotobuf_BUILD_SHARED_LIBS=${protobuf_BUILD_SHARED_LIBS} 41 | -Dprotobuf_MSVC_STATIC_RUNTIME=${protobuf_MSVC_STATIC_RUNTIME} 42 | -Dprotobuf_BUILD_TESTS=OFF 43 | -DCMAKE_INSTALL_CMAKEDIR:STRING=share/protobuf 44 | -Dprotobuf_BUILD_PROTOC_BINARIES=${protobuf_BUILD_PROTOC_BINARIES} 45 | -Dprotobuf_BUILD_LIBPROTOC=${protobuf_BUILD_LIBPROTOC} 46 | ${FEATURE_OPTIONS} 47 | ) 48 | 49 | vcpkg_cmake_install() 50 | 51 | # It appears that at this point the build hasn't actually finished. There is probably 52 | # a process spawned by the build, therefore we need to wait a bit. 53 | 54 | function(protobuf_try_remove_recurse_wait PATH_TO_REMOVE) 55 | file(REMOVE_RECURSE ${PATH_TO_REMOVE}) 56 | if (EXISTS "${PATH_TO_REMOVE}") 57 | execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 5) 58 | file(REMOVE_RECURSE ${PATH_TO_REMOVE}) 59 | endif() 60 | endfunction() 61 | 62 | protobuf_try_remove_recurse_wait("${CURRENT_PACKAGES_DIR}/debug/include") 63 | 64 | if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") 65 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake" 66 | "\${_IMPORT_PREFIX}/bin/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX}" 67 | "\${_IMPORT_PREFIX}/tools/protobuf/protoc${VCPKG_HOST_EXECUTABLE_SUFFIX}" 68 | ) 69 | endif() 70 | 71 | if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") 72 | file(READ "${CURRENT_PACKAGES_DIR}/debug/share/protobuf/protobuf-targets-debug.cmake" DEBUG_MODULE) 73 | string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${DEBUG_MODULE}") 74 | string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protobuf/protoc${EXECUTABLE_SUFFIX}" DEBUG_MODULE "${DEBUG_MODULE}") 75 | file(WRITE "${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake" "${DEBUG_MODULE}") 76 | endif() 77 | 78 | protobuf_try_remove_recurse_wait("${CURRENT_PACKAGES_DIR}/debug/share") 79 | 80 | if(protobuf_BUILD_PROTOC_BINARIES) 81 | if(VCPKG_TARGET_IS_WINDOWS) 82 | vcpkg_copy_tools(TOOL_NAMES protoc AUTO_CLEAN) 83 | else() 84 | vcpkg_copy_tools(TOOL_NAMES protoc protoc-${VERSION}.0 AUTO_CLEAN) 85 | endif() 86 | else() 87 | file(COPY "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools") 88 | endif() 89 | 90 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-config.cmake" 91 | "if(protobuf_MODULE_COMPATIBLE)" 92 | "if(ON)" 93 | ) 94 | if(NOT protobuf_BUILD_LIBPROTOC) 95 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-module.cmake" 96 | "_protobuf_find_libraries(Protobuf_PROTOC protoc)" 97 | "" 98 | ) 99 | endif() 100 | 101 | if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") 102 | protobuf_try_remove_recurse_wait("${CURRENT_PACKAGES_DIR}/bin") 103 | protobuf_try_remove_recurse_wait("${CURRENT_PACKAGES_DIR}/debug/bin") 104 | endif() 105 | 106 | if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") 107 | vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/google/protobuf/stubs/platform_macros.h" 108 | "\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" 109 | "\#ifndef PROTOBUF_USE_DLLS\n\#define PROTOBUF_USE_DLLS\n\#endif // PROTOBUF_USE_DLLS\n\n\#endif // GOOGLE_PROTOBUF_PLATFORM_MACROS_H_" 110 | ) 111 | endif() 112 | 113 | vcpkg_copy_pdbs() 114 | set(packages protobuf protobuf-lite) 115 | foreach(_package IN LISTS packages) 116 | set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${_package}.pc") 117 | if(EXISTS "${_file}") 118 | vcpkg_replace_string(${_file} "-l${_package}" "-l${_package}d") 119 | endif() 120 | endforeach() 121 | 122 | vcpkg_fixup_pkgconfig() 123 | 124 | if(NOT protobuf_BUILD_PROTOC_BINARIES) 125 | configure_file("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets-vcpkg-protoc.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/protobuf-targets-vcpkg-protoc.cmake" COPYONLY) 126 | endif() 127 | 128 | configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) 129 | file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) 130 | -------------------------------------------------------------------------------- /ports/protobuf/protobuf-targets-vcpkg-protoc.cmake: -------------------------------------------------------------------------------- 1 | # Create imported target protobuf::protoc 2 | add_executable(protobuf::protoc IMPORTED) 3 | 4 | # Import target "protobuf::protoc" for configuration "Release" 5 | set_property(TARGET protobuf::protoc APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 6 | set_target_properties(protobuf::protoc PROPERTIES 7 | IMPORTED_LOCATION_RELEASE "${Protobuf_PROTOC_EXECUTABLE}" 8 | ) 9 | -------------------------------------------------------------------------------- /ports/protobuf/vcpkg-cmake-wrapper.cmake: -------------------------------------------------------------------------------- 1 | if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.3) 2 | cmake_policy(PUSH) 3 | cmake_policy(SET CMP0057 NEW) 4 | if(NOT "CONFIG" IN_LIST ARGS AND NOT "NO_MODULE" IN_LIST ARGS) 5 | if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") 6 | set(Protobuf_USE_STATIC_LIBS ON) 7 | else() 8 | set(Protobuf_USE_STATIC_LIBS OFF) 9 | endif() 10 | endif() 11 | cmake_policy(POP) 12 | endif() 13 | 14 | find_program(Protobuf_PROTOC_EXECUTABLE NAMES protoc PATHS "${CMAKE_CURRENT_LIST_DIR}/../../../@HOST_TRIPLET@/tools/protobuf" NO_DEFAULT_PATH) 15 | 16 | _find_package(${ARGS}) 17 | -------------------------------------------------------------------------------- /ports/protobuf/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "protobuf", 3 | "version": "3.21.12", 4 | "port-version": 1, 5 | "description": "Protocol Buffers - Google's data interchange format", 6 | "homepage": "https://github.com/protocolbuffers/protobuf", 7 | "license": "BSD-3-Clause", 8 | "dependencies": [ 9 | { 10 | "name": "protobuf", 11 | "host": true 12 | }, 13 | { 14 | "name": "vcpkg-cmake", 15 | "host": true 16 | }, 17 | { 18 | "name": "vcpkg-cmake-config", 19 | "host": true 20 | } 21 | ], 22 | "features": { 23 | "zlib": { 24 | "description": "ZLib based features like Gzip streams", 25 | "dependencies": [ 26 | "zlib" 27 | ] 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ports/re2c/portfile.cmake: -------------------------------------------------------------------------------- 1 | vcpkg_from_github( 2 | OUT_SOURCE_PATH SOURCE_PATH 3 | REPO skvadrik/re2c 4 | REF "${VERSION}" 5 | SHA512 7528d78e1354c774783e63e05553b7a772f8185b43b988cddf79a527ed63316f18e6f9fb3a63ae4d5c83c9f4de2b672b0e61898d96bdd6f15a1eaa7b4d47c757 6 | HEAD_REF master 7 | ) 8 | 9 | set(VCPKG_BUILD_TYPE release) 10 | vcpkg_cmake_configure( 11 | SOURCE_PATH "${SOURCE_PATH}" 12 | ) 13 | 14 | vcpkg_cmake_install() 15 | vcpkg_copy_tools( 16 | TOOL_NAMES re2c re2go re2rust 17 | DESTINATION "${CURRENT_PACKAGES_DIR}/tools/re2c" 18 | AUTO_CLEAN 19 | ) 20 | 21 | set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) 22 | 23 | file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) 24 | -------------------------------------------------------------------------------- /ports/re2c/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "re2c", 3 | "version": "3.1", 4 | "description": "Lexer generator for C, C++, Go and Rust.", 5 | "homepage": "https://re2c.org/", 6 | "license": null, 7 | "dependencies": [ 8 | { 9 | "name": "vcpkg-cmake", 10 | "host": true 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /ports/xed/0001-mbuild-remove-m64.patch: -------------------------------------------------------------------------------- 1 | mbuild/build_env.py | 5 ----- 2 | 1 file changed, 5 deletions(-) 3 | 4 | diff --git a/mbuild/build_env.py b/mbuild/build_env.py 5 | index 396cd99..6de7f08 100755 6 | --- a/mbuild/build_env.py 7 | +++ b/mbuild/build_env.py 8 | @@ -100,11 +100,6 @@ def set_compiler_env_common(env): 9 | 10 | def add_gnu_arch_flags(d): 11 | """Accept a dictionary, return a string""" 12 | - if d['compiler'] in ['gnu','clang'] and d['gcc_version'] != '2.96': # FIXME: iclang? 13 | - if d['host_cpu'] == 'x86-64': 14 | - return '-m64' 15 | - elif d['host_cpu'] == 'ia32': 16 | - return '-m32' 17 | return '' 18 | 19 | 20 | -------------------------------------------------------------------------------- /ports/xed/XEDConfig.cmake: -------------------------------------------------------------------------------- 1 | FUNCTION(SET_LIBRARY_TARGET NAMESPACE LIB_NAME LINK_TYPE DEBUG_LIB_FILE_NAME RELEASE_LIB_FILE_NAME INCLUDE_DIR) 2 | ADD_LIBRARY(${NAMESPACE}::${LIB_NAME} ${LINK_TYPE} IMPORTED) 3 | SET_TARGET_PROPERTIES(${NAMESPACE}::${LIB_NAME} PROPERTIES 4 | IMPORTED_CONFIGURATIONS "RELEASE;DEBUG" 5 | IMPORTED_LOCATION_RELEASE "${RELEASE_LIB_FILE_NAME}" 6 | IMPORTED_LOCATION_DEBUG "${DEBUG_LIB_FILE_NAME}" 7 | INTERFACE_INCLUDE_DIRECTORIES "${INCLUDE_DIR}" 8 | ) 9 | SET(${NAMESPACE}_${LIB_NAME}_FOUND 1) 10 | ENDFUNCTION() 11 | 12 | if(XED_FOUND) 13 | return() 14 | endif() 15 | 16 | GET_FILENAME_COMPONENT(ROOT "${CMAKE_CURRENT_LIST_FILE}" PATH) 17 | GET_FILENAME_COMPONENT(ROOT "${ROOT}" PATH) 18 | GET_FILENAME_COMPONENT(ROOT "${ROOT}" PATH) 19 | 20 | set(_xed_lib_prefix "lib") 21 | if (WIN32) 22 | set(_xed_lib_prefix "") 23 | endif () 24 | 25 | set(XED_STATIC_DEBUG_LIB "${ROOT}/debug/lib/${_xed_lib_prefix}xed${CMAKE_STATIC_LIBRARY_SUFFIX}") 26 | set(XED_SHARE_DEBUG_LIB "${ROOT}/debug/lib/${_xed_lib_prefix}xed${CMAKE_SHARED_LIBRARY_SUFFIX}") 27 | set(ILD_STATIC_DEBUG_LIB "${ROOT}/debug/lib/${_xed_lib_prefix}xed-ild${CMAKE_STATIC_LIBRARY_SUFFIX}") 28 | set(ILD_SHARE_DEBUG_LIB "${ROOT}/debug/lib/${_xed_lib_prefix}xed-ild${CMAKE_SHARED_LIBRARY_SUFFIX}") 29 | 30 | set(XED_STATIC_RELEASE_LIB "${ROOT}/lib/${_xed_lib_prefix}xed${CMAKE_STATIC_LIBRARY_SUFFIX}") 31 | set(XED_SHARE_RELEASE_LIB "${ROOT}/lib/${_xed_lib_prefix}xed${CMAKE_SHARED_LIBRARY_SUFFIX}") 32 | set(ILD_STATIC_RELEASE_LIB "${ROOT}/lib/${_xed_lib_prefix}xed-ild${CMAKE_STATIC_LIBRARY_SUFFIX}") 33 | set(ILD_SHARE_RELEASE_LIB "${ROOT}/lib/${_xed_lib_prefix}xed-ild${CMAKE_SHARED_LIBRARY_SUFFIX}") 34 | 35 | # Check for existence of debug libs 36 | if (NOT EXISTS "${XED_STATIC_DEBUG_LIB}") 37 | set(XED_STATIC_DEBUG_LIB "${XED_STATIC_RELEASE_LIB}") 38 | endif() 39 | if (NOT EXISTS "${ILD_STATIC_DEBUG_LIB}") 40 | set(ILD_STATIC_DEBUG_LIB "${ILD_STATIC_RELEASE_LIB}") 41 | endif() 42 | 43 | # Check for existence of release libs 44 | if (NOT EXISTS "${XED_STATIC_RELEASE_LIB}") 45 | set(XED_STATIC_RELEASE_LIB "${XED_STATIC_DEBUG_LIB}") 46 | endif() 47 | if (NOT EXISTS "${ILD_STATIC_RELEASE_LIB}") 48 | set(ILD_STATIC_RELEASE_LIB "${ILD_STATIC_DEBUG_LIB}") 49 | endif() 50 | 51 | SET_LIBRARY_TARGET("XED" "XED" "STATIC" "${XED_STATIC_DEBUG_LIB}" "${XED_STATIC_RELEASE_LIB}" "${ROOT}/include") 52 | SET_LIBRARY_TARGET("XED" "ILD" "STATIC" "${ILD_STATIC_DEBUG_LIB}" "${ILD_STATIC_RELEASE_LIB}" "${ROOT}/include") 53 | 54 | SET(XED_FOUND 1) 55 | -------------------------------------------------------------------------------- /ports/xed/portfile.cmake: -------------------------------------------------------------------------------- 1 | vcpkg_from_github( 2 | OUT_SOURCE_PATH SOURCE_PATH 3 | REPO intelxed/xed 4 | REF v2022.04.17 5 | SHA512 941511144899701854449b510aed9f03244aee7b3d3ac27de75cf2612baaf2a4df9977ba04d3d6c3e4ea87b12525d081585fbf48c0ff9c5fde7a0f8bba889701 6 | HEAD_REF master 7 | ) 8 | 9 | # Last checked Apr. 18, 2022 10 | # Commit from Apr 16, 2021 11 | vcpkg_from_github( 12 | OUT_SOURCE_PATH MBUILD_SOURCE_PATH 13 | REPO intelxed/mbuild 14 | REF 09b6654be0c52bf1df44e88c88b411a67b624cbd 15 | SHA512 63797a1763ec7ea5ab5897fbd457c0bf715e1a144ae34e44f18c17ab1bbaaa848da479212518eb356d64dd3f46372fb69e955a0033adafc8211f5b4120016ab5 16 | HEAD_REF main 17 | PATCHES 18 | # For arm cross compilation 19 | 0001-mbuild-remove-m64.patch 20 | ) 21 | 22 | # Xed has its own compiler detection, and will readily guess wrong. 23 | # Help it out by finding the correct compiler 24 | z_vcpkg_get_cmake_vars(cmake_vars_file) 25 | include("${cmake_vars_file}") 26 | message(STATUS "Detected CXX compiler: ${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") 27 | message(STATUS "Detected C compiler: ${VCPKG_DETECTED_CMAKE_C_COMPILER}") 28 | 29 | # Copy mbuild sources. 30 | message(STATUS "Copying mbuild to parallel source directory...") 31 | file(COPY ${MBUILD_SOURCE_PATH}/ DESTINATION ${SOURCE_PATH}/../mbuild) 32 | message(STATUS "Copied mbuild") 33 | 34 | set(EXTRA_CXX_FLAGS_RELEASE "") 35 | set(EXTRA_C_FLAGS_RELEASE "") 36 | set(EXTRA_CXX_FLAGS_DEBUG "") 37 | set(EXTRA_C_FLAGS_DEBUG "") 38 | 39 | set(LINK_TYPE shared) 40 | if (VCPKG_LIBRARY_LINKAGE STREQUAL static) 41 | set(LINK_TYPE static) 42 | # Windows static library and dynamic crt linkage 43 | if (NOT VCPKG_CMAKE_SYSTEM_NAME AND VCPKG_CRT_LINKAGE STREQUAL dynamic) 44 | set(EXTRA_CXX_FLAGS_RELEASE "${EXTRA_CXX_FLAGS_RELEASE} /MD") 45 | set(EXTRA_C_FLAGS_RELEASE "${EXTRA_C_FLAGS_RELEASE} /MD") 46 | set(EXTRA_CXX_FLAGS_DEBUG "${EXTRA_CXX_FLAGS_DEBUG} /MDd") 47 | set(EXTRA_C_FLAGS_DEBUG "${EXTRA_C_FLAGS_DEBUG} /MDd") 48 | endif() 49 | endif() 50 | 51 | set(RELEASE_TRIPLET ${TARGET_TRIPLET}-rel) 52 | set(DEBUG_TRIPLET ${TARGET_TRIPLET}-dbg) 53 | 54 | # Build 55 | vcpkg_find_acquire_program(PYTHON3) 56 | if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release) 57 | 58 | # Not entirely sure if we actually repeat any of the build work if we do 59 | # separate build and install phases, so just combine them for now 60 | message(STATUS "Building and installing ${RELEASE_TRIPLET}") 61 | file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}) 62 | file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}) 63 | vcpkg_execute_required_process( 64 | COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --no-werror "--cc=${VCPKG_DETECTED_CMAKE_C_COMPILER}" "--cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR} --build-dir "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_DETECTED_CMAKE_C_FLAGS} ${VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}" "--extra-cxxflags=${VCPKG_DETECTED_CMAKE_CXX_FLAGS} ${VCPKG_DETECTED_CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS_RELEASE}" "--extra-linkflags=${VCPKG_DETECTED_CMAKE_LINKER_FLAGS} ${VCPKG_DETECTED_CMAKE_LINKER_FLAGS_RELEASE}" --verbose=9 65 | WORKING_DIRECTORY ${SOURCE_PATH} 66 | LOGNAME python-${TARGET_TRIPLET}-build-install-rel 67 | ) 68 | 69 | # Cleanup 70 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" 71 | "${CURRENT_PACKAGES_DIR}/extlib" 72 | "${CURRENT_PACKAGES_DIR}/doc" 73 | "${CURRENT_PACKAGES_DIR}/examples" 74 | "${CURRENT_PACKAGES_DIR}/mbuild" 75 | ) 76 | endif() 77 | 78 | if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) 79 | 80 | # Not entirely sure if we actually repeat any of the build work if we do 81 | # separate build and install phases, so just combine them for now 82 | message(STATUS "Building and installing ${DEBUG_TRIPLET}") 83 | file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}) 84 | file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}) 85 | vcpkg_execute_required_process( 86 | COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --no-werror "--cc=${VCPKG_DETECTED_CMAKE_C_COMPILER}" "--cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" --debug --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR}/debug --build-dir "${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_DETECTED_CMAKE_C_FLAGS} ${VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}" "--extra-cxxflags=${VCPKG_DETECTED_CMAKE_CXX_FLAGS} ${VCPKG_DETECTED_CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS_DEBUG}" "--extra-linkflags=${VCPKG_DETECTED_CMAKE_LINKER_FLAGS} ${VCPKG_DETECTED_CMAKE_LINKER_FLAGS_DEBUG}" --verbose=9 87 | WORKING_DIRECTORY ${SOURCE_PATH} 88 | LOGNAME python-${TARGET_TRIPLET}-build-install-dbg 89 | ) 90 | 91 | # Cleanup 92 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" 93 | "${CURRENT_PACKAGES_DIR}/debug/include" 94 | "${CURRENT_PACKAGES_DIR}/debug/extlib" 95 | "${CURRENT_PACKAGES_DIR}/debug/doc" 96 | "${CURRENT_PACKAGES_DIR}/debug/examples" 97 | "${CURRENT_PACKAGES_DIR}/debug/mbuild" 98 | ) 99 | endif() 100 | 101 | file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/XEDConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) 102 | file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) 103 | file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) 104 | file(INSTALL ${MBUILD_SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME mbuild.copyright) 105 | -------------------------------------------------------------------------------- /ports/xed/usage: -------------------------------------------------------------------------------- 1 | The package xed is compatible with built-in CMake targets: 2 | 3 | find_package(XED REQUIRED) 4 | target_link_libraries(main PRIVATE XED::XED XED::ILD) 5 | -------------------------------------------------------------------------------- /ports/xed/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xed", 3 | "version-date": "2022-04-17", 4 | "port-version": 1, 5 | "description": "x86 encoder decoder", 6 | "homepage": "https://intelxed.github.io/", 7 | "license": "Apache-2.0" 8 | } 9 | -------------------------------------------------------------------------------- /ports/z3/fix-install-path.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt 2 | index e8de0c7e4..064c18eab 100644 3 | --- a/src/CMakeLists.txt 4 | +++ b/src/CMakeLists.txt 5 | @@ -173,6 +173,7 @@ install(TARGETS libz3 6 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 7 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" # On Windows this installs ``libz3.lib`` which CMake calls the "corresponding import library". Do we want this installed? 8 | RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" # For Windows. DLLs are runtime targets for CMake 9 | + BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" # For MACOSX. 10 | PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" 11 | ) 12 | 13 | diff --git a/src/shell/CMakeLists.txt b/src/shell/CMakeLists.txt 14 | index 278246341..b6cd2f1c1 100644 15 | --- a/src/shell/CMakeLists.txt 16 | +++ b/src/shell/CMakeLists.txt 17 | @@ -44,5 +44,5 @@ target_link_libraries(shell PRIVATE ${Z3_DEPENDENT_LIBS}) 18 | z3_add_component_dependencies_to_target(shell ${shell_expanded_deps}) 19 | z3_append_linker_flag_list_to_target(shell ${Z3_DEPENDENT_EXTRA_CXX_LINK_FLAGS}) 20 | install(TARGETS shell 21 | - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" 22 | + RUNTIME DESTINATION tools/z3 23 | ) 24 | -------------------------------------------------------------------------------- /ports/z3/portfile.cmake: -------------------------------------------------------------------------------- 1 | vcpkg_find_acquire_program(PYTHON3) 2 | get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) 3 | vcpkg_add_to_path("${PYTHON3_DIR}") 4 | 5 | vcpkg_from_github( 6 | OUT_SOURCE_PATH SOURCE_PATH 7 | REPO Z3Prover/z3 8 | REF z3-4.12.1 9 | SHA512 031fba9cc000a8da0025f95fa3f1c7519071d1b7775b377ff3192c505bb4c7e3d267da246c9ae68c940224e055a3c30571d2c0d7fbb042ec9a3d5849543a385c 10 | HEAD_REF master 11 | PATCHES 12 | fix-install-path.patch 13 | remove-flag-overrides.patch 14 | ) 15 | 16 | if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") 17 | set(BUILD_STATIC "-DZ3_BUILD_LIBZ3_SHARED=OFF") 18 | endif() 19 | 20 | vcpkg_cmake_configure( 21 | SOURCE_PATH ${SOURCE_PATH} 22 | OPTIONS 23 | ${BUILD_STATIC} 24 | -DZ3_BUILD_TEST_EXECUTABLES=OFF 25 | -DZ3_ENABLE_EXAMPLE_TARGETS=OFF 26 | ) 27 | 28 | vcpkg_cmake_install() 29 | vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/z3) 30 | vcpkg_copy_pdbs() 31 | 32 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") 33 | 34 | file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) 35 | 36 | vcpkg_fixup_pkgconfig() 37 | -------------------------------------------------------------------------------- /ports/z3/remove-flag-overrides.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 477410ba8..fcca03917 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -1,7 +1,6 @@ 6 | # Enforce some CMake policies 7 | cmake_minimum_required(VERSION 3.4) 8 | 9 | -set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_compiler_flags_overrides.cmake") 10 | project(Z3 VERSION 4.12.1.0 LANGUAGES CXX) 11 | 12 | ################################################################################ 13 | -------------------------------------------------------------------------------- /ports/z3/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "z3", 3 | "version": "4.12.1", 4 | "description": "Z3 is a theorem prover from Microsoft Research", 5 | "homepage": "https://github.com/Z3Prover/z3", 6 | "license": "MIT", 7 | "supports": "!uwp", 8 | "dependencies": [ 9 | { 10 | "name": "vcpkg-cmake", 11 | "host": true 12 | }, 13 | { 14 | "name": "vcpkg-cmake-config", 15 | "host": true 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /scripts/assert_arch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Simple script to check whether a file was compiled with the chosen 4 | # architecture. Only supports checking binaries that are from the same 5 | # executable file format as the host (i.e., does not support checking linux 6 | # binaries on macOS) 7 | # 8 | # Usage: 9 | # assert_arch.sh 10 | # 11 | # Example (run in parent directory): 12 | # find ./vcpkg/installed/arm64-osx-rel -type f \( -name "*.a" -o -name "*.dylib" -o -executable \) -exec ./scripts/assert_arch.sh arm64 {} \; 13 | # find ./vcpkg/installed/arm64-linux-rel -type f \( -name "*.a" -o -name "*.so" -o -executable \) -exec ./scripts/assert_arch.sh aarch64 {} \; 14 | 15 | if [ $# -ne 2 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then 16 | echo "Usage: assert_arch.sh " 17 | echo "macOS uses 'arm64' and Linux uses 'aarch64'" 18 | exit 1 19 | fi 20 | 21 | # TODO: Would be nice if we could choose our tool based on the executable 22 | # format 23 | if [ "$(uname)" = "Darwin" ] ; then 24 | arch=$(lipo -archs "$2" 2> /dev/null) 25 | else 26 | # Assume Linux binutils, grep, sed, sort, uniq are available 27 | arch=$(objdump -f "$2" 2> /dev/null | perl -ne 's/^architecture: ([a-zA-Z0-9_-]+)/$1/ && print' | sort | uniq) 28 | fi 29 | 30 | # Do the check 31 | if [ -n "${arch}" ] && ! (echo "${arch}" | grep -q "$1"); then 32 | echo "$2: Incorrect arch found: '${arch}'" 33 | exit 1 34 | fi 35 | -------------------------------------------------------------------------------- /scripts/assert_asan.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Simple script to check whether a (Linux) file was compiled with address 4 | # sanitizer 5 | # Usage: 6 | # assert_asan.sh 7 | 8 | if ! (nm "$1" | grep -q "__asan"); then 9 | echo "Missing asan $1" 10 | exit 1 11 | fi 12 | -------------------------------------------------------------------------------- /toolchain/vcpkg_unix_sanitizer_toolchain.cmake: -------------------------------------------------------------------------------- 1 | # This toolchain only sets up override compiler flags for CMake's 'Release' and 2 | # 'Debug' build types. You _must_ set your sanitizer flag(s) 3 | # ('-fsanitize=address') in the vcpkg triplet. These flags aren't globally 4 | # applied because some programs like LLVM don't play nice with global 5 | # sanitizers and have their own buildsystem options to enable compilation with 6 | # those flags. 7 | get_property(_CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE) 8 | if(NOT _CMAKE_IN_TRY_COMPILE) 9 | # Our override flags for sanitization, but does not include sanitizer flags, 10 | # that comes from vcpkg flags 11 | set(common_flags "-O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls") 12 | 13 | # Copied from vcpkg's 'scripts/toolchain/linux.cmake'. Don't use the `_INIT` 14 | # suffix because we want to _override_ any flags that CMake would use 15 | set(CMAKE_C_FLAGS " -fPIC ${common_flags} ${VCPKG_C_FLAGS} ") 16 | set(CMAKE_CXX_FLAGS " -fPIC ${common_flags} ${VCPKG_CXX_FLAGS} ") 17 | set(CMAKE_C_FLAGS_DEBUG " ${VCPKG_C_FLAGS_DEBUG} ") 18 | set(CMAKE_CXX_FLAGS_DEBUG " ${VCPKG_CXX_FLAGS_DEBUG} ") 19 | set(CMAKE_C_FLAGS_RELEASE " -DNDEBUG ${VCPKG_C_FLAGS_RELEASE} ") 20 | set(CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG ${VCPKG_CXX_FLAGS_RELEASE} ") 21 | 22 | set(CMAKE_SHARED_LINKER_FLAGS " ${VCPKG_LINKER_FLAGS} ") 23 | set(CMAKE_EXE_LINKER_FLAGS " ${VCPKG_LINKER_FLAGS} ") 24 | if(VCPKG_CRT_LINKAGE STREQUAL "static") 25 | string(APPEND CMAKE_SHARED_LINKER_FLAGS "-static ") 26 | string(APPEND CMAKE_EXE_LINKER_FLAGS APPEND "-static ") 27 | endif() 28 | set(CMAKE_SHARED_LINKER_FLAGS_DEBUG " ${VCPKG_LINKER_FLAGS_DEBUG} ") 29 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG " ${VCPKG_LINKER_FLAGS_DEBUG} ") 30 | set(CMAKE_SHARED_LINKER_FLAGS_RELEASE " ${VCPKG_LINKER_FLAGS_RELEASE} ") 31 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE " ${VCPKG_LINKER_FLAGS_RELEASE} ") 32 | endif() 33 | -------------------------------------------------------------------------------- /triplets/arm64-linux-rel.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE arm64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | set(VCPKG_BUILD_TYPE release) 5 | 6 | set(VCPKG_CMAKE_SYSTEM_NAME Linux) 7 | -------------------------------------------------------------------------------- /triplets/arm64-osx-asan.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE arm64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | 5 | # ASAN 6 | # Make sure this value matches up with https://llvm.org/docs/CMake.html "LLVM_USE_SANITIZER" 7 | set(VCPKG_USE_SANITIZER "Address") 8 | 9 | # If the following flags cause errors during build, you might need to manually 10 | # ignore the PORT and check VCPKG_USE_SANITIZER 11 | set(VCPKG_CXX_FLAGS "-fsanitize=address") 12 | set(VCPKG_C_FLAGS "-fsanitize=address") 13 | 14 | # Always apply sanitizer to linker flags 15 | set(VCPKG_LINKER_FLAGS "-fsanitize=address") 16 | 17 | # This is where we override default CMake compiler/linker flags 18 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchain/vcpkg_unix_sanitizer_toolchain.cmake") 19 | 20 | set(VCPKG_CMAKE_SYSTEM_NAME Darwin) 21 | set(VCPKG_OSX_ARCHITECTURES arm64) 22 | -------------------------------------------------------------------------------- /triplets/arm64-osx-rel.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE arm64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | set(VCPKG_BUILD_TYPE release) 5 | 6 | set(VCPKG_CMAKE_SYSTEM_NAME Darwin) 7 | set(VCPKG_OSX_ARCHITECTURES arm64) 8 | -------------------------------------------------------------------------------- /triplets/x64-linux-asan.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE x64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | 5 | # ASAN 6 | # Make sure this value matches up with https://llvm.org/docs/CMake.html "LLVM_USE_SANITIZER" 7 | set(VCPKG_USE_SANITIZER "Address") 8 | 9 | # If the following flags cause errors during build, you might need to manually 10 | # ignore the PORT and check VCPKG_USE_SANITIZER 11 | set(VCPKG_CXX_FLAGS "-fsanitize=address") 12 | set(VCPKG_C_FLAGS "-fsanitize=address") 13 | 14 | # Always apply sanitizer to linker flags 15 | set(VCPKG_LINKER_FLAGS "-fsanitize=address") 16 | 17 | # This is where we override default CMake compiler/linker flags 18 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchain/vcpkg_unix_sanitizer_toolchain.cmake") 19 | 20 | set(VCPKG_CMAKE_SYSTEM_NAME Linux) 21 | -------------------------------------------------------------------------------- /triplets/x64-linux-rel-asan.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE x64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | 5 | # Only release builds 6 | set(VCPKG_BUILD_TYPE release) 7 | 8 | # ASAN 9 | # Make sure this value matches up with https://llvm.org/docs/CMake.html "LLVM_USE_SANITIZER" 10 | set(VCPKG_USE_SANITIZER "Address") 11 | 12 | # If the following flags cause errors during build, you might need to manually 13 | # ignore the PORT and check VCPKG_USE_SANITIZER 14 | set(VCPKG_CXX_FLAGS "-fsanitize=address") 15 | set(VCPKG_C_FLAGS "-fsanitize=address") 16 | 17 | # Always apply sanitizer to linker flags 18 | set(VCPKG_LINKER_FLAGS "-fsanitize=address") 19 | 20 | # This is where we override default CMake compiler/linker flags 21 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchain/vcpkg_unix_sanitizer_toolchain.cmake") 22 | 23 | set(VCPKG_CMAKE_SYSTEM_NAME Linux) 24 | -------------------------------------------------------------------------------- /triplets/x64-linux-rel.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE x64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | 5 | # Only release builds 6 | set(VCPKG_BUILD_TYPE release) 7 | 8 | set(VCPKG_CMAKE_SYSTEM_NAME Linux) 9 | -------------------------------------------------------------------------------- /triplets/x64-osx-asan.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE x64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | 5 | # ASAN 6 | # Make sure this value matches up with https://llvm.org/docs/CMake.html "LLVM_USE_SANITIZER" 7 | set(VCPKG_USE_SANITIZER "Address") 8 | 9 | # If the following flags cause errors during build, you might need to manually 10 | # ignore the PORT and check VCPKG_USE_SANITIZER 11 | set(VCPKG_CXX_FLAGS "-fsanitize=address") 12 | set(VCPKG_C_FLAGS "-fsanitize=address") 13 | 14 | # Always apply sanitizer to linker flags 15 | set(VCPKG_LINKER_FLAGS "-fsanitize=address") 16 | 17 | # This is where we override default CMake compiler/linker flags 18 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchain/vcpkg_unix_sanitizer_toolchain.cmake") 19 | 20 | set(VCPKG_CMAKE_SYSTEM_NAME Darwin) 21 | set(VCPKG_OSX_ARCHITECTURES x86_64) 22 | -------------------------------------------------------------------------------- /triplets/x64-osx-rel-asan.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE x64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | 5 | # Only release builds 6 | set(VCPKG_BUILD_TYPE release) 7 | 8 | # ASAN 9 | # Make sure this value matches up with https://llvm.org/docs/CMake.html "LLVM_USE_SANITIZER" 10 | set(VCPKG_USE_SANITIZER "Address") 11 | 12 | # If the following flags cause errors during build, you might need to manually 13 | # ignore the PORT and check VCPKG_USE_SANITIZER 14 | set(VCPKG_CXX_FLAGS "-fsanitize=address") 15 | set(VCPKG_C_FLAGS "-fsanitize=address") 16 | 17 | # Always apply sanitizer to linker flags 18 | set(VCPKG_LINKER_FLAGS "-fsanitize=address") 19 | 20 | # This is where we override default CMake compiler/linker flags 21 | set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/../toolchain/vcpkg_unix_sanitizer_toolchain.cmake") 22 | 23 | set(VCPKG_CMAKE_SYSTEM_NAME Darwin) 24 | set(VCPKG_OSX_ARCHITECTURES x86_64) 25 | -------------------------------------------------------------------------------- /triplets/x64-osx-rel.cmake: -------------------------------------------------------------------------------- 1 | set(VCPKG_TARGET_ARCHITECTURE x64) 2 | set(VCPKG_CRT_LINKAGE dynamic) 3 | set(VCPKG_LIBRARY_LINKAGE static) 4 | set(VCPKG_BUILD_TYPE release) 5 | 6 | set(VCPKG_CMAKE_SYSTEM_NAME Darwin) 7 | set(VCPKG_OSX_ARCHITECTURES x86_64) 8 | -------------------------------------------------------------------------------- /triplets/x64-windows-static-md-rel.cmake: -------------------------------------------------------------------------------- 1 | # Modified from upstream's triplet of a similar name to only build Release 2 | # build-types 3 | 4 | set(VCPKG_TARGET_ARCHITECTURE x64) 5 | set(VCPKG_CRT_LINKAGE dynamic) 6 | set(VCPKG_LIBRARY_LINKAGE static) 7 | 8 | # Keep commented since a blank VCPKG_CMAKE_SYSTEM_NAME is default Windows but 9 | # setting explicitly to "Windows" is wrong. 10 | # https://github.com/microsoft/vcpkg/blob/3f7b6777560cc9006aa43b3c4587e4d95bac7c40/scripts/cmake/vcpkg_common_definitions.cmake#L30 11 | # set(VCPKG_CMAKE_SYSTEM_NAME Windows) 12 | 13 | set(VCPKG_BUILD_TYPE release) 14 | -------------------------------------------------------------------------------- /triplets/x64-windows-static-md.cmake: -------------------------------------------------------------------------------- 1 | # Modified from upstream's triplet of a similar name to only build Release 2 | # build-types 3 | 4 | set(VCPKG_TARGET_ARCHITECTURE x64) 5 | set(VCPKG_CRT_LINKAGE dynamic) 6 | set(VCPKG_LIBRARY_LINKAGE static) 7 | 8 | # Keep commented since a blank VCPKG_CMAKE_SYSTEM_NAME is default Windows but 9 | # setting explicitly to "Windows" is wrong. 10 | # https://github.com/microsoft/vcpkg/blob/3f7b6777560cc9006aa43b3c4587e4d95bac7c40/scripts/cmake/vcpkg_common_definitions.cmake#L30 11 | # set(VCPKG_CMAKE_SYSTEM_NAME Windows) 12 | -------------------------------------------------------------------------------- /vcpkg_info.txt: -------------------------------------------------------------------------------- 1 | https://github.com/trail-of-forks/vcpkg.git 2 | 6258cbffe91897b52573929d2937481de7d66c8e 3 | --------------------------------------------------------------------------------