-
Notifications
You must be signed in to change notification settings - Fork 10
feat(taskfiles): Add tasks to install a list of boost libraries as dependencies. #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
b26c793
Add tasks to install boost libraries
sitaowang1998 a7ce193
Add boost install test
sitaowang1998 c2d72f1
Reformat files
sitaowang1998 01a18ab
Reformat cmake files
sitaowang1998 0b70373
Fix clang-tidy
sitaowang1998 1ba12d3
Fix if comparison to follow style guideline.
sitaowang1998 8aca005
Fix cmake for wrong reference
sitaowang1998 238d1de
Merge branch 'boost-install-task' of github.com:sitaowang1998/yscope-…
sitaowang1998 b0b9c9c
Remove unnecessary check for library not found.
sitaowang1998 744d42c
Use target_compile_feature to set c++ version
sitaowang1998 186204f
Remove unused code in .clang-format
sitaowang1998 3655a0a
Use tasks from cmake to configure and build boost test project
sitaowang1998 0968a4a
Restructure the tests folder
sitaowang1998 d34daaf
Merge branch 'boost-install-task' of github.com:sitaowang1998/yscope-…
sitaowang1998 75d0aed
Bump boost min requirement for potential url library
sitaowang1998 8ca176d
Add more boost libraries
sitaowang1998 0ab8ca5
Use absolute include path for taskfiles.
sitaowang1998 6158dc7
Revert "Use absolute include path for taskfiles."
sitaowang1998 6ee995d
Add all boost libraries linkage in cmake
sitaowang1998 0f4fc49
Rename boost tasks to remove prefix
sitaowang1998 dabe6b2
Add simple tests for each library
sitaowang1998 92f1d44
Fix clang tidy
sitaowang1998 9ae2231
Fix clang tidy
sitaowang1998 7742814
Fix file name change
sitaowang1998 c8e0162
Do not clean up after tests.
sitaowang1998 863b9c3
Make including depdencies install cmake optional
sitaowang1998 66670cf
Use InitCap for boost cmake package name.
sitaowang1998 55317ce
Merge branch 'boost-install-task' of github.com:sitaowang1998/yscope-…
sitaowang1998 a5ea408
Use top level build directory for boost tests.
sitaowang1998 7163bc8
Fix the directory in taskfiles and cmake
sitaowang1998 99f5616
Add requried and default arguments for boost
sitaowang1998 8e9b7a0
Fix cmake comment about including optional files
sitaowang1998 d804217
Use heredoc to write to cmake file.
sitaowang1998 b7302f7
Fix heredoc
sitaowang1998 3174964
Replace ROOT_DIR with TASK_DIR and mark TARGET optional in docstring
sitaowang1998 9468ae1
Add indentation for shell in yaml.
sitaowang1998 49b0683
Remove `misc-include-cleaner`.
sitaowang1998 e309371
Use recommended boost headers instead of exact boost headers
sitaowang1998 67146a9
Improve error message according to coderabbit
sitaowang1998 fb06df1
Use ROOT_DIR instead of TASK_DIR
sitaowang1998 ac05a93
Add error messages for each tests.
sitaowang1998 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| version: "3" | ||
|
|
||
| includes: | ||
| 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. | ||
| # | ||
| # @param {string} SOURCE_DIR Project source directory. | ||
| # @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"] | ||
| cmds: | ||
| - >- | ||
| ./bootstrap.sh | ||
| --prefix="{{.INSTALL_PREFIX}}" | ||
| --exec-prefix="{{.INSTALL_PREFIX}}" | ||
| --with-libraries={{(join "," .TARGETS)}} | ||
| {{- range .EXTRA_ARGS}} | ||
| "{{.}}" | ||
| {{- end}} | ||
|
|
||
| # Runs the b2 build step for boost. The caller must have previously called `generate` on | ||
| # `SOURCE_DIR` for this task to succeed. | ||
| # | ||
| # @param {string} SOURCE_DIR Directory containing the boost source. | ||
| # @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: | ||
| internal: true | ||
| dir: "{{.SOURCE_DIR}}" | ||
| vars: | ||
| EXTRA_ARGS: | ||
| ref: "default (list) .EXTRA_ARGS" | ||
| JOBS: >- | ||
| {{default "" .JOBS}} | ||
| requires: | ||
| vars: ["SOURCE_DIR"] | ||
| cmds: | ||
| - >- | ||
| ./b2 | ||
| {{- range .EXTRA_ARGS}} | ||
| "{{.}}" | ||
| {{- 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}} | ||
| - >- | ||
| {{- if .CMAKE_SETTINGS_DIR}} | ||
| echo "set(Boost_ROOT | ||
| \"{{.INSTALL_PREFIX}}\" | ||
| CACHE PATH | ||
| \"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} [SOURCE_DIR={{.WORK_DIR}}/boost-src] Directory in which to extract the tar | ||
| # file. | ||
| # | ||
| # Download parameters | ||
| # @param {string} FILE_SHA256 Content hash to verify the downloaded tar file against. | ||
| # @param {string} URL | ||
| # | ||
| # Boost generate parameters | ||
| # @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. | ||
| # | ||
| # Boost build parameters | ||
| # @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} [CMAKE_SETTINGS_DIR] If set, the directory where the project's CMake settings | ||
| # file should be stored. | ||
| download-and-install: | ||
| internal: true | ||
| label: "{{.TASK}}:{{.URL}}-{{.INSTALL_PREFIX}}" | ||
| vars: | ||
| # General parameters | ||
| WORK_DIR: >- | ||
| {{default .ROOT_DIR .WORK_DIR}} | ||
| SOURCE_DIR: >- | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| {{default (printf "%s/boost-src" .WORK_DIR) .SOURCE_DIR}} | ||
|
|
||
| # Boost generate parameters | ||
| INSTALL_PREFIX: >- | ||
| {{default (printf "%s/boost-install" .WORK_DIR) .INSTALL_PREFIX}} | ||
| TARGETS: | ||
| ref: "default (list) .TARGETS" | ||
| GEN_ARGS: | ||
| ref: "default (list) .GEN_ARGS" | ||
|
|
||
| # Boost build parameters | ||
| BUILD_ARGS: | ||
| ref: "default (list) .BUILD_ARGS" | ||
| JOBS: >- | ||
| {{default "" .JOBS}} | ||
|
|
||
| # Boost install parameters | ||
| INSTALL_ARGS: | ||
| ref: "default (list) .INSTALL_ARGS" | ||
| CMAKE_SETTINGS_DIR: >- | ||
| {{default "" .CMAKE_SETTINGS_DIR}} | ||
| requires: | ||
| vars: ["FILE_SHA256", "URL"] | ||
|
sitaowang1998 marked this conversation as resolved.
|
||
| deps: | ||
| - task: "remote:download-and-extract-tar" | ||
| vars: | ||
| FILE_SHA256: "{{.FILE_SHA256}}" | ||
| OUTPUT_DIR: "{{.SOURCE_DIR}}" | ||
| URL: "{{.URL}}" | ||
| cmds: | ||
| - task: "generate" | ||
| vars: | ||
| SOURCE_DIR: "{{.SOURCE_DIR}}" | ||
| 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" | ||
| vars: | ||
| SOURCE_DIR: "{{.SOURCE_DIR}}" | ||
| INSTALL_PREFIX: "{{.INSTALL_PREFIX}}" | ||
| CMAKE_SETTINGS_DIR: "{{.CMAKE_SETTINGS_DIR}}" | ||
| EXTRA_ARGS: | ||
| ref: ".INSTALL_ARGS" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| version: "3" | ||
|
|
||
| includes: | ||
| boost: boost.yaml | ||
| checksum: checksum.yaml | ||
| cmake: cmake.yaml | ||
| cpp-lint: cpp-lint.yaml | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,4 +16,4 @@ tasks: | |
|
|
||
| test: | ||
| cmds: | ||
| - task: "tests:download-and-extract-zip-basic" | ||
| - task: "tests:all" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| BasedOnStyle: "InheritParentConfig" | ||
|
|
||
| IncludeCategories: | ||
| # NOTE: A header is grouped by first matching regex | ||
| # Library headers. Update when adding new libraries. | ||
| # NOTE: clang-format retains leading white-space on a line in violation of the YAML spec. | ||
| # Ex: | ||
| # - Regex: "<(fmt|spdlog)" | ||
| # Priority: 3 | ||
| - Regex: "^<(boost)" | ||
| Priority: 3 | ||
| # C system headers | ||
| - Regex: "^<.+\\.h>" | ||
| Priority: 1 | ||
| # C++ standard libraries | ||
| - Regex: "^<.+>" | ||
| Priority: 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| cmake_minimum_required(VERSION 3.22.1) | ||
|
|
||
| project(boost-test LANGUAGES CXX VERSION 0.1.0) | ||
|
|
||
|
sitaowang1998 marked this conversation as resolved.
|
||
| set(CMAKE_EXPORT_COMPILE_COMMANDS | ||
| ON | ||
| CACHE BOOL | ||
| "Enable/Disable output of compile commands during generation." | ||
| FORCE | ||
| ) | ||
|
|
||
| if(PROJECT_IS_TOP_LEVEL) | ||
| # Include dependency settings if the project isn't being included as a subproject. | ||
| # NOTE: We mark the file optional because if the user happens to have the dependencies | ||
| # installed, this file is not necessary. | ||
| include( | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/../../build/deps/cmake-settings/all.cmake" | ||
| OPTIONAL | ||
| ) | ||
| endif() | ||
|
|
||
| find_package( | ||
| Boost | ||
| 1.83 | ||
| REQUIRED | ||
| COMPONENTS | ||
| filesystem | ||
| headers | ||
| iostreams | ||
| process | ||
| program_options | ||
| regex | ||
| system | ||
| url | ||
|
sitaowang1998 marked this conversation as resolved.
|
||
| ) | ||
| if(Boost_FOUND) | ||
| message(STATUS "Found Boost ${Boost_VERSION}.") | ||
| endif() | ||
|
|
||
| add_executable(boost-test) | ||
| target_compile_features(boost-test PRIVATE cxx_std_20) | ||
| target_sources(boost-test PRIVATE test_boost.cpp) | ||
| target_link_libraries( | ||
| boost-test | ||
| PRIVATE | ||
| Boost::filesystem | ||
| Boost::headers | ||
| Boost::iostreams | ||
| Boost::process | ||
| Boost::program_options | ||
| Boost::regex | ||
| Boost::system | ||
| Boost::url | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.