Skip to content
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
384e48f
Use separate directory for build
sitaowang1998 Jun 8, 2025
ca3967a
Copy the folder instead of symlink
sitaowang1998 Jun 9, 2025
c70d154
Merge generate and build task; Use checksum to skip tasks
sitaowang1998 Jun 9, 2025
0d49309
Fix path
sitaowang1998 Jun 9, 2025
b5ad554
Fix typo
sitaowang1998 Jun 9, 2025
fe92a80
Use checksum to skip generate; Merge build and install and separate c…
sitaowang1998 Jun 9, 2025
5b0b96c
Fix index
sitaowang1998 Jun 9, 2025
d3775b3
Remove install checksum
sitaowang1998 Jun 9, 2025
96fc539
Remove install checksum
sitaowang1998 Jun 9, 2025
f6a856a
Fix docstring
sitaowang1998 Jun 9, 2025
5f680a4
Fix docstring
sitaowang1998 Jun 9, 2025
c57bf19
Remove use of dir
sitaowang1998 Jun 10, 2025
24c5176
Improve docstring
sitaowang1998 Jun 11, 2025
3651df2
Improve docstring
sitaowang1998 Jun 11, 2025
008fdc4
Use GENERATE_CHECKSUM_FILE instead of GENERATE_CHECKSUM
sitaowang1998 Jun 11, 2025
7271b9d
Rename BUILD_ARGS to BUILD_AND_INSTALL_ARGS
sitaowang1998 Jun 11, 2025
3df61e4
Move cmake step into build-and-install
sitaowang1998 Jun 11, 2025
e01262d
Improve docstring for build-and-install
sitaowang1998 Jun 11, 2025
037a814
Remove duplicate argument in docstring
sitaowang1998 Jun 11, 2025
65c4c60
Fix cmake
sitaowang1998 Jun 11, 2025
9786089
Copy directory without creating target directory
sitaowang1998 Jun 11, 2025
72b2964
Fix docstring
sitaowang1998 Jun 11, 2025
4311d99
Fix argument mismatch
sitaowang1998 Jun 11, 2025
e146d53
Fix docstring
sitaowang1998 Jun 11, 2025
409ffde
Merge branch 'boost-build' of github.com:sitaowang1998/yscope-dev-uti…
sitaowang1998 Jun 11, 2025
339c013
Fix default args
sitaowang1998 Jun 11, 2025
0ad5cba
Fix docstring
sitaowang1998 Jun 11, 2025
7f073d1
Apply suggestions from code review
davidlion Jun 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 76 additions & 72 deletions exports/taskfiles/utils/boost.yaml
Original file line number Diff line number Diff line change
@@ -1,107 +1,108 @@
version: "3"

includes:
checksum: "checksum.yaml"
remote: "remote.yaml"

set: ["u", "pipefail"]
shopt: ["globstar"]

tasks:
# Runs the bootstrap.sh generate step in the given source directory. Boost only supports
# in-source generation and building.
# Generates `GENERATE_DIR` by copying `SOURCE_DIR` and then running boost's bootstrap step.
Comment thread
sitaowang1998 marked this conversation as resolved.
#
# @param {string} SOURCE_DIR Project source directory.
# @param {string} GENERATE_DIR Directory in which to generate `b2` and the build configuration.
# @param {string} GENERATE_CHECKSUM_FILE Checksum file for `GENERATE_DIR`.
# @param {string} INSTALL_PREFIX Path prefix of where the project should be installed.
# @param {string[]} TARGETS Target libraries to build.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the generate command.
generate:
internal: true
dir: "{{.SOURCE_DIR}}"
vars:
EXTRA_ARGS:
ref: "default (list) .EXTRA_ARGS"
requires:
vars: ["SOURCE_DIR", "INSTALL_PREFIX", "TARGETS"]
vars: ["SOURCE_DIR", "GENERATE_DIR", "GENERATE_CHECKSUM_FILE", "INSTALL_PREFIX", "TARGETS"]
sources:
- "{{.SOURCE_DIR}}/**/*"
generates:
- "{{.GENERATE_CHECKSUM_FILE}}"
deps:
- task: "checksum:validate"
vars:
CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}"
INCLUDE_PATTERNS:
- "{{.GENERATE_DIR}}"
Comment thread
sitaowang1998 marked this conversation as resolved.
Comment thread
sitaowang1998 marked this conversation as resolved.
cmds:
Comment thread
sitaowang1998 marked this conversation as resolved.
- >-
rm -rf "{{.GENERATE_DIR}}"
Comment thread
sitaowang1998 marked this conversation as resolved.
- >-
cp -R "{{.SOURCE_DIR}}" "{{.GENERATE_DIR}}"
- >-
pushd "{{.GENERATE_DIR}}";
Comment thread
sitaowang1998 marked this conversation as resolved.
./bootstrap.sh
--prefix="{{.INSTALL_PREFIX}}"
--exec-prefix="{{.INSTALL_PREFIX}}"
--with-libraries={{(join "," .TARGETS)}}
{{- range .EXTRA_ARGS}}
"{{.}}"
{{- end}}
{{- end}};
popd
- task: "checksum:compute"
vars:
CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}"
INCLUDE_PATTERNS:
- "{{.GENERATE_DIR}}"
Comment thread
sitaowang1998 marked this conversation as resolved.

# Runs the b2 build step for boost. The caller must have previously called `generate` on
# `SOURCE_DIR` for this task to succeed.
# Runs boost's b2 build and install step, and creates a CMake settings file. The caller must have
# previously called `generate` on `SOURCE_DIR` (to produce the `GENERATE_DIR`) for this task to
# succeed.
#
# @param {string} SOURCE_DIR Directory containing the boost source.
# @param {string} GENERATE_DIR Directory containing boost's source and build files.
# @param {string} BUILD_DIR Directory in which to build boost.
# @param {string} INSTALL_PREFIX Path prefix of where the project should be installed.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the build command.
# @param {int} [JOBS] The maximum number of concurrent processes to use when building. If
# omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the
# default is the number of cores.
build:
# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings
# file should be stored.
Comment thread
sitaowang1998 marked this conversation as resolved.
build-and-install:
internal: true
dir: "{{.SOURCE_DIR}}"
vars:
EXTRA_ARGS:
ref: "default (list) .EXTRA_ARGS"
Comment thread
sitaowang1998 marked this conversation as resolved.
JOBS: >-
Comment thread
sitaowang1998 marked this conversation as resolved.
{{default "" .JOBS}}
requires:
vars: ["SOURCE_DIR"]
vars: ["GENERATE_DIR", "BUILD_DIR", "INSTALL_PREFIX"]
Comment thread
sitaowang1998 marked this conversation as resolved.
Comment thread
sitaowang1998 marked this conversation as resolved.
cmds:
- >-
pushd "{{.GENERATE_DIR}}";
./b2
install
--build-dir="{{.BUILD_DIR}}"
{{- range .EXTRA_ARGS}}
Comment thread
sitaowang1998 marked this conversation as resolved.
"{{.}}"
{{- end}}
{{- if .JOBS}}
"-j{{.JOBS}}"
{{- end}}

# Runs the b2 install step for boost. The caller must have previously called `build` on
# `SOURCE_DIR` for this task to succeed. If `CMAKE_SETTINGS_DIR` is set, a settings file will be
# created in that directory, containing a `boost_ROOT` CMake variable that points to
# `INSTALL_PREFIX`.
#
# @param {string} SOURCE_DIR Directory containing the boost source.
# @param {string} INSTALL_PREFIX Path prefix of where the project should be installed.
# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings
# file should be stored.
# @param {string[]} [EXTRA_ARGS] Any additional arguments to pass to the install command.
install:
internal: true
dir: "{{.SOURCE_DIR}}"
vars:
EXTRA_ARGS:
ref: "default (list) .EXTRA_ARGS"
INSTALL_PREFIX: >-
{{default "" .INSTALL_PREFIX}}
CMAKE_SETTINGS_DIR: >-
{{default "" .CMAKE_SETTINGS_DIR}}
requires:
vars: ["SOURCE_DIR", "INSTALL_PREFIX"]
cmds:
- >-
./b2
install
{{- range .EXTRA_ARGS}}
"{{.}}"
{{- end}}
{{- end}};
popd;
Comment thread
sitaowang1998 marked this conversation as resolved.
- >-
{{- if .CMAKE_SETTINGS_DIR}}
echo "set(Boost_ROOT
\"{{.INSTALL_PREFIX}}\"
CACHE PATH
\"Package root for boost.\"
)" >> "{{.CMAKE_SETTINGS_DIR}}/boost.cmake"
\"Package root for Boost.\"
)" >> "{{.CMAKE_SETTINGS_DIR}}/Boost.cmake"
{{- end}}

# Downloads boost from `URL` and installs boost.
#
# General parameters
# @param {string} [WORK_DIR={{.ROOT_DIR}}] Base directory to store the install and src
# directories inside.
# @param {string} [WORK_DIR={{.ROOT_DIR}}] Base directory in which to store the source, generate,
# build, and install directories.
# @param {string} [SOURCE_DIR={{.WORK_DIR}}/boost-src] Directory in which to extract the tar
# file.
#
Expand All @@ -110,19 +111,22 @@ tasks:
# @param {string} URL
#
# Boost generate parameters
# @param {string} [GENERATE_DIR={{.WORK_DIR}}/boost-generate] Directory in which to generate the
# project build files.
# @param {string} [GENERATE_CHECKSUM_FILE={{.WORK_DIR}}/boost-generate.md5] Checksum file for the
# generate directory.
# @param {string} [INSTALL_PREFIX={{.WORK_DIR}}/boost-install] Path prefix of where the project
# should be installed.
# @param {string[]} [TARGETS] Target libraries to build.
# @param {string[]} [GEN_ARGS] Any additional arguments to pass to the generate command.
# @param {string[]} [GENERATE_ARGS] Any additional arguments to pass to the generate command.
#
# Boost build parameters
# Boost build-and-install parameters
# @param {string} [BUILD_DIR={{.WORK_DIR}}/boost-build] Directory in which to build the project.
# @param {int} [JOBS] The maximum number of concurrent processes to use when building. If
# omitted, the b2 default number is used. Before 1.76.0, the number was 1. Since 1.76.0, the
# default is the number of cores.
# @param {string[]} [BUILD_ARGS] Any additional arguments to pass to the build command.
#
# Boost install parameters
# @param {string[]} [INSTALL_ARGS] Any additional arguments to pass to the install command.
# @param {string[]} [BUILD_AND_INSTALL_ARGS] Any additional arguments to pass to boost's build
# and install command.
Comment thread
sitaowang1998 marked this conversation as resolved.
# @param {string} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings
# file should be stored.
download-and-install:
Expand All @@ -136,22 +140,24 @@ tasks:
{{default (printf "%s/boost-src" .WORK_DIR) .SOURCE_DIR}}

# Boost generate parameters
GENERATE_DIR: >-
{{default (printf "%s/boost-generate" .WORK_DIR) .GENERATE_DIR}}
GENERATE_CHECKSUM_FILE: >-
{{default (printf "%s/boost-generate.md5" .WORK_DIR) .GENERATE_CHECKSUM_FILE}}
INSTALL_PREFIX: >-
{{default (printf "%s/boost-install" .WORK_DIR) .INSTALL_PREFIX}}
TARGETS:
ref: "default (list) .TARGETS"
GEN_ARGS:
ref: "default (list) .GEN_ARGS"
GENERATE_ARGS:
ref: "default (list) .GENERATE_ARGS"

Comment thread
sitaowang1998 marked this conversation as resolved.
# Boost build parameters
BUILD_ARGS:
ref: "default (list) .BUILD_ARGS"
# Boost build-and-install parameters
BUILD_DIR: >-
{{default (printf "%s/boost-build" .WORK_DIR) .BUILD_DIR}}
BUILD_AND_INSTALL_ARGS:
ref: "default (list) .BUILD_AND_INSTALL_ARGS"
JOBS: >-
{{default "" .JOBS}}

# Boost install parameters
INSTALL_ARGS:
ref: "default (list) .INSTALL_ARGS"
CMAKE_SETTINGS_DIR: >-
{{default "" .CMAKE_SETTINGS_DIR}}
requires:
Expand All @@ -166,21 +172,19 @@ tasks:
- task: "generate"
vars:
SOURCE_DIR: "{{.SOURCE_DIR}}"
GENERATE_DIR: "{{.GENERATE_DIR}}"
GENERATE_CHECKSUM_FILE: "{{.GENERATE_CHECKSUM_FILE}}"
INSTALL_PREFIX: "{{.INSTALL_PREFIX}}"
TARGETS:
ref: ".TARGETS"
EXTRA_ARGS:
ref: ".GEN_ARGS"
- task: "build"
vars:
SOURCE_DIR: "{{.SOURCE_DIR}}"
JOBS: "{{.JOBS}}"
EXTRA_ARGS:
ref: ".BUILD_ARGS"
- task: "install"
ref: ".GENERATE_ARGS"
- task: "build-and-install"
vars:
SOURCE_DIR: "{{.SOURCE_DIR}}"
GENERATE_DIR: "{{.GENERATE_DIR}}"
BUILD_DIR: "{{.BUILD_DIR}}"
INSTALL_PREFIX: "{{.INSTALL_PREFIX}}"
CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}"
EXTRA_ARGS:
ref: ".INSTALL_ARGS"
ref: ".BUILD_AND_INSTALL_ARGS"
JOBS: "{{.JOBS}}"
CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}"