From db725d57cb05df5481396fd127fca68041db1be1 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Wed, 11 May 2022 23:39:08 +0200 Subject: [PATCH 01/34] Delete .clang-tidy --- .clang-tidy | 104 ---------------------------------------------------- 1 file changed, 104 deletions(-) delete mode 100644 .clang-tidy diff --git a/.clang-tidy b/.clang-tidy deleted file mode 100644 index 60b3bd99..00000000 --- a/.clang-tidy +++ /dev/null @@ -1,104 +0,0 @@ -Checks: ' -bugprone-*, -cert-dcl21-cpp, -cert-dcl50-cpp, -cert-dcl58-cpp, -cert-dcl59-cpp, -cert-env33-c, -cert-err34-c, -cert-err52-cpp, -cert-err58-cpp, -cert-err60-cpp, -cert-flp30-c, -cert-mem57-cpp, -cert-msc50-cpp, -cert-msc51-cpp, -cert-oop57-cpp, -cert-oop58-cpp, -clang-analyzer-*, -clang-diagnostic-*, -concurrency-*, -cppcoreguidelines-*, -hicpp-exception-baseclass, -hicpp-multiway-paths-covered, -hicpp-no-assembler, -hicpp-signed-bitwise, -misc-*, -modernize-*, -performance-*, -readability-*, --cppcoreguidelines-avoid-c-arrays, --cppcoreguidelines-avoid-magic-numbers, --cppcoreguidelines-c-copy-assignment-signature, --cppcoreguidelines-explicit-virtual-functions, --cppcoreguidelines-non-private-member-variables-in-classes, --misc-no-recursion, --readability-identifier-length, --bugprone-exception-escape -' -WarningsAsErrors: ' -bugprone-*, -cert-dcl21-cpp, -cert-dcl50-cpp, -cert-dcl58-cpp, -cert-dcl59-cpp, -cert-env33-c, -cert-err34-c, -cert-err52-cpp, -cert-err58-cpp, -cert-err60-cpp, -cert-flp30-c, -cert-mem57-cpp, -cert-msc50-cpp, -cert-msc51-cpp, -cert-oop57-cpp, -cert-oop58-cpp, -clang-analyzer-*, -clang-diagnostic-*, -concurrency-*, -cppcoreguidelines-*, -hicpp-exception-baseclass, -hicpp-multiway-paths-covered, -hicpp-no-assembler, -hicpp-signed-bitwise, -misc-*, -modernize-*, -performance-*, -readability-*, --cppcoreguidelines-avoid-c-arrays, --cppcoreguidelines-avoid-magic-numbers, --cppcoreguidelines-c-copy-assignment-signature, --cppcoreguidelines-explicit-virtual-functions, --cppcoreguidelines-non-private-member-variables-in-classes, --misc-no-recursion, --readability-identifier-length, --bugprone-exception-escape -' - -FormatStyle: file -CheckOptions: - - key: readability-identifier-naming.ClassCase - value: 'CamelCase' - - key: readability-identifier-naming.EnumCase - value: 'CamelCase' - - key: readability-identifier-naming.EnumConstantCase - value: 'CamelCase' - - key: readability-identifier-naming.FunctionCase - value: 'lower_case' - - key: readability-identifier-naming.GlobalConstantCase - value: 'UPPER_CASE' - - key: readability-identifier-naming.MacroDefinitionCase - value: 'UPPER_CASE' - - key: readability-identifier-naming.NamespaceCase - value: 'lower_case' - - key: readability-identifier-naming.StructCase - value: 'CamelCase' - #Broken as of LLVM 13 (2nd October 2021) - #- key: readability-identifier-naming.TemplateParameterCase - # value: 'CamelCase' - - key: readability-identifier-naming.ValueTemplateParameterCase - value: 'camelBack' - - key: readability-identifier-naming.TypeAliasCase - value: 'CamelCase' - - key: readability-identifier-naming.VariableCase - value: 'camelBack' From 628f2d9ccce06b92a0a0f1eef6ead7a49a169293 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Wed, 11 May 2022 23:39:13 +0200 Subject: [PATCH 02/34] Update readme.md --- readme.md | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/readme.md b/readme.md index 2179f26d..6352b798 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ Agnesoft central development repository. Run (use Git Bash on Windows): ``` -./adev.sh +./build.sh ``` This will show all available actions: building, running various checks, installation of prerequisites & tools etc. E.g. @@ -27,9 +27,9 @@ This will show all available actions: building, running various checks, installa To build simply run any of: ``` -./adev.sh build -./adev.sh build -./adev.sh build +./build.sh build +./build.sh build +./build.sh build ``` Available toolchains are: @@ -56,23 +56,23 @@ The binaries will be output to `build/`. ## Tools -| Windows | Installation | Note | -| ---------------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------- | -| [(Git) Bash](https://git-scm.com/download/win) | - | | -| [Visual Studio 2022](https://visualstudio.microsoft.com/cs/downloads/) | manual | | -| [clang 13](https://llvm.org/) | `./adev.sh install llvm` | | -| [gcc 11\*](https://gcc.gnu.org/) | `./adev.sh install gcc` | See [Known Issues](#known-issues) | -| [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) | `./adev.sh install llvm` | | -| [llvm-cov](https://clang.llvm.org/docs/SourceBasedCodeCoverage.html) | `./adev.sh install llvm` | | -| [Doxygen](https://www.doxygen.nl/index.html) | `./adev.sh install doxygen` | | -| [clang-format](https://clang.llvm.org/docs/ClangFormat.html) | `./adev.sh install llvm` | | -| [Docker Desktop](https://docs.docker.com/desktop/windows/install/) | manual | Required only for [Continuous Integration](#continuous-integration) | +| Windows | Installation | Note | +| ---------------------------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------- | +| [(Git) Bash](https://git-scm.com/download/win) | - | | +| [Visual Studio 2022](https://visualstudio.microsoft.com/cs/downloads/) | manual | | +| [clang 13](https://llvm.org/) | `./build.sh install llvm` | | +| [gcc 11\*](https://gcc.gnu.org/) | `./build.sh install gcc` | See [Known Issues](#known-issues) | +| [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) | `./build.sh install llvm` | | +| [llvm-cov](https://clang.llvm.org/docs/SourceBasedCodeCoverage.html) | `./build.sh install llvm` | | +| [Doxygen](https://www.doxygen.nl/index.html) | `./build.sh install doxygen` | | +| [clang-format](https://clang.llvm.org/docs/ClangFormat.html) | `./build.sh install llvm` | | +| [Docker Desktop](https://docs.docker.com/desktop/windows/install/) | manual | Required only for [Continuous Integration](#continuous-integration) | ## Development Please refer to [contribution.md](contribution.md) and [style_guide.md](style_guide.md) for general information. -For development you can use the [docker image](https://github.com/agnesoft/adev/pkgs/container/adev) (preferred) or setup your environment with `./adev.sh install ` actions or install the [tools](#tools) manually. +For development you can use the [docker image](https://github.com/agnesoft/adev/pkgs/container/adev) (preferred) or setup your environment with `./build.sh install ` actions or install the [tools](#tools) manually. Workflow summary: @@ -80,14 +80,14 @@ Workflow summary: 2. Create a branch for that issue - observe the naming rules in the [style_guide.md](style_guide.md), i.e. use `[project tag]` and name the branch after your issue, including the issue # 3. Work on the branch - - build & run checks via `./adev.sh` + - build & run checks via `./build.sh` 4. Push the branch to GitHub & open PR from your branch to `main` 5. Merge to `main` - requires 1 approval & all [Continous Integration](#continuous-integration) checks to pass ## Continuous Integration -The `adev` is using GitHub Actions. The `.adev.sh` script actions are run as part of the continuous integration (CI) on every pull request and subsequent merge to `main`. Most actions are run on Ubuntu based custom docker image that comes with preinstalled prerequisites & tools listed above: +The `adev` is using GitHub Actions. The `.build.sh` script actions are run as part of the continuous integration (CI) on every pull request and subsequent merge to `main`. Most actions are run on Ubuntu based custom docker image that comes with preinstalled prerequisites & tools listed above: - [`agnesoft/adev`](https://github.com/agnesoft/adev/pkgs/container/adev) @@ -114,7 +114,6 @@ There are two workflows: | -------- | ----------------- | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | any | coverage | llvm | 13 | LLVM instrumentation has difficulties with `if constexpr` and some other entities showing them "uncovered" even though they are executed. | **None.** Increase coverage thresholds as needed. | 29/09/2021 | | any | coverage | llvm | 13 | LLVM source code based coverage has difficulties with spawned processes. The resulting `profraw` file is reported as corrupted and cannot be used by `llvm-profdata`. | **None.** Exclude affected projects from coverage. | 25/11/2021 | -| any | analysis | llvm | 13 | `clang-tidy` cannot use TemplateParameterCase style parameter along with other style checks citing "invalid style". | **None.** Do not use for now. | 02/10/2021 | | Linux | build | gcc | 11 | Unable to use its own STL (`libstdc++`) as header units. Build fails on internal compiler error. The `libc++` does not work either. | **None.** GCC is not usable with modules and STL. | 31/08/2021 | | Linux | analysis | llvm | 13 | `clang-tidy` has difficulties using Unix headers such as `wait.h` as header units even with correct `module.modulemap`. The build si ok. | Specify the headers in `module.modulemap` manually. | 25/11/2021 | | Linux | address-sanitizer | llvm | 13.0.1 | Address sanitizer produces `alloc-dealloc-mismatch` false positives coming from `libc++`. | Set `export ASAN_OPTIONS=alloc_dealloc_mismatch=0` before running the tests built with asan. | 18/01/2022 | From 122a60c587bb79911de891d89b237d619ce4432a Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Wed, 11 May 2022 23:39:30 +0200 Subject: [PATCH 03/34] Rename adev.sh to build.sh --- adev.sh => build.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename adev.sh => build.sh (56%) mode change 100755 => 100644 diff --git a/adev.sh b/build.sh old mode 100755 new mode 100644 similarity index 56% rename from adev.sh rename to build.sh index 64547852..f2f3254a --- a/adev.sh +++ b/build.sh @@ -2,22 +2,22 @@ source "sh/common.sh" -action="${1}" +readonly action="${1}" if [[ "${action}" == "" ]] || [[ "${action}" == "help" ]] || [[ "${action}" == "?" ]]; then sh/help.sh elif [[ "${action}" == "analyse" ]]; then - sh/analyse.sh $2 $3 + sh/analyse.sh "${2}" "${3}" elif [[ "${action}" == "build" ]]; then - sh/build.sh $2 $3 + sh/build.sh "${2}" "${3}" elif [[ "${action}" == "coverage" ]]; then - sh/coverage.sh $2 $3 + sh/coverage.sh "${2}" "${3}" elif [[ "${action}" == "format" ]]; then - sh/format.sh $2 $3 + sh/format.sh "${2}" "${3}" elif [[ "${action}" == "install" ]]; then - sh/install.sh $2 $3 + sh/install.sh "${2}" "${3}" elif [[ "${action}" == "test" ]]; then - sh/test.sh $2 $3 + sh/test.sh "${2}" "${3}" else - print_error "ERROR: unknown action '${action}'. Run './adev.sh' to display available actions." + print_error "ERROR: unknown action '${action}'. Run './build.sh' to display available actions." fi From 7ef0569864af1bd6241da4f58be1c0e83530e57a Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Wed, 11 May 2022 23:39:34 +0200 Subject: [PATCH 04/34] Update pr.yml --- .github/workflows/pr.yml | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 396c35c6..8745c94b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -40,10 +40,10 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./adev.sh build address-sanitizer + - run: ./build.sh build address-sanitizer - run: | export ASAN_OPTIONS=alloc_dealloc_mismatch=0 - ./adev.sh test clang + ./build.sh test clang analysis_linux: runs-on: ubuntu-latest @@ -54,8 +54,8 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - run: ./adev.sh build clang - - run: ./adev.sh analyse diff + - run: ./build.sh build clang + - run: ./build.sh analyse diff analysis_windows: runs-on: windows-2022 @@ -66,9 +66,9 @@ jobs: with: fetch-depth: 0 - shell: bash - run: ./adev.sh build clang + run: ./build.sh build clang - shell: bash - run: ./adev.sh analyse diff + run: ./build.sh analyse diff coverage_linux: runs-on: ubuntu-latest @@ -77,8 +77,8 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./adev.sh build coverage - - run: ./adev.sh coverage + - run: ./build.sh build coverage + - run: ./build.sh coverage - if: always() uses: actions/upload-artifact@v2 with: @@ -93,9 +93,9 @@ jobs: steps: - uses: actions/checkout@v2 - shell: bash - run: ./adev.sh build coverage + run: ./build.sh build coverage - shell: bash - run: ./adev.sh coverage + run: ./build.sh coverage - if: always() uses: actions/upload-artifact@v2 with: @@ -110,7 +110,7 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./adev.sh build docs + - run: ./build.sh build docs - uses: actions/upload-artifact@v2 with: name: adev-pr-${{ github.run_number }}-documentation @@ -126,7 +126,7 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - run: ./adev.sh format check diff + - run: ./build.sh format check diff linux_clang_x64: runs-on: ubuntu-latest @@ -135,8 +135,8 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./adev.sh build clang - - run: ./adev.sh test clang 100 + - run: ./build.sh build clang + - run: ./build.sh test clang 100 - if: always() uses: actions/upload-artifact@v2 with: @@ -151,8 +151,8 @@ jobs: if: false steps: - uses: actions/checkout@v2 - - run: ./adev.sh build gcc - - run: ./adev.sh test gcc 100 + - run: ./build.sh build gcc + - run: ./build.sh test gcc 100 - if: always() uses: actions/upload-artifact@v2 with: @@ -167,8 +167,8 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./adev.sh build memory-sanitizer - - run: ./adev.sh test clang + - run: ./build.sh build memory-sanitizer + - run: ./build.sh test clang thread_sanitizer: runs-on: ubuntu-latest @@ -177,8 +177,8 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./adev.sh build thread-sanitizer - - run: ./adev.sh test clang + - run: ./build.sh build thread-sanitizer + - run: ./build.sh test clang undefined_sanitizer: runs-on: ubuntu-latest @@ -187,8 +187,8 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./adev.sh build undefined-sanitizer - - run: ./adev.sh test clang + - run: ./build.sh build undefined-sanitizer + - run: ./build.sh test clang windows_clang_x64: runs-on: windows-2022 @@ -197,9 +197,9 @@ jobs: steps: - uses: actions/checkout@v2 - shell: bash - run: ./adev.sh build clang + run: ./build.sh build clang - shell: bash - run: ./adev.sh test clang 100 + run: ./build.sh test clang 100 - if: always() uses: actions/upload-artifact@v2 with: @@ -214,9 +214,9 @@ jobs: steps: - uses: actions/checkout@v2 - shell: bash - run: ./adev.sh build msvc + run: ./build.sh build msvc - shell: bash - run: ./adev.sh test msvc 100 + run: ./build.sh test msvc 100 - if: always() uses: actions/upload-artifact@v2 with: From b58551e7afb538a5cbab56505143a6ce22c3ff5e Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Wed, 11 May 2022 23:39:36 +0200 Subject: [PATCH 05/34] Update adev.yml --- .github/workflows/adev.yml | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/adev.yml b/.github/workflows/adev.yml index eacb58ae..4f647e63 100644 --- a/.github/workflows/adev.yml +++ b/.github/workflows/adev.yml @@ -25,10 +25,10 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh build address-sanitizer + - run: ./build.sh build address-sanitizer - run: | export ASAN_OPTIONS=alloc_dealloc_mismatch=0 - ./adev.sh test clang + ./build.sh test clang analysis_linux: runs-on: ubuntu-latest @@ -36,17 +36,17 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh build clang - - run: ./adev.sh analyse + - run: ./build.sh build clang + - run: ./build.sh analyse analysis_windows: runs-on: windows-2022 steps: - uses: actions/checkout@v2 - shell: bash - run: ./adev.sh build clang + run: ./build.sh build clang - shell: bash - run: ./adev.sh analyse + run: ./build.sh analyse coverage_linux: runs-on: ubuntu-latest @@ -54,8 +54,8 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh build coverage - - run: ./adev.sh coverage + - run: ./build.sh build coverage + - run: ./build.sh coverage - if: always() uses: actions/upload-artifact@v2 with: @@ -68,9 +68,9 @@ jobs: steps: - uses: actions/checkout@v2 - shell: bash - run: ./adev.sh build coverage + run: ./build.sh build coverage - shell: bash - run: ./adev.sh coverage + run: ./build.sh coverage - if: always() uses: actions/upload-artifact@v2 with: @@ -84,7 +84,7 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh build docs + - run: ./build.sh build docs - if: always() uses: actions/upload-artifact@v2 with: @@ -98,7 +98,7 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh format check + - run: ./build.sh format check linux_clang_x64: runs-on: ubuntu-latest @@ -106,8 +106,8 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh build clang - - run: ./adev.sh test clang 100 + - run: ./build.sh build clang + - run: ./build.sh test clang 100 - if: always() uses: actions/upload-artifact@v2 with: @@ -122,8 +122,8 @@ jobs: if: false steps: - uses: actions/checkout@v2 - - run: ./adev.sh build gcc - - run: ./adev.sh test gcc 100 + - run: ./build.sh build gcc + - run: ./build.sh test gcc 100 - if: always() uses: actions/upload-artifact@v2 with: @@ -137,8 +137,8 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh build memory-sanitizer - - run: ./adev.sh test clang + - run: ./build.sh build memory-sanitizer + - run: ./build.sh test clang thread_sanitizer: runs-on: ubuntu-latest @@ -146,8 +146,8 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh build thread-sanitizer - - run: ./adev.sh test clang + - run: ./build.sh build thread-sanitizer + - run: ./build.sh test clang undefined_sanitizer: runs-on: ubuntu-latest @@ -155,17 +155,17 @@ jobs: needs: create_container steps: - uses: actions/checkout@v2 - - run: ./adev.sh build undefined-sanitizer - - run: ./adev.sh test clang + - run: ./build.sh build undefined-sanitizer + - run: ./build.sh test clang windows_clang_x64: runs-on: windows-2022 steps: - uses: actions/checkout@v2 - shell: bash - run: ./adev.sh build clang + run: ./build.sh build clang - shell: bash - run: ./adev.sh test clang 100 + run: ./build.sh test clang 100 - if: always() uses: actions/upload-artifact@v2 with: @@ -178,9 +178,9 @@ jobs: steps: - uses: actions/checkout@v2 - shell: bash - run: ./adev.sh build msvc + run: ./build.sh build msvc - shell: bash - run: ./adev.sh test msvc 100 + run: ./build.sh test msvc 100 - if: always() uses: actions/upload-artifact@v2 with: From 75123b3972efd44b21cab60280df550a60d1bf4d Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Wed, 11 May 2022 23:39:39 +0200 Subject: [PATCH 06/34] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cc65fb91..863ed60f 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ *.pch *.profraw /gcm.cache/ +.clang-tidy #JS node_modules/ From d883f33784e55ba21dda6047c46c16b8223e1a3e Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Wed, 11 May 2022 23:39:42 +0200 Subject: [PATCH 07/34] Update analyse.sh --- sh/analyse.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/sh/analyse.sh b/sh/analyse.sh index d98e5abe..ea6d148e 100755 --- a/sh/analyse.sh +++ b/sh/analyse.sh @@ -1,4 +1,5 @@ source sh/common.sh +source sh/clang-tidy.sh pids=() @@ -145,9 +146,54 @@ function do_analyse_source() { fi } +function set_checks() { + local checkSets=("${1}") + local checks="" + + if [[ "${checkSets[@]}" == "" ]]; then + checkSets=("bugprone cert cppcoreguidelines fuchsia google hicpp misc modernize performance readability") + fi + + for check in ${checkSets[@]}; do + checks="${checks} +${allChecks[$check]}," + done + + echo "Checks: '${checks} +' +WarningsAsErrors: '${checks} +' +FormatStyle: file +CheckOptions: + - key: readability-identifier-naming.ClassCase + value: 'CamelCase' + - key: readability-identifier-naming.EnumCase + value: 'CamelCase' + - key: readability-identifier-naming.EnumConstantCase + value: 'CamelCase' + - key: readability-identifier-naming.FunctionCase + value: 'lower_case' + - key: readability-identifier-naming.GlobalConstantCase + value: 'UPPER_CASE' + - key: readability-identifier-naming.MacroDefinitionCase + value: 'UPPER_CASE' + - key: readability-identifier-naming.NamespaceCase + value: 'lower_case' + - key: readability-identifier-naming.StructCase + value: 'CamelCase' + - key: readability-identifier-naming.TemplateParameterCase + value: 'CamelCase' + - key: readability-identifier-naming.ValueTemplateParameterCase + value: 'camelBack' + - key: readability-identifier-naming.TypeAliasCase + value: 'CamelCase' + - key: readability-identifier-naming.VariableCase + value: 'camelBack'" > ./.clang-tidy +} + function should_analyse() { - local diff="${1}" - local sources="${2}" + local -r diff="${1}" + local -r sources="${2}" ( ! [[ "${diff}" == "diff" ]] || is_changed "${sources}" ) } @@ -166,7 +212,15 @@ function wait_for_jobs() { } detect_clang_tidy -analyse "${1}" + +if [[ "${1}" == "diff" ]]; then + set_checks "${2}" + analyse "${1}" +else + set_checks "${1}" + analyse +fi + wait_for_jobs if (( $result == 0 )); then From 3cd655b0e7effefe2b9db743b9eaa8a252994f1b Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Wed, 11 May 2022 23:39:59 +0200 Subject: [PATCH 08/34] Update sh scripts --- sh/build_common.sh | 2 +- sh/clang-tidy.sh | 185 +++++++++++++++++++++++++++++++++++++++++++++ sh/common.sh | 8 +- sh/coverage.sh | 2 +- sh/format.sh | 8 +- sh/help.sh | 54 ++++++------- sh/install.sh | 4 +- sh/test.sh | 6 +- 8 files changed, 227 insertions(+), 42 deletions(-) create mode 100644 sh/clang-tidy.sh diff --git a/sh/build_common.sh b/sh/build_common.sh index 527a5b44..208b5562 100755 --- a/sh/build_common.sh +++ b/sh/build_common.sh @@ -92,7 +92,7 @@ msvcCompilerFlags="/nologo \ /std:c++latest \ /EHsc \ /MT \ - /O2 \ + /Z7 \ /W4 \ /WX \ /wd4005 \ diff --git a/sh/clang-tidy.sh b/sh/clang-tidy.sh new file mode 100644 index 00000000..b6b8138d --- /dev/null +++ b/sh/clang-tidy.sh @@ -0,0 +1,185 @@ +declare -A allChecks + +allChecks["bugprone"]="bugprone-bool-pointer-implicit-conversion +bugprone-branch-clone +bugprone-copy-constructor-init +bugprone-dangling-handle +bugprone-easily-swappable-parameters +bugprone-exception-escape +bugprone-fold-init-type +bugprone-forward-declaration-namespace +bugprone-forwarding-reference-overload +bugprone-implicit-widening-of-multiplication-result +bugprone-inaccurate-erase +bugprone-incorrect-roundings +bugprone-infinite-loop +bugprone-integer-division +bugprone-misplaced-widening-cast +bugprone-move-forwarding-reference +bugprone-parent-virtual-call +bugprone-redundant-branch-condition +bugprone-reserved-identifier +bugprone-shared-ptr-array-mismatch +bugprone-signed-char-misuse +bugprone-sizeof-expression +bugprone-string-constructor +bugprone-string-integer-assignment +bugprone-string-literal-with-embedded-nul +bugprone-stringview-nullptr +bugprone-suspicious-enum-usage +bugprone-suspicious-include +bugprone-suspicious-memory-comparison +bugprone-suspicious-memset-usage +bugprone-suspicious-missing-comma +bugprone-suspicious-semicolon +bugprone-suspicious-string-compare +bugprone-swapped-arguments +bugprone-throw-keyword-missing +bugprone-too-small-loop-variable +bugprone-undefined-memory-manipulation +bugprone-undelegated-constructor +bugprone-unhandled-exception-at-new +bugprone-unhandled-self-assignment +bugprone-unused-raii +bugprone-unused-return-value +bugprone-use-after-move +bugprone-virtual-near-miss" + +allChecks["cert"]="cert-dcl21-cpp +cert-dcl58-cpp +cert-env33-c +cert-err33-c +cert-err58-cpp +cert-err60-cpp +cert-mem57-cpp" + +allChecks["cppcoreguidelines"]="cppcoreguidelines-avoid-non-const-global-variables +cppcoreguidelines-init-variables +cppcoreguidelines-interfaces-global-init +cppcoreguidelines-narrowing-conversions +cppcoreguidelines-no-malloc +cppcoreguidelines-owning-memory +cppcoreguidelines-prefer-member-initializer +cppcoreguidelines-pro-bounds-array-to-pointer-decay +cppcoreguidelines-pro-bounds-constant-array-index +cppcoreguidelines-pro-bounds-pointer-arithmetic +cppcoreguidelines-pro-type-const-cast +cppcoreguidelines-pro-type-cstyle-cast +cppcoreguidelines-pro-type-member-init +cppcoreguidelines-pro-type-reinterpret-cast +cppcoreguidelines-pro-type-static-cast-downcast +cppcoreguidelines-pro-type-vararg +cppcoreguidelines-slicing +cppcoreguidelines-special-member-functions (IgnorePositiveIntegerLiterals: true) +cppcoreguidelines-virtual-class-destructor" + +allChecks["fuchsia"]="fuchsia-default-arguments-calls +fuchsia-default-arguments-declarations +fuchsia-multiple-inheritance +fuchsia-overloaded-operator +fuchsia-statically-constructed-objects +fuchsia-virtual-inheritance" + +allChecks["google"]="google-build-explicit-make-pair +google-build-namespaces +google-build-using-namespace +google-default-arguments +google-explicit-constructor +google-readability-casting +google-runtime-int +google-runtime-operator" + +allChecks["hicpp"]="hicpp-exception-baseclass +hicpp-signed-bitwise" + +allChecks["misc"]="misc-misleading-bidirectional +misc-misleading-identifier +misc-misplaced-const +misc-new-delete-overloads +misc-non-copyable-objects +misc-non-private-member-variables-in-classes +misc-redundant-expression +misc-throw-by-value-catch-by-reference +misc-unconventional-assign-operator +misc-uniqueptr-reset-release +misc-unused-alias-decls +misc-unused-parameters +misc-unused-using-decls" + +allChecks["modernize"]="modernize-avoid-bind +modernize-avoid-c-arrays +modernize-deprecated-ios-base-aliases +modernize-loop-convert +modernize-make-shared +modernize-make-unique +modernize-pass-by-value +modernize-raw-string-literal +modernize-return-braced-init-list +modernize-use-auto +modernize-use-bool-literals +modernize-use-default-member-init +modernize-use-emplace +modernize-use-equals-default +modernize-use-equals-delete +modernize-use-nodiscard +modernize-use-nullptr +modernize-use-override +modernize-use-trailing-return-type +modernize-use-transparent-functors +modernize-use-using" + +allChecks["performance"]="performance-faster-string-find +performance-for-range-copy +performance-implicit-conversion-in-loop +performance-inefficient-algorithm +performance-inefficient-string-concatenation +performance-inefficient-vector-operation +performance-move-const-arg +performance-move-constructor-init +performance-no-automatic-move +performance-no-int-to-ptr +performance-noexcept-move-constructor +performance-trivially-destructible +performance-type-promotion-in-math-fn +performance-unnecessary-copy-initialization +performance-unnecessary-value-param" + +allChecks["readability"]="readability-avoid-const-params-in-decls +readability-braces-around-statements +readability-const-return-type +readability-container-contains +readability-container-data-pointer +readability-container-size-empty +readability-convert-member-functions-to-static +readability-function-cognitive-complexity +readability-function-size +readability-identifier-length +readability-identifier-naming +readability-implicit-bool-conversion +readability-inconsistent-declaration-parameter-name +readability-isolate-declaration +readability-magic-numbers +readability-make-member-function-const +readability-misleading-indentation +readability-misplaced-array-index +readability-named-parameter +readability-non-const-parameter +readability-qualified-auto +readability-redundant-access-specifiers +readability-redundant-control-flow +readability-redundant-declaration +readability-redundant-function-ptr-dereference +readability-redundant-member-init +readability-redundant-preprocessor +readability-redundant-smartptr-get +readability-redundant-string-cstr +readability-redundant-string-init +readability-simplify-boolean-expr +readability-simplify-subscript-expr +readability-static-accessed-through-instance +readability-static-definition-in-anonymous-namespace +readability-string-compare +readability-suspicious-call-argument +readability-uniqueptr-delete-release +readability-uppercase-literal-suffix +readability-use-anyofallof" diff --git a/sh/common.sh b/sh/common.sh index 30636f8e..5a258a96 100755 --- a/sh/common.sh +++ b/sh/common.sh @@ -33,10 +33,10 @@ function is_windows() { } function run_script() { - local script="${1}" - local arg1="${2}" - local arg2="${3}" - local arg3="${4}" + local -r script="${1}" + local -r arg1="${2}" + local -r arg2="${3}" + local -r arg3="${4}" "${script[@]}" "${arg1}" "${arg2}" "${arg3}" local status=$? diff --git a/sh/coverage.sh b/sh/coverage.sh index 0f5c1ece..6029b728 100755 --- a/sh/coverage.sh +++ b/sh/coverage.sh @@ -22,7 +22,7 @@ function coverage() { local objectArgs="" local profData="" - local dir=$(pwd) + local -r dir=$(pwd) for test in build/clang/bin/*_test${executableExtension}; do if [[ "${test}" != "build/clang/bin/aprocess_test${executableExtension}" ]]; then diff --git a/sh/format.sh b/sh/format.sh index 020794f5..70483c7a 100755 --- a/sh/format.sh +++ b/sh/format.sh @@ -9,13 +9,13 @@ function detect_clang_format() { } function format_check_source() { - local source="${1}" + local -r source="${1}" if [[ ${source} == projects/yamlcpp/* ]]; then return fi - local replacements=$($clangFormat -output-replacements-xml $source | grep " Prints this help. -./adev.sh analyse Run clang-tidy on all projects. -./adev.sh analyse diff Run clang-tidy on files/projects changed from main. -./adev.sh analyse Run clang-tidy on . -./adev.sh build Build all projects with the default toolchain. -./adev.sh build list List available projects. -./adev.sh build docs Build Doxygen documentation. -./adev.sh build coverage Build all projects with clang and code coverage instrumentation. -./adev.sh build libc++-msan Build libc++ with memory sanitizer flags. -./adev.sh build address-sanitizer Build all projects with clang and address sanitizer flags. -./adev.sh build memory-sanitizer Build all projects with cland and memory sanitizer flags. -./adev.sh build thread-sanitizer Build all projects with cland and thread sanitizer flags. -./adev.sh build undefined-sanitizer Build all projects with cland and undefined behavior sanitizer flags. -./adev.sh build Build all projects with . -./adev.sh build Build with default toolchain. -./adev.sh build Build with . -./adev.sh coverage Run tests and collect code coverage stats (requires 'build coverage'). -./adev.sh format Formats source code with clang-format. -./adev.sh format check Checks formatting of the sources with clang-format. -./adev.sh format check diff Checks formatting of changed sources with clang-format. -./adev.sh install list List available packages. -./adev.sh install Install . -./adev.sh test Run all tests once for build of the default toolchain. -./adev.sh test Run all tests for build of the default toolchain. -./adev.sh test Run all tests once for build of the . -./adev.sh test Run all tests for build of the . +./build.sh <|help|?> Prints this help. +./build.sh analyse Run clang-tidy on all projects. +./build.sh analyse diff Run clang-tidy on files/projects changed from main. +./build.sh analyse Run clang-tidy on . +./build.sh build Build all projects with the default toolchain. +./build.sh build list List available projects. +./build.sh build docs Build Doxygen documentation. +./build.sh build coverage Build all projects with clang and code coverage instrumentation. +./build.sh build libc++-msan Build libc++ with memory sanitizer flags. +./build.sh build address-sanitizer Build all projects with clang and address sanitizer flags. +./build.sh build memory-sanitizer Build all projects with cland and memory sanitizer flags. +./build.sh build thread-sanitizer Build all projects with cland and thread sanitizer flags. +./build.sh build undefined-sanitizer Build all projects with cland and undefined behavior sanitizer flags. +./build.sh build Build all projects with . +./build.sh build Build with default toolchain. +./build.sh build Build with . +./build.sh coverage Run tests and collect code coverage stats (requires 'build coverage'). +./build.sh format Formats source code with clang-format. +./build.sh format check Checks formatting of the sources with clang-format. +./build.sh format check diff Checks formatting of changed sources with clang-format. +./build.sh install list List available packages. +./build.sh install Install . +./build.sh test Run all tests once for build of the default toolchain. +./build.sh test Run all tests for build of the default toolchain. +./build.sh test Run all tests once for build of the . +./build.sh test Run all tests for build of the . Toolchains: clang diff --git a/sh/install.sh b/sh/install.sh index 66c7bb22..c7b48121 100755 --- a/sh/install.sh +++ b/sh/install.sh @@ -1,8 +1,8 @@ source "sh/common.sh" function install_package() { - local package="${1}" - local installScript="sh/install/${package}.sh" + local -r package="${1}" + local -r installScript="sh/install/${package}.sh" if [[ -f "${installScript}" ]]; then echo "Installing package '${package}'..." diff --git a/sh/test.sh b/sh/test.sh index f237616b..f67ca101 100755 --- a/sh/test.sh +++ b/sh/test.sh @@ -11,7 +11,7 @@ function set_iterations() { } function run_test() { - local test="${1}" + local -r test="${1}" local failures=0 local i=0 @@ -37,7 +37,7 @@ function run_test() { } function run_tests() { - local testDir="build/${toolchain}/bin" + local -r testDir="build/${toolchain}/bin" result=0 echo "Running tests from '${testDir}'..." @@ -59,5 +59,5 @@ function run_tests() { } set_toolchain "${1}" -set_iterations $1 $2 +set_iterations "${1}" "${2}" run_tests From 2e11ef5f988f9864b9d1135075779f63d3aeb73f Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 15:22:40 +0200 Subject: [PATCH 09/34] Rename doxyfile --- adev.doxyfile => .doxyfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename adev.doxyfile => .doxyfile (100%) diff --git a/adev.doxyfile b/.doxyfile similarity index 100% rename from adev.doxyfile rename to .doxyfile From a37d085eb7f94f93daf807b6881e80c170fdf7e5 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 15:22:43 +0200 Subject: [PATCH 10/34] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 863ed60f..b27ebb9e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ node_modules/ #adev /build/ /.vscode/ +/build.bat From a4db0b60ba27321da07d111562de557419749749 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 15:22:54 +0200 Subject: [PATCH 11/34] Update compile_flags.txt --- compile_flags.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compile_flags.txt b/compile_flags.txt index ff07b4f4..33da5d6f 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -12,10 +12,10 @@ -fprebuilt-module-path=build/clang/aprocess -fprebuilt-module-path=build/clang/athreadpool -fprebuilt-module-path=build/clang/awinapi --fprebuilt-module-path=build/clang/abuild/cpptokenizer --fprebuilt-module-path=build/clang/abuild/cache --fprebuilt-module-path=build/clang/abuild/scanners --fprebuilt-module-path=build/clang/abuild/test_utilities +-fprebuilt-module-path=build/clang/abuild.cpptokenizer +-fprebuilt-module-path=build/clang/abuild.cache +-fprebuilt-module-path=build/clang/abuild.scanners +-fprebuilt-module-path=build/clang/abuild.test_utilities -fprebuilt-module-path=build/clang/yamlcpp -fmodule-map-file=projects/astl/module.modulemap -fmodule-map-file=projects/awinapi/module.modulemap From 57f5fda4c50c56e0421e79f298596a76f6e98127 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 15:22:58 +0200 Subject: [PATCH 12/34] Update containerfile --- containerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/containerfile b/containerfile index 37242f58..e30b8155 100644 --- a/containerfile +++ b/containerfile @@ -4,4 +4,3 @@ WORKDIR /adev ADD adev.sh /adev ADD sh /adev/sh RUN bash sh/docker.sh - From f06ac2ea6a6f3b7ed04d87c1c626b44991bd58aa Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 15:23:27 +0200 Subject: [PATCH 13/34] Refactor build --- build.sh | 30 +- .../{abuild/cache => abuild.cache}/abi.cpp | 0 .../abuild.cache.cpp} | 10 +- .../cache_impl.cpp => abuild.cache/cache.cpp} | 22 +- .../cache => abuild.cache}/cache_data.cpp | 0 .../cache => abuild.cache}/cache_index.cpp | 0 .../cache => abuild.cache}/cache_reader.cpp | 8 +- .../cache => abuild.cache}/cache_writer.cpp | 0 .../cache => abuild.cache}/cpp_file.cpp | 0 .../{abuild/cache => abuild.cache}/file.cpp | 0 .../{abuild/cache => abuild.cache}/flag.cpp | 0 .../{abuild/cache => abuild.cache}/header.cpp | 0 .../cache => abuild.cache}/header_file.cpp | 0 .../cache => abuild.cache}/header_unit.cpp | 0 .../{abuild/cache => abuild.cache}/module.cpp | 0 .../module_partition.cpp | 0 .../cache => abuild.cache}/project.cpp | 0 .../cache => abuild.cache}/settings.cpp | 0 .../cache => abuild.cache}/source_file.cpp | 0 .../test/cache_test.cpp | 0 .../test/defines_test.cpp | 0 .../test/file_lookup_test.cpp | 0 .../cache => abuild.cache}/test/flag_test.cpp | 0 .../test/header_file_test.cpp | 0 .../test/header_test.cpp | 0 .../test/header_unit_test.cpp | 0 .../cache => abuild.cache}/test/main.cpp | 0 .../test/module_partition_test.cpp | 0 .../test/module_test.cpp | 0 .../test/project_test.cpp | 0 .../test/settings_test.cpp | 0 .../test/source_file_test.cpp | 0 .../test/tokens_test.cpp | 0 .../test/toolchain_test.cpp | 0 .../cache => abuild.cache}/toolchain.cpp | 0 .../abuild.cpptokenizer.cpp} | 0 .../if_token.cpp | 0 .../preprocessor_if_tokenizer.cpp | 0 .../preprocessor_tokenizer.cpp | 0 .../preprocessor_tokenizer_common.cpp | 0 .../test/define_test.cpp | 0 .../test/if_bracket_test.cpp | 0 .../test/if_defined_test.cpp | 0 .../test/if_else_test.cpp | 0 .../test/if_has_include_test.cpp | 0 .../test/if_test.cpp | 0 .../test/ifdef_test.cpp | 0 .../test/import_include_external_test.cpp | 0 .../test/import_include_local_test.cpp | 0 .../test/import_module_partition_test.cpp | 0 .../test/import_module_test.cpp | 0 .../test/include_external_test.cpp | 0 .../test/include_local_test.cpp | 0 .../test/main.cpp | 0 .../test/module_partition_test.cpp | 0 .../test/module_test.cpp | 0 .../test/token_operators_test.cpp | 0 .../test/tokenizer_test.cpp | 0 .../test/undef_test.cpp | 0 .../token.cpp | 0 .../token_operators.cpp | 0 .../tokenizer.cpp | 0 .../tokenizer_common.cpp | 0 .../abuild.scanners.cpp} | 0 .../project_scanner.cpp | 0 .../test/main.cpp | 0 .../test/project_scanner_test.cpp | 0 .../abuild.test_utilities.cpp} | 0 .../test_file.cpp | 0 .../test_project.cpp | 0 .../token_operators.cpp | 0 .../test => }/aprocesstestapp/main.cpp | 0 sh/build.sh | 76 ++-- sh/build/abuild.cache.sh | 198 +++++---- sh/build/abuild.cache.test.sh | 99 +++++ sh/build/abuild.cache_test.sh | 104 ----- sh/build/abuild.cpptokenizer.sh | 100 ++--- sh/build/abuild.cpptokenizer.test.sh | 96 +++++ sh/build/abuild.cpptokenizer_test.sh | 100 ----- sh/build/abuild.scanners.sh | 82 ++-- sh/build/abuild.scanners.test.sh | 68 +++ sh/build/abuild.scanners_test.sh | 73 ---- sh/build/abuild.test_utilities.sh | 72 ++-- sh/build/acommandline.sh | 134 +++--- sh/build/acommandline.test.sh | 73 ++++ sh/build/acommandline_test.sh | 77 ---- sh/build/aprocess.sh | 101 +++-- sh/build/aprocess.test.sh | 86 ++++ sh/build/aprocess_test.sh | 91 ---- sh/build/aprocesstestapp.sh | 58 ++- sh/build/astl.sh | 27 +- sh/build/astl.test.sh | 38 ++ sh/build/astl_test.sh | 42 -- sh/build/atest.sh | 217 +++++----- sh/build/atest.test.sh | 74 ++++ sh/build/atest_test.sh | 77 ---- sh/build/athreadpool.sh | 97 ++--- sh/build/athreadpool.test.sh | 45 ++ sh/build/athreadpool_test.sh | 49 --- sh/build/awinapi.sh | 71 ++-- sh/build/awinapi.test.sh | 52 +++ sh/build/awinapi_test.sh | 56 --- sh/build/yamlcpp.sh | 184 ++++---- sh/build_common.sh | 396 +++++++++++++----- sh/build_docs.sh | 25 +- sh/{build_libc++.sh => build_libc++_msan.sh} | 60 +-- sh/clang-tidy.sh | 1 - sh/common.sh | 126 +++--- sh/format.sh | 8 +- sh/help.sh | 101 +++-- sh/install/cmake.sh | 2 +- sh/install/gcc.sh | 2 +- 112 files changed, 1817 insertions(+), 1691 deletions(-) rename projects/{abuild/cache => abuild.cache}/abi.cpp (100%) rename projects/{abuild/cache/cache.cpp => abuild.cache/abuild.cache.cpp} (86%) rename projects/{abuild/cache/cache_impl.cpp => abuild.cache/cache.cpp} (94%) rename projects/{abuild/cache => abuild.cache}/cache_data.cpp (100%) rename projects/{abuild/cache => abuild.cache}/cache_index.cpp (100%) rename projects/{abuild/cache => abuild.cache}/cache_reader.cpp (99%) rename projects/{abuild/cache => abuild.cache}/cache_writer.cpp (100%) rename projects/{abuild/cache => abuild.cache}/cpp_file.cpp (100%) rename projects/{abuild/cache => abuild.cache}/file.cpp (100%) rename projects/{abuild/cache => abuild.cache}/flag.cpp (100%) rename projects/{abuild/cache => abuild.cache}/header.cpp (100%) rename projects/{abuild/cache => abuild.cache}/header_file.cpp (100%) rename projects/{abuild/cache => abuild.cache}/header_unit.cpp (100%) rename projects/{abuild/cache => abuild.cache}/module.cpp (100%) rename projects/{abuild/cache => abuild.cache}/module_partition.cpp (100%) rename projects/{abuild/cache => abuild.cache}/project.cpp (100%) rename projects/{abuild/cache => abuild.cache}/settings.cpp (100%) rename projects/{abuild/cache => abuild.cache}/source_file.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/cache_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/defines_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/file_lookup_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/flag_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/header_file_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/header_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/header_unit_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/main.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/module_partition_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/module_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/project_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/settings_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/source_file_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/tokens_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/test/toolchain_test.cpp (100%) rename projects/{abuild/cache => abuild.cache}/toolchain.cpp (100%) rename projects/{abuild/cpptokenizer/cpptokenizer.cpp => abuild.cpptokenizer/abuild.cpptokenizer.cpp} (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/if_token.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/preprocessor_if_tokenizer.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/preprocessor_tokenizer.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/preprocessor_tokenizer_common.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/define_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/if_bracket_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/if_defined_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/if_else_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/if_has_include_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/if_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/ifdef_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/import_include_external_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/import_include_local_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/import_module_partition_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/import_module_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/include_external_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/include_local_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/main.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/module_partition_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/module_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/token_operators_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/tokenizer_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/test/undef_test.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/token.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/token_operators.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/tokenizer.cpp (100%) rename projects/{abuild/cpptokenizer => abuild.cpptokenizer}/tokenizer_common.cpp (100%) rename projects/{abuild/scanners/scanners.cpp => abuild.scanners/abuild.scanners.cpp} (100%) rename projects/{abuild/scanners => abuild.scanners}/project_scanner.cpp (100%) rename projects/{abuild/scanners => abuild.scanners}/test/main.cpp (100%) rename projects/{abuild/scanners => abuild.scanners}/test/project_scanner_test.cpp (100%) rename projects/{abuild/test_utilities/test_utilities.cpp => abuild.test_utilities/abuild.test_utilities.cpp} (100%) rename projects/{abuild/test_utilities => abuild.test_utilities}/test_file.cpp (100%) rename projects/{abuild/test_utilities => abuild.test_utilities}/test_project.cpp (100%) rename projects/{abuild/test_utilities => abuild.test_utilities}/token_operators.cpp (100%) rename projects/{aprocess/test => }/aprocesstestapp/main.cpp (100%) create mode 100644 sh/build/abuild.cache.test.sh delete mode 100755 sh/build/abuild.cache_test.sh create mode 100644 sh/build/abuild.cpptokenizer.test.sh delete mode 100755 sh/build/abuild.cpptokenizer_test.sh create mode 100644 sh/build/abuild.scanners.test.sh delete mode 100755 sh/build/abuild.scanners_test.sh create mode 100644 sh/build/acommandline.test.sh delete mode 100755 sh/build/acommandline_test.sh create mode 100644 sh/build/aprocess.test.sh delete mode 100755 sh/build/aprocess_test.sh create mode 100644 sh/build/astl.test.sh delete mode 100755 sh/build/astl_test.sh create mode 100644 sh/build/atest.test.sh delete mode 100755 sh/build/atest_test.sh create mode 100644 sh/build/athreadpool.test.sh delete mode 100755 sh/build/athreadpool_test.sh create mode 100644 sh/build/awinapi.test.sh delete mode 100755 sh/build/awinapi_test.sh rename sh/{build_libc++.sh => build_libc++_msan.sh} (68%) mode change 100755 => 100644 diff --git a/build.sh b/build.sh index f2f3254a..8dc654c4 100644 --- a/build.sh +++ b/build.sh @@ -1,23 +1,25 @@ #!/usr/bin/env bash -source "sh/common.sh" +#source "sh/analyse.sh" +source "sh/build.sh" +#source "sh/coverage.sh" +#source "sh/format.sh" +source "sh/help.sh" +#source "sh/install.sh" +#source "sh/test.sh" readonly action="${1}" -if [[ "${action}" == "" ]] || [[ "${action}" == "help" ]] || [[ "${action}" == "?" ]]; then - sh/help.sh -elif [[ "${action}" == "analyse" ]]; then - sh/analyse.sh "${2}" "${3}" -elif [[ "${action}" == "build" ]]; then - sh/build.sh "${2}" "${3}" -elif [[ "${action}" == "coverage" ]]; then - sh/coverage.sh "${2}" "${3}" +if [[ "${action}" == "analyse" ]]; then + analyse "${2}" "${3}" +elif [[ "${action}" == "help" ]]; then + help_ elif [[ "${action}" == "format" ]]; then - sh/format.sh "${2}" "${3}" + format "${2}" elif [[ "${action}" == "install" ]]; then - sh/install.sh "${2}" "${3}" + install "${2}" elif [[ "${action}" == "test" ]]; then - sh/test.sh "${2}" "${3}" -else - print_error "ERROR: unknown action '${action}'. Run './build.sh' to display available actions." + test_ "${2}" "${3}" "${4}" "${5}" +else + build_ "${1}" "${2}" "${3}" fi diff --git a/projects/abuild/cache/abi.cpp b/projects/abuild.cache/abi.cpp similarity index 100% rename from projects/abuild/cache/abi.cpp rename to projects/abuild.cache/abi.cpp diff --git a/projects/abuild/cache/cache.cpp b/projects/abuild.cache/abuild.cache.cpp similarity index 86% rename from projects/abuild/cache/cache.cpp rename to projects/abuild.cache/abuild.cache.cpp index aa928023..2664657e 100644 --- a/projects/abuild/cache/cache.cpp +++ b/projects/abuild.cache/abuild.cache.cpp @@ -1,7 +1,7 @@ export module abuild.cache; #ifndef __clang__ -export import :cache_impl; +export import :cache; #else export import abuild.cpptokenizer; import yamlcpp; @@ -21,14 +21,8 @@ import yamlcpp; #include "toolchain.cpp" //NOLINT(bugprone-suspicious-include) #include "cache_data.cpp" //NOLINT(bugprone-suspicious-include) #include "cache_index.cpp" //NOLINT(bugprone-suspicious-include) -#include "cache_impl.cpp" //NOLINT(bugprone-suspicious-include) +#include "cache.cpp" //NOLINT(bugprone-suspicious-include) #include "cache_reader.cpp" //NOLINT(bugprone-suspicious-include) #include "cache_writer.cpp" //NOLINT(bugprone-suspicious-include) // clang-format on #endif - -namespace abuild -{ -//! Convenience type alias for `CacheImpl`. -export using Cache = CacheImpl; -} diff --git a/projects/abuild/cache/cache_impl.cpp b/projects/abuild.cache/cache.cpp similarity index 94% rename from projects/abuild/cache/cache_impl.cpp rename to projects/abuild.cache/cache.cpp index 94755399..eec5a031 100644 --- a/projects/abuild/cache/cache_impl.cpp +++ b/projects/abuild.cache/cache.cpp @@ -1,19 +1,19 @@ #ifndef __clang__ -export module abuild.cache:cache_impl; +export module abuild.cache:cache; export import :cache_data; import :cache_index; #endif namespace abuild { -export class CacheImpl; +export class Cache; //! \private -auto read_cache(const std::filesystem::path &path, CacheImpl &cache) -> void; +auto read_cache(const std::filesystem::path &path, Cache &cache) -> void; //! \private auto write_cache(const CacheData &data) -> void; -//! The CacheImpl class stores all the build +//! The Cache class stores all the build //! information. //! //! The Cache indexes all of its content for @@ -25,14 +25,14 @@ auto write_cache(const CacheData &data) -> void; //! //! When loaded from a cache file all non-existent //! files are skipped. -export class CacheImpl +export class Cache { public: //! Constructs the `Cache` with file `path`. //! If the `path` exists it will read the data //! from it and populate the cache and build //! all the indexes. - explicit CacheImpl(std::filesystem::path path) : + explicit Cache(std::filesystem::path path) : data{.filePath = std::move(path)} { if (std::filesystem::exists(this->data.filePath)) @@ -42,14 +42,14 @@ export class CacheImpl } //! Deleted copy constructor. - CacheImpl(const CacheImpl &other) = delete; + Cache(const Cache &other) = delete; //! Move constructor. - CacheImpl(CacheImpl &&other) noexcept = default; + Cache(Cache &&other) noexcept = default; //! Destructs the Cache and writes its data to //! the file passed in the constructor. - ~CacheImpl() + ~Cache() { try { @@ -294,10 +294,10 @@ export class CacheImpl } //! Deleted copy assignment. - auto operator=(const CacheImpl &other) -> CacheImpl & = delete; + auto operator=(const Cache &other) -> Cache & = delete; //! Move assignment. - auto operator=(CacheImpl &&other) noexcept -> CacheImpl & = default; + auto operator=(Cache &&other) noexcept -> Cache & = default; private: CacheData data; diff --git a/projects/abuild/cache/cache_data.cpp b/projects/abuild.cache/cache_data.cpp similarity index 100% rename from projects/abuild/cache/cache_data.cpp rename to projects/abuild.cache/cache_data.cpp diff --git a/projects/abuild/cache/cache_index.cpp b/projects/abuild.cache/cache_index.cpp similarity index 100% rename from projects/abuild/cache/cache_index.cpp rename to projects/abuild.cache/cache_index.cpp diff --git a/projects/abuild/cache/cache_reader.cpp b/projects/abuild.cache/cache_reader.cpp similarity index 99% rename from projects/abuild/cache/cache_reader.cpp rename to projects/abuild.cache/cache_reader.cpp index 29a5c303..35494cba 100644 --- a/projects/abuild/cache/cache_reader.cpp +++ b/projects/abuild.cache/cache_reader.cpp @@ -1,6 +1,6 @@ #ifndef __clang__ module abuild.cache:cache_reader; -import :cache_impl; +import :cache; import yamlcpp; #endif @@ -10,7 +10,7 @@ namespace abuild class CacheReader { public: - explicit CacheReader(const std::filesystem::path &path, CacheImpl &cache) : + explicit CacheReader(const std::filesystem::path &path, Cache &cache) : cache{cache}, root{::YAML::LoadFile(path.string())} { @@ -655,12 +655,12 @@ class CacheReader return Toolchain::Frontend::GCC; } - CacheImpl &cache; + Cache &cache; ::YAML::Node root; }; //! \private -auto read_cache(const std::filesystem::path &path, CacheImpl &cache) -> void +auto read_cache(const std::filesystem::path &path, Cache &cache) -> void { CacheReader reader{path, cache}; reader.read_configuration_name(); diff --git a/projects/abuild/cache/cache_writer.cpp b/projects/abuild.cache/cache_writer.cpp similarity index 100% rename from projects/abuild/cache/cache_writer.cpp rename to projects/abuild.cache/cache_writer.cpp diff --git a/projects/abuild/cache/cpp_file.cpp b/projects/abuild.cache/cpp_file.cpp similarity index 100% rename from projects/abuild/cache/cpp_file.cpp rename to projects/abuild.cache/cpp_file.cpp diff --git a/projects/abuild/cache/file.cpp b/projects/abuild.cache/file.cpp similarity index 100% rename from projects/abuild/cache/file.cpp rename to projects/abuild.cache/file.cpp diff --git a/projects/abuild/cache/flag.cpp b/projects/abuild.cache/flag.cpp similarity index 100% rename from projects/abuild/cache/flag.cpp rename to projects/abuild.cache/flag.cpp diff --git a/projects/abuild/cache/header.cpp b/projects/abuild.cache/header.cpp similarity index 100% rename from projects/abuild/cache/header.cpp rename to projects/abuild.cache/header.cpp diff --git a/projects/abuild/cache/header_file.cpp b/projects/abuild.cache/header_file.cpp similarity index 100% rename from projects/abuild/cache/header_file.cpp rename to projects/abuild.cache/header_file.cpp diff --git a/projects/abuild/cache/header_unit.cpp b/projects/abuild.cache/header_unit.cpp similarity index 100% rename from projects/abuild/cache/header_unit.cpp rename to projects/abuild.cache/header_unit.cpp diff --git a/projects/abuild/cache/module.cpp b/projects/abuild.cache/module.cpp similarity index 100% rename from projects/abuild/cache/module.cpp rename to projects/abuild.cache/module.cpp diff --git a/projects/abuild/cache/module_partition.cpp b/projects/abuild.cache/module_partition.cpp similarity index 100% rename from projects/abuild/cache/module_partition.cpp rename to projects/abuild.cache/module_partition.cpp diff --git a/projects/abuild/cache/project.cpp b/projects/abuild.cache/project.cpp similarity index 100% rename from projects/abuild/cache/project.cpp rename to projects/abuild.cache/project.cpp diff --git a/projects/abuild/cache/settings.cpp b/projects/abuild.cache/settings.cpp similarity index 100% rename from projects/abuild/cache/settings.cpp rename to projects/abuild.cache/settings.cpp diff --git a/projects/abuild/cache/source_file.cpp b/projects/abuild.cache/source_file.cpp similarity index 100% rename from projects/abuild/cache/source_file.cpp rename to projects/abuild.cache/source_file.cpp diff --git a/projects/abuild/cache/test/cache_test.cpp b/projects/abuild.cache/test/cache_test.cpp similarity index 100% rename from projects/abuild/cache/test/cache_test.cpp rename to projects/abuild.cache/test/cache_test.cpp diff --git a/projects/abuild/cache/test/defines_test.cpp b/projects/abuild.cache/test/defines_test.cpp similarity index 100% rename from projects/abuild/cache/test/defines_test.cpp rename to projects/abuild.cache/test/defines_test.cpp diff --git a/projects/abuild/cache/test/file_lookup_test.cpp b/projects/abuild.cache/test/file_lookup_test.cpp similarity index 100% rename from projects/abuild/cache/test/file_lookup_test.cpp rename to projects/abuild.cache/test/file_lookup_test.cpp diff --git a/projects/abuild/cache/test/flag_test.cpp b/projects/abuild.cache/test/flag_test.cpp similarity index 100% rename from projects/abuild/cache/test/flag_test.cpp rename to projects/abuild.cache/test/flag_test.cpp diff --git a/projects/abuild/cache/test/header_file_test.cpp b/projects/abuild.cache/test/header_file_test.cpp similarity index 100% rename from projects/abuild/cache/test/header_file_test.cpp rename to projects/abuild.cache/test/header_file_test.cpp diff --git a/projects/abuild/cache/test/header_test.cpp b/projects/abuild.cache/test/header_test.cpp similarity index 100% rename from projects/abuild/cache/test/header_test.cpp rename to projects/abuild.cache/test/header_test.cpp diff --git a/projects/abuild/cache/test/header_unit_test.cpp b/projects/abuild.cache/test/header_unit_test.cpp similarity index 100% rename from projects/abuild/cache/test/header_unit_test.cpp rename to projects/abuild.cache/test/header_unit_test.cpp diff --git a/projects/abuild/cache/test/main.cpp b/projects/abuild.cache/test/main.cpp similarity index 100% rename from projects/abuild/cache/test/main.cpp rename to projects/abuild.cache/test/main.cpp diff --git a/projects/abuild/cache/test/module_partition_test.cpp b/projects/abuild.cache/test/module_partition_test.cpp similarity index 100% rename from projects/abuild/cache/test/module_partition_test.cpp rename to projects/abuild.cache/test/module_partition_test.cpp diff --git a/projects/abuild/cache/test/module_test.cpp b/projects/abuild.cache/test/module_test.cpp similarity index 100% rename from projects/abuild/cache/test/module_test.cpp rename to projects/abuild.cache/test/module_test.cpp diff --git a/projects/abuild/cache/test/project_test.cpp b/projects/abuild.cache/test/project_test.cpp similarity index 100% rename from projects/abuild/cache/test/project_test.cpp rename to projects/abuild.cache/test/project_test.cpp diff --git a/projects/abuild/cache/test/settings_test.cpp b/projects/abuild.cache/test/settings_test.cpp similarity index 100% rename from projects/abuild/cache/test/settings_test.cpp rename to projects/abuild.cache/test/settings_test.cpp diff --git a/projects/abuild/cache/test/source_file_test.cpp b/projects/abuild.cache/test/source_file_test.cpp similarity index 100% rename from projects/abuild/cache/test/source_file_test.cpp rename to projects/abuild.cache/test/source_file_test.cpp diff --git a/projects/abuild/cache/test/tokens_test.cpp b/projects/abuild.cache/test/tokens_test.cpp similarity index 100% rename from projects/abuild/cache/test/tokens_test.cpp rename to projects/abuild.cache/test/tokens_test.cpp diff --git a/projects/abuild/cache/test/toolchain_test.cpp b/projects/abuild.cache/test/toolchain_test.cpp similarity index 100% rename from projects/abuild/cache/test/toolchain_test.cpp rename to projects/abuild.cache/test/toolchain_test.cpp diff --git a/projects/abuild/cache/toolchain.cpp b/projects/abuild.cache/toolchain.cpp similarity index 100% rename from projects/abuild/cache/toolchain.cpp rename to projects/abuild.cache/toolchain.cpp diff --git a/projects/abuild/cpptokenizer/cpptokenizer.cpp b/projects/abuild.cpptokenizer/abuild.cpptokenizer.cpp similarity index 100% rename from projects/abuild/cpptokenizer/cpptokenizer.cpp rename to projects/abuild.cpptokenizer/abuild.cpptokenizer.cpp diff --git a/projects/abuild/cpptokenizer/if_token.cpp b/projects/abuild.cpptokenizer/if_token.cpp similarity index 100% rename from projects/abuild/cpptokenizer/if_token.cpp rename to projects/abuild.cpptokenizer/if_token.cpp diff --git a/projects/abuild/cpptokenizer/preprocessor_if_tokenizer.cpp b/projects/abuild.cpptokenizer/preprocessor_if_tokenizer.cpp similarity index 100% rename from projects/abuild/cpptokenizer/preprocessor_if_tokenizer.cpp rename to projects/abuild.cpptokenizer/preprocessor_if_tokenizer.cpp diff --git a/projects/abuild/cpptokenizer/preprocessor_tokenizer.cpp b/projects/abuild.cpptokenizer/preprocessor_tokenizer.cpp similarity index 100% rename from projects/abuild/cpptokenizer/preprocessor_tokenizer.cpp rename to projects/abuild.cpptokenizer/preprocessor_tokenizer.cpp diff --git a/projects/abuild/cpptokenizer/preprocessor_tokenizer_common.cpp b/projects/abuild.cpptokenizer/preprocessor_tokenizer_common.cpp similarity index 100% rename from projects/abuild/cpptokenizer/preprocessor_tokenizer_common.cpp rename to projects/abuild.cpptokenizer/preprocessor_tokenizer_common.cpp diff --git a/projects/abuild/cpptokenizer/test/define_test.cpp b/projects/abuild.cpptokenizer/test/define_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/define_test.cpp rename to projects/abuild.cpptokenizer/test/define_test.cpp diff --git a/projects/abuild/cpptokenizer/test/if_bracket_test.cpp b/projects/abuild.cpptokenizer/test/if_bracket_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/if_bracket_test.cpp rename to projects/abuild.cpptokenizer/test/if_bracket_test.cpp diff --git a/projects/abuild/cpptokenizer/test/if_defined_test.cpp b/projects/abuild.cpptokenizer/test/if_defined_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/if_defined_test.cpp rename to projects/abuild.cpptokenizer/test/if_defined_test.cpp diff --git a/projects/abuild/cpptokenizer/test/if_else_test.cpp b/projects/abuild.cpptokenizer/test/if_else_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/if_else_test.cpp rename to projects/abuild.cpptokenizer/test/if_else_test.cpp diff --git a/projects/abuild/cpptokenizer/test/if_has_include_test.cpp b/projects/abuild.cpptokenizer/test/if_has_include_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/if_has_include_test.cpp rename to projects/abuild.cpptokenizer/test/if_has_include_test.cpp diff --git a/projects/abuild/cpptokenizer/test/if_test.cpp b/projects/abuild.cpptokenizer/test/if_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/if_test.cpp rename to projects/abuild.cpptokenizer/test/if_test.cpp diff --git a/projects/abuild/cpptokenizer/test/ifdef_test.cpp b/projects/abuild.cpptokenizer/test/ifdef_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/ifdef_test.cpp rename to projects/abuild.cpptokenizer/test/ifdef_test.cpp diff --git a/projects/abuild/cpptokenizer/test/import_include_external_test.cpp b/projects/abuild.cpptokenizer/test/import_include_external_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/import_include_external_test.cpp rename to projects/abuild.cpptokenizer/test/import_include_external_test.cpp diff --git a/projects/abuild/cpptokenizer/test/import_include_local_test.cpp b/projects/abuild.cpptokenizer/test/import_include_local_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/import_include_local_test.cpp rename to projects/abuild.cpptokenizer/test/import_include_local_test.cpp diff --git a/projects/abuild/cpptokenizer/test/import_module_partition_test.cpp b/projects/abuild.cpptokenizer/test/import_module_partition_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/import_module_partition_test.cpp rename to projects/abuild.cpptokenizer/test/import_module_partition_test.cpp diff --git a/projects/abuild/cpptokenizer/test/import_module_test.cpp b/projects/abuild.cpptokenizer/test/import_module_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/import_module_test.cpp rename to projects/abuild.cpptokenizer/test/import_module_test.cpp diff --git a/projects/abuild/cpptokenizer/test/include_external_test.cpp b/projects/abuild.cpptokenizer/test/include_external_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/include_external_test.cpp rename to projects/abuild.cpptokenizer/test/include_external_test.cpp diff --git a/projects/abuild/cpptokenizer/test/include_local_test.cpp b/projects/abuild.cpptokenizer/test/include_local_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/include_local_test.cpp rename to projects/abuild.cpptokenizer/test/include_local_test.cpp diff --git a/projects/abuild/cpptokenizer/test/main.cpp b/projects/abuild.cpptokenizer/test/main.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/main.cpp rename to projects/abuild.cpptokenizer/test/main.cpp diff --git a/projects/abuild/cpptokenizer/test/module_partition_test.cpp b/projects/abuild.cpptokenizer/test/module_partition_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/module_partition_test.cpp rename to projects/abuild.cpptokenizer/test/module_partition_test.cpp diff --git a/projects/abuild/cpptokenizer/test/module_test.cpp b/projects/abuild.cpptokenizer/test/module_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/module_test.cpp rename to projects/abuild.cpptokenizer/test/module_test.cpp diff --git a/projects/abuild/cpptokenizer/test/token_operators_test.cpp b/projects/abuild.cpptokenizer/test/token_operators_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/token_operators_test.cpp rename to projects/abuild.cpptokenizer/test/token_operators_test.cpp diff --git a/projects/abuild/cpptokenizer/test/tokenizer_test.cpp b/projects/abuild.cpptokenizer/test/tokenizer_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/tokenizer_test.cpp rename to projects/abuild.cpptokenizer/test/tokenizer_test.cpp diff --git a/projects/abuild/cpptokenizer/test/undef_test.cpp b/projects/abuild.cpptokenizer/test/undef_test.cpp similarity index 100% rename from projects/abuild/cpptokenizer/test/undef_test.cpp rename to projects/abuild.cpptokenizer/test/undef_test.cpp diff --git a/projects/abuild/cpptokenizer/token.cpp b/projects/abuild.cpptokenizer/token.cpp similarity index 100% rename from projects/abuild/cpptokenizer/token.cpp rename to projects/abuild.cpptokenizer/token.cpp diff --git a/projects/abuild/cpptokenizer/token_operators.cpp b/projects/abuild.cpptokenizer/token_operators.cpp similarity index 100% rename from projects/abuild/cpptokenizer/token_operators.cpp rename to projects/abuild.cpptokenizer/token_operators.cpp diff --git a/projects/abuild/cpptokenizer/tokenizer.cpp b/projects/abuild.cpptokenizer/tokenizer.cpp similarity index 100% rename from projects/abuild/cpptokenizer/tokenizer.cpp rename to projects/abuild.cpptokenizer/tokenizer.cpp diff --git a/projects/abuild/cpptokenizer/tokenizer_common.cpp b/projects/abuild.cpptokenizer/tokenizer_common.cpp similarity index 100% rename from projects/abuild/cpptokenizer/tokenizer_common.cpp rename to projects/abuild.cpptokenizer/tokenizer_common.cpp diff --git a/projects/abuild/scanners/scanners.cpp b/projects/abuild.scanners/abuild.scanners.cpp similarity index 100% rename from projects/abuild/scanners/scanners.cpp rename to projects/abuild.scanners/abuild.scanners.cpp diff --git a/projects/abuild/scanners/project_scanner.cpp b/projects/abuild.scanners/project_scanner.cpp similarity index 100% rename from projects/abuild/scanners/project_scanner.cpp rename to projects/abuild.scanners/project_scanner.cpp diff --git a/projects/abuild/scanners/test/main.cpp b/projects/abuild.scanners/test/main.cpp similarity index 100% rename from projects/abuild/scanners/test/main.cpp rename to projects/abuild.scanners/test/main.cpp diff --git a/projects/abuild/scanners/test/project_scanner_test.cpp b/projects/abuild.scanners/test/project_scanner_test.cpp similarity index 100% rename from projects/abuild/scanners/test/project_scanner_test.cpp rename to projects/abuild.scanners/test/project_scanner_test.cpp diff --git a/projects/abuild/test_utilities/test_utilities.cpp b/projects/abuild.test_utilities/abuild.test_utilities.cpp similarity index 100% rename from projects/abuild/test_utilities/test_utilities.cpp rename to projects/abuild.test_utilities/abuild.test_utilities.cpp diff --git a/projects/abuild/test_utilities/test_file.cpp b/projects/abuild.test_utilities/test_file.cpp similarity index 100% rename from projects/abuild/test_utilities/test_file.cpp rename to projects/abuild.test_utilities/test_file.cpp diff --git a/projects/abuild/test_utilities/test_project.cpp b/projects/abuild.test_utilities/test_project.cpp similarity index 100% rename from projects/abuild/test_utilities/test_project.cpp rename to projects/abuild.test_utilities/test_project.cpp diff --git a/projects/abuild/test_utilities/token_operators.cpp b/projects/abuild.test_utilities/token_operators.cpp similarity index 100% rename from projects/abuild/test_utilities/token_operators.cpp rename to projects/abuild.test_utilities/token_operators.cpp diff --git a/projects/aprocess/test/aprocesstestapp/main.cpp b/projects/aprocesstestapp/main.cpp similarity index 100% rename from projects/aprocess/test/aprocesstestapp/main.cpp rename to projects/aprocesstestapp/main.cpp diff --git a/sh/build.sh b/sh/build.sh index 3ac4c930..7550a05d 100755 --- a/sh/build.sh +++ b/sh/build.sh @@ -1,25 +1,36 @@ -source "sh/common.sh" +[ -n "$BUILD_SH" ] && return || readonly BUILD_SH=1 -function build_project() { - local project="${1}" - local buildScript="sh/build/${project}.sh" +source "sh/build_docs.sh" +source "sh/build_libc++_msan.sh" - if [[ -f "${buildScript}" ]]; then - run_script "${buildScript}" "${toolchain}" - else - echo "" - print_error "ERROR: Project '${project}' does not exist." - echo " -Available projects:" +function build_() { + if [[ "${1}" == "docs" ]]; then + build_docs + return + fi + + if [[ "${1}" == "libc++-msan" ]]; then + build_libcpp_msan + return + fi + + if [[ "${1}" == "list" ]]; then list_projects - exit 1; + return + fi + + set_build_properties "${1}" "${2}" "${3}" + + if [[ "${project}" != "" ]]; then + rm -f "build/${toolchain}/${configuration}/${project}.done" + build_project "${project}" + else + build_projects fi } function build_projects() { - set_toolchain "${1}" - - remove_done_files + remove_done_files "${1}" "${2}" for script in sh/build/*.sh; do if [[ "${script}" =~ sh/build/(.*)\.sh ]]; then @@ -37,38 +48,7 @@ function list_projects() { } function remove_done_files() { - if [[ -d "build/${toolchain}/" ]]; then - find build/${toolchain}/ -name "*.done" -type f -delete + if [[ -d "build/${toolchain}/${configuration}" ]]; then + find "build/${toolchain}/${configuration}" -name "*.done" -type f -delete fi } - -if [[ "${1}" == "coverage" ]]; then - export CODE_COVERAGE="true" - build_projects "clang" -elif [[ "${1}" == "docs" ]]; then - sh/build_docs.sh -elif [[ "${1}" == "list" ]]; then - list_projects -elif [[ "${1}" == "address-sanitizer" ]]; then - export ADDRESS_SANITIZER="true" - build_projects "clang" -elif [[ "${1}" == "memory-sanitizer" ]]; then - export MEMORY_SANITIZER="true" - build_projects "clang" -elif [[ "${1}" == "thread-sanitizer" ]]; then - export THREAD_SANITIZER="true" - build_projects "clang" -elif [[ "${1}" == "undefined-sanitizer" ]]; then - export UNDEFINED_SANITIZER="true" - build_projects "clang" -elif [[ "${1}" == "libc++-msan" ]]; then - sh/build_libc++.sh "msan" -elif is_toolchain "${1}"; then - build_projects "${1}" -elif [[ "${1}" != "" ]]; then - set_toolchain "${2}" - remove_done_files - build_project "${1}" -else - build_projects -fi diff --git a/sh/build/abuild.cache.sh b/sh/build/abuild.cache.sh index 4ab96454..6f6849ba 100755 --- a/sh/build/abuild.cache.sh +++ b/sh/build/abuild.cache.sh @@ -1,120 +1,116 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="abuild.cache" -projectDir="projects/abuild/cache" -buildDir="${buildRoot}/abuild/cache" +set_build_properties "abuild.cache" "${1}" "${2}" function build_clang() { - $clang $clangCompilerFlags \ - -Xclang -emit-module-interface \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -fprebuilt-module-path=${buildRoot}/yamlcpp \ - -o "${buildDir}/abuild.cache.pcm" \ - -c "${projectDir}/cache.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang -emit-module-interface \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" - $clang $clangCompilerFlags \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -fprebuilt-module-path=${buildRoot}/yamlcpp \ - -o "${buildDir}/abuild.cache.obj" \ - -c "${projectDir}/cache.cpp" + ${clang} ${clangCompilerFlags} \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -o "${buildDir}/file.obj" -c "${projectDir}/file.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/project.obj" -c "${projectDir}/project.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/header.obj" -c "${projectDir}/header.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/cpp_file.obj" -c "${projectDir}/cpp_file.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/source_file.obj" -c "${projectDir}/source_file.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/header_file.obj" -c "${projectDir}/header_file.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/module_partition.obj" -c "${projectDir}/module_partition.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/module_.obj" -c "${projectDir}/module_.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/header_unit.obj" -c "${projectDir}/header_unit.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/settings.obj" -c "${projectDir}/settings.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/abi.obj" -c "${projectDir}/abi.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/flag.obj" -c "${projectDir}/flag.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/toolchain.obj" -c "${projectDir}/toolchain.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/cache_data.obj" -c "${projectDir}/cache_data.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/cache_index.obj" -c "${projectDir}/cache_index.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/cache_impl.obj" -c "${projectDir}/cache_impl.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/cache_reader.obj" -c "${projectDir}/cache_reader.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/cache_writer.obj" -c "${projectDir}/cache_writer.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/file.obj" -c "${projectDir}/file.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/project.obj" -c "${projectDir}/project.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/header.obj" -c "${projectDir}/header.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/cpp_file.obj" -c "${projectDir}/cpp_file.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/source_file.obj" -c "${projectDir}/source_file.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/header_file.obj" -c "${projectDir}/header_file.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/module_partition.obj" -c "${projectDir}/module_partition.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/module_.obj" -c "${projectDir}/module_.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/header_unit.obj" -c "${projectDir}/header_unit.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/settings.obj" -c "${projectDir}/settings.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/abi.obj" -c "${projectDir}/abi.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/flag.obj" -c "${projectDir}/flag.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/toolchain.obj" -c "${projectDir}/toolchain.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/cache_data.obj" -c "${projectDir}/cache_data.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/cache_index.obj" -c "${projectDir}/cache_index.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/cache.obj" -c "${projectDir}/cache.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/cache_reader.obj" -c "${projectDir}/cache_reader.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/cache_writer.obj" -c "${projectDir}/cache_writer.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/cache.obj" -c "${projectDir}/cache.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" - ar r "${buildDir}/abuild.cache.lib" \ - "${buildDir}/cache.obj" \ - "${buildDir}/project.obj" \ - "${buildDir}/header.obj" \ - "${buildDir}/file.obj" \ - "${buildDir}/cpp_file.obj" \ - "${buildDir}/source_file.obj" \ - "${buildDir}/header_file.obj" \ + ar r "${buildDir}/${project}.lib" \ + "${buildDir}/${project}.obj" \ + "${buildDir}/project.obj" \ + "${buildDir}/header.obj" \ + "${buildDir}/file.obj" \ + "${buildDir}/cpp_file.obj" \ + "${buildDir}/source_file.obj" \ + "${buildDir}/header_file.obj" \ "${buildDir}/module_partition.obj" \ - "${buildDir}/module_.obj" \ - "${buildDir}/header_unit.obj" \ - "${buildDir}/settings.obj" \ - "${buildDir}/abi.obj" \ - "${buildDir}/flag.obj" \ - "${buildDir}/toolchain.obj" \ - "${buildDir}/cache_data.obj" \ - "${buildDir}/cache_index.obj" \ - "${buildDir}/cache_impl.obj" \ - "${buildDir}/cache_reader.obj" \ + "${buildDir}/module_.obj" \ + "${buildDir}/header_unit.obj" \ + "${buildDir}/settings.obj" \ + "${buildDir}/abi.obj" \ + "${buildDir}/flag.obj" \ + "${buildDir}/toolchain.obj" \ + "${buildDir}/cache_data.obj" \ + "${buildDir}/cache_index.obj" \ + "${buildDir}/cache.obj" \ + "${buildDir}/cache_reader.obj" \ "${buildDir}/cache_writer.obj" } buildMSVC=" -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-file.ifc\" /Fo\"${buildDir}/abuild.cache-file.obj\" /c /TP \"${projectDir}/file.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-project.ifc\" /Fo\"${buildDir}/abuild.cache-project.obj\" /c /TP \"${projectDir}/project.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-header.ifc\" /Fo\"${buildDir}/abuild.cache-header.obj\" /c /TP \"${projectDir}/header.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-cpp_file.ifc\" /Fo\"${buildDir}/abuild.cache-cpp_file.obj\" /c /TP \"${projectDir}/cpp_file.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-source_file.ifc\" /Fo\"${buildDir}/abuild.cache-source_file.obj\" /c /TP \"${projectDir}/source_file.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-header_file.ifc\" /Fo\"${buildDir}/abuild.cache-header_file.obj\" /c /TP \"${projectDir}/header_file.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-module_partition.ifc\" /Fo\"${buildDir}/abuild.cache-module_partition.obj\" /c /TP \"${projectDir}/module_partition.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-module_.ifc\" /Fo\"${buildDir}/abuild.cache-module_.obj\" /c /TP \"${projectDir}/module.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-header_unit.ifc\" /Fo\"${buildDir}/abuild.cache-header_unit.obj\" /c /TP \"${projectDir}/header_unit.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-settings.ifc\" /Fo\"${buildDir}/abuild.cache-settings.obj\" /c /TP \"${projectDir}/settings.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-abi.ifc\" /Fo\"${buildDir}/abuild.cache-abi.obj\" /c /TP \"${projectDir}/abi.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-flag.ifc\" /Fo\"${buildDir}/abuild.cache-flag.obj\" /c /TP \"${projectDir}/flag.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-toolchain.ifc\" /Fo\"${buildDir}/abuild.cache-toolchain.obj\" /c /TP \"${projectDir}/toolchain.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-cache_data.ifc\" /Fo\"${buildDir}/abuild.cache-cache_data.obj\" /c /TP \"${projectDir}/cache_data.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-cache_index.ifc\" /Fo\"${buildDir}/abuild.cache-cache_index.obj\" /c /TP \"${projectDir}/cache_index.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcOutput\"${buildDir}/abuild.cache-cache_impl.ifc\" /Fo\"${buildDir}/abuild.cache-cache_impl.obj\" /c /TP \"${projectDir}/cache_impl.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcSearchDir \"${buildRoot}/yamlcpp\" /ifcOutput\"${buildDir}/abuild.cache-cache_reader.ifc\" /Fo\"${buildDir}/abuild.cache-cache_reader.obj\" /c /TP \"${projectDir}/cache_reader.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcSearchDir \"${buildRoot}/yamlcpp\" /ifcOutput\"${buildDir}/abuild.cache-cache_writer.ifc\" /Fo\"${buildDir}/abuild.cache-cache_writer.obj\" /c /TP \"${projectDir}/cache_writer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-file.ifc\" /Fo\"${buildDir}/${project}-file.obj\" /c /TP \"${projectDir}/file.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-project.ifc\" /Fo\"${buildDir}/${project}-project.obj\" /c /TP \"${projectDir}/project.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-header.ifc\" /Fo\"${buildDir}/${project}-header.obj\" /c /TP \"${projectDir}/header.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-cpp_file.ifc\" /Fo\"${buildDir}/${project}-cpp_file.obj\" /c /TP \"${projectDir}/cpp_file.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-source_file.ifc\" /Fo\"${buildDir}/${project}-source_file.obj\" /c /TP \"${projectDir}/source_file.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-header_file.ifc\" /Fo\"${buildDir}/${project}-header_file.obj\" /c /TP \"${projectDir}/header_file.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-module_partition.ifc\" /Fo\"${buildDir}/${project}-module_partition.obj\" /c /TP \"${projectDir}/module_partition.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-module_.ifc\" /Fo\"${buildDir}/${project}-module_.obj\" /c /TP \"${projectDir}/module.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-header_unit.ifc\" /Fo\"${buildDir}/${project}-header_unit.obj\" /c /TP \"${projectDir}/header_unit.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-settings.ifc\" /Fo\"${buildDir}/${project}-settings.obj\" /c /TP \"${projectDir}/settings.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-abi.ifc\" /Fo\"${buildDir}/${project}-abi.obj\" /c /TP \"${projectDir}/abi.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-flag.ifc\" /Fo\"${buildDir}/${project}-flag.obj\" /c /TP \"${projectDir}/flag.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-toolchain.ifc\" /Fo\"${buildDir}/${project}-toolchain.obj\" /c /TP \"${projectDir}/toolchain.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-cache_data.ifc\" /Fo\"${buildDir}/${project}-cache_data.obj\" /c /TP \"${projectDir}/cache_data.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-cache_index.ifc\" /Fo\"${buildDir}/${project}-cache_index.obj\" /c /TP \"${projectDir}/cache_index.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-cache.ifc\" /Fo\"${buildDir}/${project}-cache.obj\" /c /TP \"${projectDir}/cache.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcSearchDir \"${buildRoot}/yamlcpp\" /ifcOutput\"${buildDir}/${project}-cache_reader.ifc\" /Fo\"${buildDir}/${project}-cache_reader.obj\" /c /TP \"${projectDir}/cache_reader.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcSearchDir \"${buildRoot}/yamlcpp\" /ifcOutput\"${buildDir}/${project}-cache_writer.ifc\" /Fo\"${buildDir}/${project}-cache_writer.obj\" /c /TP \"${projectDir}/cache_writer.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ - /ifcSearchDir \"${buildRoot}/yamlcpp\" ^ - /ifcOutput\"${buildDir}/abuild.cache.ifc\" ^ - /Fo\"${buildDir}/abuild.cache.obj\" ^ - /c \"${projectDir}/cache.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" ^ + /ifcSearchDir \"${buildRoot}/yamlcpp\" ^ + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/abuild.cache.lib\" ^ - \"${buildDir}/abuild.cache.obj\" ^ - \"${buildDir}/abuild.cache-project.obj\" ^ - \"${buildDir}/abuild.cache-file.obj\" ^ - \"${buildDir}/abuild.cache-cpp_file.obj\" ^ - \"${buildDir}/abuild.cache-source_file.obj\" ^ - \"${buildDir}/abuild.cache-header_file.obj\" ^ - \"${buildDir}/abuild.cache-module_partition.obj\" ^ - \"${buildDir}/abuild.cache-module_.obj\" ^ - \"${buildDir}/abuild.cache-header.obj\" ^ - \"${buildDir}/abuild.cache-header_unit.obj\" ^ - \"${buildDir}/abuild.cache-settings.obj\" ^ - \"${buildDir}/abuild.cache-abi.obj\" ^ - \"${buildDir}/abuild.cache-flag.obj\" ^ - \"${buildDir}/abuild.cache-toolchain.obj\" ^ - \"${buildDir}/abuild.cache-cache_data.obj\" ^ - \"${buildDir}/abuild.cache-cache_index.obj\" ^ - \"${buildDir}/abuild.cache-cache_impl.obj\" ^ - \"${buildDir}/abuild.cache-cache_reader.obj\" ^ - \"${buildDir}/abuild.cache-cache_writer.obj\" || exit 1 + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.obj\" ^ + \"${buildDir}/${project}-project.obj\" ^ + \"${buildDir}/${project}-file.obj\" ^ + \"${buildDir}/${project}-cpp_file.obj\" ^ + \"${buildDir}/${project}-source_file.obj\" ^ + \"${buildDir}/${project}-header_file.obj\" ^ + \"${buildDir}/${project}-module_partition.obj\" ^ + \"${buildDir}/${project}-module_.obj\" ^ + \"${buildDir}/${project}-header.obj\" ^ + \"${buildDir}/${project}-header_unit.obj\" ^ + \"${buildDir}/${project}-settings.obj\" ^ + \"${buildDir}/${project}-abi.obj\" ^ + \"${buildDir}/${project}-flag.obj\" ^ + \"${buildDir}/${project}-toolchain.obj\" ^ + \"${buildDir}/${project}-cache_data.obj\" ^ + \"${buildDir}/${project}-cache_index.obj\" ^ + \"${buildDir}/${project}-cache.obj\" ^ + \"${buildDir}/${project}-cache_reader.obj\" ^ + \"${buildDir}/${project}-cache_writer.obj\" || exit 1 " -sh/build/abuild.cpptokenizer.sh "${toolchain}" -sh/build/yamlcpp.sh "${toolchain}" -build +build "abuild.cpptokenizer yamlcpp" diff --git a/sh/build/abuild.cache.test.sh b/sh/build/abuild.cache.test.sh new file mode 100644 index 00000000..f3666223 --- /dev/null +++ b/sh/build/abuild.cache.test.sh @@ -0,0 +1,99 @@ +source "sh/build_common.sh" + +set_build_properties "abuild.cache.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path="${buildRoot}/acommandline" \ + -fprebuilt-module-path="${buildRoot}/abuild.cache" \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path="${buildRoot}/abuild.test_utilities" \ + -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/cache_test.cpp" \ + "${projectDir}/defines_test.cpp" \ + "${projectDir}/file_lookup_test.cpp" \ + "${projectDir}/flag_test.cpp" \ + "${projectDir}/header_file_test.cpp" \ + "${projectDir}/header_test.cpp" \ + "${projectDir}/header_unit_test.cpp" \ + "${projectDir}/main.cpp" \ + "${projectDir}/module_partition_test.cpp" \ + "${projectDir}/module_test.cpp" \ + "${projectDir}/project_test.cpp" \ + "${projectDir}/settings_test.cpp" \ + "${projectDir}/source_file_test.cpp" \ + "${projectDir}/tokens_test.cpp" \ + "${projectDir}/toolchain_test.cpp" \ + "${buildRoot}/abuild.cache/abuild.cache.obj" \ + "${buildRoot}/abuild.test_utilities/abuild.test_utilities.obj" \ + "${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.obj" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/astl/astl.obj" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/yamlcpp/yamlcpp.lib" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/cache_test.cpp" \ + "${projectDir}/defines_test.cpp" \ + "${projectDir}/file_lookup_test.cpp" \ + "${projectDir}/flag_test.cpp" \ + "${projectDir}/header_file_test.cpp" \ + "${projectDir}/header_test.cpp" \ + "${projectDir}/header_unit_test.cpp" \ + "${projectDir}/main.cpp" \ + "${projectDir}/module_partition_test.cpp" \ + "${projectDir}/module_test.cpp" \ + "${projectDir}/project_test.cpp" \ + "${projectDir}/settings_test.cpp" \ + "${projectDir}/source_file_test.cpp" \ + "${projectDir}/tokens_test.cpp" \ + "${projectDir}/toolchain_test.cpp" \ + "${buildRoot}/abuild.cache/abuild.cache.lib" \ + "${buildRoot}/abuild.test_utilities/abuild.test_utilities.lib" \ + "${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.lib" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/astl/astl.lib" \ + "${buildRoot}/acommandline/acommandline.lib" \ + "${buildRoot}/yamlcpp/yamlcpp.lib" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /ifcSearchDir \"${buildRoot}/acommandline\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cache\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" ^ + /ifcSearchDir \"${buildRoot}/abuild.test_utilities\" ^ + /ifcSearchDir \"${buildRoot}/yamlcpp\" ^ + /Fo\"${buildDir}/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/cache_test.cpp\" ^ + \"${projectDir}/defines_test.cpp\" ^ + \"${projectDir}/file_lookup_test.cpp\" ^ + \"${projectDir}/flag_test.cpp\" ^ + \"${projectDir}/header_file_test.cpp\" ^ + \"${projectDir}/header_test.cpp\" ^ + \"${projectDir}/header_unit_test.cpp\" ^ + \"${projectDir}/main.cpp\" ^ + \"${projectDir}/module_partition_test.cpp\" ^ + \"${projectDir}/module_test.cpp\" ^ + \"${projectDir}/project_test.cpp\" ^ + \"${projectDir}/settings_test.cpp\" ^ + \"${projectDir}/source_file_test.cpp\" ^ + \"${projectDir}/tokens_test.cpp\" ^ + \"${projectDir}/toolchain_test.cpp\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/astl/astl.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" ^ + \"${buildRoot}/abuild.cache/abuild.cache.lib\" ^ + \"${buildRoot}/abuild.test_utilities/abuild.test_utilities.lib\" ^ + \"${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.lib\" ^ + \"${buildRoot}/yamlcpp/yamlcpp.lib\" || exit 1 +" + +build "abuild.cache abuild.test_utilities atest" diff --git a/sh/build/abuild.cache_test.sh b/sh/build/abuild.cache_test.sh deleted file mode 100755 index d13e1ca7..00000000 --- a/sh/build/abuild.cache_test.sh +++ /dev/null @@ -1,104 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="abuild.cache_test" -projectDir="projects/abuild/cache/test" -buildDir="${buildRoot}/abuild/cache/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -fprebuilt-module-path=${buildRoot}/acommandline \ - -fprebuilt-module-path=${buildRoot}/abuild/cache \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -fprebuilt-module-path=${buildRoot}/abuild/test_utilities \ - -fprebuilt-module-path=${buildRoot}/yamlcpp \ - -o "${binDir}/abuild.cache_test${executableExtension}" \ - "${projectDir}/cache_test.cpp" \ - "${projectDir}/defines_test.cpp" \ - "${projectDir}/file_lookup_test.cpp" \ - "${projectDir}/flag_test.cpp" \ - "${projectDir}/header_file_test.cpp" \ - "${projectDir}/header_test.cpp" \ - "${projectDir}/header_unit_test.cpp" \ - "${projectDir}/main.cpp" \ - "${projectDir}/module_partition_test.cpp" \ - "${projectDir}/module_test.cpp" \ - "${projectDir}/project_test.cpp" \ - "${projectDir}/settings_test.cpp" \ - "${projectDir}/source_file_test.cpp" \ - "${projectDir}/tokens_test.cpp" \ - "${projectDir}/toolchain_test.cpp" \ - "${buildRoot}/abuild/cache/abuild.cache.obj" \ - "${buildRoot}/abuild/test_utilities/abuild.test_utilities.obj" \ - "${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.obj" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/astl/astl.obj" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/yamlcpp/yamlcpp.lib" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/abuild.cache_test" \ - "${projectDir}/cache_test.cpp" \ - "${projectDir}/defines_test.cpp" \ - "${projectDir}/file_lookup_test.cpp" \ - "${projectDir}/flag_test.cpp" \ - "${projectDir}/header_file_test.cpp" \ - "${projectDir}/header_test.cpp" \ - "${projectDir}/header_unit_test.cpp" \ - "${projectDir}/main.cpp" \ - "${projectDir}/module_partition_test.cpp" \ - "${projectDir}/module_test.cpp" \ - "${projectDir}/project_test.cpp" \ - "${projectDir}/settings_test.cpp" \ - "${projectDir}/source_file_test.cpp" - "${projectDir}/tokens_test.cpp" \ - "${projectDir}/toolchain_test.cpp" \ - "${buildRoot}/abuild/cache/abuild.cache.lib" \ - "${buildRoot}/abuild/test_utilities/abuild.test_utilities.lib" \ - "${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.lib" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/astl/astl.lib" \ - "${buildRoot}/acommandline/acommandline.lib" \ - "${buildRoot}/yamlcpp/yamlcpp.lib" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /ifcSearchDir \"${buildRoot}/acommandline\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cache\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ - /ifcSearchDir \"${buildRoot}/abuild/test_utilities\" ^ - /ifcSearchDir \"${buildRoot}/yamlcpp\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/abuild.cache_test.exe\" ^ - \"${projectDir}/cache_test.cpp\" ^ - \"${projectDir}/defines_test.cpp\" ^ - \"${projectDir}/file_lookup_test.cpp\" ^ - \"${projectDir}/flag_test.cpp\" ^ - \"${projectDir}/header_file_test.cpp\" ^ - \"${projectDir}/header_test.cpp\" ^ - \"${projectDir}/header_unit_test.cpp\" ^ - \"${projectDir}/main.cpp\" ^ - \"${projectDir}/module_partition_test.cpp\" ^ - \"${projectDir}/module_test.cpp\" ^ - \"${projectDir}/project_test.cpp\" ^ - \"${projectDir}/settings_test.cpp\" ^ - \"${projectDir}/source_file_test.cpp\" ^ - \"${projectDir}/tokens_test.cpp\" ^ - \"${projectDir}/toolchain_test.cpp\" ^ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/astl/astl.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" ^ - \"${buildRoot}/abuild/cache/abuild.cache.lib\" ^ - \"${buildRoot}/abuild/test_utilities/abuild.test_utilities.lib\" ^ - \"${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.lib\" ^ - \"${buildRoot}/yamlcpp/yamlcpp.lib\" || exit 1 -" - -sh/build/abuild.cache.sh "${toolchain}" -sh/build/abuild.test_utilities.sh "${toolchain}" -sh/build/atest.sh "${toolchain}" -build diff --git a/sh/build/abuild.cpptokenizer.sh b/sh/build/abuild.cpptokenizer.sh index 6c9ebf43..994c5532 100755 --- a/sh/build/abuild.cpptokenizer.sh +++ b/sh/build/abuild.cpptokenizer.sh @@ -1,68 +1,70 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="abuild.cpptokenizer" -projectDir="projects/abuild/cpptokenizer" -buildDir="${buildRoot}/abuild/cpptokenizer" +set_build_properties "abuild.cpptokenizer" "${1}" "${2}" function build_clang() { + ${clang} ${clangCompilerFlags} \ + -Xclang -emit-module-interface \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/project.cpp" - $clang $clangCompilerFlags -Xclang -emit-module-interface -o "${buildDir}/abuild.cpptokenizer.pcm" -c "${projectDir}/cpptokenizer.cpp" - $clang $clangCompilerFlags -o "${buildDir}/abuild.cpptokenizer.obj" -c "${projectDir}/cpptokenizer.cpp" + ${clang} ${clangCompilerFlags} \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -o "${buildDir}/if_token.obj" -c "${projectDir}/if_token.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/token.obj" -c "${projectDir}/token.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/token_operators.obj" -c "${projectDir}/token_operators.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/tokenizer_common.obj" -c "${projectDir}/tokenizer_common.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/preprocessor_tokenizer_common.obj" -c "${projectDir}/preprocessor_tokenizer_common.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/preprocessor_if_tokenizer.obj" -c "${projectDir}/preprocessor_if_tokenizer.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/preprocessor_tokenizer.obj" -c "${projectDir}/preprocessor_tokenizer.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/tokenizer.obj" -c "${projectDir}/tokenizer.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/if_token.obj" -c "${projectDir}/if_token.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/token.obj" -c "${projectDir}/token.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/token_operators.obj" -c "${projectDir}/token_operators.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/tokenizer_common.obj" -c "${projectDir}/tokenizer_common.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/preprocessor_tokenizer_common.obj" -c "${projectDir}/preprocessor_tokenizer_common.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/preprocessor_if_tokenizer.obj" -c "${projectDir}/preprocessor_if_tokenizer.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/preprocessor_tokenizer.obj" -c "${projectDir}/preprocessor_tokenizer.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/tokenizer.obj" -c "${projectDir}/tokenizer.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/cpptokenizer.obj" -c "${projectDir}/acommandline.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" - ar r "${buildDir}/abuild.cpptokenizer.lib" \ - "${buildDir}/cpptokenizer.obj" \ - "${buildDir}/if_token.obj" \ - "${buildDir}/token.obj" \ - "${buildDir}/token_operators.obj" \ - "${buildDir}/tokenizer_common.obj" \ + ar r "${buildDir}/${project}.lib" \ + "${buildDir}/${project}.obj" \ + "${buildDir}/if_token.obj" \ + "${buildDir}/token.obj" \ + "${buildDir}/token_operators.obj" \ + "${buildDir}/tokenizer_common.obj" \ "${buildDir}/preprocessor_tokenizer_common.obj" \ - "${buildDir}/preprocessor_if_tokenizer.obj" \ - "${buildDir}/preprocessor_tokenizer.obj" \ + "${buildDir}/preprocessor_if_tokenizer.obj" \ + "${buildDir}/preprocessor_tokenizer.obj" \ "${buildDir}/tokenizer.obj" } buildMSVC=" -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/abuild.cpptokenizer-if_token.ifc\" /Fo\"${buildDir}/abuild.cpptokenizer-if_token.obj\" /c /TP \"${projectDir}/if_token.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/abuild.cpptokenizer-token.ifc\" /Fo\"${buildDir}/abuild.cpptokenizer-token.obj\" /c /TP \"${projectDir}/token.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/abuild.cpptokenizer-token_operators.ifc\" /Fo\"${buildDir}/abuild.cpptokenizer-token_operators.obj\" /c /TP \"${projectDir}/token_operators.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/abuild.cpptokenizer-tokenizer_common.ifc\" /Fo\"${buildDir}/abuild.cpptokenizer-tokenizer_common.obj\" /c /TP \"${projectDir}/tokenizer_common.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/abuild.cpptokenizer-preprocessor_tokenizer_common.ifc\" /Fo\"${buildDir}/abuild.cpptokenizer-preprocessor_tokenizer_common.obj\" /c /TP \"${projectDir}/preprocessor_tokenizer_common.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/abuild.cpptokenizer-preprocessor_if_tokenizer.ifc\" /Fo\"${buildDir}/abuild.cpptokenizer-preprocessor_if_tokenizer.obj\" /c /TP \"${projectDir}/preprocessor_if_tokenizer.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/abuild.cpptokenizer-preprocessor_tokenizer.ifc\" /Fo\"${buildDir}/abuild.cpptokenizer-preprocessor_tokenizer.obj\" /c /TP \"${projectDir}/preprocessor_tokenizer.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/abuild.cpptokenizer-tokenizer.ifc\" /Fo\"${buildDir}/abuild.cpptokenizer-tokenizer.obj\" /c /TP \"${projectDir}/tokenizer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-if_token.ifc\" /Fo\"${buildDir}/${project}-if_token.obj\" /c /TP \"${projectDir}/if_token.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-token.ifc\" /Fo\"${buildDir}/${project}-token.obj\" /c /TP \"${projectDir}/token.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-token_operators.ifc\" /Fo\"${buildDir}/${project}-token_operators.obj\" /c /TP \"${projectDir}/token_operators.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-tokenizer_common.ifc\" /Fo\"${buildDir}/${project}-tokenizer_common.obj\" /c /TP \"${projectDir}/tokenizer_common.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-preprocessor_tokenizer_common.ifc\" /Fo\"${buildDir}/${project}-preprocessor_tokenizer_common.obj\" /c /TP \"${projectDir}/preprocessor_tokenizer_common.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-preprocessor_if_tokenizer.ifc\" /Fo\"${buildDir}/${project}-preprocessor_if_tokenizer.obj\" /c /TP \"${projectDir}/preprocessor_if_tokenizer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-preprocessor_tokenizer.ifc\" /Fo\"${buildDir}/${project}-preprocessor_tokenizer.obj\" /c /TP \"${projectDir}/preprocessor_tokenizer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-tokenizer.ifc\" /Fo\"${buildDir}/${project}-tokenizer.obj\" /c /TP \"${projectDir}/tokenizer.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ - /ifcOutput\"${buildDir}/abuild.cpptokenizer.ifc\" ^ - /Fo\"${buildDir}/abuild.cpptokenizer.obj\" ^ - /c \"${projectDir}/cpptokenizer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/abuild.cpptokenizer.lib\" ^ - \"${buildDir}/abuild.cpptokenizer.obj\" ^ - \"${buildDir}/abuild.cpptokenizer-if_token.obj\" ^ - \"${buildDir}/abuild.cpptokenizer-token.obj\" ^ - \"${buildDir}/abuild.cpptokenizer-token_operators.obj\" ^ - \"${buildDir}/abuild.cpptokenizer-tokenizer_common.obj\" ^ - \"${buildDir}/abuild.cpptokenizer-preprocessor_tokenizer_common.obj\" ^ - \"${buildDir}/abuild.cpptokenizer-preprocessor_if_tokenizer.obj\" ^ - \"${buildDir}/abuild.cpptokenizer-preprocessor_tokenizer.obj\" ^ - \"${buildDir}/abuild.cpptokenizer-tokenizer.obj\" || exit 1 + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.obj\" ^ + \"${buildDir}/${project}-if_token.obj\" ^ + \"${buildDir}/${project}-token.obj\" ^ + \"${buildDir}/${project}-token_operators.obj\" ^ + \"${buildDir}/${project}-tokenizer_common.obj\" ^ + \"${buildDir}/${project}-preprocessor_tokenizer_common.obj\" ^ + \"${buildDir}/${project}-preprocessor_if_tokenizer.obj\" ^ + \"${buildDir}/${project}-preprocessor_tokenizer.obj\" ^ + \"${buildDir}/${project}-tokenizer.obj\" || exit 1 " -sh/build/astl.sh "${toolchain}" -build +build "astl" diff --git a/sh/build/abuild.cpptokenizer.test.sh b/sh/build/abuild.cpptokenizer.test.sh new file mode 100644 index 00000000..a88173d6 --- /dev/null +++ b/sh/build/abuild.cpptokenizer.test.sh @@ -0,0 +1,96 @@ +source "sh/build_common.sh" + +set_build_properties "abuild.cpptokenizer.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path="${buildRoot}/acommandline" \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/define_test.cpp" \ + "${projectDir}/if_bracket_test.cpp" \ + "${projectDir}/if_defined_test.cpp" \ + "${projectDir}/if_else_test.cpp" \ + "${projectDir}/if_has_include_test.cpp" \ + "${projectDir}/if_test.cpp" \ + "${projectDir}/ifdef_test.cpp" \ + "${projectDir}/import_include_external_test.cpp" \ + "${projectDir}/import_include_local_test.cpp" \ + "${projectDir}/import_module_partition_test.cpp" \ + "${projectDir}/import_module_test.cpp" \ + "${projectDir}/include_external_test.cpp" \ + "${projectDir}/include_local_test.cpp" \ + "${projectDir}/main.cpp" \ + "${projectDir}/module_test.cpp" \ + "${projectDir}/module_partition_test.cpp" \ + "${projectDir}/tokenizer_test.cpp" \ + "${projectDir}/token_operators_test.cpp" \ + "${projectDir}/undef_test.cpp" \ + "${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.obj" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/astl/astl.obj" \ + "${buildRoot}/acommandline/acommandline.obj" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/define_test.cpp" \ + "${projectDir}/if_bracket_test.cpp" \ + "${projectDir}/if_defined_test.cpp" \ + "${projectDir}/if_else_test.cpp" \ + "${projectDir}/if_has_include_test.cpp" \ + "${projectDir}/if_test.cpp" \ + "${projectDir}/ifdef_test.cpp" \ + "${projectDir}/import_include_external_test.cpp" \ + "${projectDir}/import_include_local_test.cpp" \ + "${projectDir}/import_module_partition_test.cpp" \ + "${projectDir}/import_module_test.cpp" \ + "${projectDir}/include_external_test.cpp" \ + "${projectDir}/include_local_test.cpp" \ + "${projectDir}/main.cpp" \ + "${projectDir}/module_test.cpp" \ + "${projectDir}/module_partition_test.cpp" \ + "${projectDir}/tokenizer_test.cpp" \ + "${projectDir}/token_operators_test.cpp" \ + "${projectDir}/undef_test.cpp" \ + "${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.lib" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/astl/astl.lib" \ + "${buildRoot}/acommandline/acommandline.lib" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /ifcSearchDir \"${buildRoot}/acommandline\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/define_test.cpp\" ^ + \"${projectDir}/if_bracket_test.cpp\" ^ + \"${projectDir}/if_defined_test.cpp\" ^ + \"${projectDir}/if_else_test.cpp\" ^ + \"${projectDir}/if_has_include_test.cpp\" ^ + \"${projectDir}/if_test.cpp\" ^ + \"${projectDir}/import_include_external_test.cpp\" ^ + \"${projectDir}/import_include_local_test.cpp\" ^ + \"${projectDir}/import_module_partition_test.cpp\" ^ + \"${projectDir}/import_module_test.cpp\" ^ + \"${projectDir}/ifdef_test.cpp\" ^ + \"${projectDir}/include_external_test.cpp\" ^ + \"${projectDir}/include_local_test.cpp\" ^ + \"${projectDir}/main.cpp\" ^ + \"${projectDir}/module_test.cpp\" ^ + \"${projectDir}/module_partition_test.cpp\" ^ + \"${projectDir}/tokenizer_test.cpp\" ^ + \"${projectDir}/token_operators_test.cpp\" ^ + \"${projectDir}/undef_test.cpp\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/astl/astl.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" ^ + \"${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.lib\" || exit 1 +" + +build "abuild.cpptokenizer atest" diff --git a/sh/build/abuild.cpptokenizer_test.sh b/sh/build/abuild.cpptokenizer_test.sh deleted file mode 100755 index ddca80a5..00000000 --- a/sh/build/abuild.cpptokenizer_test.sh +++ /dev/null @@ -1,100 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="abuild.cpptokenizer_test" -projectDir="projects/abuild/cpptokenizer/test" -buildDir="${buildRoot}/abuild/cpptokenizer/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -fprebuilt-module-path=${buildRoot}/acommandline \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -o "${binDir}/abuild.cpptokenizer_test${executableExtension}" \ - "${projectDir}/define_test.cpp" \ - "${projectDir}/if_bracket_test.cpp" \ - "${projectDir}/if_defined_test.cpp" \ - "${projectDir}/if_else_test.cpp" \ - "${projectDir}/if_has_include_test.cpp" \ - "${projectDir}/if_test.cpp" \ - "${projectDir}/ifdef_test.cpp" \ - "${projectDir}/import_include_external_test.cpp" \ - "${projectDir}/import_include_local_test.cpp" \ - "${projectDir}/import_module_partition_test.cpp" \ - "${projectDir}/import_module_test.cpp" \ - "${projectDir}/include_external_test.cpp" \ - "${projectDir}/include_local_test.cpp" \ - "${projectDir}/main.cpp" \ - "${projectDir}/module_test.cpp" \ - "${projectDir}/module_partition_test.cpp" \ - "${projectDir}/tokenizer_test.cpp" \ - "${projectDir}/token_operators_test.cpp" \ - "${projectDir}/undef_test.cpp" \ - "${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.obj" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/astl/astl.obj" \ - "${buildRoot}/acommandline/acommandline.obj" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/abuild.cpptokenizer_test" \ - "${projectDir}/define_test.cpp" \ - "${projectDir}/if_bracket_test.cpp" \ - "${projectDir}/if_defined_test.cpp" \ - "${projectDir}/if_else_test.cpp" \ - "${projectDir}/if_has_include_test.cpp" \ - "${projectDir}/if_test.cpp" \ - "${projectDir}/ifdef_test.cpp" \ - "${projectDir}/import_include_external_test.cpp" \ - "${projectDir}/import_include_local_test.cpp" \ - "${projectDir}/import_module_partition_test.cpp" \ - "${projectDir}/import_module_test.cpp" \ - "${projectDir}/include_external_test.cpp" \ - "${projectDir}/include_local_test.cpp" \ - "${projectDir}/main.cpp" \ - "${projectDir}/module_test.cpp" \ - "${projectDir}/module_partition_test.cpp" \ - "${projectDir}/tokenizer_test.cpp" \ - "${projectDir}/token_operators_test.cpp" \ - "${projectDir}/undef_test.cpp" \ - "${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.lib" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/astl/astl.lib" \ - "${buildRoot}/acommandline/acommandline.lib" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /ifcSearchDir \"${buildRoot}/acommandline\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/abuild.cpptokenizer_test.exe\" ^ - \"${projectDir}/define_test.cpp\" ^ - \"${projectDir}/if_bracket_test.cpp\" ^ - \"${projectDir}/if_defined_test.cpp\" ^ - \"${projectDir}/if_else_test.cpp\" ^ - \"${projectDir}/if_has_include_test.cpp\" ^ - \"${projectDir}/if_test.cpp\" ^ - \"${projectDir}/import_include_external_test.cpp\" ^ - \"${projectDir}/import_include_local_test.cpp\" ^ - \"${projectDir}/import_module_partition_test.cpp\" ^ - \"${projectDir}/import_module_test.cpp\" ^ - \"${projectDir}/ifdef_test.cpp\" ^ - \"${projectDir}/include_external_test.cpp\" ^ - \"${projectDir}/include_local_test.cpp\" ^ - \"${projectDir}/main.cpp\" ^ - \"${projectDir}/module_test.cpp\" ^ - \"${projectDir}/module_partition_test.cpp\" ^ - \"${projectDir}/tokenizer_test.cpp\" ^ - \"${projectDir}/token_operators_test.cpp\" ^ - \"${projectDir}/undef_test.cpp\" ^ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/astl/astl.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" ^ - \"${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.lib\" || exit 1 -" - -sh/build/abuild.cpptokenizer.sh "${toolchain}" -sh/build/atest.sh "${toolchain}" -build diff --git a/sh/build/abuild.scanners.sh b/sh/build/abuild.scanners.sh index 4587e032..de625ba4 100755 --- a/sh/build/abuild.scanners.sh +++ b/sh/build/abuild.scanners.sh @@ -1,58 +1,54 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="abuild.scanners" -projectDir="projects/abuild/scanners" -buildDir="${buildRoot}/abuild/scanners" +set_build_properties "abuild.scanners" "${1}" "${2}" function build_clang() { - $clang $clangCompilerFlags \ - -Xclang -emit-module-interface \ - -fprebuilt-module-path=${buildRoot}/abuild/cache \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -fprebuilt-module-path=${buildRoot}/athreadpool \ - -fprebuilt-module-path=${buildRoot}/yamlcpp \ - -o "${buildDir}/abuild.scanners.pcm" \ - -c "${projectDir}/scanners.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang -emit-module-interface \ + -fprebuilt-module-path="${buildRoot}/abuild.cache" \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path="${buildRoot}/athreadpool" \ + -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" - $clang $clangCompilerFlags \ - -fprebuilt-module-path=${buildRoot}/abuild/cache \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -fprebuilt-module-path=${buildRoot}/athreadpool \ - -fprebuilt-module-path=${buildRoot}/yamlcpp \ - -o "${buildDir}/abuild.scanners.obj" \ - -c "${projectDir}/scanners.cpp" + ${clang} ${clangCompilerFlags} \ + -fprebuilt-module-path="${buildRoot}/abuild.cache" \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path="${buildRoot}/athreadpool" \ + -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -o "${buildDir}/project_scanner.obj" -c "${projectDir}/project_scanner.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/project_scanner.obj" -c "${projectDir}/project_scanner.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/scanners.obj" -c "${projectDir}/scanners.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" - ar r "${buildDir}/abuild.scanners.lib" \ - "${buildDir}/scanners.obj" \ + ar r "${buildDir}/${project}.lib" \ + "${buildDir}/${project}.obj" \ "${buildDir}/project_scanner.obj" } buildMSVC=" -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" /ifcSearchDir \"${buildRoot}/abuild/cache\" /ifcSearchDir \"${buildRoot}/athreadpool\" /ifcOutput\"${buildDir}/abuild.scanners-project_scanner.ifc\" /Fo\"${buildDir}/abuild.scanners-project_scanner.obj\" /c /TP \"${projectDir}/project_scanner.cpp\" || exit 1 - -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cache\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ - /ifcSearchDir \"${buildRoot}/athreadpool\" ^ - /ifcSearchDir \"${buildRoot}/yamlcpp\" ^ - /ifcOutput\"${buildDir}/abuild.scanners.ifc\" ^ - /Fo\"${buildDir}/abuild.scanners.obj\" ^ - /c \"${projectDir}/scanners.cpp\" || exit 1 - -lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/abuild.scanners.lib\" ^ - \"${buildDir}/abuild.scanners.obj\" ^ - \"${buildDir}/abuild.scanners-project_scanner.obj\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcSearchDir \"${buildRoot}/abuild.cache\" /ifcSearchDir \"${buildRoot}/athreadpool\" /ifcOutput\"${buildDir}/${project}-project_scanner.ifc\" /Fo\"${buildDir}/${project}-project_scanner.obj\" /c /TP \"${projectDir}/project_scanner.cpp\" || exit 1 + +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cache\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" ^ + /ifcSearchDir \"${buildRoot}/athreadpool\" ^ + /ifcSearchDir \"${buildRoot}/yamlcpp\" ^ + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 + +lib.exe /NOLOGO ^ + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.obj\" ^ + \"${buildDir}/${project}-project_scanner.obj\" || exit 1 " -sh/build/abuild.cache.sh "${toolchain}" -sh/build/athreadpool.sh "${toolchain}" -build +build "abuild.cache athreadpool" diff --git a/sh/build/abuild.scanners.test.sh b/sh/build/abuild.scanners.test.sh new file mode 100644 index 00000000..70fe47bd --- /dev/null +++ b/sh/build/abuild.scanners.test.sh @@ -0,0 +1,68 @@ +source "sh/build_common.sh" + +set_build_properties "abuild.scanners.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path="${buildRoot}/acommandline" \ + -fprebuilt-module-path="${buildRoot}/abuild.scanners" \ + -fprebuilt-module-path="${buildRoot}/abuild.cache" \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path="${buildRoot}/abuild.test_utilities" \ + -fprebuilt-module-path="${buildRoot}/athreadpool" \ + -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/main.cpp" \ + "${projectDir}/project_scanner_test.cpp" \ + "${buildRoot}/abuild.scanners/abuild.scanners.obj" \ + "${buildRoot}/abuild.cache/abuild.cache.obj" \ + "${buildRoot}/abuild.test_utilities/abuild.test_utilities.obj" \ + "${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.obj" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/astl/astl.obj" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/yamlcpp/yamlcpp.lib" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/main.cpp" \ + "${projectDir}/project_scanner_test.cpp" \ + "${buildRoot}/abuild.scanners/abuild.scanners.lib" \ + "${buildRoot}/abuild.cache/abuild.cache.lib" \ + "${buildRoot}/abuild.test_utilities/abuild.test_utilities.lib" \ + "${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.lib" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/astl/astl.lib" \ + "${buildRoot}/acommandline/acommandline.lib" \ + "${buildRoot}/yamlcpp/yamlcpp.lib" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /ifcSearchDir \"${buildRoot}/acommandline\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cache\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" ^ + /ifcSearchDir \"${buildRoot}/abuild.scanners\" ^ + /ifcSearchDir \"${buildRoot}/abuild.test_utilities\" ^ + /ifcSearchDir \"${buildRoot}/athreadpool\" ^ + /ifcSearchDir \"${buildRoot}/yamlcpp\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/main.cpp\" ^ + \"${projectDir}/project_scanner_test.cpp\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/astl/astl.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" ^ + \"${buildRoot}/abuild.cache/abuild.cache.lib\" ^ + \"${buildRoot}/abuild.scanners/abuild.scanners.lib\" ^ + \"${buildRoot}/abuild.test_utilities/abuild.test_utilities.lib\" ^ + \"${buildRoot}/abuild.cpptokenizer/abuild.cpptokenizer.lib\" ^ + \"${buildRoot}/yamlcpp/yamlcpp.lib\" ^ + \"${buildRoot}/athreadpool/athreadpool.lib\" || exit 1 +" + +build "abuild.scanners abuild.test_utilities atest" diff --git a/sh/build/abuild.scanners_test.sh b/sh/build/abuild.scanners_test.sh deleted file mode 100755 index 363dc234..00000000 --- a/sh/build/abuild.scanners_test.sh +++ /dev/null @@ -1,73 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="abuild.scanners_test" -projectDir="projects/abuild/scanners/test" -buildDir="${buildRoot}/abuild/scanners/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -fprebuilt-module-path=${buildRoot}/acommandline \ - -fprebuilt-module-path=${buildRoot}/abuild/scanners \ - -fprebuilt-module-path=${buildRoot}/abuild/cache \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -fprebuilt-module-path=${buildRoot}/abuild/test_utilities \ - -fprebuilt-module-path=${buildRoot}/athreadpool \ - -fprebuilt-module-path=${buildRoot}/yamlcpp \ - -o "${binDir}/abuild.scanners_test${executableExtension}" \ - "${projectDir}/main.cpp" \ - "${projectDir}/project_scanner_test.cpp" \ - "${buildRoot}/abuild/scanners/abuild.scanners.obj" \ - "${buildRoot}/abuild/cache/abuild.cache.obj" \ - "${buildRoot}/abuild/test_utilities/abuild.test_utilities.obj" \ - "${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.obj" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/astl/astl.obj" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/yamlcpp/yamlcpp.lib" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/abuild.scanners_test" \ - "${projectDir}/main.cpp" \ - "${projectDir}/project_scanner_test.cpp" \ - "${buildRoot}/abuild/scanners/abuild.scanners.lib" \ - "${buildRoot}/abuild/cache/abuild.cache.lib" \ - "${buildRoot}/abuild/test_utilities/abuild.test_utilities.lib" \ - "${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.lib" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/astl/astl.lib" \ - "${buildRoot}/acommandline/acommandline.lib" \ - "${buildRoot}/yamlcpp/yamlcpp.lib" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /ifcSearchDir \"${buildRoot}/acommandline\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cache\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ - /ifcSearchDir \"${buildRoot}/abuild/scanners\" ^ - /ifcSearchDir \"${buildRoot}/abuild/test_utilities\" ^ - /ifcSearchDir \"${buildRoot}/athreadpool\" ^ - /ifcSearchDir \"${buildRoot}/yamlcpp\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/abuild.scanners_test.exe\" ^ - \"${projectDir}/main.cpp\" ^ - \"${projectDir}/project_scanner_test.cpp\" ^ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/astl/astl.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" ^ - \"${buildRoot}/abuild/cache/abuild.cache.lib\" ^ - \"${buildRoot}/abuild/scanners/abuild.scanners.lib\" ^ - \"${buildRoot}/abuild/test_utilities/abuild.test_utilities.lib\" ^ - \"${buildRoot}/abuild/cpptokenizer/abuild.cpptokenizer.lib\" ^ - \"${buildRoot}/yamlcpp/yamlcpp.lib\" ^ - \"${buildRoot}/athreadpool/athreadpool.lib\" || exit 1 -" - -sh/build/abuild.scanners.sh "${toolchain}" -sh/build/abuild.test_utilities.sh "${toolchain}" -sh/build/atest.sh "${toolchain}" -build diff --git a/sh/build/abuild.test_utilities.sh b/sh/build/abuild.test_utilities.sh index bbad1d9e..7d5d2010 100755 --- a/sh/build/abuild.test_utilities.sh +++ b/sh/build/abuild.test_utilities.sh @@ -1,56 +1,52 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="abuild.test_utilities" -projectDir="projects/abuild/test_utilities" -buildDir="${buildRoot}/abuild/test_utilities" +set_build_properties "abuild.test_utilities" "${1}" "${2}" function build_clang() { - - $clang $clangCompilerFlags \ - -Xclang -emit-module-interface \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -o "${buildDir}/abuild.test_utilities.pcm" \ - -c "${projectDir}/test_utilities.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang -emit-module-interface \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" - $clang $clangCompilerFlags \ - -fprebuilt-module-path=${buildRoot}/abuild/cpptokenizer \ - -o "${buildDir}/abuild.test_utilities.obj" \ - -c "${projectDir}/test_utilities.cpp" + ${clang} ${clangCompilerFlags} \ + -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -o "${buildDir}/test_file.obj" -c "${projectDir}/test_file.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/token_operators.obj" -c "${projectDir}/token_operators.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/test_project.obj" -c "${projectDir}/test_project.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/test_file.obj" -c "${projectDir}/test_file.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/token_operators.obj" -c "${projectDir}/token_operators.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/test_project.obj" -c "${projectDir}/test_project.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/test_utilities.obj" -c "${projectDir}/test_utilities.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" - ar r "${buildDir}/test_file.obj" \ - "${buildDir}/test_utilities.obj" \ + ar r "${buildDir}/test_file.obj" \ + "${buildDir}/${project}.obj" \ "${buildDir}/token_operators.obj" \ "${buildDir}/test_project.obj" } buildMSVC=" -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ /ifcOutput\"${buildDir}/abuild.test_utilities-test_file.ifc\" /Fo\"${buildDir}/abuild.test_utilities-test_file.obj\" /c /TP \"${projectDir}/test_file.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ /ifcOutput\"${buildDir}/abuild.test_utilities-token_operators.ifc\" /Fo\"${buildDir}/abuild.test_utilities-token_operators.obj\" /c /TP \"${projectDir}/token_operators.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ /ifcOutput\"${buildDir}/abuild.test_utilities-test_project.ifc\" /Fo\"${buildDir}/abuild.test_utilities-test_project.obj\" /c /TP \"${projectDir}/test_project.cpp\" || exit 1 - -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ - /ifcOutput\"${buildDir}/abuild.test_utilities.ifc\" ^ - /ifcSearchDir \"${buildRoot}/abuild/cpptokenizer\" ^ - /Fo\"${buildDir}/abuild.test_utilities.obj\" ^ - /c \"${projectDir}/test_utilities.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-test_file.ifc\" /Fo\"${buildDir}/${project}-test_file.obj\" /c /TP \"${projectDir}/test_file.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-token_operators.ifc\" /Fo\"${buildDir}/${project}-token_operators.obj\" /c /TP \"${projectDir}/token_operators.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-test_project.ifc\" /Fo\"${buildDir}/${project}-test_project.obj\" /c /TP \"${projectDir}/test_project.cpp\" || exit 1 + +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/abuild.test_utilities.lib\" ^ - \"${buildDir}/abuild.test_utilities.obj\" ^ - \"${buildDir}/abuild.test_utilities-test_file.obj\" ^ - \"${buildDir}/abuild.test_utilities-test_project.obj\" ^ - \"${buildDir}/abuild.test_utilities-token_operators.obj\" || exit 1 + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.obj\" ^ + \"${buildDir}/${project}-test_file.obj\" ^ + \"${buildDir}/${project}-test_project.obj\" ^ + \"${buildDir}/${project}-token_operators.obj\" || exit 1 " -sh/build/abuild.cpptokenizer.sh "${toolchain}" -build +build "abuild.cpptokenizer" diff --git a/sh/build/acommandline.sh b/sh/build/acommandline.sh index f7594c1a..4245909a 100755 --- a/sh/build/acommandline.sh +++ b/sh/build/acommandline.sh @@ -1,84 +1,86 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="acommandline" -projectDir="projects/${project}" -buildDir="${buildRoot}/${project}" +set_build_properties "acommandline" "${1}" "${2}" function build_clang() { + ${clang} ${clangCompilerFlags} \ + -Xclang -emit-module-interface \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" - $clang $clangCompilerFlags -Xclang -emit-module-interface -o "${buildDir}/acommandline.pcm" -c "${projectDir}/acommandline.cpp" - $clang $clangCompilerFlags -o "${buildDir}/acommandline.obj" -c "${projectDir}/acommandline.cpp" + ${clang} ${clangCompilerFlags} \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -o "${buildDir}/option.obj" -c "${projectDir}/option.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_builder_base.obj" -c "${projectDir}/option_builder_base.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_builder_described.obj" -c "${projectDir}/option_builder_described.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_builder_defined.obj" -c "${projectDir}/option_builder_defined.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_builder_value.obj" -c "${projectDir}/option_builder_value.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_builder_named.obj" -c "${projectDir}/option_builder_named.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_builder.obj" -c "${projectDir}/option_builder.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_matcher.obj" -c "${projectDir}/option_matcher.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_setter.obj" -c "${projectDir}/option_setter.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/option_help_line.obj" -c "${projectDir}/option_help_line.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/printer.obj" -c "${projectDir}/printer.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/command_line.obj" -c "${projectDir}/command_line.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option.obj" -c "${projectDir}/option.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_builder_base.obj" -c "${projectDir}/option_builder_base.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_builder_described.obj" -c "${projectDir}/option_builder_described.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_builder_defined.obj" -c "${projectDir}/option_builder_defined.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_builder_value.obj" -c "${projectDir}/option_builder_value.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_builder_named.obj" -c "${projectDir}/option_builder_named.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_builder.obj" -c "${projectDir}/option_builder.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_matcher.obj" -c "${projectDir}/option_matcher.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_setter.obj" -c "${projectDir}/option_setter.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/option_help_line.obj" -c "${projectDir}/option_help_line.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/printer.obj" -c "${projectDir}/printer.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/command_line.obj" -c "${projectDir}/command_line.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/acommandline.obj" -c "${projectDir}/acommandline.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" - ar r "${buildDir}/acommandline.lib" \ - "${buildDir}/acommandline.obj" \ - "${buildDir}/option.obj" \ - "${buildDir}/option_builder_base.obj" \ + ar r "${buildDir}/${project}.lib" \ + "${buildDir}/${project}.obj" \ + "${buildDir}/option.obj" \ + "${buildDir}/option_builder_base.obj" \ "${buildDir}/option_builder_described.obj" \ - "${buildDir}/option_builder_defined.obj" \ - "${buildDir}/option_builder_value.obj" \ - "${buildDir}/option_builder_named.obj" \ - "${buildDir}/option_builder.obj" \ - "${buildDir}/option_matcher.obj" \ - "${buildDir}/option_setter.obj" \ - "${buildDir}/option_help_line.obj" \ - "${buildDir}/printer.obj" \ + "${buildDir}/option_builder_defined.obj" \ + "${buildDir}/option_builder_value.obj" \ + "${buildDir}/option_builder_named.obj" \ + "${buildDir}/option_builder.obj" \ + "${buildDir}/option_matcher.obj" \ + "${buildDir}/option_setter.obj" \ + "${buildDir}/option_help_line.obj" \ + "${buildDir}/printer.obj" \ "${buildDir}/command_line.obj" } buildMSVC=" -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option.ifc\" /Fo\"${buildDir}/acommandline-option.obj\" /c /TP \"${projectDir}/option.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_builder_base.ifc\" /Fo\"${buildDir}/acommandline-option_builder_base.obj\" /c /TP \"${projectDir}/option_builder_base.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_builder_described.ifc\" /Fo\"${buildDir}/acommandline-option_builder_described.obj\" /c /TP \"${projectDir}/option_builder_described.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_builder_defined.ifc\" /Fo\"${buildDir}/acommandline-option_builder_defined.obj\" /c /TP \"${projectDir}/option_builder_defined.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_builder_value.ifc\" /Fo\"${buildDir}/acommandline-option_builder_value.obj\" /c /TP \"${projectDir}/option_builder_value.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_builder_named.ifc\" /Fo\"${buildDir}/acommandline-option_builder_named.obj\" /c /TP \"${projectDir}/option_builder_named.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_builder.ifc\" /Fo\"${buildDir}/acommandline-option_builder.obj\" /c /TP \"${projectDir}/option_builder.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_matcher.ifc\" /Fo\"${buildDir}/acommandline-option_matcher.obj\" /c /TP \"${projectDir}/option_matcher.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_setter.ifc\" /Fo\"${buildDir}/acommandline-option_setter.obj\" /c /TP \"${projectDir}/option_setter.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-option_help_line.ifc\" /Fo\"${buildDir}/acommandline-option_help_line.obj\" /c /TP \"${projectDir}/option_help_line.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-printer.ifc\" /Fo\"${buildDir}/acommandline-printer.obj\" /c /TP \"${projectDir}/printer.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/acommandline-command_line.ifc\" /Fo\"${buildDir}/acommandline-command_line.obj\" /c /TP \"${projectDir}/command_line.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option.ifc\" /Fo\"${buildDir}/${project}-option.obj\" /c /TP \"${projectDir}/option.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_builder_base.ifc\" /Fo\"${buildDir}/${project}-option_builder_base.obj\" /c /TP \"${projectDir}/option_builder_base.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_builder_described.ifc\" /Fo\"${buildDir}/${project}-option_builder_described.obj\" /c /TP \"${projectDir}/option_builder_described.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_builder_defined.ifc\" /Fo\"${buildDir}/${project}-option_builder_defined.obj\" /c /TP \"${projectDir}/option_builder_defined.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_builder_value.ifc\" /Fo\"${buildDir}/${project}-option_builder_value.obj\" /c /TP \"${projectDir}/option_builder_value.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_builder_named.ifc\" /Fo\"${buildDir}/${project}-option_builder_named.obj\" /c /TP \"${projectDir}/option_builder_named.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_builder.ifc\" /Fo\"${buildDir}/${project}-option_builder.obj\" /c /TP \"${projectDir}/option_builder.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_matcher.ifc\" /Fo\"${buildDir}/${project}-option_matcher.obj\" /c /TP \"${projectDir}/option_matcher.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_setter.ifc\" /Fo\"${buildDir}/${project}-option_setter.obj\" /c /TP \"${projectDir}/option_setter.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-option_help_line.ifc\" /Fo\"${buildDir}/${project}-option_help_line.obj\" /c /TP \"${projectDir}/option_help_line.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-printer.ifc\" /Fo\"${buildDir}/${project}-printer.obj\" /c /TP \"${projectDir}/printer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-command_line.ifc\" /Fo\"${buildDir}/${project}-command_line.obj\" /c /TP \"${projectDir}/command_line.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ - /ifcOutput\"${buildDir}/acommandline.ifc\" ^ - /Fo\"${buildDir}/acommandline.obj\" ^ - /c \"${projectDir}/acommandline.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 -lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/acommandline.lib\" ^ - \"${buildDir}/acommandline.obj\" ^ - \"${buildDir}/acommandline-option.obj\" ^ - \"${buildDir}/acommandline-option_builder_base.obj\" ^ - \"${buildDir}/acommandline-option_builder_described.obj\" ^ - \"${buildDir}/acommandline-option_builder_defined.obj\" ^ - \"${buildDir}/acommandline-option_builder_value.obj\" ^ - \"${buildDir}/acommandline-option_builder_named.obj\" ^ - \"${buildDir}/acommandline-option_builder.obj\" ^ - \"${buildDir}/acommandline-option_matcher.obj\" ^ - \"${buildDir}/acommandline-option_setter.obj\" ^ - \"${buildDir}/acommandline-option_help_line.obj\" ^ - \"${buildDir}/acommandline-printer.obj\" ^ - \"${buildDir}/acommandline-command_line.obj\" || exit 1 +lib.exe /NOLOGO ^ + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.obj\" ^ + \"${buildDir}/${project}-option.obj\" ^ + \"${buildDir}/${project}-option_builder_base.obj\" ^ + \"${buildDir}/${project}-option_builder_described.obj\" ^ + \"${buildDir}/${project}-option_builder_defined.obj\" ^ + \"${buildDir}/${project}-option_builder_value.obj\" ^ + \"${buildDir}/${project}-option_builder_named.obj\" ^ + \"${buildDir}/${project}-option_builder.obj\" ^ + \"${buildDir}/${project}-option_matcher.obj\" ^ + \"${buildDir}/${project}-option_setter.obj\" ^ + \"${buildDir}/${project}-option_help_line.obj\" ^ + \"${buildDir}/${project}-printer.obj\" ^ + \"${buildDir}/${project}-command_line.obj\" || exit 1 " -sh/build/astl.sh "${toolchain}" -build +build "astl" diff --git a/sh/build/acommandline.test.sh b/sh/build/acommandline.test.sh new file mode 100644 index 00000000..a082d969 --- /dev/null +++ b/sh/build/acommandline.test.sh @@ -0,0 +1,73 @@ +source "sh/build_common.sh" + +set_build_properties "acommandline.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path="${buildRoot}/acommandline" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/application_name_test.cpp" \ + "${projectDir}/command_line_test.cpp" \ + "${projectDir}/command_test.cpp" \ + "${projectDir}/examples.cpp" \ + "${projectDir}/default_value_test.cpp" \ + "${projectDir}/help_test.cpp" \ + "${projectDir}/long_name_test.cpp" \ + "${projectDir}/main.cpp" \ + "${projectDir}/parse_test.cpp" \ + "${projectDir}/positional_test.cpp" \ + "${projectDir}/repeated_test.cpp" \ + "${projectDir}/required_test.cpp" \ + "${projectDir}/short_name_test.cpp" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/astl/astl.obj" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/application_name_test.cpp" \ + "${projectDir}/command_line_test.cpp" \ + "${projectDir}/command_test.cpp" \ + "${projectDir}/examples.cpp" \ + "${projectDir}/default_value_test.cpp" \ + "${projectDir}/help_test.cpp" \ + "${projectDir}/long_name_test.cpp" \ + "${projectDir}/main.cpp" \ + "${projectDir}/parse_test.cpp" \ + "${projectDir}/positional_test.cpp" \ + "${projectDir}/repeated_test.cpp" \ + "${projectDir}/required_test.cpp" \ + "${projectDir}/short_name_test.cpp" \ + "${buildRoot}/acommandline/acommandline.lib" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/astl/astl.lib" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /ifcSearchDir \"${buildRoot}/acommandline\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/application_name_test.cpp\" ^ + \"${projectDir}/command_line_test.cpp\" ^ + \"${projectDir}/command_test.cpp\" ^ + \"${projectDir}/examples.cpp\" ^ + \"${projectDir}/default_value_test.cpp\" ^ + \"${projectDir}/help_test.cpp\" ^ + \"${projectDir}/long_name_test.cpp\" ^ + \"${projectDir}/main.cpp\" ^ + \"${projectDir}/parse_test.cpp\" ^ + \"${projectDir}/positional_test.cpp\" ^ + \"${projectDir}/repeated_test.cpp\" ^ + \"${projectDir}/required_test.cpp\" ^ + \"${projectDir}/short_name_test.cpp\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/astl/astl.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" || exit 1 +" + +build "acommandline atest" diff --git a/sh/build/acommandline_test.sh b/sh/build/acommandline_test.sh deleted file mode 100755 index 939eb37a..00000000 --- a/sh/build/acommandline_test.sh +++ /dev/null @@ -1,77 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="acommandline_test" -projectDir="projects/acommandline/test" -buildDir="${buildRoot}/acommandline/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -fprebuilt-module-path=${buildRoot}/acommandline \ - -o "${binDir}/acommandline_test${executableExtension}" \ - "${projectDir}/application_name_test.cpp" \ - "${projectDir}/command_line_test.cpp" \ - "${projectDir}/command_test.cpp" \ - "${projectDir}/examples.cpp" \ - "${projectDir}/default_value_test.cpp" \ - "${projectDir}/help_test.cpp" \ - "${projectDir}/long_name_test.cpp" \ - "${projectDir}/main.cpp" \ - "${projectDir}/parse_test.cpp" \ - "${projectDir}/positional_test.cpp" \ - "${projectDir}/repeated_test.cpp" \ - "${projectDir}/required_test.cpp" \ - "${projectDir}/short_name_test.cpp" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/astl/astl.obj" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/acommandline_test" \ - "${projectDir}/application_name_test.cpp" \ - "${projectDir}/command_line_test.cpp" \ - "${projectDir}/command_test.cpp" \ - "${projectDir}/examples.cpp" \ - "${projectDir}/default_value_test.cpp" \ - "${projectDir}/help_test.cpp" \ - "${projectDir}/long_name_test.cpp" \ - "${projectDir}/main.cpp" \ - "${projectDir}/parse_test.cpp" \ - "${projectDir}/positional_test.cpp" \ - "${projectDir}/repeated_test.cpp" \ - "${projectDir}/required_test.cpp" \ - "${projectDir}/short_name_test.cpp" \ - "${buildRoot}/acommandline/acommandline.lib" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/astl/astl.lib" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /ifcSearchDir \"${buildRoot}/acommandline\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/acommandline_test.exe\" ^ - \"${projectDir}/application_name_test.cpp\" \ - \"${projectDir}/command_line_test.cpp\" \ - \"${projectDir}/command_test.cpp\" \ - \"${projectDir}/examples.cpp\" \ - \"${projectDir}/default_value_test.cpp\" \ - \"${projectDir}/help_test.cpp\" \ - \"${projectDir}/long_name_test.cpp\" \ - \"${projectDir}/main.cpp\" \ - \"${projectDir}/parse_test.cpp\" \ - \"${projectDir}/positional_test.cpp\" \ - \"${projectDir}/repeated_test.cpp\" \ - \"${projectDir}/required_test.cpp\" \ - \"${projectDir}/short_name_test.cpp\" \ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/astl/astl.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" || exit 1 -" - -sh/build/acommandline.sh "${toolchain}" -sh/build/atest.sh "${toolchain}" -build diff --git a/sh/build/aprocess.sh b/sh/build/aprocess.sh index edb02ab0..ca6619b7 100755 --- a/sh/build/aprocess.sh +++ b/sh/build/aprocess.sh @@ -1,72 +1,69 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="aprocess" -projectDir="projects/${project}" -buildDir="${buildRoot}/${project}" +set_build_properties "aprocess" "${1}" "${2}" function build_clang() { - $clang $clangCompilerFlags \ - -Xclang -emit-module-interface \ - -fprebuilt-module-path=${buildRoot}/awinapi \ - -o "${buildDir}/aprocess.pcm" \ - -c "${projectDir}/aprocess.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang -emit-module-interface \ + -fprebuilt-module-path="${buildRoot}/awinapi" \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" - $clang $clangCompilerFlags \ - -fprebuilt-module-path=${buildRoot}/awinapi \ - -o "${buildDir}/aprocess.obj" \ - -c "${projectDir}/aprocess.cpp" + ${clang} ${clangCompilerFlags} \ + -fprebuilt-module-path="${buildRoot}/awinapi" \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -x c++-system-header "fcntl.h" - $gcc $gccCompilerFlags -x c++-system-header "unistd.h" - $gcc $gccCompilerFlags -x c++-system-header "wait.h" + ${gcc} ${gccCompilerFlags} -x c++-system-header "fcntl.h" + ${gcc} ${gccCompilerFlags} -x c++-system-header "unistd.h" + ${gcc} ${gccCompilerFlags} -x c++-system-header "wait.h" - $gcc $gccCompilerFlags -o "${buildDir}/environment_variable.obj" -c "${projectDir}/environment_variable.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/process_setup.obj" -c "${projectDir}/process_setup.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/pipe.obj" -c "${projectDir}/pipe.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/unix_process.obj" -c "${projectDir}/unix_process.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/windows_process.obj" -c "${projectDir}/windows_process.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/aprocess.obj" -c "${projectDir}/aprocess.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/environment_variable.obj" -c "${projectDir}/environment_variable.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/process_setup.obj" -c "${projectDir}/process_setup.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/pipe.obj" -c "${projectDir}/pipe.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/unix_process.obj" -c "${projectDir}/unix_process.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/windows_process.obj" -c "${projectDir}/windows_process.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" - ar r "${buildDir}/aprocess.lib" \ + ar r "${buildDir}/${project}.lib" \ "${buildDir}/environment_variable.obj" \ - "${buildDir}/process_setup.obj" \ - "${buildDir}/pipe.obj" \ - "${buildDir}/unix_process.obj" \ - "${buildDir}/windows_process.obj" \ - "${buildDir}/aprocess.obj" + "${buildDir}/process_setup.obj" \ + "${buildDir}/pipe.obj" \ + "${buildDir}/unix_process.obj" \ + "${buildDir}/windows_process.obj" \ + "${buildDir}/${project}.obj" } buildMSVC=" if not exist \"${buildDir}/windows\" mkdir \"${buildDir}/windows\" if not exist \"${buildDir}/unix\" mkdir \"${buildDir}/unix\" -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/aprocess-environment_variable.ifc\" /Fo\"${buildDir}/aprocess-environment_variable.obj\" /c /TP \"${projectDir}/environment_variable.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/aprocess-process_setup.ifc\" /Fo\"${buildDir}/aprocess-process_setup.obj\" /c /TP \"${projectDir}/process_setup.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/aprocess-pipe.ifc\" /Fo\"${buildDir}/aprocess-pipe.obj\" /c /TP \"${projectDir}/pipe.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/aprocess-unix_process.ifc\" /Fo\"${buildDir}/aprocess-unix_process.obj\" /c /TP \"${projectDir}/unix_process.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/aprocess-windows_process.ifc\" /Fo\"${buildDir}/aprocess-windows_process.obj\" /c /TP \"${projectDir}/windows_process.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/aprocess-process.ifc\" /Fo\"${buildDir}/aprocess-process.obj\" /c /TP \"${projectDir}/process.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/${project}-environment_variable.ifc\" /Fo\"${buildDir}/${project}-environment_variable.obj\" /c /TP \"${projectDir}/environment_variable.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/${project}-process_setup.ifc\" /Fo\"${buildDir}/${project}-process_setup.obj\" /c /TP \"${projectDir}/process_setup.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/${project}-pipe.ifc\" /Fo\"${buildDir}/${project}-pipe.obj\" /c /TP \"${projectDir}/pipe.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/${project}-unix_process.ifc\" /Fo\"${buildDir}/${project}-unix_process.obj\" /c /TP \"${projectDir}/unix_process.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/${project}-windows_process.ifc\" /Fo\"${buildDir}/${project}-windows_process.obj\" /c /TP \"${projectDir}/windows_process.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/awinapi\" /ifcOutput\"${buildDir}/${project}-process.ifc\" /Fo\"${buildDir}/${project}-process.obj\" /c /TP \"${projectDir}/process.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ - /ifcSearchDir \"${buildRoot}/awinapi\" ^ - /ifcOutput\"${buildDir}/aprocess.ifc\" ^ - /Fo\"${buildDir}/aprocess.obj\" ^ - /c \"${projectDir}/aprocess.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ + /ifcSearchDir \"${buildRoot}/awinapi\" ^ + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 -lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/aprocess.lib\" ^ - \"${buildDir}/aprocess.obj\" ^ - \"${buildDir}/aprocess-environment_variable.obj\" ^ - \"${buildDir}/aprocess-process_setup.obj\" ^ - \"${buildDir}/aprocess-pipe.obj\" ^ - \"${buildDir}/aprocess-unix_process.obj\" ^ - \"${buildDir}/aprocess-windows_process.obj\" ^ - \"${buildDir}/aprocess-process.obj\" || exit 1 +lib.exe /NOLOGO ^ + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.obj\" ^ + \"${buildDir}/${project}-environment_variable.obj\" ^ + \"${buildDir}/${project}-process_setup.obj\" ^ + \"${buildDir}/${project}-pipe.obj\" ^ + \"${buildDir}/${project}-unix_process.obj\" ^ + \"${buildDir}/${project}-windows_process.obj\" ^ + \"${buildDir}/${project}-process.obj\" || exit 1 " -sh/build/awinapi.sh "${toolchain}" -build +build "awinapi" diff --git a/sh/build/aprocess.test.sh b/sh/build/aprocess.test.sh new file mode 100644 index 00000000..5cad25aa --- /dev/null +++ b/sh/build/aprocess.test.sh @@ -0,0 +1,86 @@ +source "sh/build_common.sh" + +set_build_properties "aprocess.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path="${buildRoot}/aprocess" \ + -fprebuilt-module-path="${buildRoot}/awinapi" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/arguments_test.cpp" \ + "${projectDir}/command_test.cpp" \ + "${projectDir}/detached_test.cpp" \ + "${projectDir}/environment_test.cpp" \ + "${projectDir}/examples.cpp" \ + "${projectDir}/exit_code_test.cpp" \ + "${projectDir}/is_process_running.cpp" \ + "${projectDir}/kill_test.cpp" \ + "${projectDir}/main.cpp" \ + "${projectDir}/read_test.cpp" \ + "${projectDir}/terminate_test.cpp" \ + "${projectDir}/wait_test.cpp" \ + "${projectDir}/working_directory_test.cpp" \ + "${projectDir}/write_test.cpp" \ + "${buildRoot}/aprocess/aprocess.obj" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/awinapi/awinapi.obj" \ + "${buildRoot}/astl/astl.obj" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/arguments_test.cpp" \ + "${projectDir}/command_test.cpp" \ + "${projectDir}/detached_test.cpp" \ + "${projectDir}/environment_test.cpp" \ + "${projectDir}/examples.cpp" \ + "${projectDir}/exit_code_test.cpp" \ + "${projectDir}/is_process_running.cpp" \ + "${projectDir}/kill_test.cpp" \ + "${projectDir}/main.cpp" \ + "${projectDir}/read_test.cpp" \ + "${projectDir}/terminate_test.cpp" \ + "${projectDir}/wait_test.cpp" \ + "${projectDir}/working_directory_test.cpp" \ + "${projectDir}/write_test.cpp" \ + "${projectDir}/working_directory_test.cpp" \ + "${buildRoot}/aprocess/aprocess.lib" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/awinapi/awinapi.lib" \ + "${buildRoot}/astl/astl.lib" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /ifcSearchDir \"${buildRoot}/aprocess\" ^ + /ifcSearchDir \"${buildRoot}/awinapi\" ^ + /ifcSearchDir \"${buildDir}\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/arguments_test.cpp\" ^ + \"${projectDir}/command_test.cpp\" ^ + \"${projectDir}/detached_test.cpp\" ^ + \"${projectDir}/environment_test.cpp\" ^ + \"${projectDir}/examples.cpp\" ^ + \"${projectDir}/exit_code_test.cpp\" ^ + \"${projectDir}/is_process_running.cpp\" ^ + \"${projectDir}/kill_test.cpp\" ^ + \"${projectDir}/main.cpp\" ^ + \"${projectDir}/read_test.cpp\" ^ + \"${projectDir}/terminate_test.cpp\" ^ + \"${projectDir}/wait_test.cpp\" ^ + \"${projectDir}/working_directory_test.cpp\" ^ + \"${projectDir}/write_test.cpp\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/astl/astl.lib\" ^ + \"${buildRoot}/awinapi/awinapi.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" ^ + \"${buildRoot}/aprocess/aprocess.lib\" || exit 1 +" + +build "aprocess atest aprocesstestapp" diff --git a/sh/build/aprocess_test.sh b/sh/build/aprocess_test.sh deleted file mode 100755 index dd4df121..00000000 --- a/sh/build/aprocess_test.sh +++ /dev/null @@ -1,91 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="aprocess_test" -projectDir="projects/aprocess/test" -buildDir="${buildRoot}/aprocess/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -fprebuilt-module-path=${buildRoot}/aprocess \ - -fprebuilt-module-path=${buildRoot}/awinapi \ - -o "${binDir}/aprocess_test${executableExtension}" \ - "${projectDir}/arguments_test.cpp" \ - "${projectDir}/command_test.cpp" \ - "${projectDir}/detached_test.cpp" \ - "${projectDir}/environment_test.cpp" \ - "${projectDir}/examples.cpp" \ - "${projectDir}/exit_code_test.cpp" \ - "${projectDir}/is_process_running.cpp" \ - "${projectDir}/kill_test.cpp" \ - "${projectDir}/main.cpp" \ - "${projectDir}/read_test.cpp" \ - "${projectDir}/terminate_test.cpp" \ - "${projectDir}/wait_test.cpp" \ - "${projectDir}/working_directory_test.cpp" \ - "${projectDir}/write_test.cpp" \ - "${buildRoot}/aprocess/aprocess.obj" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/awinapi/awinapi.obj" \ - "${buildRoot}/astl/astl.obj" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/aprocess_test" \ - "${projectDir}/arguments_test.cpp" \ - "${projectDir}/command_test.cpp" \ - "${projectDir}/detached_test.cpp" \ - "${projectDir}/environment_test.cpp" \ - "${projectDir}/examples.cpp" \ - "${projectDir}/exit_code_test.cpp" \ - "${projectDir}/is_process_running.cpp" \ - "${projectDir}/kill_test.cpp" \ - "${projectDir}/main.cpp" \ - "${projectDir}/read_test.cpp" \ - "${projectDir}/terminate_test.cpp" \ - "${projectDir}/wait_test.cpp" \ - "${projectDir}/working_directory_test.cpp" \ - "${projectDir}/write_test.cpp" \ - "${projectDir}/working_directory_test.cpp" \ - "${buildRoot}/aprocess/aprocess.lib" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/awinapi/awinapi.lib" \ - "${buildRoot}/astl/astl.lib" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /ifcSearchDir \"${buildRoot}/aprocess\" ^ - /ifcSearchDir \"${buildRoot}/awinapi\" ^ - /ifcSearchDir \"${buildDir}\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/aprocess_test.exe\" ^ - \"${projectDir}/arguments_test.cpp\" ^ - \"${projectDir}/command_test.cpp\" ^ - \"${projectDir}/detached_test.cpp\" ^ - \"${projectDir}/environment_test.cpp\" ^ - \"${projectDir}/examples.cpp\" ^ - \"${projectDir}/exit_code_test.cpp\" ^ - \"${projectDir}/is_process_running.cpp\" ^ - \"${projectDir}/kill_test.cpp\" ^ - \"${projectDir}/main.cpp\" ^ - \"${projectDir}/read_test.cpp\" ^ - \"${projectDir}/terminate_test.cpp\" ^ - \"${projectDir}/wait_test.cpp\" ^ - \"${projectDir}/working_directory_test.cpp\" ^ - \"${projectDir}/write_test.cpp\" ^ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/astl/astl.lib\" ^ - \"${buildRoot}/awinapi/awinapi.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" ^ - \"${buildRoot}/aprocess/aprocess.lib\" || exit 1 -" - -sh/build/aprocess.sh "${toolchain}" -sh/build/atest.sh "${toolchain}" -sh/build/aprocesstestapp.sh "${toolchain}" -build diff --git a/sh/build/aprocesstestapp.sh b/sh/build/aprocesstestapp.sh index 199d620f..d8fe5f9f 100755 --- a/sh/build/aprocesstestapp.sh +++ b/sh/build/aprocesstestapp.sh @@ -1,45 +1,41 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="aprocesstestapp" -projectDir="projects/aprocess/test/aprocesstestapp" -buildDir="${buildRoot}/aprocess/test/aprocesstestapp" +set_build_properties "aprocesstestapp" "${1}" "${2}" function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/aprocess \ - -fprebuilt-module-path=${buildRoot}/acommandline \ - -fprebuilt-module-path=${buildRoot}/awinapi \ - -o "${binDir}/aprocesstestapp${executableExtension}" \ - "${projectDir}/main.cpp" \ - "${buildRoot}/aprocess/aprocess.obj" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/awinapi/awinapi.obj" \ + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/aprocess" \ + -fprebuilt-module-path="${buildRoot}/acommandline" \ + -fprebuilt-module-path="${buildRoot}/awinapi" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/main.cpp" \ + "${buildRoot}/aprocess/aprocess.obj" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/awinapi/awinapi.obj" \ "${buildRoot}/astl/astl.obj" } function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/aprocesstestapp" \ - "${projectDir}/main.cpp" \ - "${buildRoot}/aprocess/aprocess.lib" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/astl/astl.obj" + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/main.cpp" \ + "${buildRoot}/aprocess/aprocess.lib" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/astl/astl.obj" } buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/acommandline\" ^ - /ifcSearchDir \"${buildRoot}/aprocess\" ^ - /ifcSearchDir \"${buildRoot}/awinapi\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/aprocesstestapp.exe\" ^ - \"${projectDir}/main.cpp\" \ - \"${buildRoot}/astl/astl.lib\" ^ +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/acommandline\" ^ + /ifcSearchDir \"${buildRoot}/aprocess\" ^ + /ifcSearchDir \"${buildRoot}/awinapi\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/main.cpp\" ^ + \"${buildRoot}/astl/astl.lib\" ^ \"${buildRoot}/acommandline/acommandline.lib\" ^ - \"${buildRoot}/aprocess/aprocess.lib\" ^ + \"${buildRoot}/aprocess/aprocess.lib\" ^ \"${buildRoot}/awinapi/awinapi.lib\" || exit 1 " -sh/build/acommandline.sh "${toolchain}" -sh/build/aprocess.sh "${toolchain}" -build +build "acommandline aprocess" diff --git a/sh/build/astl.sh b/sh/build/astl.sh index b683b81c..ee53b447 100755 --- a/sh/build/astl.sh +++ b/sh/build/astl.sh @@ -1,23 +1,28 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="astl" -projectDir="projects/${project}" -buildDir="${buildRoot}/${project}" +set_build_properties "astl" "${1}" "${2}" function build_clang() { - $clang $clangCompilerFlags -Xclang -emit-module-interface -o "${buildDir}/astl.pcm" -c "${projectDir}/astl.cpp" - $clang $clangCompilerFlags -o "${buildDir}/astl.obj" -c "${projectDir}/astl.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang \ + -emit-module-interface \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" + + ${clang} ${clangCompilerFlags} \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -x c++-header "${projectDir}/astl.hpp" - $gcc $gccCompilerFlags -o "${buildDir}/astl.obj" -c "${projectDir}/astl.cpp" + ${gcc} ${gccCompilerFlags} -x c++-header "${projectDir}/${project}.hpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" } buildMSVC=" -cl.exe ${msvcCompilerFlags} /exportHeader /ifcOutput \"${buildDir}/astl.hpp.ifc\" /Fo\"${buildDir}/astl.hpp.obj\" /c /TP \"${projectDir}/astl.hpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /interface /ifcOutput \"${buildDir}/astl.ifc\" /Fo\"${buildDir}/astl.obj\" /c /TP \"${projectDir}/astl.cpp\" || exit 1 -lib.exe /NOLOGO /OUT:\"${buildDir}/astl.lib\" \"${buildDir}/astl.hpp.obj\" \"${buildDir}/astl.obj\" || exit 1 +cl.exe ${msvcCompilerFlags} /exportHeader /ifcOutput \"${buildDir}/${project}.hpp.ifc\" /Fo\"${buildDir}/${project}.hpp.obj\" /c /TP \"${projectDir}/${project}.hpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /interface /ifcOutput \"${buildDir}/${project}.ifc\" /Fo\"${buildDir}/${project}.obj\" /c /TP \"${projectDir}/${project}.cpp\" || exit 1 +lib.exe /NOLOGO /OUT:\"${buildDir}/${project}.lib\" \"${buildDir}/${project}.hpp.obj\" \"${buildDir}/${project}.obj\" || exit 1 " build diff --git a/sh/build/astl.test.sh b/sh/build/astl.test.sh new file mode 100644 index 00000000..6fb016b1 --- /dev/null +++ b/sh/build/astl.test.sh @@ -0,0 +1,38 @@ +source "sh/build_common.sh" + +set_build_properties "astl.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/main.cpp" \ + "${projectDir}/source_location_test.cpp" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/astl/astl.obj" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/main.cpp" \ + "${projectDir}/source_location_test.cpp" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/acommandline/acommandline.lib" \ + "${buildRoot}/astl/astl.obj" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/main.cpp\" ^ + \"${projectDir}/source_location_test.cpp\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" ^ + \"${buildRoot}/astl/astl.lib\" || exit 1 +" + +build "atest" diff --git a/sh/build/astl_test.sh b/sh/build/astl_test.sh deleted file mode 100755 index 91aa8338..00000000 --- a/sh/build/astl_test.sh +++ /dev/null @@ -1,42 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="astl_test" -projectDir="projects/astl/test" -buildDir="${buildRoot}/astl/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -o "${binDir}/astl_test${executableExtension}" \ - "${projectDir}/main.cpp" \ - "${projectDir}/source_location_test.cpp" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/astl/astl.obj" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/astl_test" \ - "${projectDir}/main.cpp" \ - "${projectDir}/source_location_test.cpp" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/acommandline/acommandline.lib" \ - "${buildRoot}/astl/astl.obj" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/astl_test.exe\" ^ - \"${projectDir}/main.cpp\" \ - \"${projectDir}/source_location_test.cpp\" \ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" ^ - \"${buildRoot}/astl/astl.lib\" || exit 1 -" - -sh/build/astl.sh "${toolchain}" -sh/build/atest.sh "${toolchain}" -build diff --git a/sh/build/atest.sh b/sh/build/atest.sh index 71b22620..4035325b 100755 --- a/sh/build/atest.sh +++ b/sh/build/atest.sh @@ -1,128 +1,125 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="atest" -projectDir="projects/${project}" -buildDir="${buildRoot}/${project}" +set_build_properties "atest" "${1}" "${2}" function build_clang() { - $clang $clangCompilerFlags \ - -Xclang \ - -emit-module-interface \ - -fprebuilt-module-path=${buildRoot}/acommandline \ - -o "${buildDir}/atest.pcm" \ - -c "${projectDir}/atest.cpp" - - $clang $clangCompilerFlags \ - -fprebuilt-module-path=${buildRoot}/acommandline \ - -o "${buildDir}/atest.obj" \ - -c "${projectDir}/atest.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang \ + -emit-module-interface \ + -fprebuilt-module-path="${buildRoot}/acommandline" \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" + + ${clang} ${clangCompilerFlags} \ + -fprebuilt-module-path="${buildRoot}/acommandline" \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -o "${buildDir}/stringify.obj" -c "${projectDir}/stringify.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/failed_assertion.obj" -c "${projectDir}/failed_assertion.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/failure.obj" -c "${projectDir}/failure.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/test.obj" -c "${projectDir}/test.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/test_suite.obj" -c "${projectDir}/test_suite.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/test_context.obj" -c "${projectDir}/test_context.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/matcher_base.obj" -c "${projectDir}/matcher_base.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/matcher.obj" -c "${projectDir}/matcher.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/matcher_contains.obj" -c "${projectDir}/matcher_contains.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/expect_base.obj" -c "${projectDir}/expect_base.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/expect_to_match.obj" -c "${projectDir}/expect_to_match.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/expect_to_throw.obj" -c "${projectDir}/expect_to_throw.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/expect.obj" -c "${projectDir}/expect.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/stats.obj" -c "${projectDir}/stats.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/results.obj" -c "${projectDir}/results.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/filters.obj" -c "${projectDir}/filters.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/test_filter.obj" -c "${projectDir}/test_filter.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/selected_tests.obj" -c "${projectDir}/selected_tests.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/reporter.obj" -c "${projectDir}/reporter.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/printer.obj" -c "${projectDir}/printer.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/test_runner.obj" -c "${projectDir}/test_runner.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/atest.obj" -c "${projectDir}/atest.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/stringify.obj" -c "${projectDir}/stringify.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/failed_assertion.obj" -c "${projectDir}/failed_assertion.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/failure.obj" -c "${projectDir}/failure.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/test.obj" -c "${projectDir}/test.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/test_suite.obj" -c "${projectDir}/test_suite.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/test_context.obj" -c "${projectDir}/test_context.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/matcher_base.obj" -c "${projectDir}/matcher_base.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/matcher.obj" -c "${projectDir}/matcher.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/matcher_contains.obj" -c "${projectDir}/matcher_contains.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/expect_base.obj" -c "${projectDir}/expect_base.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/expect_to_match.obj" -c "${projectDir}/expect_to_match.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/expect_to_throw.obj" -c "${projectDir}/expect_to_throw.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/expect.obj" -c "${projectDir}/expect.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/stats.obj" -c "${projectDir}/stats.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/results.obj" -c "${projectDir}/results.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/filters.obj" -c "${projectDir}/filters.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/test_filter.obj" -c "${projectDir}/test_filter.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/selected_tests.obj" -c "${projectDir}/selected_tests.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/reporter.obj" -c "${projectDir}/reporter.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/printer.obj" -c "${projectDir}/printer.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/test_runner.obj" -c "${projectDir}/test_runner.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" - ar r "${buildDir}/atest.lib" \ - "${buildDir}/atest.obj" \ - "${buildDir}/stringify.obj" \ + ar r "${buildDir}/${project}.lib" \ + "${buildDir}/${project}.obj" \ + "${buildDir}/stringify.obj" \ "${buildDir}/failed_assertion.obj" \ - "${buildDir}/failure.obj" \ - "${buildDir}/test.obj" \ - "${buildDir}/test_suite.obj" \ - "${buildDir}/test_context.obj" \ - "${buildDir}/matcher_base.obj" \ - "${buildDir}/matcher.obj" \ + "${buildDir}/failure.obj" \ + "${buildDir}/test.obj" \ + "${buildDir}/test_suite.obj" \ + "${buildDir}/test_context.obj" \ + "${buildDir}/matcher_base.obj" \ + "${buildDir}/matcher.obj" \ "${buildDir}/matcher_contains.obj" \ - "${buildDir}/expect_base.obj" \ - "${buildDir}/expect_to_match.obj" \ - "${buildDir}/expect_to_throw.obj" \ - "${buildDir}/expect.obj" \ - "${buildDir}/stats.obj" \ - "${buildDir}/results.obj" \ - "${buildDir}/selected_tests.obj" \ - "${buildDir}/reporter.obj" \ - "${buildDir}/printer.obj" \ - "${buildDir}/filters.obj" \ - "${buildDir}/test_filter.obj" \ + "${buildDir}/expect_base.obj" \ + "${buildDir}/expect_to_match.obj" \ + "${buildDir}/expect_to_throw.obj" \ + "${buildDir}/expect.obj" \ + "${buildDir}/stats.obj" \ + "${buildDir}/results.obj" \ + "${buildDir}/selected_tests.obj" \ + "${buildDir}/reporter.obj" \ + "${buildDir}/printer.obj" \ + "${buildDir}/filters.obj" \ + "${buildDir}/test_filter.obj" \ "${buildDir}/test_runner.obj" } buildMSVC=" -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-stringify.ifc\" /Fo\"${buildDir}/atest-stringify.obj\" /c /TP \"${projectDir}/stringify.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-failed_assertion.ifc\" /Fo\"${buildDir}/atest-failed_assertion.obj\" /c /TP \"${projectDir}/failed_assertion.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-failure.ifc\" /Fo\"${buildDir}/atest-failure.obj\" /c /TP \"${projectDir}/failure.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-test.ifc\" /Fo\"${buildDir}/atest-test.obj\" /c /TP \"${projectDir}/test.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-test_suite.ifc\" /Fo\"${buildDir}/atest-test_suite.obj\" /c /TP \"${projectDir}/test_suite.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-test_context.ifc\" /Fo\"${buildDir}/atest-test_context.obj\" /c /TP \"${projectDir}/test_context.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-matcher_base.ifc\" /Fo\"${buildDir}/atest-matcher_base.obj\" /c /TP \"${projectDir}/matcher_base.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-matcher.ifc\" /Fo\"${buildDir}/atest-matcher.obj\" /c /TP \"${projectDir}/matcher.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-matcher_contains.ifc\" /Fo\"${buildDir}/atest-matcher_contains.obj\" /c /TP \"${projectDir}/matcher_contains.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-expect_base.ifc\" /Fo\"${buildDir}/atest-expect_base.obj\" /c /TP \"${projectDir}/expect_base.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-expect_to_match.ifc\" /Fo\"${buildDir}/atest-expect_to_match.obj\" /c /TP \"${projectDir}/expect_to_match.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-expect_to_throw.ifc\" /Fo\"${buildDir}/atest-expect_to_throw.obj\" /c /TP \"${projectDir}/expect_to_throw.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-expect.ifc\" /Fo\"${buildDir}/atest-expect.obj\" /c /TP \"${projectDir}/expect.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-stats.ifc\" /Fo\"${buildDir}/atest-stats.obj\" /c /TP \"${projectDir}/stats.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-filters.ifc\" /Fo\"${buildDir}/atest-filters.obj\" /c /TP \"${projectDir}/filters.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-test_filter.ifc\" /Fo\"${buildDir}/atest-test_filter.obj\" /c /TP \"${projectDir}/test_filter.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-results.ifc\" /Fo\"${buildDir}/atest-results.obj\" /c /TP \"${projectDir}/results.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-selected_tests.ifc\" /Fo\"${buildDir}/atest-selected_tests.obj\" /c /TP \"${projectDir}/selected_tests.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-reporter.ifc\" /Fo\"${buildDir}/atest-reporter.obj\" /c /TP \"${projectDir}/reporter.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-printer.ifc\" /Fo\"${buildDir}/atest-printer.obj\" /c /TP \"${projectDir}/printer.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/atest-test_runner.ifc\" /Fo\"${buildDir}/atest-test_runner.obj\" /c /TP \"${projectDir}/test_runner.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-stringify.ifc\" /Fo\"${buildDir}/${project}-stringify.obj\" /c /TP \"${projectDir}/stringify.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-failed_assertion.ifc\" /Fo\"${buildDir}/${project}-failed_assertion.obj\" /c /TP \"${projectDir}/failed_assertion.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-failure.ifc\" /Fo\"${buildDir}/${project}-failure.obj\" /c /TP \"${projectDir}/failure.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-test.ifc\" /Fo\"${buildDir}/${project}-test.obj\" /c /TP \"${projectDir}/test.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-test_suite.ifc\" /Fo\"${buildDir}/${project}-test_suite.obj\" /c /TP \"${projectDir}/test_suite.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-test_context.ifc\" /Fo\"${buildDir}/${project}-test_context.obj\" /c /TP \"${projectDir}/test_context.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-matcher_base.ifc\" /Fo\"${buildDir}/${project}-matcher_base.obj\" /c /TP \"${projectDir}/matcher_base.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-matcher.ifc\" /Fo\"${buildDir}/${project}-matcher.obj\" /c /TP \"${projectDir}/matcher.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-matcher_contains.ifc\" /Fo\"${buildDir}/${project}-matcher_contains.obj\" /c /TP \"${projectDir}/matcher_contains.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-expect_base.ifc\" /Fo\"${buildDir}/${project}-expect_base.obj\" /c /TP \"${projectDir}/expect_base.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-expect_to_match.ifc\" /Fo\"${buildDir}/${project}-expect_to_match.obj\" /c /TP \"${projectDir}/expect_to_match.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-expect_to_throw.ifc\" /Fo\"${buildDir}/${project}-expect_to_throw.obj\" /c /TP \"${projectDir}/expect_to_throw.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-expect.ifc\" /Fo\"${buildDir}/${project}-expect.obj\" /c /TP \"${projectDir}/expect.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-stats.ifc\" /Fo\"${buildDir}/${project}-stats.obj\" /c /TP \"${projectDir}/stats.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-filters.ifc\" /Fo\"${buildDir}/${project}-filters.obj\" /c /TP \"${projectDir}/filters.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-test_filter.ifc\" /Fo\"${buildDir}/${project}-test_filter.obj\" /c /TP \"${projectDir}/test_filter.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-results.ifc\" /Fo\"${buildDir}/${project}-results.obj\" /c /TP \"${projectDir}/results.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-selected_tests.ifc\" /Fo\"${buildDir}/${project}-selected_tests.obj\" /c /TP \"${projectDir}/selected_tests.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-reporter.ifc\" /Fo\"${buildDir}/${project}-reporter.obj\" /c /TP \"${projectDir}/reporter.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-printer.ifc\" /Fo\"${buildDir}/${project}-printer.obj\" /c /TP \"${projectDir}/printer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/acommandline\" /ifcOutput\"${buildDir}/${project}-test_runner.ifc\" /Fo\"${buildDir}/${project}-test_runner.obj\" /c /TP \"${projectDir}/test_runner.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ /ifcSearchDir \"${buildRoot}/acommandline\" ^ - /ifcOutput\"${buildDir}/atest.ifc\" ^ - /Fo\"${buildDir}/atest.obj\" ^ - /c \"${projectDir}/atest.cpp\" || exit 1 + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 -lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/atest.lib\" ^ - \"${buildDir}/atest.obj\" ^ - \"${buildDir}/atest-stringify.obj\" ^ - \"${buildDir}/atest-failed_assertion.obj\" ^ - \"${buildDir}/atest-failure.obj\" ^ - \"${buildDir}/atest-test.obj\" ^ - \"${buildDir}/atest-test_suite.obj\" ^ - \"${buildDir}/atest-test_context.obj\" ^ - \"${buildDir}/atest-matcher_base.obj\" ^ - \"${buildDir}/atest-matcher.obj\" ^ - \"${buildDir}/atest-matcher_contains.obj\" ^ - \"${buildDir}/atest-expect_base.obj\" ^ - \"${buildDir}/atest-expect_to_match.obj\" ^ - \"${buildDir}/atest-expect_to_throw.obj\" ^ - \"${buildDir}/atest-expect.obj\" ^ - \"${buildDir}/atest-stats.obj\" ^ - \"${buildDir}/atest-results.obj\" ^ - \"${buildDir}/atest-selected_tests.obj\" ^ - \"${buildDir}/atest-reporter.obj\" ^ - \"${buildDir}/atest-printer.obj\" ^ - \"${buildDir}/atest-filters.obj\" ^ - \"${buildDir}/atest-test_filter.obj\" ^ - \"${buildDir}/atest-test_runner.obj\" || exit 1 +lib.exe /NOLOGO ^ + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.obj\" ^ + \"${buildDir}/${project}-stringify.obj\" ^ + \"${buildDir}/${project}-failed_assertion.obj\" ^ + \"${buildDir}/${project}-failure.obj\" ^ + \"${buildDir}/${project}-test.obj\" ^ + \"${buildDir}/${project}-test_suite.obj\" ^ + \"${buildDir}/${project}-test_context.obj\" ^ + \"${buildDir}/${project}-matcher_base.obj\" ^ + \"${buildDir}/${project}-matcher.obj\" ^ + \"${buildDir}/${project}-matcher_contains.obj\" ^ + \"${buildDir}/${project}-expect_base.obj\" ^ + \"${buildDir}/${project}-expect_to_match.obj\" ^ + \"${buildDir}/${project}-expect_to_throw.obj\" ^ + \"${buildDir}/${project}-expect.obj\" ^ + \"${buildDir}/${project}-stats.obj\" ^ + \"${buildDir}/${project}-results.obj\" ^ + \"${buildDir}/${project}-selected_tests.obj\" ^ + \"${buildDir}/${project}-reporter.obj\" ^ + \"${buildDir}/${project}-printer.obj\" ^ + \"${buildDir}/${project}-filters.obj\" ^ + \"${buildDir}/${project}-test_filter.obj\" ^ + \"${buildDir}/${project}-test_runner.obj\" || exit 1 " -sh/build/acommandline.sh "${toolchain}" -build +build "acommandline" diff --git a/sh/build/atest.test.sh b/sh/build/atest.test.sh new file mode 100644 index 00000000..5220c69f --- /dev/null +++ b/sh/build/atest.test.sh @@ -0,0 +1,74 @@ +source "sh/build_common.sh" + +set_build_properties "atest.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/assert_test.cpp" \ + "${projectDir}/throwing_test_test.cpp" \ + "${projectDir}/throwing_suites_test.cpp" \ + "${projectDir}/expect_to_be_test.cpp" \ + "${projectDir}/expect_to_be_string_test.cpp" \ + "${projectDir}/expect_to_contain_test.cpp" \ + "${projectDir}/expect_to_match_test.cpp" \ + "${projectDir}/expect_to_throw_test.cpp" \ + "${projectDir}/test_runner_test.cpp" \ + "${projectDir}/test_filter_test_test.cpp" \ + "${projectDir}/test_filter_suite_test.cpp" \ + "${projectDir}/test_filter_filter_test_test.cpp" \ + "${projectDir}/test_filter_filter_suite_test.cpp" \ + "${projectDir}/main.cpp" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/astl/astl.obj" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/assert_test.cpp" \ + "${projectDir}/throwing_test_test.cpp" \ + "${projectDir}/throwing_suites_test.cpp" \ + "${projectDir}/expect_to_be_test.cpp" \ + "${projectDir}/expect_to_be_string_test.cpp" \ + "${projectDir}/expect_to_contain_test.cpp" \ + "${projectDir}/expect_to_match_test.cpp" \ + "${projectDir}/expect_to_throw_test.cpp" \ + "${projectDir}/test_runner_test.cpp" \ + "${projectDir}/test_filter_test_test.cpp" \ + "${projectDir}/test_filter_suite_test.cpp" \ + "${projectDir}/test_filter_filter_test_test.cpp" \ + "${projectDir}/test_filter_filter_suite_test.cpp" \ + "${projectDir}/main.cpp" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/acommandline/acommandline.lib" \ + "${buildRoot}/astl/astl.obj" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/assert_test.cpp\" ^ + \"${projectDir}/throwing_test_test.cpp\" ^ + \"${projectDir}/throwing_suites_test.cpp\" ^ + \"${projectDir}/expect_to_be_test.cpp\" ^ + \"${projectDir}/expect_to_be_string_test.cpp\" ^ + \"${projectDir}/expect_to_contain_test.cpp\" ^ + \"${projectDir}/expect_to_match_test.cpp\" ^ + \"${projectDir}/expect_to_throw_test.cpp\" ^ + \"${projectDir}/test_runner_test.cpp\" ^ + \"${projectDir}/test_filter_test_test.cpp\" ^ + \"${projectDir}/test_filter_suite_test.cpp\" ^ + \"${projectDir}/test_filter_filter_test_test.cpp\" ^ + \"${projectDir}/test_filter_filter_suite_test.cpp\" ^ + \"${projectDir}/main.cpp\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" ^ + \"${buildRoot}/astl/astl.lib\" || exit 1 +" + +build "atest" diff --git a/sh/build/atest_test.sh b/sh/build/atest_test.sh deleted file mode 100755 index a7d0a6b3..00000000 --- a/sh/build/atest_test.sh +++ /dev/null @@ -1,77 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="atest_test" -projectDir="projects/atest/test" -buildDir="${buildRoot}/atest/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -o "${binDir}/atest_test${executableExtension}" \ - "${projectDir}/assert_test.cpp" \ - "${projectDir}/throwing_test_test.cpp" \ - "${projectDir}/throwing_suites_test.cpp" \ - "${projectDir}/expect_to_be_test.cpp" \ - "${projectDir}/expect_to_be_string_test.cpp" \ - "${projectDir}/expect_to_contain_test.cpp" \ - "${projectDir}/expect_to_match_test.cpp" \ - "${projectDir}/expect_to_throw_test.cpp" \ - "${projectDir}/test_runner_test.cpp" \ - "${projectDir}/test_filter_test_test.cpp" \ - "${projectDir}/test_filter_suite_test.cpp" \ - "${projectDir}/test_filter_filter_test_test.cpp" \ - "${projectDir}/test_filter_filter_suite_test.cpp" \ - "${projectDir}/main.cpp" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/astl/astl.obj" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/atest_test" \ - "${projectDir}/assert_test.cpp" \ - "${projectDir}/throwing_test_test.cpp" \ - "${projectDir}/throwing_suites_test.cpp" \ - "${projectDir}/expect_to_be_test.cpp" \ - "${projectDir}/expect_to_be_string_test.cpp" \ - "${projectDir}/expect_to_contain_test.cpp" \ - "${projectDir}/expect_to_match_test.cpp" \ - "${projectDir}/expect_to_throw_test.cpp" \ - "${projectDir}/test_runner_test.cpp" \ - "${projectDir}/test_filter_test_test.cpp" \ - "${projectDir}/test_filter_suite_test.cpp" \ - "${projectDir}/test_filter_filter_test_test.cpp" \ - "${projectDir}/test_filter_filter_suite_test.cpp" \ - "${projectDir}/main.cpp" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/acommandline/acommandline.lib" \ - "${buildRoot}/astl/astl.obj" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/atest_test.exe\" ^ - \"${projectDir}/assert_test.cpp\" ^ - \"${projectDir}/throwing_test_test.cpp\" ^ - \"${projectDir}/throwing_suites_test.cpp\" ^ - \"${projectDir}/expect_to_be_test.cpp\" ^ - \"${projectDir}/expect_to_be_string_test.cpp\" ^ - \"${projectDir}/expect_to_contain_test.cpp\" ^ - \"${projectDir}/expect_to_match_test.cpp\" ^ - \"${projectDir}/expect_to_throw_test.cpp\" ^ - \"${projectDir}/test_runner_test.cpp\" ^ - \"${projectDir}/test_filter_test_test.cpp\" ^ - \"${projectDir}/test_filter_suite_test.cpp\" ^ - \"${projectDir}/test_filter_filter_test_test.cpp\" ^ - \"${projectDir}/test_filter_filter_suite_test.cpp\" ^ - \"${projectDir}/main.cpp\" ^ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" ^ - \"${buildRoot}/astl/astl.lib\" || exit 1 -" - -sh/build/atest.sh "${toolchain}" -build diff --git a/sh/build/athreadpool.sh b/sh/build/athreadpool.sh index 118d0a80..82798b8a 100755 --- a/sh/build/athreadpool.sh +++ b/sh/build/athreadpool.sh @@ -1,64 +1,59 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="athreadpool" -projectDir="projects/${project}" -buildDir="${buildRoot}/${project}" +set_build_properties "athreadpool" "${1}" "${2}" function build_clang() { - $clang $clangCompilerFlags \ - -Xclang \ - -emit-module-interface \ - -fprebuilt-module-path=${buildRoot}/athreadpool \ - -o "${buildDir}/athreadpool.pcm" \ - -c "${projectDir}/athreadpool.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang \ + -emit-module-interface \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" - $clang $clangCompilerFlags \ - -fprebuilt-module-path=${buildRoot}/athreadpool \ - -o "${buildDir}/athreadpool.obj" \ - -c "${projectDir}/athreadpool.cpp" + ${clang} ${clangCompilerFlags} \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -o "${buildDir}/job.obj" -c "${projectDir}/job.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/jobs.obj" -c "${projectDir}/jobs.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/queue.obj" -c "${projectDir}/queue.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/monitor.obj" -c "${projectDir}/monitor.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/threadpool.obj" -c "${projectDir}/threadpool.cpp" - - $gcc $gccCompilerFlags -o "${buildDir}/athreadpool.obj" -c "${projectDir}/athreadpool.cpp" - - ar r "${buildDir}/atest.lib" \ - "${buildDir}/athreadpool.obj" \ - "${buildDir}/job.obj" \ - "${buildDir}/jobs.obj" \ - "${buildDir}/queue.obj" \ - "${buildDir}/monitor.obj" \ + ${gcc} ${gccCompilerFlags} -o "${buildDir}/job.obj" -c "${projectDir}/job.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/jobs.obj" -c "${projectDir}/jobs.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/queue.obj" -c "${projectDir}/queue.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/monitor.obj" -c "${projectDir}/monitor.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/threadpool.obj" -c "${projectDir}/threadpool.cpp" + + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" + + ar r "${buildDir}/${project}.lib" \ + "${buildDir}/${project}.obj" \ + "${buildDir}/job.obj" \ + "${buildDir}/jobs.obj" \ + "${buildDir}/queue.obj" \ + "${buildDir}/monitor.obj" \ "${buildDir}/threadpool.obj" } buildMSVC=" -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/athreadpool-job.ifc\" /Fo\"${buildDir}/athreadpool-job.obj\" /c /TP \"${projectDir}/job.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/athreadpool-jobs.ifc\" /Fo\"${buildDir}/athreadpool-jobs.obj\" /c /TP \"${projectDir}/jobs.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/athreadpool-queue.ifc\" /Fo\"${buildDir}/athreadpool-queue.obj\" /c /TP \"${projectDir}/queue.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/athreadpool-monitor.ifc\" /Fo\"${buildDir}/athreadpool-monitor.obj\" /c /TP \"${projectDir}/monitor.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/athreadpool-threadpool.ifc\" /Fo\"${buildDir}/athreadpool-threadpool.obj\" /c /TP \"${projectDir}/threadpool.cpp\" || exit 1 - -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ - /ifcOutput\"${buildDir}/athreadpool.ifc\" ^ - /Fo\"${buildDir}/athreadpool.obj\" ^ - /c \"${projectDir}/athreadpool.cpp\" || exit 1 - -lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/athreadpool.lib\" ^ - \"${buildDir}/athreadpool.obj\" ^ - \"${buildDir}/athreadpool-job.obj\" ^ - \"${buildDir}/athreadpool-jobs.obj\" ^ - \"${buildDir}/athreadpool-queue.obj\" ^ - \"${buildDir}/athreadpool-monitor.obj\" ^ - \"${buildDir}/athreadpool-threadpool.obj\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-job.ifc\" /Fo\"${buildDir}/${project}-job.obj\" /c /TP \"${projectDir}/job.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-jobs.ifc\" /Fo\"${buildDir}/${project}-jobs.obj\" /c /TP \"${projectDir}/jobs.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-queue.ifc\" /Fo\"${buildDir}/${project}-queue.obj\" /c /TP \"${projectDir}/queue.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-monitor.ifc\" /Fo\"${buildDir}/${project}-monitor.obj\" /c /TP \"${projectDir}/monitor.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-threadpool.ifc\" /Fo\"${buildDir}/${project}-threadpool.obj\" /c /TP \"${projectDir}/threadpool.cpp\" || exit 1 + +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 + +lib.exe /NOLOGO ^ + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.obj\" ^ + \"${buildDir}/${project}-job.obj\" ^ + \"${buildDir}/${project}-jobs.obj\" ^ + \"${buildDir}/${project}-queue.obj\" ^ + \"${buildDir}/${project}-monitor.obj\" ^ + \"${buildDir}/${project}-threadpool.obj\" || exit 1 " -sh/build/astl.sh "${toolchain}" -build +build "astl" diff --git a/sh/build/athreadpool.test.sh b/sh/build/athreadpool.test.sh new file mode 100644 index 00000000..28d5d9bb --- /dev/null +++ b/sh/build/athreadpool.test.sh @@ -0,0 +1,45 @@ +source "sh/build_common.sh" + +set_build_properties "athreadpool.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path="${buildRoot}/acommandline" \ + -fprebuilt-module-path="${buildRoot}/athreadpool" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/main.cpp" \ + "${projectDir}/threadpool_test.cpp" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/athreadpool/athreadpool.obj" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/astl/astl.obj" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/main.cpp" \ + "${projectDir}/threadpool_test.cpp" \ + "${buildRoot}/acommandline/acommandline.lib" \ + "${buildRoot}/athreadpool/athreadpool.lib" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/astl/astl.lib" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /ifcSearchDir \"${buildRoot}/acommandline\" ^ + /ifcSearchDir \"${buildRoot}/athreadpool\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/main.cpp\" ^ + \"${projectDir}/threadpool_test.cpp\" ^ + \"${buildRoot}/athreadpool/athreadpool.lib\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/astl/astl.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" || exit 1 +" + +build "athreadpool atest" diff --git a/sh/build/athreadpool_test.sh b/sh/build/athreadpool_test.sh deleted file mode 100755 index 67fc6853..00000000 --- a/sh/build/athreadpool_test.sh +++ /dev/null @@ -1,49 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="athreadpool_test" -projectDir="projects/athreadpool/test" -buildDir="${buildRoot}/athreadpool/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -fprebuilt-module-path=${buildRoot}/acommandline \ - -fprebuilt-module-path=${buildRoot}/athreadpool \ - -o "${binDir}/athreadpool_test${executableExtension}" \ - "${projectDir}/main.cpp" \ - "${projectDir}/threadpool_test.cpp" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/athreadpool/athreadpool.obj" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/astl/astl.obj" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/athreadpool_test" \ - "${projectDir}/main.cpp" \ - "${projectDir}/threadpool_test.cpp" \ - "${buildRoot}/acommandline/acommandline.lib" \ - "${buildRoot}/athreadpool/athreadpool.lib" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/astl/astl.lib" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /ifcSearchDir \"${buildRoot}/acommandline\" ^ - /ifcSearchDir \"${buildRoot}/athreadpool\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/athreadpool_test.exe\" ^ - \"${projectDir}/main.cpp\" ^ - \"${projectDir}/threadpool_test.cpp\" ^ - \"${buildRoot}/athreadpool/athreadpool.lib\" ^ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/astl/astl.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" || exit 1 -" - -sh/build/athreadpool.sh "${toolchain}" -sh/build/atest.sh "${toolchain}" -build diff --git a/sh/build/awinapi.sh b/sh/build/awinapi.sh index fad689a1..ae239d5f 100755 --- a/sh/build/awinapi.sh +++ b/sh/build/awinapi.sh @@ -1,46 +1,51 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="awinapi" -projectDir="projects/${project}" -buildDir="${buildRoot}/${project}" +set_build_properties "awinapi" "${1}" "${2}" function build_clang() { - $clang $clangCompilerFlags -Xclang -emit-module-interface -o "${buildDir}/awinapi.pcm" -c "${projectDir}/awinapi.cpp" - $clang $clangCompilerFlags -o "${buildDir}/awinapi.obj" -c "${projectDir}/awinapi.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang -emit-module-interface \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" + + ${clang} ${clangCompilerFlags} \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" } function build_gcc() { - $gcc $gccCompilerFlags -x c++-header "${projectDir}/windows.hpp" - $gcc $gccCompilerFlags -o "${buildDir}/buffer.obj" -c "${projectDir}/buffer.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/last_error_message.obj" -c "${projectDir}/last_error_message.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/handle.obj" -c "${projectDir}/handle.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/pipe.obj" -c "${projectDir}/pipe.cpp" - $gcc $gccCompilerFlags -o "${buildDir}/awinapi.obj" -c "${projectDir}/awinapi.cpp" - - ar r "${buildDir}/awinapi.lib" \ - "${buildDir}/buffer.obj" \ + ${gcc} ${gccCompilerFlags} -x c++-header "${projectDir}/windows.hpp" + + ${gcc} ${gccCompilerFlags} -o "${buildDir}/buffer.obj" -c "${projectDir}/buffer.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/last_error_message.obj" -c "${projectDir}/last_error_message.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/handle.obj" -c "${projectDir}/handle.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/pipe.obj" -c "${projectDir}/pipe.cpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" + + ar r "${buildDir}/${project}.lib" \ + "${buildDir}/buffer.obj" \ "${buildDir}/last_error_message.obj" \ - "${buildDir}/handle.obj" \ - "${buildDir}/pipe.obj" \ - "${buildDir}/awinapi.obj" + "${buildDir}/handle.obj" \ + "${buildDir}/pipe.obj" \ + "${buildDir}/${project}.obj" } buildMSVC=" cl.exe ${msvcCompilerFlags} /exportHeader /ifcOutput \"${buildDir}/windows.hpp.ifc\" /Fo\"${buildDir}/windows.hpp.obj\" /c /TP \"${projectDir}/windows.hpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/awinapi-buffer.ifc\" /Fo\"${buildDir}/awinapi-buffer.obj\" /c /TP \"${projectDir}/buffer.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/awinapi-last_error_message.ifc\" /Fo\"${buildDir}/awinapi-last_error_message.obj\" /c /TP \"${projectDir}/last_error_message.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/awinapi-handle.ifc\" /Fo\"${buildDir}/awinapi-handle.obj\" /c /TP \"${projectDir}/handle.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/awinapi-pipe.ifc\" /Fo\"${buildDir}/awinapi-pipe.obj\" /c /TP \"${projectDir}/pipe.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /interface /ifcSearchDir \"${buildDir}\" /ifcOutput \"${buildDir}/awinapi.ifc\" /Fo\"${buildDir}/awinapi.obj\" /c /TP \"${projectDir}/awinapi.cpp\" || exit 1 - -lib.exe /NOLOGO /OUT:\"${buildDir}/awinapi.lib\" ^ - \"${buildDir}/windows.hpp.obj\" ^ - \"${buildDir}/awinapi-buffer.obj\" ^ - \"${buildDir}/awinapi-last_error_message.obj\" ^ - \"${buildDir}/awinapi-handle.obj\" ^ - \"${buildDir}/awinapi-pipe.obj\" ^ - \"${buildDir}/awinapi.obj\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-buffer.ifc\" /Fo\"${buildDir}/${project}-buffer.obj\" /c /TP \"${projectDir}/buffer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-last_error_message.ifc\" /Fo\"${buildDir}/${project}-last_error_message.obj\" /c /TP \"${projectDir}/last_error_message.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-handle.ifc\" /Fo\"${buildDir}/${project}-handle.obj\" /c /TP \"${projectDir}/handle.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcOutput\"${buildDir}/${project}-pipe.ifc\" /Fo\"${buildDir}/${project}-pipe.obj\" /c /TP \"${projectDir}/pipe.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /interface /ifcSearchDir \"${buildDir}\" /ifcOutput \"${buildDir}/${project}.ifc\" /Fo\"${buildDir}/${project}.obj\" /c /TP \"${projectDir}/${project}.cpp\" || exit 1 + +lib.exe /NOLOGO ^ + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/windows.hpp.obj\" ^ + \"${buildDir}/${project}-buffer.obj\" ^ + \"${buildDir}/${project}-last_error_message.obj\" ^ + \"${buildDir}/${project}-handle.obj\" ^ + \"${buildDir}/${project}-pipe.obj\" ^ + \"${buildDir}/${project}.obj\" || exit 1 " -sh/build/astl.sh "${toolchain}" -build +build "astl" diff --git a/sh/build/awinapi.test.sh b/sh/build/awinapi.test.sh new file mode 100644 index 00000000..8fac7468 --- /dev/null +++ b/sh/build/awinapi.test.sh @@ -0,0 +1,52 @@ +source "sh/build_common.sh" + +set_build_properties "awinapi.test" "${1}" "${2}" + +function build_clang() { + ${clang} ${clangCompilerLinkerFlags} \ + -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path="${buildRoot}/awinapi" \ + -o "${binDir}/${project}${executableExtension}" \ + "${projectDir}/main.cpp" \ + "${projectDir}/buffer_test.cpp" \ + "${projectDir}/handle_test.cpp" \ + "${projectDir}/last_error_message_test.cpp" \ + "${projectDir}/pipe_test.cpp" \ + "${buildRoot}/awinapi/awinapi.obj" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/atest/atest.obj" \ + "${buildRoot}/astl/astl.obj" +} + +function build_gcc() { + ${gcc} ${gccCompilerFlags} \ + -o "${binDir}/${project}" \ + "${projectDir}/main.cpp" \ + "${projectDir}/buffer_test.cpp" \ + "${projectDir}/handle_test.cpp" \ + "${projectDir}/last_error_message_test.cpp" \ + "${projectDir}/pipe_test.cpp" \ + "${buildRoot}/awinapi/awinapi.lib" \ + "${buildRoot}/acommandline/acommandline.obj" \ + "${buildRoot}/atest/atest.lib" \ + "${buildRoot}/astl/astl.obj" +} + +buildMSVC=" +cl.exe ${msvcCompilerFlags} ^ + /ifcSearchDir \"${buildRoot}/atest\" ^ + /ifcSearchDir \"${buildRoot}/awinapi\" ^ + /Fo\"$buildDir/\" ^ + /Fe\"${binDir}/${project}.exe\" ^ + \"${projectDir}/main.cpp\" ^ + \"${projectDir}/buffer_test.cpp\" ^ + \"${projectDir}/handle_test.cpp\" ^ + \"${projectDir}/last_error_message_test.cpp\" ^ + \"${projectDir}/pipe_test.cpp\" ^ + \"${buildRoot}/atest/atest.lib\" ^ + \"${buildRoot}/astl/astl.lib\" ^ + \"${buildRoot}/acommandline/acommandline.lib\" ^ + \"${buildRoot}/awinapi/awinapi.lib\" || exit 1 +" + +build "awinapi atest" diff --git a/sh/build/awinapi_test.sh b/sh/build/awinapi_test.sh deleted file mode 100755 index 134ce6a3..00000000 --- a/sh/build/awinapi_test.sh +++ /dev/null @@ -1,56 +0,0 @@ -source "sh/build_common.sh" "${1}" - -project="awinapi_test" -projectDir="projects/awinapi/test" -buildDir="${buildRoot}/awinapi/test" - -function build_clang() { - $clang $clangCompilerLinkerFlags \ - -fprebuilt-module-path=${buildRoot}/atest \ - -fprebuilt-module-path=${buildRoot}/awinapi \ - -o "${binDir}/awinapi_test${executableExtension}" \ - "${projectDir}/main.cpp" \ - "${projectDir}/buffer_test.cpp" \ - "${projectDir}/handle_test.cpp" \ - "${projectDir}/last_error_message_test.cpp" \ - "${projectDir}/pipe_test.cpp" \ - "${buildRoot}/awinapi/awinapi.obj" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/atest/atest.obj" \ - "${buildRoot}/astl/astl.obj" -} - -function build_gcc() { - $gcc $gccCompilerFlags \ - -o "${binDir}/awinapi_test" \ - "${projectDir}/main.cpp" \ - "${projectDir}/buffer_test.cpp" \ - "${projectDir}/handle_test.cpp" \ - "${projectDir}/last_error_message_test.cpp" \ - "${projectDir}/pipe_test.cpp" \ - "${buildRoot}/awinapi/awinapi.lib" \ - "${buildRoot}/acommandline/acommandline.obj" \ - "${buildRoot}/atest/atest.lib" \ - "${buildRoot}/astl/astl.obj" -} - -buildMSVC=" -cl.exe ${msvcCompilerFlags} ^ - /ifcSearchDir \"${buildRoot}/atest\" ^ - /ifcSearchDir \"${buildRoot}/awinapi\" ^ - /Fo\"$buildDir/\" ^ - /Fe\"${binDir}/awinapi_test.exe\" ^ - \"${projectDir}/main.cpp\" \ - \"${projectDir}/buffer_test.cpp\" \ - \"${projectDir}/handle_test.cpp\" \ - \"${projectDir}/last_error_message_test.cpp\" \ - \"${projectDir}/pipe_test.cpp\" \ - \"${buildRoot}/atest/atest.lib\" ^ - \"${buildRoot}/astl/astl.lib\" ^ - \"${buildRoot}/acommandline/acommandline.lib\" ^ - \"${buildRoot}/awinapi/awinapi.lib\" || exit 1 -" - -sh/build/awinapi.sh "${toolchain}" -sh/build/atest.sh "${toolchain}" -build diff --git a/sh/build/yamlcpp.sh b/sh/build/yamlcpp.sh index bc34dee4..8fe27854 100755 --- a/sh/build/yamlcpp.sh +++ b/sh/build/yamlcpp.sh @@ -1,53 +1,51 @@ -source "sh/build_common.sh" "${1}" +source "sh/build_common.sh" -project="yamlcpp" -projectDir="projects/yamlcpp" -buildDir="${buildRoot}/yamlcpp" +set_build_properties "yamlcpp" "${1}" "${2}" function build_clang() { - $clang $clangCompilerFlags \ - -Xclang -emit-module-interface \ - -I"${projectDir}/include" \ - -o "${buildDir}/yamlcpp.pcm" \ - -c "${projectDir}/yamlcpp.cpp" - - $clang $clangCompilerFlags \ - -I"${projectDir}/include" \ - -o "${buildDir}/yamlcpp.obj" \ - -c "${projectDir}/yamlcpp.cpp" + ${clang} ${clangCompilerFlags} \ + -Xclang -emit-module-interface \ + -I"${projectDir}/include" \ + -o "${buildDir}/${project}.pcm" \ + -c "${projectDir}/${project}.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/binary.o" -c "${projectDir}/src/binary.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/convert.o" -c "${projectDir}/src/convert.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/depthguard.o" -c "${projectDir}/src/depthguard.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/directives.o" -c "${projectDir}/src/directives.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emit.o" -c "${projectDir}/src/emit.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emitfromevents.o" -c "${projectDir}/src/emitfromevents.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emitter.o" -c "${projectDir}/src/emitter.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emitterstate.o" -c "${projectDir}/src/emitterstate.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emitterutils.o" -c "${projectDir}/src/emitterutils.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/exceptions.o" -c "${projectDir}/src/exceptions.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/exp.o" -c "${projectDir}/src/exp.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/memory.o" -c "${projectDir}/src/memory.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/node.o" -c "${projectDir}/src/node.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/node_data.o" -c "${projectDir}/src/node_data.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/nodebuilder.o" -c "${projectDir}/src/nodebuilder.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/nodeevents.o" -c "${projectDir}/src/nodeevents.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/null.o" -c "${projectDir}/src/null.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/ostream_wrapper.o" -c "${projectDir}/src/ostream_wrapper.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/parse.o" -c "${projectDir}/src/parse.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/parser.o" -c "${projectDir}/src/parser.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/regex_yaml.o" -c "${projectDir}/src/regex_yaml.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/scanner.o" -c "${projectDir}/src/scanner.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/scanscalar.o" -c "${projectDir}/src/scanscalar.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/scantag.o" -c "${projectDir}/src/scantag.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/scantoken.o" -c "${projectDir}/src/scantoken.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/simplekey.o" -c "${projectDir}/src/simplekey.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/singledocparser.o" -c "${projectDir}/src/singledocparser.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/stream.o" -c "${projectDir}/src/stream.cpp" - $clang $clangCompilerFlags -I"${projectDir}/include" -o "${buildDir}/tag.o" -c "${projectDir}/src/tag.cpp" + ${clang} ${clangCompilerFlags} \ + -I"${projectDir}/include" \ + -o "${buildDir}/${project}.obj" \ + -c "${projectDir}/${project}.cpp" - ${ar} r "${buildDir}/yamlcpp.lib" \ - "${buildDir}/yamlcpp.obj" \ + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/binary.o" -c "${projectDir}/src/binary.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/convert.o" -c "${projectDir}/src/convert.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/depthguard.o" -c "${projectDir}/src/depthguard.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/directives.o" -c "${projectDir}/src/directives.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emit.o" -c "${projectDir}/src/emit.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emitfromevents.o" -c "${projectDir}/src/emitfromevents.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emitter.o" -c "${projectDir}/src/emitter.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emitterstate.o" -c "${projectDir}/src/emitterstate.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emitterutils.o" -c "${projectDir}/src/emitterutils.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/exceptions.o" -c "${projectDir}/src/exceptions.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/exp.o" -c "${projectDir}/src/exp.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/memory.o" -c "${projectDir}/src/memory.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/node.o" -c "${projectDir}/src/node.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/node_data.o" -c "${projectDir}/src/node_data.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/nodebuilder.o" -c "${projectDir}/src/nodebuilder.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/nodeevents.o" -c "${projectDir}/src/nodeevents.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/null.o" -c "${projectDir}/src/null.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/ostream_wrapper.o" -c "${projectDir}/src/ostream_wrapper.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/parse.o" -c "${projectDir}/src/parse.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/parser.o" -c "${projectDir}/src/parser.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/regex_yaml.o" -c "${projectDir}/src/regex_yaml.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/scanner.o" -c "${projectDir}/src/scanner.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/scanscalar.o" -c "${projectDir}/src/scanscalar.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/scantag.o" -c "${projectDir}/src/scantag.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/scantoken.o" -c "${projectDir}/src/scantoken.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/simplekey.o" -c "${projectDir}/src/simplekey.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/singledocparser.o" -c "${projectDir}/src/singledocparser.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/stream.o" -c "${projectDir}/src/stream.cpp" + ${clang} ${clangCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/tag.o" -c "${projectDir}/src/tag.cpp" + + ${ar} r "${buildDir}/${project}.lib" \ + "${buildDir}/${project}.obj" \ "${buildDir}/binary.o" \ "${buildDir}/convert.o" \ "${buildDir}/depthguard.o" \ @@ -80,41 +78,41 @@ function build_clang() { } function build_gcc() { - $gcc $gccCompilerFlags -x c++-header "${projectDir}/yamlcpp.hpp" - $gcc $gccCompilerFlags -o "${buildDir}/yamlcpp.obj" -c "${projectDir}/yamlcpp.cpp" + ${gcc} ${gccCompilerFlags} -x c++-header "${projectDir}/${project}.hpp" + ${gcc} ${gccCompilerFlags} -o "${buildDir}/${project}.obj" -c "${projectDir}/${project}.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/binary.o" -c "${projectDir}/src/binary.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/convert.o" -c "${projectDir}/src/convert.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/depthguard.o" -c "${projectDir}/src/depthguard.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/directives.o" -c "${projectDir}/src/directives.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emit.o" -c "${projectDir}/src/emit.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emitfromevents.o" -c "${projectDir}/src/emitfromevents.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emitter.o" -c "${projectDir}/src/emitter.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emitterstate.o" -c "${projectDir}/src/emitterstate.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/emitterutils.o" -c "${projectDir}/src/emitterutils.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/exceptions.o" -c "${projectDir}/src/exceptions.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/exp.o" -c "${projectDir}/src/exp.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/memory.o" -c "${projectDir}/src/memory.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/node.o" -c "${projectDir}/src/node.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/node_data.o" -c "${projectDir}/src/node_data.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/nodebuilder.o" -c "${projectDir}/src/nodebuilder.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/nodeevents.o" -c "${projectDir}/src/nodeevents.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/null.o" -c "${projectDir}/src/null.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/ostream_wrapper.o" -c "${projectDir}/src/ostream_wrapper.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/parse.o" -c "${projectDir}/src/parse.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/parser.o" -c "${projectDir}/src/parser.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/regex_yaml.o" -c "${projectDir}/src/regex_yaml.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/scanner.o" -c "${projectDir}/src/scanner.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/scanscalar.o" -c "${projectDir}/src/scanscalar.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/scantag.o" -c "${projectDir}/src/scantag.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/scantoken.o" -c "${projectDir}/src/scantoken.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/simplekey.o" -c "${projectDir}/src/simplekey.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/singledocparser.o" -c "${projectDir}/src/singledocparser.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/stream.o" -c "${projectDir}/src/stream.cpp" - $gcc $gccCompilerFlags -I"${projectDir}/include" -o "${buildDir}/tag.o" -c "${projectDir}/src/tag.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/binary.o" -c "${projectDir}/src/binary.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/convert.o" -c "${projectDir}/src/convert.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/depthguard.o" -c "${projectDir}/src/depthguard.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/directives.o" -c "${projectDir}/src/directives.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emit.o" -c "${projectDir}/src/emit.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emitfromevents.o" -c "${projectDir}/src/emitfromevents.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emitter.o" -c "${projectDir}/src/emitter.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emitterstate.o" -c "${projectDir}/src/emitterstate.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/emitterutils.o" -c "${projectDir}/src/emitterutils.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/exceptions.o" -c "${projectDir}/src/exceptions.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/exp.o" -c "${projectDir}/src/exp.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/memory.o" -c "${projectDir}/src/memory.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/node.o" -c "${projectDir}/src/node.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/node_data.o" -c "${projectDir}/src/node_data.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/nodebuilder.o" -c "${projectDir}/src/nodebuilder.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/nodeevents.o" -c "${projectDir}/src/nodeevents.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/null.o" -c "${projectDir}/src/null.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/ostream_wrapper.o" -c "${projectDir}/src/ostream_wrapper.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/parse.o" -c "${projectDir}/src/parse.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/parser.o" -c "${projectDir}/src/parser.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/regex_yaml.o" -c "${projectDir}/src/regex_yaml.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/scanner.o" -c "${projectDir}/src/scanner.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/scanscalar.o" -c "${projectDir}/src/scanscalar.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/scantag.o" -c "${projectDir}/src/scantag.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/scantoken.o" -c "${projectDir}/src/scantoken.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/simplekey.o" -c "${projectDir}/src/simplekey.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/singledocparser.o" -c "${projectDir}/src/singledocparser.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/stream.o" -c "${projectDir}/src/stream.cpp" + ${gcc} ${gccCompilerFlags} -I"${projectDir}/include" -o "${buildDir}/tag.o" -c "${projectDir}/src/tag.cpp" - ar r "${buildDir}/yamlcpp.lib" \ - "${buildDir}/yamlcpp.obj" \ + ar r "${buildDir}/${project}.lib" \ + "${buildDir}/${project}.obj" \ "${buildDir}/binary.o" \ "${buildDir}/convert.o" \ "${buildDir}/depthguard.o" \ @@ -147,18 +145,18 @@ function build_gcc() { } buildMSVC=" -cl.exe ${msvcCompilerFlags} /exportHeader ^ - /I\"${projectDir}/include\" ^ - /ifcOutput \"${buildDir}/yamlcpp.hpp.ifc\" ^ - /Fo\"${buildDir}/yamlcpp.hpp.obj\" ^ - /c /TP \"${projectDir}/yamlcpp.hpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /exportHeader ^ + /I\"${projectDir}/include\" ^ + /ifcOutput \"${buildDir}/${project}.hpp.ifc\" ^ + /Fo\"${buildDir}/${project}.hpp.obj\" ^ + /c /TP \"${projectDir}/${project}.hpp\" || exit 1 -cl.exe ${msvcCompilerFlags} ^ - /interface ^ - /ifcSearchDir \"${buildDir}\" ^ - /ifcOutput\"${buildDir}/yamlcpp.ifc\" ^ - /Fo\"${buildDir}/yamlcpp.obj\" ^ - /c \"${projectDir}/yamlcpp.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} ^ + /interface ^ + /ifcSearchDir \"${buildDir}\" ^ + /ifcOutput\"${buildDir}/${project}.ifc\" ^ + /Fo\"${buildDir}/${project}.obj\" ^ + /c \"${projectDir}/${project}.cpp\" || exit 1 cl.exe ${msvcCompilerFlags} /I\"${projectDir}/include\" /Fo\"${buildDir}/binary.obj\" /c \"${projectDir}/src/binary.cpp\" /wd4244 || exit 1 cl.exe ${msvcCompilerFlags} /I\"${projectDir}/include\" /Fo\"${buildDir}/convert.obj\" /c \"${projectDir}/src/convert.cpp\" || exit 1 @@ -190,10 +188,10 @@ cl.exe ${msvcCompilerFlags} /I\"${projectDir}/include\" /Fo\"${buildDir}/singled cl.exe ${msvcCompilerFlags} /I\"${projectDir}/include\" /Fo\"${buildDir}/stream.obj\" /c \"${projectDir}/src/stream.cpp\" || exit 1 cl.exe ${msvcCompilerFlags} /I\"${projectDir}/include\" /Fo\"${buildDir}/tag.obj\" /c \"${projectDir}/src/tag.cpp\" || exit 1 -lib.exe /NOLOGO ^ - /OUT:\"${buildDir}/yamlcpp.lib\" ^ - \"${buildDir}/yamlcpp.hpp.obj\" ^ - \"${buildDir}/yamlcpp.obj\" ^ +lib.exe /NOLOGO ^ + /OUT:\"${buildDir}/${project}.lib\" ^ + \"${buildDir}/${project}.hpp.obj\" ^ + \"${buildDir}/${project}.obj\" ^ \"${buildDir}/binary.obj\" ^ \"${buildDir}/convert.obj\" ^ \"${buildDir}/depthguard.obj\" ^ diff --git a/sh/build_common.sh b/sh/build_common.sh index 208b5562..d9b247ac 100755 --- a/sh/build_common.sh +++ b/sh/build_common.sh @@ -1,114 +1,279 @@ +[ -n "$BUILD_COMMON_SH" ] && return || readonly BUILD_COMMON_SH=1 + source "sh/common.sh" -toolchain="${1}" -buildRoot="build/${toolchain}" -binDir="${buildRoot}/bin" -libCppMsanRoot="${home}/libc++-msan" - -clangCompilerFlagsCommon="-std=c++20 \ - -Wall \ - -Wextra \ - -Werror \ - -pedantic \ - -Wno-missing-field-initializers \ - -fmodules \ - -fimplicit-module-maps \ - -fprebuilt-module-path=${buildRoot}/astl \ - -fmodule-map-file=projects/astl/module.modulemap \ - -fmodule-map-file=projects/awinapi/module.modulemap \ - -fmodule-map-file=projects/aprocess/module.modulemap \ - -fmodule-map-file=projects/yamlcpp/module.modulemap" - -if is_windows; then - clangCompilerFlags="${clangCompilerFlagsCommon}" -else - clangCompilerFlags="${clangCompilerFlagsCommon} \ - -stdlib=libc++" -fi - -if [[ "${ADDRESS_SANITIZER}" == "true" ]]; then - clangCompilerFlags="${clangCompilerFlags} \ - -g \ - -fsanitize=address \ - -fsanitize-address-use-after-return=always \ - -fsanitize-address-use-after-scope \ - -fno-omit-frame-pointer \ - -fno-optimize-sibling-calls" -elif [[ "${CODE_COVERAGE}" == "true" ]]; then - clangCompilerFlags="${clangCompilerFlags} \ - -fprofile-instr-generate \ - -fcoverage-mapping" -elif [[ "${MEMORY_SANITIZER}" == "true" ]]; then - if [[ ! -d "${libCppMsanRoot}" ]]; then - print_error "ERROR: libc++ with memory sanitizer not found. Build it with './adev.sh build libc++-msan'." +function set_build_properties() { + set_build_arguments "${1}" "${2}" "${3}" + detect_msvc_env_script + set_build_dirs + set_build_flags +} + + +function set_build_dirs() { + readonly buildRoot="build/${toolchain}/${configuration}" + readonly binDir="${buildRoot}/bin" + + if [[ "${project}" == *.test ]]; then + readonly projectDir="projects/${project:: -5}/test" + readonly buildDir="${buildRoot}/${project:: -5}/test" + else + readonly projectDir="projects/${project}" + readonly buildDir="${buildRoot}/${project}" + fi +} + +function set_build_arguments() { + if [[ "${1}" != "" ]]; then + set_first_argument "${1}" "${2}" "${3}" + fi + + validate_toolchain + validate_configuration +} + +function set_first_argument() { + if is_toolchain "${1}"; then + readonly toolchain="${1}" + elif is_configuration "${1}"; then + readonly configuration="${1}" + else + readonly project="${1}" + fi + + if [[ "${2}" != "" ]]; then + set_second_argument "${2}" "${3}" + fi +} + +function set_second_argument() { + if is_toolchain "${1}"; then + readonly toolchain="${1}" + elif is_configuration "${1}"; then + readonly configuration="${1}" + else + print_error "ERROR: second build argument '${1}' is not a toolchain or configuration" exit 1 fi - clangCompilerFlags="${clangCompilerFlagsCommon} \ - -g \ - -Wno-error=unused-command-line-argument - -fsanitize=memory \ - -fno-omit-frame-pointer \ - -fno-optimize-sibling-calls \ - -fsanitize-memory-track-origins \ - -fsanitize-memory-use-after-dtor \ - -nostdinc++ \ - -I${libCppMsanRoot}/include/c++/v1" -elif [[ "${THREAD_SANITIZER}" == "true" ]]; then - clangCompilerFlags="${clangCompilerFlags} \ - -g \ - -O1 \ - -fsanitize=thread" -elif [[ "${UNDEFINED_SANITIZER}" == "true" ]]; then - clangCompilerFlags="${clangCompilerFlags} \ - -fsanitize=undefined" -else + if [[ "${2}" != "" ]]; then + set_third_argument "${2}" + fi +} + +function set_third_argument() { + if is_configuration "${1}"; then + readonly configuration="${1}" + else + print_error "ERROR: third build argument '${1}' is not a configuration" + exit 1 + fi +} + +function validate_toolchain() { + if ! is_linux && [[ "${toolchain}" == "gcc" ]]; then + print_error "ERROR: 'gcc' toolchain is only available on Linux" + exit 1 + elif ! is_windows && [[ "${toolchain}" == "msvc" ]]; then + print_error "ERROR: 'msvc' toolchain is only available on Windows" + exit 1 + fi + + if [[ "${toolchain}" == "" ]]; then + if is_windows; then + readonly toolchain="msvc" + elif is_linux; then + readonly toolchain="gcc" + else + readonly toolchain="clang" + fi + fi +} + +function validate_configuration() { + if [[ "${configuration}" == "memory" ]]; then + if [[ ! -d "${libCppMsanRoot}" ]]; then + print_error "ERROR: libc++ with memory sanitizer not found. Build it with './adev.sh build libc++-msan'." + exit 1 + fi + fi + + if [[ "${configuration}" == "" ]]; then + readonly configuration="release" + fi +} + +function set_clang_common_flags() { + readonly clangCommonFlags=\ +"-std=c++20 \ +-Wall \ +-Wextra \ +-Werror \ +-pedantic \ +-Wno-missing-field-initializers \ +-fmodules \ +-fimplicit-module-maps \ +-fmodule-map-file=projects/astl/module.modulemap \ +-fmodule-map-file=projects/awinapi/module.modulemap \ +-fmodule-map-file=projects/aprocess/module.modulemap \ +-fmodule-map-file=projects/yamlcpp/module.modulemap" + + if is_windows; then + clangCompilerFlags="${clangCommonFlags}" + else + clangCompilerFlags="${clangCompilerFlagsCommon} -stdlib=libc++" + fi +} + +function set_clang_release_flags() { clangCompilerFlags="${clangCompilerFlags} \ -O3" -fi - -if is_windows; then - clangCompilerLinkerFlags="${clangCompilerFlags}" -else - clangCompilerLinkerFlags="${clangCompilerFlags} \ - -lpthread" -fi - -if [[ "${MEMORY_SANITIZER}" == "true" ]]; then - clangCompilerLinkerFlags="${clangCompilerLinkerFlags} \ - -L${libCppMsanRoot}/lib \ - -lc++ \ - -lc++abi \ - -Wl,-rpath,${libCppMsanRoot}/lib" -fi - -gccCompilerFlags="-std=c++20 \ - -Wall \ - -Werror \ - -pedantic-errors \ - -fmodules-ts" - -msvcCompilerFlags="/nologo \ - /std:c++latest \ - /EHsc \ - /MT \ - /Z7 \ - /W4 \ - /WX \ - /wd4005 \ - /wd5105 \ - /wd5106 \ - /ifcSearchDir \"${buildRoot}/astl\" \ - /headerUnit \"projects/astl/astl.hpp=${buildRoot}/astl/astl.hpp.ifc\" \ - /headerUnit \"projects/awinapi/windows.hpp=${buildRoot}/awinapi/windows.hpp.ifc\" \ - /headerUnit \"projects/yamlcpp/yamlcpp.hpp=${buildRoot}/yamlcpp/yamlcpp.hpp.ifc\" " +} + +function set_clang_debug_flags() { + clangCompilerFlags="${clangCompilerFlags} \ + -g" +} + +function set_clang_address_flags() { + clangCompilerFlags=\ +"${clangCompilerFlags} \ +-g \ +-fsanitize=address \ +-fsanitize-address-use-after-return=always \ +-fsanitize-address-use-after-scope \ +-fno-omit-frame-pointer \ +-fno-optimize-sibling-calls" +} + +function set_clang_memory_flags() { + clangCompilerFlags=\ +"${clangCommonFlags} \ +-g \ +-Wno-error=unused-command-line-argument +-fsanitize=memory \ +-fno-omit-frame-pointer \ +-fno-optimize-sibling-calls \ +-fsanitize-memory-track-origins \ +-fsanitize-memory-use-after-dtor \ +-nostdinc++ \ +-I${libCppMsanRoot}/include/c++/v1" +} + +function set_clang_thread_flags() { + clangCompilerFlags="${clangCompilerFlags} -g -O1 -fsanitize=thread" +} + +function set_clang_undefined_flags() { + clangCompilerFlags="${clangCompilerFlags} -fsanitize=undefined" +} + +function set_clang_coverage_flags() { + clangCompilerFlags="${clangCompilerFlags} -fprofile-instr-generate -fcoverage-mapping" +} + +function set_clang_compiler_linker_flags() { + if is_windows; then + readonly clangCompilerLinkerFlags="${clangCompilerFlags}" + elif [[ "${configuration}" == "memory" ]]; then + readonly clangCompilerLinkerFlags=\ +"${clangCompilerLinkerFlags} \ +-L${libCppMsanRoot}/lib \ +-lc++ \ +-lc++abi \ +-lpthread \ +-Wl,-rpath,${libCppMsanRoot}/lib" + else + readonly clangCompilerLinkerFlags="${clangCompilerFlags} -lpthread" + fi +} + +function set_clang_flags() { + set_clang_common_flags + + if [[ "${configuration}" == "release" ]]; then + set_clang_release_flags + elif [[ "${configuration}" == "debug" ]]; then + set_clang_debug_flags + elif [[ "${configuration}" == "address" ]]; then + set_clang_address_flags + elif [[ "${configuration}" == "coverage" ]]; then + set_clang_coverage_flags + elif [[ "${configuration}" == "memory" ]]; then + set_clang_memory_flags + elif [[ "${configuration}" == "thread" ]]; then + set_clang_thread_flags + elif [[ "${configuration}" == "undefined" ]]; then + set_clang_undefined_flags + fi + + set_clang_compiler_linker_flags +} + +function set_gcc_flags() { + readonly gccCompilerFlags=\ +"-std=c++20 \ +-Wall \ +-Werror \ +-pedantic-errors \ +-fmodules-ts" +} + +function set_msvc_flags() { + readonly msvcCompilerFlags=\ +"/nologo \ +/std:c++latest \ +/EHsc \ +/MT \ +/Z7 \ +/W4 \ +/WX \ +/wd4005 \ +/wd5105 \ +/wd5106 \ +/ifcSearchDir \"${buildRoot}/astl\" \ +/headerUnit \"projects/astl/astl.hpp=${buildRoot}/astl/astl.hpp.ifc\" \ +/headerUnit \"projects/awinapi/windows.hpp=${buildRoot}/awinapi/windows.hpp.ifc\" \ +/headerUnit \"projects/yamlcpp/yamlcpp.hpp=${buildRoot}/yamlcpp/yamlcpp.hpp.ifc\"" +} + +function set_build_flags() { + if [[ "${toolchain}" == "clang" ]]; then + set_clang_flags + elif [[ "${toolchain}" == "gcc" ]]; then + set_gcc_flags + elif [[ "${toolchain}" == "msvc" ]]; then + set_msvc_flags + fi +} + +function build_project() { + local -r buildScript="sh/build/${1}.sh" + + if [[ -f "${buildScript}" ]]; then + run_script "${buildScript}" "${toolchain}" "${configuration}" + else + print_error "ERROR: Project '${1}' does not exist." + exit 1; + fi +} + +function build_dependencies() { + local -r dependencies="${1}" + + for dependency in ${dependencies[@]}; do + build_project "${dependency}" + done +} function build() { if [[ -f "${buildRoot}/${project}.done" ]]; then - exit 0 + return fi - echo "*** ${project} ***" + build_dependencies "${1}" + + echo "*** ${project} | ${toolchain} | ${configuration} ***" mkdir -p "${binDir}" mkdir -p "${buildDir}" @@ -116,41 +281,42 @@ function build() { if [[ "${toolchain}" == "clang" ]]; then set -e build_clang - status=$? + readonly status=$? elif [[ "${toolchain}" == "gcc" ]]; then set -e build_gcc - status=$? + readonly status=$? elif [[ "${toolchain}" == "msvc" ]]; then build_msvc - else - print_error "ERROR: Unknown toolchain '${toolchain}'" - status=1 fi if (( $status == 0 )); then echo "${satus}" > "${buildRoot}/${project}.done" + else + print_error "ERROR: build of '${project}' failed" + exit 1 fi - - exit $status } function build_msvc() { - detect_msvc_env_script - - local buildScript=" -@echo off + echo "@echo off call \"${msvcEnvScript}\" >nul -${buildMSVC}" +${buildMSVC}" > build.bat + + local log="" + + if log=$(cmd //c build.bat); then + readonly status=0 + else + readonly status=1 + echo "Failed: ${log}" + fi - echo "${buildScript}" > build.bat - cmd //c build.bat - status=$? rm build.bat } function detect_msvc_env_script() { - if [[ "${msvcEnvScript}" != "" ]]; then + if [[ "${toolchain}" != "msvc" ]] || [[ "${msvcEnvScript}" != "" ]]; then return fi diff --git a/sh/build_docs.sh b/sh/build_docs.sh index 204d7974..867c5cae 100755 --- a/sh/build_docs.sh +++ b/sh/build_docs.sh @@ -1,30 +1,23 @@ +[ -n "$BUILD_DOCS_SH" ] && return || readonly BUILD_DOCS_SH=1 + source "sh/common.sh" -function detect_doxygen () { +function build_docs () { if is_available "doxygen"; then - doxygen="doxygen" + local -r doxygen="doxygen" elif is_windows && [[ -f "C:/Program Files/doxygen/bin/doxygen.exe" ]]; then - doxygen="C:/Program Files/doxygen/bin/doxygen.exe" + local -r doxygen="C:/Program Files/doxygen/bin/doxygen.exe" else - print_error "ERROR: 'doxygen' is not available. Try installing it with './adev.sh install doxygen'." + print_error "ERROR: 'doxygen' is not available. Try installing it with './build.sh install doxygen'." exit 1 fi + mkdir -p "build" + echo "Doxygen $("$doxygen" --version)" -} -function build_docs () { - echo "Generating documentation..." - mkdir -p "build" - "${doxygen}" adev.doxyfile - - if (( $? != 0 )); then + if $("${doxygen}" .doxyfile); then print_error "ERROR: Building documentation failed." exit 1 - else - print_ok "done" fi } - -detect_doxygen -build_docs diff --git a/sh/build_libc++.sh b/sh/build_libc++_msan.sh old mode 100755 new mode 100644 similarity index 68% rename from sh/build_libc++.sh rename to sh/build_libc++_msan.sh index c150b95f..4a3bd0c1 --- a/sh/build_libc++.sh +++ b/sh/build_libc++_msan.sh @@ -1,8 +1,35 @@ -source "sh/common.sh" +[ -n "$BUILD_LIBCPP_MSAN_SH" ] && return || readonly BUILD_LIBCPP_MSAN_SH=1 + +source "sh/build_common.sh" + +function build_libcpp_msan() { + detect_cmake + detect_ninja + get_llvm_sources + set_build_properties "clang" "memory" + + cd ${home}/llvm/build_msan/ + + #echo "src:/adev/llvm/libcxx/src/filesystem/operations.cpp" > ignorelist.txt + local dir=$(pwd) + + cmake -G Ninja \ + ../llvm \ + -D CMAKE_CXX_FLAGS="-fsanitize-ignorelist=${dir}/ignorelist.txt" \ + -D CMAKE_BUILD_TYPE=Release \ + -D LLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \ + -D CMAKE_C_COMPILER=clang-${llvmVersion} \ + -D CMAKE_CXX_COMPILER=${clang} \ + -D LLVM_USE_SANITIZER=MemoryWithOrigins \ + -D CMAKE_INSTALL_PREFIX="${home}/libc++-msan/" + + cmake --build . -- cxx cxxabi + cmake --build . -- install-cxx install-cxxabi +} function detect_cmake() { if ! is_available "cmake"; then - print_error "ERROR: 'cmake' is not available. Try installing it with './adev.sh install cmake'." + print_error "ERROR: 'cmake' is not available. Try installing it with './build.sh install cmake'." exit 1 fi @@ -11,7 +38,7 @@ function detect_cmake() { function detect_ninja () { if ! is_available "ninja"; then - print_error "ERROR: 'ninja' is not available. Try installing it with './adev.sh install ninja'." + print_error "ERROR: 'ninja' is not available. Try installing it with './build.sh install ninja'." exit 1 fi @@ -20,34 +47,9 @@ function detect_ninja () { function get_llvm_sources() { if [[ ! -d "${home}/llvm" ]]; then - git clone --depth=1 -b llvmorg-13.0.1-rc1 https://github.com/llvm/llvm-project.git "${home}/llvm" + git clone --depth=1 -b llvmorg-14.0.3 https://github.com/llvm/llvm-project.git "${home}/llvm" fi mkdir -p "${home}/llvm/build_msan/" mkdir -p "${home}/libc++-msan/" } - -function build() { - cd ${home}/llvm/build_msan/ - - echo "src:/adev/llvm/libcxx/src/filesystem/operations.cpp" > ignorelist.txt - local dir=$(pwd) - - cmake -G Ninja \ - ../llvm \ - -D CMAKE_CXX_FLAGS="-fsanitize-ignorelist=${dir}/ignorelist.txt" \ - -D CMAKE_BUILD_TYPE=Release \ - -D LLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \ - -D CMAKE_C_COMPILER=clang-${llvmVersion} \ - -D CMAKE_CXX_COMPILER=${clang} \ - -D LLVM_USE_SANITIZER=MemoryWithOrigins \ - -D CMAKE_INSTALL_PREFIX="${home}/libc++-msan/" - - cmake --build . -- cxx cxxabi - cmake --build . -- install-cxx install-cxxabi -} - -detect_cmake -detect_ninja -get_llvm_sources -build diff --git a/sh/clang-tidy.sh b/sh/clang-tidy.sh index b6b8138d..9de046c9 100644 --- a/sh/clang-tidy.sh +++ b/sh/clang-tidy.sh @@ -153,7 +153,6 @@ readability-container-size-empty readability-convert-member-functions-to-static readability-function-cognitive-complexity readability-function-size -readability-identifier-length readability-identifier-naming readability-implicit-bool-conversion readability-inconsistent-declaration-parameter-name diff --git a/sh/common.sh b/sh/common.sh index 5a258a96..c8f5a7af 100755 --- a/sh/common.sh +++ b/sh/common.sh @@ -1,10 +1,4 @@ -function print_error() { - echo -e "\033[31m${1}\033[0m" -} - -function print_ok() { - echo -e "\033[32m${1}\033[0m" -} +[ -n "$COMMON_SH" ] && return || readonly COMMON_SH=1 function is_available() { local cmd=$(command -v $1) @@ -16,6 +10,16 @@ function is_changed() { [[ "${diff}" != "" ]] } +function is_configuration() { + [[ "${1}" == "release" ]] \ + || [[ "${1}" == "debug" ]] \ + || [[ "${1}" == "coverage" ]] \ + || [[ "${1}" == "address" ]] \ + || [[ "${1}" == "memory" ]] \ + || [[ "${1}" == "thread" ]] \ + || [[ "${1}" == "undefined" ]] +} + function is_linux() { [[ $OSTYPE == "linux-gnu" ]] } @@ -25,80 +29,80 @@ function is_number() { } function is_toolchain() { - [[ "${1}" == "clang" ]] || [[ "${1}" == "msvc" ]] || [[ "${1}" == "gcc" ]] + [[ "${1}" == "clang" ]] \ + || [[ "${1}" == "msvc" ]] \ + || [[ "${1}" == "gcc" ]] } function is_windows() { [[ $OSTYPE == "msys" ]] || [[ $OSTYPE == "cygwin" ]] } +function print_error() { + echo -e "\033[31m${1}\033[0m" +} + +function print_ok() { + echo -e "\033[32m${1}\033[0m" +} + function run_script() { local -r script="${1}" local -r arg1="${2}" local -r arg2="${3}" local -r arg3="${4}" - "${script[@]}" "${arg1}" "${arg2}" "${arg3}" - local status=$? - if (( $status != 0 )); then - print_error "ERROR: ${script} failed: ${status}" + "${script}" "${arg1}" "${arg2}" "${arg3}" + + if (( $? != 0 )); then exit 1 fi } -function set_toolchain() { - if [[ "${1}" == "" ]]; then - if is_linux; then - toolchain="gcc" - elif is_windows; then - toolchain="msvc" - else - toolchain="clang" - fi - elif is_toolchain "${1}"; then - toolchain="${1}" - - if [[ "${toolchain}" == "msvc" ]] && ! is_windows; then - print_error "ERROR: 'msvc' toolchain is only available on Windows" - exit 1 - elif [[ "${toolchain}" == "gcc" ]] && ! is_linux; then - print_error "ERROR: 'gcc' toolchain is only available on Linux" - exit 1 - fi +function set_host_properties() { + if is_windows; then + set_windows_properties + elif is_linux; then + set_linux_properties else - print_error "ERROR: unknown toolchain '${1}'" - exit 1 + set_unix_properties fi +} + +function set_linux_properties() { + readonly home="/adev" + readonly llvmVersion=14 + readonly gccVersion=12 + readonly clang="clang++-${llvmVersion}" + readonly clangFormat="clang-format-${llvmVersion}" + readonly clangTidy="clang-tidy-${llvmVersion}" + readonly lld="lld-${llvmVersion}" + readonly llvmCov="llvm-cov-${llvmVersion}" + readonly llvmProfdata="llvm-profdata-${llvmVersion}" + readonly gcc="g++-${gccVersion}" + readonly ar="ar" + readonly libCppMsanRoot="${home}/libc++-msan" +} + +function set_unix_properties() { + readonly clang="clang++" + readonly clangFormat="clang-format" + readonly clangTidy="clang-tidy" + readonly llvmCov="llvm-cov" + readonly llvmProfdata="llvm-profdata" + readonly ar="ar" +} - echo "Toolchain: ${toolchain}" +function set_windows_properties() { + readonly executableExtension=".exe" + readonly clang="clang++${executableExtension}" + readonly clangFormat="clang-format${executableExtension}" + readonly clangTidy="clang-tidy${executableExtension}" + readonly llvmCov="llvm-cov${executableExtension}" + readonly llvmProfdata="llvm-profdata${executableExtension}" + readonly ar="llvm-ar${executableExtension}" } shopt -s globstar -if is_windows; then - executableExtension=".exe" - clang="clang++${executableExtension}" - clangFormat="clang-format${executableExtension}" - clangTidy="clang-tidy${executableExtension}" - llvmCov="llvm-cov${executableExtension}" - llvmProfdata="llvm-profdata${executableExtension}" - ar="llvm-ar${executableExtension}" -elif is_linux; then - home="/adev" - llvmVersion=14 - clang="clang++-${llvmVersion}" - clangFormat="clang-format-${llvmVersion}" - clangTidy="clang-tidy-${llvmVersion}" - lld="lld-${llvmVersion}" - llvmCov="llvm-cov-${llvmVersion}" - llvmProfdata="llvm-profdata-${llvmVersion}" - gcc="g++-11" - ar="ar" -else - clang="clang++" - clangFormat="clang-format" - clangTidy="clang-tidy" - llvmCov="llvm-cov" - llvmProfdata="llvm-profdata" - ar="ar" -fi +set_host_properties diff --git a/sh/format.sh b/sh/format.sh index 70483c7a..7e55fce6 100755 --- a/sh/format.sh +++ b/sh/format.sh @@ -4,7 +4,7 @@ function detect_clang_format() { if ! is_available "${clangFormat}"; then print_error "ERROR: ${clangFormat} is not available. Please install it with './adev.sh install llvm'." else - $clangFormat --version | head -n 1 + ${clangFormat} --version | head -n 1 fi } @@ -15,13 +15,13 @@ function format_check_source() { return fi - local -r replacements=$($clangFormat -output-replacements-xml $source | grep " Prints this help. -./build.sh analyse Run clang-tidy on all projects. -./build.sh analyse diff Run clang-tidy on files/projects changed from main. -./build.sh analyse Run clang-tidy on . -./build.sh build Build all projects with the default toolchain. -./build.sh build list List available projects. -./build.sh build docs Build Doxygen documentation. -./build.sh build coverage Build all projects with clang and code coverage instrumentation. -./build.sh build libc++-msan Build libc++ with memory sanitizer flags. -./build.sh build address-sanitizer Build all projects with clang and address sanitizer flags. -./build.sh build memory-sanitizer Build all projects with cland and memory sanitizer flags. -./build.sh build thread-sanitizer Build all projects with cland and thread sanitizer flags. -./build.sh build undefined-sanitizer Build all projects with cland and undefined behavior sanitizer flags. -./build.sh build Build all projects with . -./build.sh build Build with default toolchain. -./build.sh build Build with . -./build.sh coverage Run tests and collect code coverage stats (requires 'build coverage'). -./build.sh format Formats source code with clang-format. -./build.sh format check Checks formatting of the sources with clang-format. -./build.sh format check diff Checks formatting of changed sources with clang-format. -./build.sh install list List available packages. -./build.sh install Install . -./build.sh test Run all tests once for build of the default toolchain. -./build.sh test Run all tests for build of the default toolchain. -./build.sh test Run all tests once for build of the . -./build.sh test Run all tests for build of the . +function help_() { + echo \ +"Usage: ./build.sh [OPTIONS] -Toolchains: - clang - gcc (Linux only, default) - msvc (Windows only, default)" +./build.sh Builds sources with default toolchain and release configuration. +./build.sh list List available projects. +./build.sh Builds sources with default toolchain and . +./build.sh Builds sources with and release configuration. +./build.sh Builds sources with and . +./build.sh Builds with default toolchain and release configuration. +./build.sh Builds with and release configuration. +./build.sh Builds with default toolchain and . +./build.sh Builds with and release configuration. +./build.sh docs Builds documentation with Doxygen. +./build.sh libc++-msan Builds libc++ with memory sanitizer. +./build.sh analyse Runs clang-tidy on all sources with all checks. +./build.sh analyse Runs clang-tidy on all sources with sets. +./build.sh analyse diff Runs clang-tidy on sources changed from main with all checks. +./build.sh analyse diff Runs clang-tidy on sources changed from main with sets. +./build.sh analyse Runs clang-tidy on with all checks. +./build.sh analyse Runs clang-tidy on with sets. +./build.sh format Runs clang-format on sources. +./build.sh format diff Runs clang-format on sources changed fomr main. +./build.sh install list Lists available packages. +./build.sh install Installs for current platform. +./build.sh test Runs all tests once for default toolchain and release configuration. +./build.sh test Runs all tests times for default toolchain and release configuration. +./build.sh test Runs all tests once for default toolchain and . +./build.sh test Runs all tests times for default toolchain and . +./build.sh test coverage Runs all tests once for clang and coverage configuration. Reports coverage. +./build.sh test Runs all tests once for and release configuration. +./build.sh test Runs all tests times for and release configuration. +./build.sh test Runs all tests once for and . +./build.sh test Runs all tests times for and . +./build.sh test Runs test once for and release configuration. +./build.sh test Runs test times for and release configuration. +./build.sh test Runs test once for and . +./build.sh test Runs test times for and . +./build.sh test coverage Runs test once for clang and coverage configuration. Reports coverage. + + +Toolchain | Platforms | Default Platform +------------------|-----------------------|----------------- +clang | Windows, macOS, Linux | macOS +gcc | Linux | Linux +msvc | Windows | Windows + +Configuration | Description +------------------|----------------------------------------- +release | Optimized build +debug | Unoptimized build with debug symbols +coverage | Instrumented build (clang only) +memory | Memory sanitized build (clang only) +address | Address sanitized build (gcc and clang) +thread | Thread sanitized build (gcc and clang) +undefined | UB sanitized build (gcc and clang) + +Check Set | Decsription +------------------|----------------------------------------- +bugprone | Bugprone checks +cert | CERT Security Guidelines +cppcoreguidelines | C++ Core Guidelines +fuchsia | Fuchsia OS (Android Successor) +google | Google checks +hicpp | High Performance C++ +misc | Miscellaneous checks +modernize | Modernize checks +performance | Performance checks +readability | Readability checks" +} diff --git a/sh/install/cmake.sh b/sh/install/cmake.sh index 33475de7..cca19059 100755 --- a/sh/install/cmake.sh +++ b/sh/install/cmake.sh @@ -3,7 +3,7 @@ source "sh/common.sh" if is_windows; then choco install -y cmake else - wget -O cmake.sh https://github.com/Kitware/CMake/releases/download/v3.21.3/cmake-3.21.3-linux-x86_64.sh + wget -O cmake.sh https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.sh chmod +x cmake.sh mkdir -p "${home}/cmake" ./cmake.sh --skip-license --prefix="${home}/cmake" diff --git a/sh/install/gcc.sh b/sh/install/gcc.sh index 65556756..bdf31045 100755 --- a/sh/install/gcc.sh +++ b/sh/install/gcc.sh @@ -6,5 +6,5 @@ if is_windows; then else sudo add-apt-repository -y 'deb http://mirrors.kernel.org/ubuntu hirsute main universe' sudo apt-get update -y - sudo apt-get install -y g++-11 + sudo apt-get install -y g++-12 fi From 99699fdbcd7b991f6edac5809e3913542dc4915a Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 15:37:28 +0200 Subject: [PATCH 14/34] Re-enable formatting --- build.sh | 4 +- sh/common.sh | 4 ++ sh/format.sh | 103 ++++++++++++++++++++++++--------------------------- sh/help.sh | 5 ++- 4 files changed, 58 insertions(+), 58 deletions(-) diff --git a/build.sh b/build.sh index 8dc654c4..251f7843 100644 --- a/build.sh +++ b/build.sh @@ -3,7 +3,7 @@ #source "sh/analyse.sh" source "sh/build.sh" #source "sh/coverage.sh" -#source "sh/format.sh" +source "sh/format.sh" source "sh/help.sh" #source "sh/install.sh" #source "sh/test.sh" @@ -15,7 +15,7 @@ if [[ "${action}" == "analyse" ]]; then elif [[ "${action}" == "help" ]]; then help_ elif [[ "${action}" == "format" ]]; then - format "${2}" + format "${2}" "${3}" elif [[ "${action}" == "install" ]]; then install "${2}" elif [[ "${action}" == "test" ]]; then diff --git a/sh/common.sh b/sh/common.sh index c8f5a7af..7e53ca57 100755 --- a/sh/common.sh +++ b/sh/common.sh @@ -20,6 +20,10 @@ function is_configuration() { || [[ "${1}" == "undefined" ]] } +function is_ignored() { + [[ "${1}" == projects/yamlcpp/* ]] +} + function is_linux() { [[ $OSTYPE == "linux-gnu" ]] } diff --git a/sh/format.sh b/sh/format.sh index 7e55fce6..32b65a10 100755 --- a/sh/format.sh +++ b/sh/format.sh @@ -1,77 +1,72 @@ -source "sh/common.sh" +[ -n "$FORMAT_SH" ] && return || readonly FORMAT_SH=1 -function detect_clang_format() { - if ! is_available "${clangFormat}"; then - print_error "ERROR: ${clangFormat} is not available. Please install it with './adev.sh install llvm'." - else - ${clangFormat} --version | head -n 1 - fi -} - -function format_check_source() { - local -r source="${1}" +source "sh/common.sh" - if [[ ${source} == projects/yamlcpp/* ]]; then - return - fi +function format() { + detect_clang_format - local -r replacements=$("${clangFormat}" -output-replacements-xml "${source}" | grep " Runs clang-tidy on sources changed from main with sets. ./build.sh analyse Runs clang-tidy on with all checks. ./build.sh analyse Runs clang-tidy on with sets. -./build.sh format Runs clang-format on sources. -./build.sh format diff Runs clang-format on sources changed fomr main. +./build.sh format Runs clang-format on all sources. +./build.sh format check Runs clang-format on all sources to detect unformatted files. +./build.sh format check diff Runs clang-format on sources changed from main to detect unformatted files. ./build.sh install list Lists available packages. ./build.sh install Installs for current platform. ./build.sh test Runs all tests once for default toolchain and release configuration. From 50f4ede6012175853b3737c67206bc9567c2b7b8 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 16:07:09 +0200 Subject: [PATCH 15/34] Re-enable tests --- build.sh | 5 +- sh/build_common.sh | 116 ++++++++++++++++++++++++--------------------- sh/coverage.sh | 4 +- sh/install.sh | 18 +++---- sh/test.sh | 44 ++++++++++++----- 5 files changed, 109 insertions(+), 78 deletions(-) diff --git a/build.sh b/build.sh index 251f7843..8bf605db 100644 --- a/build.sh +++ b/build.sh @@ -2,11 +2,10 @@ #source "sh/analyse.sh" source "sh/build.sh" -#source "sh/coverage.sh" source "sh/format.sh" source "sh/help.sh" -#source "sh/install.sh" -#source "sh/test.sh" +source "sh/install.sh" +source "sh/test.sh" readonly action="${1}" diff --git a/sh/build_common.sh b/sh/build_common.sh index d9b247ac..361beb28 100755 --- a/sh/build_common.sh +++ b/sh/build_common.sh @@ -2,6 +2,57 @@ source "sh/common.sh" +function build_project() { + local -r buildScript="sh/build/${1}.sh" + + if [[ -f "${buildScript}" ]]; then + run_script "${buildScript}" "${toolchain}" "${configuration}" + else + print_error "ERROR: Project '${1}' does not exist." + exit 1; + fi +} + +function build() { + if [[ -f "${buildRoot}/${project}.done" ]]; then + return + fi + + build_dependencies "${1}" + + echo "*** ${project} | ${toolchain} | ${configuration} ***" + + mkdir -p "${binDir}" + mkdir -p "${buildDir}" + + if [[ "${toolchain}" == "clang" ]]; then + set -e + build_clang + readonly status=$? + elif [[ "${toolchain}" == "gcc" ]]; then + set -e + build_gcc + readonly status=$? + elif [[ "${toolchain}" == "msvc" ]]; then + build_msvc + fi + + if (( $status == 0 )); then + echo "${satus}" > "${buildRoot}/${project}.done" + else + print_error "ERROR: build of '${project}' failed" + exit 1 + fi +} + +function build_dependencies() { + local -r dependencies="${1}" + + for dependency in ${dependencies[@]}; do + build_project "${dependency}" + done +} + function set_build_properties() { set_build_arguments "${1}" "${2}" "${3}" detect_msvc_env_script @@ -20,6 +71,7 @@ function set_build_dirs() { else readonly projectDir="projects/${project}" readonly buildDir="${buildRoot}/${project}" + fi } @@ -37,7 +89,7 @@ function set_first_argument() { readonly toolchain="${1}" elif is_configuration "${1}"; then readonly configuration="${1}" - else + elif ! is_number $1; then readonly project="${1}" fi @@ -51,7 +103,7 @@ function set_second_argument() { readonly toolchain="${1}" elif is_configuration "${1}"; then readonly configuration="${1}" - else + elif ! is_number $1; then print_error "ERROR: second build argument '${1}' is not a toolchain or configuration" exit 1 fi @@ -64,7 +116,7 @@ function set_second_argument() { function set_third_argument() { if is_configuration "${1}"; then readonly configuration="${1}" - else + elif ! is_number $1; then print_error "ERROR: third build argument '${1}' is not a configuration" exit 1 fi @@ -220,12 +272,11 @@ function set_gcc_flags() { } function set_msvc_flags() { - readonly msvcCompilerFlags=\ + readonly msvcCommonFlags=\ "/nologo \ /std:c++latest \ /EHsc \ /MT \ -/Z7 \ /W4 \ /WX \ /wd4005 \ @@ -235,6 +286,12 @@ function set_msvc_flags() { /headerUnit \"projects/astl/astl.hpp=${buildRoot}/astl/astl.hpp.ifc\" \ /headerUnit \"projects/awinapi/windows.hpp=${buildRoot}/awinapi/windows.hpp.ifc\" \ /headerUnit \"projects/yamlcpp/yamlcpp.hpp=${buildRoot}/yamlcpp/yamlcpp.hpp.ifc\"" + + if [[ "${configuration}" == "release" ]]; then + readonly msvcCompilerFlags="${msvcCommonFlags} /O2" + elif [[ "${configuration}" == "debug" ]]; then + readonly msvcCompilerFlags="${msvcCommonFlags} /Z7" + fi } function set_build_flags() { @@ -247,56 +304,7 @@ function set_build_flags() { fi } -function build_project() { - local -r buildScript="sh/build/${1}.sh" - - if [[ -f "${buildScript}" ]]; then - run_script "${buildScript}" "${toolchain}" "${configuration}" - else - print_error "ERROR: Project '${1}' does not exist." - exit 1; - fi -} - -function build_dependencies() { - local -r dependencies="${1}" - - for dependency in ${dependencies[@]}; do - build_project "${dependency}" - done -} - -function build() { - if [[ -f "${buildRoot}/${project}.done" ]]; then - return - fi - - build_dependencies "${1}" - - echo "*** ${project} | ${toolchain} | ${configuration} ***" - - mkdir -p "${binDir}" - mkdir -p "${buildDir}" - if [[ "${toolchain}" == "clang" ]]; then - set -e - build_clang - readonly status=$? - elif [[ "${toolchain}" == "gcc" ]]; then - set -e - build_gcc - readonly status=$? - elif [[ "${toolchain}" == "msvc" ]]; then - build_msvc - fi - - if (( $status == 0 )); then - echo "${satus}" > "${buildRoot}/${project}.done" - else - print_error "ERROR: build of '${project}' failed" - exit 1 - fi -} function build_msvc() { echo "@echo off diff --git a/sh/coverage.sh b/sh/coverage.sh index 6029b728..9e60ea17 100755 --- a/sh/coverage.sh +++ b/sh/coverage.sh @@ -1,3 +1,5 @@ +[ -n "$COVERAGE_SH" ] && return || readonly COVERAGE_SH=1 + source "sh/common.sh" if is_windows; then @@ -126,5 +128,3 @@ function print_summary() { print_ok " * branch: ${branch} uncovered" fi } - -coverage diff --git a/sh/install.sh b/sh/install.sh index c7b48121..73214fb9 100755 --- a/sh/install.sh +++ b/sh/install.sh @@ -1,5 +1,15 @@ +[ -n "$INSTALL_SH" ] && return || readonly INSTALL_SH=1 + source "sh/common.sh" +function install() { + if [[ "${1}" == "list" ]]; then + list_packages + else + install_package "${1}" + fi +} + function install_package() { local -r package="${1}" local -r installScript="sh/install/${package}.sh" @@ -9,8 +19,6 @@ function install_package() { run_script "${installScript}" else print_error "ERROR: Package '${package}' does not exist." - echo "" - list_packages exit 1; fi } @@ -24,9 +32,3 @@ function list_packages() { fi done } - -if [[ "${1}" == "list" ]]; then - list_packages -else - install_package "${1}" -fi diff --git a/sh/test.sh b/sh/test.sh index f67ca101..3d9ef753 100755 --- a/sh/test.sh +++ b/sh/test.sh @@ -1,10 +1,28 @@ -source "sh/common.sh" +[ -n "$TEST_SH" ] && return || readonly TEST_SH=1 + +source "sh/build_common.sh" +source "sh/coverage.sh" + +function test_() { + set_build_properties "${1}" "${2}" "${3}" + set_iterations "${1}" "${2}" "${3}" "${4}" + + if [[ "${configuration}" == "coverage" ]]; then + coverage + else + run_tests + fi +} function set_iterations() { if [[ "${1}" != "" ]] && is_number $1; then iterations=$1 elif [[ "${2}" != "" ]] && is_number $2; then iterations=$2 + elif [[ "${3}" != "" ]] && is_number $3; then + iterations=$3 + elif [[ "${4}" != "" ]] && is_number $4; then + iterations=$4 else iterations=1 fi @@ -17,9 +35,9 @@ function run_test() { for (( i=0; i < $iterations; i++ )); do local log - log=$($test) + - if (( $? != 0 )); then + if ! log=$($test); then result=1 failures=$(( $failures + 1 )) echo "${log}" @@ -36,28 +54,32 @@ function run_test() { result=$(( $result + $failures )) } -function run_tests() { - local -r testDir="build/${toolchain}/bin" +function run_all_tests() { + local -r testDir="build/${toolchain}/${configuration}/bin" + result=0 echo "Running tests from '${testDir}'..." if [[ -d "${testDir}" ]]; then - for test in $testDir/*_test$executableExtension; do + for test in ${testDir}/*.test${executableExtension}; do if [[ -f "${test}" ]]; then run_test "${test}" fi done fi +} + +function run_tests() { + if [[ "${project}" != "" ]]; then + run_test "build/${toolchain}/${configuration}/bin/${project}" + else + run_all_tests + fi if (( $result != 0 )); then print_error "Tests FAILED" exit 1 else print_ok "All tests PASSED" - exit 0 fi } - -set_toolchain "${1}" -set_iterations "${1}" "${2}" -run_tests From e80cf9d302ff8ace3787e89bc688dd7778949b30 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 19:24:01 +0200 Subject: [PATCH 16/34] Re-enable tests --- .../aprocess/test/working_directory_test.cpp | 2 +- sh/build/abuild.cache.sh | 8 +- sh/build/abuild.cache.test.sh | 12 +- sh/build/abuild.cpptokenizer.sh | 2 +- sh/build/abuild.cpptokenizer.test.sh | 6 +- sh/build/abuild.scanners.sh | 16 +- sh/build/abuild.scanners.test.sh | 16 +- sh/build/abuild.test_utilities.sh | 4 +- sh/build/acommandline.test.sh | 4 +- sh/build/aprocess.sh | 4 +- sh/build/aprocess.test.sh | 6 +- sh/build/aprocesstestapp.sh | 6 +- sh/build/astl.test.sh | 2 +- sh/build/atest.sh | 4 +- sh/build/atest.test.sh | 2 +- sh/build/athreadpool.test.sh | 6 +- sh/build/awinapi.test.sh | 4 +- sh/build_common.sh | 14 +- sh/coverage.sh | 214 +++++++++++------- sh/test.sh | 10 +- 20 files changed, 196 insertions(+), 146 deletions(-) diff --git a/projects/aprocess/test/working_directory_test.cpp b/projects/aprocess/test/working_directory_test.cpp index 46f5b572..7102a2c6 100644 --- a/projects/aprocess/test/working_directory_test.cpp +++ b/projects/aprocess/test/working_directory_test.cpp @@ -29,6 +29,6 @@ static const auto S = suite("working directory", [] { // NOLINT(cert-err58-cpp) .wait(DEFAULT_WAIT_TIMEOUT); expect(process.working_directory()).to_be(dir); - expect(std::filesystem::path{process.read()}).to_be(dir); + expect(process.read()).to_contain(dir.string()); }); }); diff --git a/sh/build/abuild.cache.sh b/sh/build/abuild.cache.sh index 6f6849ba..5254ad51 100755 --- a/sh/build/abuild.cache.sh +++ b/sh/build/abuild.cache.sh @@ -5,14 +5,14 @@ set_build_properties "abuild.cache" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerFlags} \ -Xclang -emit-module-interface \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ - -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ + -fprebuilt-module-path=${buildRoot}/yamlcpp \ -o "${buildDir}/${project}.pcm" \ -c "${projectDir}/${project}.cpp" ${clang} ${clangCompilerFlags} \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ - -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ + -fprebuilt-module-path=${buildRoot}/yamlcpp \ -o "${buildDir}/${project}.obj" \ -c "${projectDir}/${project}.cpp" } diff --git a/sh/build/abuild.cache.test.sh b/sh/build/abuild.cache.test.sh index f3666223..742239e9 100644 --- a/sh/build/abuild.cache.test.sh +++ b/sh/build/abuild.cache.test.sh @@ -4,12 +4,12 @@ set_build_properties "abuild.cache.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ - -fprebuilt-module-path="${buildRoot}/acommandline" \ - -fprebuilt-module-path="${buildRoot}/abuild.cache" \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ - -fprebuilt-module-path="${buildRoot}/abuild.test_utilities" \ - -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -fprebuilt-module-path=${buildRoot}/atest \ + -fprebuilt-module-path=${buildRoot}/acommandline \ + -fprebuilt-module-path=${buildRoot}/abuild.cache \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ + -fprebuilt-module-path=${buildRoot}/abuild.test_utilities \ + -fprebuilt-module-path=${buildRoot}/yamlcpp \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/cache_test.cpp" \ "${projectDir}/defines_test.cpp" \ diff --git a/sh/build/abuild.cpptokenizer.sh b/sh/build/abuild.cpptokenizer.sh index 994c5532..739b14de 100755 --- a/sh/build/abuild.cpptokenizer.sh +++ b/sh/build/abuild.cpptokenizer.sh @@ -6,7 +6,7 @@ function build_clang() { ${clang} ${clangCompilerFlags} \ -Xclang -emit-module-interface \ -o "${buildDir}/${project}.pcm" \ - -c "${projectDir}/project.cpp" + -c "${projectDir}/${project}.cpp" ${clang} ${clangCompilerFlags} \ -o "${buildDir}/${project}.obj" \ diff --git a/sh/build/abuild.cpptokenizer.test.sh b/sh/build/abuild.cpptokenizer.test.sh index a88173d6..61303211 100644 --- a/sh/build/abuild.cpptokenizer.test.sh +++ b/sh/build/abuild.cpptokenizer.test.sh @@ -4,9 +4,9 @@ set_build_properties "abuild.cpptokenizer.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ - -fprebuilt-module-path="${buildRoot}/acommandline" \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path=${buildRoot}/atest \ + -fprebuilt-module-path=${buildRoot}/acommandline \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/define_test.cpp" \ "${projectDir}/if_bracket_test.cpp" \ diff --git a/sh/build/abuild.scanners.sh b/sh/build/abuild.scanners.sh index de625ba4..9bfbdd5d 100755 --- a/sh/build/abuild.scanners.sh +++ b/sh/build/abuild.scanners.sh @@ -5,18 +5,18 @@ set_build_properties "abuild.scanners" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerFlags} \ -Xclang -emit-module-interface \ - -fprebuilt-module-path="${buildRoot}/abuild.cache" \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ - -fprebuilt-module-path="${buildRoot}/athreadpool" \ - -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -fprebuilt-module-path=${buildRoot}/abuild.cache \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ + -fprebuilt-module-path=${buildRoot}/athreadpool \ + -fprebuilt-module-path=${buildRoot}/yamlcpp \ -o "${buildDir}/${project}.pcm" \ -c "${projectDir}/${project}.cpp" ${clang} ${clangCompilerFlags} \ - -fprebuilt-module-path="${buildRoot}/abuild.cache" \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ - -fprebuilt-module-path="${buildRoot}/athreadpool" \ - -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -fprebuilt-module-path=${buildRoot}/abuild.cache \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ + -fprebuilt-module-path=${buildRoot}/athreadpool \ + -fprebuilt-module-path=${buildRoot}/yamlcpp \ -o "${buildDir}/${project}.obj" \ -c "${projectDir}/${project}.cpp" } diff --git a/sh/build/abuild.scanners.test.sh b/sh/build/abuild.scanners.test.sh index 70fe47bd..7f92a4ef 100644 --- a/sh/build/abuild.scanners.test.sh +++ b/sh/build/abuild.scanners.test.sh @@ -4,14 +4,14 @@ set_build_properties "abuild.scanners.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ - -fprebuilt-module-path="${buildRoot}/acommandline" \ - -fprebuilt-module-path="${buildRoot}/abuild.scanners" \ - -fprebuilt-module-path="${buildRoot}/abuild.cache" \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ - -fprebuilt-module-path="${buildRoot}/abuild.test_utilities" \ - -fprebuilt-module-path="${buildRoot}/athreadpool" \ - -fprebuilt-module-path="${buildRoot}/yamlcpp" \ + -fprebuilt-module-path=${buildRoot}/atest \ + -fprebuilt-module-path=${buildRoot}/acommandline \ + -fprebuilt-module-path=${buildRoot}/abuild.scanners \ + -fprebuilt-module-path=${buildRoot}/abuild.cache \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ + -fprebuilt-module-path=${buildRoot}/abuild.test_utilities \ + -fprebuilt-module-path=${buildRoot}/athreadpool \ + -fprebuilt-module-path=${buildRoot}/yamlcpp \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/main.cpp" \ "${projectDir}/project_scanner_test.cpp" \ diff --git a/sh/build/abuild.test_utilities.sh b/sh/build/abuild.test_utilities.sh index 7d5d2010..25b57dc3 100755 --- a/sh/build/abuild.test_utilities.sh +++ b/sh/build/abuild.test_utilities.sh @@ -5,12 +5,12 @@ set_build_properties "abuild.test_utilities" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerFlags} \ -Xclang -emit-module-interface \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ -o "${buildDir}/${project}.pcm" \ -c "${projectDir}/${project}.cpp" ${clang} ${clangCompilerFlags} \ - -fprebuilt-module-path="${buildRoot}/abuild.cpptokenizer" \ + -fprebuilt-module-path=${buildRoot}/abuild.cpptokenizer \ -o "${buildDir}/${project}.obj" \ -c "${projectDir}/${project}.cpp" } diff --git a/sh/build/acommandline.test.sh b/sh/build/acommandline.test.sh index a082d969..c30256e0 100644 --- a/sh/build/acommandline.test.sh +++ b/sh/build/acommandline.test.sh @@ -4,8 +4,8 @@ set_build_properties "acommandline.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ - -fprebuilt-module-path="${buildRoot}/acommandline" \ + -fprebuilt-module-path=${buildRoot}/atest \ + -fprebuilt-module-path=${buildRoot}/acommandline \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/application_name_test.cpp" \ "${projectDir}/command_line_test.cpp" \ diff --git a/sh/build/aprocess.sh b/sh/build/aprocess.sh index ca6619b7..7b423fb3 100755 --- a/sh/build/aprocess.sh +++ b/sh/build/aprocess.sh @@ -5,12 +5,12 @@ set_build_properties "aprocess" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerFlags} \ -Xclang -emit-module-interface \ - -fprebuilt-module-path="${buildRoot}/awinapi" \ + -fprebuilt-module-path=${buildRoot}/awinapi \ -o "${buildDir}/${project}.pcm" \ -c "${projectDir}/${project}.cpp" ${clang} ${clangCompilerFlags} \ - -fprebuilt-module-path="${buildRoot}/awinapi" \ + -fprebuilt-module-path=${buildRoot}/awinapi \ -o "${buildDir}/${project}.obj" \ -c "${projectDir}/${project}.cpp" } diff --git a/sh/build/aprocess.test.sh b/sh/build/aprocess.test.sh index 5cad25aa..f7dc5f4c 100644 --- a/sh/build/aprocess.test.sh +++ b/sh/build/aprocess.test.sh @@ -4,9 +4,9 @@ set_build_properties "aprocess.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ - -fprebuilt-module-path="${buildRoot}/aprocess" \ - -fprebuilt-module-path="${buildRoot}/awinapi" \ + -fprebuilt-module-path=${buildRoot}/atest \ + -fprebuilt-module-path=${buildRoot}/aprocess \ + -fprebuilt-module-path=${buildRoot}/awinapi \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/arguments_test.cpp" \ "${projectDir}/command_test.cpp" \ diff --git a/sh/build/aprocesstestapp.sh b/sh/build/aprocesstestapp.sh index d8fe5f9f..d2dc5677 100755 --- a/sh/build/aprocesstestapp.sh +++ b/sh/build/aprocesstestapp.sh @@ -4,9 +4,9 @@ set_build_properties "aprocesstestapp" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/aprocess" \ - -fprebuilt-module-path="${buildRoot}/acommandline" \ - -fprebuilt-module-path="${buildRoot}/awinapi" \ + -fprebuilt-module-path=${buildRoot}/aprocess \ + -fprebuilt-module-path=${buildRoot}/acommandline \ + -fprebuilt-module-path=${buildRoot}/awinapi \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/main.cpp" \ "${buildRoot}/aprocess/aprocess.obj" \ diff --git a/sh/build/astl.test.sh b/sh/build/astl.test.sh index 6fb016b1..913d4973 100644 --- a/sh/build/astl.test.sh +++ b/sh/build/astl.test.sh @@ -4,7 +4,7 @@ set_build_properties "astl.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path=${buildRoot}/atest \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/main.cpp" \ "${projectDir}/source_location_test.cpp" \ diff --git a/sh/build/atest.sh b/sh/build/atest.sh index 4035325b..f1daf096 100755 --- a/sh/build/atest.sh +++ b/sh/build/atest.sh @@ -6,12 +6,12 @@ function build_clang() { ${clang} ${clangCompilerFlags} \ -Xclang \ -emit-module-interface \ - -fprebuilt-module-path="${buildRoot}/acommandline" \ + -fprebuilt-module-path=${buildRoot}/acommandline \ -o "${buildDir}/${project}.pcm" \ -c "${projectDir}/${project}.cpp" ${clang} ${clangCompilerFlags} \ - -fprebuilt-module-path="${buildRoot}/acommandline" \ + -fprebuilt-module-path=${buildRoot}/acommandline \ -o "${buildDir}/${project}.obj" \ -c "${projectDir}/${project}.cpp" } diff --git a/sh/build/atest.test.sh b/sh/build/atest.test.sh index 5220c69f..8ba5ecbc 100644 --- a/sh/build/atest.test.sh +++ b/sh/build/atest.test.sh @@ -4,7 +4,7 @@ set_build_properties "atest.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ + -fprebuilt-module-path=${buildRoot}/atest \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/assert_test.cpp" \ "${projectDir}/throwing_test_test.cpp" \ diff --git a/sh/build/athreadpool.test.sh b/sh/build/athreadpool.test.sh index 28d5d9bb..2e2b8862 100644 --- a/sh/build/athreadpool.test.sh +++ b/sh/build/athreadpool.test.sh @@ -4,9 +4,9 @@ set_build_properties "athreadpool.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ - -fprebuilt-module-path="${buildRoot}/acommandline" \ - -fprebuilt-module-path="${buildRoot}/athreadpool" \ + -fprebuilt-module-path=${buildRoot}/atest \ + -fprebuilt-module-path=${buildRoot}/acommandline \ + -fprebuilt-module-path=${buildRoot}/athreadpool \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/main.cpp" \ "${projectDir}/threadpool_test.cpp" \ diff --git a/sh/build/awinapi.test.sh b/sh/build/awinapi.test.sh index 8fac7468..5a16ff46 100644 --- a/sh/build/awinapi.test.sh +++ b/sh/build/awinapi.test.sh @@ -4,8 +4,8 @@ set_build_properties "awinapi.test" "${1}" "${2}" function build_clang() { ${clang} ${clangCompilerLinkerFlags} \ - -fprebuilt-module-path="${buildRoot}/atest" \ - -fprebuilt-module-path="${buildRoot}/awinapi" \ + -fprebuilt-module-path=${buildRoot}/atest \ + -fprebuilt-module-path=${buildRoot}/awinapi \ -o "${binDir}/${project}${executableExtension}" \ "${projectDir}/main.cpp" \ "${projectDir}/buffer_test.cpp" \ diff --git a/sh/build_common.sh b/sh/build_common.sh index 361beb28..f69f76a7 100755 --- a/sh/build_common.sh +++ b/sh/build_common.sh @@ -53,6 +53,10 @@ function build_dependencies() { done } +function is_clang_configuration() { + [[ "${configuration}" == "memory" ]] || [[ "${configuration}" == "coverage" ]] +} + function set_build_properties() { set_build_arguments "${1}" "${2}" "${3}" detect_msvc_env_script @@ -60,7 +64,6 @@ function set_build_properties() { set_build_flags } - function set_build_dirs() { readonly buildRoot="build/${toolchain}/${configuration}" readonly binDir="${buildRoot}/bin" @@ -132,7 +135,9 @@ function validate_toolchain() { fi if [[ "${toolchain}" == "" ]]; then - if is_windows; then + if is_clang_configuration; then + readonly toolchain="clang" + elif is_windows; then readonly toolchain="msvc" elif is_linux; then readonly toolchain="gcc" @@ -148,9 +153,7 @@ function validate_configuration() { print_error "ERROR: libc++ with memory sanitizer not found. Build it with './adev.sh build libc++-msan'." exit 1 fi - fi - - if [[ "${configuration}" == "" ]]; then + elif [[ "${configuration}" == "" ]]; then readonly configuration="release" fi } @@ -165,6 +168,7 @@ function set_clang_common_flags() { -Wno-missing-field-initializers \ -fmodules \ -fimplicit-module-maps \ +-fprebuilt-module-path=${buildRoot}/astl \ -fmodule-map-file=projects/astl/module.modulemap \ -fmodule-map-file=projects/awinapi/module.modulemap \ -fmodule-map-file=projects/aprocess/module.modulemap \ diff --git a/sh/coverage.sh b/sh/coverage.sh index 9e60ea17..f00021c1 100755 --- a/sh/coverage.sh +++ b/sh/coverage.sh @@ -2,129 +2,177 @@ source "sh/common.sh" -if is_windows; then - ignoredSources="(\\\\|\\|\/)(test|test_utilities|yamlcpp)(\\\\|\\|\/)" - uncoveredFunctions="7" - uncoveredLines="41" - uncoveredRegions="40" - uncoveredBranches="4" -else - ignoredSources="\/(test|test_utilities|yamlcpp)\/" - uncoveredFunctions="7" - uncoveredLines="38" - uncoveredRegions="39" - uncoveredBranches="3" -fi +#function | line | region | branch +#e.g. thresholds["abuild.cache.test.exe"]="1 0 1 0" +declare -A thresholds function coverage() { detect_llvm_cov detect_llvm_profdata + set_coverage_properties result=0 - local objectArgs="" - local profData="" - local -r dir=$(pwd) - - for test in build/clang/bin/*_test${executableExtension}; do - if [[ "${test}" != "build/clang/bin/aprocess_test${executableExtension}" ]]; then - objectArgs="${objectArgs} -object=${test}" - - LLVM_PROFILE_FILE="${dir}/${test}.profraw" ${test}>/dev/null - if (( $? != 0 )); then - result=2 - fi - "${llvmProfdata}" merge "${test}.profraw" -o "${test}.profdata" - profData="${profData} ${test}.profdata" - fi - done - - generate_report "${objectArgs}" "${profData}" - generate_summary "${objectArgs}" + if [[ "${project}" != "" ]]; then + coverage_project "${binDir}/${project}" + else + coverage_all + fi - rm build/clang/bin/*.profdata - rm build/clang/bin/*.profraw + cleanup exit $result } -function detect_llvm_cov() { - if ! is_available "${llvmCov}"; then - print_error "ERROR: 'llvm-cov' is not available. Try installing it with './adev.sh install llvm'" - exit 1 +function set_coverage_properties() { + if is_windows; then + readonly ignoredSources="(\\\\|\\|\/)(test|test_utilities|yamlcpp)(\\\\|\\|\/)" + + thresholds["astl.test.exe"]="2 2 2 0" + thresholds["abuild.cache.test.exe"]="3 4 4 0" + thresholds["abuild.scanners.test.exe"]="0 0 0 1" + thresholds["acommandline.test.exe"]="0 1 12 0" + thresholds["aprocess.test.exe"]="1 9 5 5" + thresholds["atest.test.exe"]="2 31 21 2" + thresholds["awinapi.test.exe"]="0 3 1 1" + else + readonly ignoredSources="\/(test|test_utilities|yamlcpp)\/" fi } -function detect_llvm_profdata() { - if ! is_available "${llvmProfdata}"; then - print_error "ERROR: 'llvm-profdata' is not available. Try installing it with './adev.sh install llvm'" - exit 1 - fi +function generate_project_report() { + local -r test="${1}" + + "${llvmCov}" show -output-dir="${buildRoot}/reports/$(basename ${test})" \ + -format=html \ + -instr-profile="${test}.profdata" \ + -ignore-filename-regex="${ignoredSources}" \ + -show-instantiations=false \ + -show-branches=count \ + -show-expansions \ + -show-line-counts-or-regions \ + "${test}" \ + ${sources} } -function generate_report() { - local objectArgs=$1 - local profData=$2 - - "${llvmProfdata}" merge ${profData} -o build/clang/bin/coverage.profdata - "${llvmCov}" show ${objectArgs} -output-dir=build/coverage -format=html -instr-profile=build/clang/bin/coverage.profdata -ignore-filename-regex="${ignoredSources}" -show-instantiations=false -show-branches=count -show-expansions -show-line-counts-or-regions -} +function set_data_points() { + local -r total="${1}" -function generate_summary() { - local objectArgs=$1 - local total=$($llvmCov report $objectArgs -instr-profile=build/clang/bin/coverage.profdata -ignore-filename-regex="${ignoredSources}" | grep "TOTAL.*") local dataPoints=() + for point in ${total}; do dataPoints+=($point) done - local regionDiff=${dataPoints[2]} - local functionDiff=${dataPoints[5]} - local lineDiff=${dataPoints[8]} - local branchDiff=${dataPoints[11]} + regionCoverage=${dataPoints[2]} + functionCoverage=${dataPoints[5]} + lineCoverage=${dataPoints[8]} + branchCoverage=${dataPoints[11]} +} + +function set_thresholds() { + local -r test="${1}" + local -r testThresholds=(${thresholds["${test}"]}) - if [[ "${functionDiff}" != "${uncoveredFunctions}" ]] || [[ "${lineDiff}" != "${uncoveredLines}" ]] || [[ "${regionDiff}" != "${uncoveredRegions}" ]] || [[ "${branchDiff}" != "${uncoveredBranches}" ]]; then + if [[ "${testThresholds}" == "" ]]; then + functionThreshold="0" + lineThreshold="0" + branchThreshold="0" + regionThreshold="0" + else + functionThreshold="${testThresholds[0]}" + lineThreshold="${testThresholds[1]}" + regionThreshold="${testThresholds[2]}" + branchThreshold="${testThresholds[3]}" + fi +} + +function match_thresholds() { + if [[ "${functionCoverage}" == "${functionThreshold}" ]] && [[ "${lineCoverage}" == "${lineThreshold}" ]] && [[ "${regionCoverage}" == "${regionThreshold}" ]] && [[ "${branchCoverage}" == "${branchThreshold}" ]]; then + result=0 + else result=1 fi +} + +function generate_project_summary() { + local -r test="${1}" + local -r basenameTest=$(basename "${test}") + local -r total=$(${llvmCov} report ${test} -instr-profile=${test}.profdata -ignore-filename-regex="${ignoredSources}" ${sources} | grep "TOTAL.*") - print_summary "${functionDiff}" "${lineDiff}" "${regionDiff}" "${branchDiff}" + set_data_points "${total}" + set_thresholds "${basenameTest}" + match_thresholds + print_project_summary "${test}" } -function print_summary() { - local function="${1}" - local line="${2}" - local region="${3}" - local branch="${4}" +function coverage_project() { + local -r test="${1}" - if (( $result == 1 )); then - print_error "ERROR: insufficient code coverage:" - elif (( $result == 2 )); then - print_error "ERROR: tests failed:" + log=$(LLVM_PROFILE_FILE="${test}.profraw" ${test}) + + if (( $? != 0 )); then + echo "${log}" + print_error "[ FAILED ] ${test}" + exit 1 else - print_ok "Code coverage OK" + "${llvmProfdata}" merge "${test}.profraw" -o "${test}.profdata" + set_sources "${test}" + generate_project_report "${test}" + generate_project_summary "${test}" fi +} - if [[ "${function}" != "${uncoveredFunctions}" ]]; then - print_error " * function: ${functionDiff} uncovered (${uncoveredFunctions} expected)" - else - print_ok " * function: ${functionDiff} uncovered" +function coverage_all() { + for test in ${binDir}/*.test${executableExtension}; do + coverage_project "${test}" + done +} + +function cleanup() { + rm -f ${binDir}/*.profdata + rm -f ${binDir}/*.profraw +} + +function detect_llvm_cov() { + if ! is_available "${llvmCov}"; then + print_error "ERROR: 'llvm-cov' is not available. Try installing it with './adev.sh install llvm'" + exit 1 fi +} - if [[ "${line}" != "${uncoveredLines}" ]]; then - print_error " * line: ${line} uncovered (${uncoveredLines} expected)" - else - print_ok " * line: ${line} uncovered" +function detect_llvm_profdata() { + if ! is_available "${llvmProfdata}"; then + print_error "ERROR: 'llvm-profdata' is not available. Try installing it with './adev.sh install llvm'" + exit 1 fi +} + +function print_project_summary() { + local -r test="${1}" - if [[ "${region}" != "${uncoveredRegions}" ]]; then - print_error " * region: ${region} uncovered (${uncoveredRegions} expected)" + if (( $result == 1 )); then + print_error "[ FAILED ] ${test} +Insufficient coverage: + * function: ${functionCoverage} uncovered (must be ${functionThreshold}) + * line: ${lineCoverage} uncovered (must be ${lineThreshold}) + * region: ${regionCoverage} uncovered (must be ${branchThreshold}) + * branch: ${branchCoverage} uncovered (must be ${regionThreshold})" else - print_ok " * region: ${region} uncovered" + print_ok "[ PASSED ] ${test}" fi +} + +function set_sources() { + local -r test="${1}" + local -r baseName=$(basename ${test}) + sources="" - if [[ "${branch}" != "${uncoveredBranches}" ]]; then - print_error " * branch: ${branch} uncovered (${uncoveredBranches} expected)" + if [[ "${baseName}" == *.exe ]]; then + local -r projectName="${baseName:: -9}" else - print_ok " * branch: ${branch} uncovered" + local -r projectName="${baseName:: -5}" fi + + sources="$(find projects/${projectName} -maxdepth 1 -name *.cpp) $(find projects/${projectName} -maxdepth 1 -name *.hpp)" } diff --git a/sh/test.sh b/sh/test.sh index 3d9ef753..e5c928f4 100755 --- a/sh/test.sh +++ b/sh/test.sh @@ -55,13 +55,11 @@ function run_test() { } function run_all_tests() { - local -r testDir="build/${toolchain}/${configuration}/bin" - result=0 - echo "Running tests from '${testDir}'..." + echo "Running tests from '${binDir}'..." - if [[ -d "${testDir}" ]]; then - for test in ${testDir}/*.test${executableExtension}; do + if [[ -d "${binDir}" ]]; then + for test in ${binDir}/*.test${executableExtension}; do if [[ -f "${test}" ]]; then run_test "${test}" fi @@ -71,7 +69,7 @@ function run_all_tests() { function run_tests() { if [[ "${project}" != "" ]]; then - run_test "build/${toolchain}/${configuration}/bin/${project}" + run_test "${binDir}/${project}" else run_all_tests fi From 677bae1d3dd51447164e5b2b698d744186664d85 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 19:34:50 +0200 Subject: [PATCH 17/34] Enable coverage --- sh/coverage.sh | 19 ++----------------- sh/coverage_thresholds.sh | 12 ++++++++++++ 2 files changed, 14 insertions(+), 17 deletions(-) create mode 100644 sh/coverage_thresholds.sh diff --git a/sh/coverage.sh b/sh/coverage.sh index f00021c1..3a6097a3 100755 --- a/sh/coverage.sh +++ b/sh/coverage.sh @@ -1,6 +1,7 @@ [ -n "$COVERAGE_SH" ] && return || readonly COVERAGE_SH=1 source "sh/common.sh" +source "sh/coverage_thresholds.sh" #function | line | region | branch #e.g. thresholds["abuild.cache.test.exe"]="1 0 1 0" @@ -9,8 +10,8 @@ declare -A thresholds function coverage() { detect_llvm_cov detect_llvm_profdata - set_coverage_properties + readonly ignoredSources="(\\\\|\\|\/)(test|test_utilities|yamlcpp)(\\\\|\\|\/)" result=0 if [[ "${project}" != "" ]]; then @@ -24,22 +25,6 @@ function coverage() { exit $result } -function set_coverage_properties() { - if is_windows; then - readonly ignoredSources="(\\\\|\\|\/)(test|test_utilities|yamlcpp)(\\\\|\\|\/)" - - thresholds["astl.test.exe"]="2 2 2 0" - thresholds["abuild.cache.test.exe"]="3 4 4 0" - thresholds["abuild.scanners.test.exe"]="0 0 0 1" - thresholds["acommandline.test.exe"]="0 1 12 0" - thresholds["aprocess.test.exe"]="1 9 5 5" - thresholds["atest.test.exe"]="2 31 21 2" - thresholds["awinapi.test.exe"]="0 3 1 1" - else - readonly ignoredSources="\/(test|test_utilities|yamlcpp)\/" - fi -} - function generate_project_report() { local -r test="${1}" diff --git a/sh/coverage_thresholds.sh b/sh/coverage_thresholds.sh new file mode 100644 index 00000000..9b7af65e --- /dev/null +++ b/sh/coverage_thresholds.sh @@ -0,0 +1,12 @@ +[ -n "$COVERAGE_THRESHOLDS_SH" ] && return || readonly COVERAGE_THRESHOLDS_SH=1 + +#function | line | region | branch +#e.g. thresholds["abuild.cache.test.exe"]="1 0 1 0" +declare -A thresholds +thresholds["astl.test.exe"]="2 2 2 0" +thresholds["abuild.cache.test.exe"]="3 4 4 0" +thresholds["abuild.scanners.test.exe"]="0 0 0 1" +thresholds["acommandline.test.exe"]="0 1 12 0" +thresholds["aprocess.test.exe"]="1 9 5 5" +thresholds["atest.test.exe"]="2 31 21 2" +thresholds["awinapi.test.exe"]="0 3 1 1" \ No newline at end of file From b9b1101a341965873e613fc2302c766afe04e0bd Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 20:46:14 +0200 Subject: [PATCH 18/34] Re-enable analysis --- .gitignore | 3 +- build.sh | 2 +- compile_flags.txt | 24 ++-- readme.md | 1 + sh/analyse.sh | 175 +++++++++++------------- sh/{clang-tidy.sh => analyse_checks.sh} | 34 +++-- sh/coverage.sh | 9 +- 7 files changed, 121 insertions(+), 127 deletions(-) rename sh/{clang-tidy.sh => analyse_checks.sh} (88%) diff --git a/.gitignore b/.gitignore index b27ebb9e..7bef51eb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,8 @@ *.pcm *.pch *.profraw +*.profdata /gcm.cache/ -.clang-tidy #JS node_modules/ @@ -20,3 +20,4 @@ node_modules/ /build/ /.vscode/ /build.bat +/.clang-tidy diff --git a/build.sh b/build.sh index 8bf605db..5f3b3386 100644 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -#source "sh/analyse.sh" +source "sh/analyse.sh" source "sh/build.sh" source "sh/format.sh" source "sh/help.sh" diff --git a/compile_flags.txt b/compile_flags.txt index 33da5d6f..b943fc28 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -6,19 +6,19 @@ -Wno-missing-field-initializers -fmodules -fimplicit-module-maps --fprebuilt-module-path=build/clang/acommandline --fprebuilt-module-path=build/clang/atest --fprebuilt-module-path=build/clang/astl --fprebuilt-module-path=build/clang/aprocess --fprebuilt-module-path=build/clang/athreadpool --fprebuilt-module-path=build/clang/awinapi --fprebuilt-module-path=build/clang/abuild.cpptokenizer --fprebuilt-module-path=build/clang/abuild.cache --fprebuilt-module-path=build/clang/abuild.scanners --fprebuilt-module-path=build/clang/abuild.test_utilities --fprebuilt-module-path=build/clang/yamlcpp +-fprebuilt-module-path=build/clang/release/acommandline +-fprebuilt-module-path=build/clang/release/atest +-fprebuilt-module-path=build/clang/release/astl +-fprebuilt-module-path=build/clang/release/aprocess +-fprebuilt-module-path=build/clang/release/athreadpool +-fprebuilt-module-path=build/clang/release/awinapi +-fprebuilt-module-path=build/clang/release/abuild.cpptokenizer +-fprebuilt-module-path=build/clang/release/abuild.cache +-fprebuilt-module-path=build/clang/release/abuild.scanners +-fprebuilt-module-path=build/clang/release/abuild.test_utilities +-fprebuilt-module-path=build/clang/release/yamlcpp -fmodule-map-file=projects/astl/module.modulemap -fmodule-map-file=projects/awinapi/module.modulemap -fmodule-map-file=projects/aprocess/module.modulemap -fmodule-map-file=projects/yamlcpp/module.modulemap --Iprojects/yamlcpp/include \ No newline at end of file +-I projects/yamlcpp/include diff --git a/readme.md b/readme.md index 6352b798..85ee4804 100644 --- a/readme.md +++ b/readme.md @@ -114,6 +114,7 @@ There are two workflows: | -------- | ----------------- | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------- | | any | coverage | llvm | 13 | LLVM instrumentation has difficulties with `if constexpr` and some other entities showing them "uncovered" even though they are executed. | **None.** Increase coverage thresholds as needed. | 29/09/2021 | | any | coverage | llvm | 13 | LLVM source code based coverage has difficulties with spawned processes. The resulting `profraw` file is reported as corrupted and cannot be used by `llvm-profdata`. | **None.** Exclude affected projects from coverage. | 25/11/2021 | +| any | analysis | llvm | 13 | `clang-tidy` cannot use TemplateParameterCase style parameter along with other style checks citing "invalid style". | **None.** Do not use for now. | 02/10/2021 | | Linux | build | gcc | 11 | Unable to use its own STL (`libstdc++`) as header units. Build fails on internal compiler error. The `libc++` does not work either. | **None.** GCC is not usable with modules and STL. | 31/08/2021 | | Linux | analysis | llvm | 13 | `clang-tidy` has difficulties using Unix headers such as `wait.h` as header units even with correct `module.modulemap`. The build si ok. | Specify the headers in `module.modulemap` manually. | 25/11/2021 | | Linux | address-sanitizer | llvm | 13.0.1 | Address sanitizer produces `alloc-dealloc-mismatch` false positives coming from `libc++`. | Set `export ASAN_OPTIONS=alloc_dealloc_mismatch=0` before running the tests built with asan. | 18/01/2022 | diff --git a/sh/analyse.sh b/sh/analyse.sh index ea6d148e..2ce0d30d 100755 --- a/sh/analyse.sh +++ b/sh/analyse.sh @@ -1,119 +1,97 @@ -source sh/common.sh -source sh/clang-tidy.sh +[ -n "$ANALYSE_SH" ] && return || readonly ANALYSE_SH=1 -pids=() +source sh/build_common.sh +source sh/analyse_checks.sh function analyse() { - local parameter="${1}" + detect_clang_tidy - if [[ "${parameter}" == "" ]] || [[ "${parameter}" == "diff" ]]; then - analyse_projects "${parameter}" - else - analyse_project "${parameter}" - fi -} + pids=() -function analyse_source() { - if [[ "${1}" == projects/yamlcpp/* ]]; then - return; + set_analyse_properties "${1}" "${2}" + + if [[ "${file}" != "" ]]; then + analyse_source "${file}" + else + analyse_projects fi - wait_for_free_job 8 # $(nproc) - do_analyse_source $1 $2 & - pids+=($!) -} + wait_for_jobs -function analyse_sources() { - local path="${1}" - local diff="${2}" + if (( $result == 0 )); then + print_ok "Analysis OK" + else + print_error "ERROR: analysis found issues (see above)" + fi - for source in $path/*.cpp; do - if should_analyse "${diff}" "${source}"; then - analyse_source "${source}" - fi - done + exit $result } function analyse_project() { - local project="${1}" - local diff="${2}" + local -r project="${1}" - if [[ "${project}" != "astl" ]]; then - analyse_project_module "${project}" "${diff}" - analyse_project_main "${project}" "${diff}" - analyse_project_test "${project}" "${diff}" - fi + analyse_project_module "${project}" + analyse_project_main "${project}" + analyse_project_test "${project}" } function analyse_project_module() { - local project="${1}" - local diff="${2}" + local -r project="${1}" - if [[ "${project}" == */* ]]; then - local ar=(${project//\// }) - local fileName=${ar[1]} - else - local fileName=${project} - fi - - local source="projects/${project}/${fileName}.cpp" - - if [[ -f "${source}" ]]; then - analyse_project_module_source "${source}" "${project}" "${diff}" + if [[ -f "projects/${project}/${project}.cpp" ]]; then + analyse_project_module_source "${project}" fi } function analyse_project_module_source() { - local source="${1}" - local project="${2}" - local diff="${3}" + local project="${1}" local sources=(projects/${project}/*.cpp) - sources="${sources[@]}" - if should_analyse "${diff}" "${sources}"; then - analyse_source "${source}" "-header-filter=.*\\.cpp" + if should_analyse "${sources[@]}"; then + analyse_source "projects/${project}/${project}.cpp" fi } function analyse_project_main() { local project="${1}" - local diff="${2}" local source="projects/${project}/main.cpp" - if [[ -f "${source}" ]] && should_analyse "${diff}" "${source}"; then + if [[ -f "${source}" ]] && should_analyse "${source}"; then analyse_source "${source}" fi } function analyse_project_test() { local project="${1}" - local diff="${diff}" local path="projects/${project}/test" if [[ -d "${path}" ]]; then - analyse_sources "${path}" "${diff}" + analyse_sources "${path}" fi } function analyse_projects() { - local diff="${1}" - for project in projects/*; do - if [[ -d "${project}" ]]; then - analyse_project "${project:9}" "${diff}" - analyse_subprojects "${project}" "${diff}" - fi + analyse_project "${project:9}" done } -function analyse_subprojects() { - local project="${1}" - local diff="${2}" - local size=${#project}+1 - - for subproject in "${project}"/*; do - if [[ -d "${subproject}" ]] && ! [[ "${subproject}" == */test ]]; then - analyse_project "${project:9}/${subproject:${size}}" "${diff}" +function analyse_source() { + if [[ "${1}" == projects/yamlcpp/* ]]; then + return; + fi + + wait_for_free_job 8 # $(nproc) + do_analyse_source "${1}" "${2}" & + pids+=($!) +} + +function analyse_sources() { + local path="${1}" + + for source in ${path}/*.cpp; do + if should_analyse "${source}"; then + analyse_source "${source}" fi done } @@ -134,7 +112,7 @@ function do_analyse_source() { local source="${1}" local headerFilter="${2}" local log - log=$(${clangTidy} --quiet ${libCppModuleMap} ${headerFilter} ${source} 2>&1) + log=$(${clangTidy} --quiet ${libCppModuleMap} "-header-filter=.*\\.cpp" ${source} 2>&1) if (( $? != 0 )); then echo "${log}" @@ -146,6 +124,23 @@ function do_analyse_source() { fi } +function set_analyse_properties() { + if [[ "${1}" == "diff" ]]; then + diff="diff" + set_checks "${2}" + elif [[ -f "${1}" ]]; then + file="${1}" + set_checks "${2}" + else + set_checks "${1}" + fi + + if ! [[ -d "build/clang/release" ]]; then + print_error "ERROR: 'clang | release' build missing. Please build it with './build.sh clang release'." + exit 1 + fi +} + function set_checks() { local checkSets=("${1}") local checks="" @@ -154,9 +149,11 @@ function set_checks() { checkSets=("bugprone cert cppcoreguidelines fuchsia google hicpp misc modernize performance readability") fi - for check in ${checkSets[@]}; do - checks="${checks} -${allChecks[$check]}," + for checkSet in ${checkSets[@]}; do + for check in ${allChecks[$checkSet]}; do + checks="${checks} +${check}," + done done echo "Checks: '${checks} @@ -165,6 +162,8 @@ WarningsAsErrors: '${checks} ' FormatStyle: file CheckOptions: + - key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals + value: true - key: readability-identifier-naming.ClassCase value: 'CamelCase' - key: readability-identifier-naming.EnumCase @@ -181,8 +180,9 @@ CheckOptions: value: 'lower_case' - key: readability-identifier-naming.StructCase value: 'CamelCase' - - key: readability-identifier-naming.TemplateParameterCase - value: 'CamelCase' + #Broken since LLVM 13 (2nd October 2021) + #- key: readability-identifier-naming.TemplateParameterCase + # value: 'CamelCase' - key: readability-identifier-naming.ValueTemplateParameterCase value: 'camelBack' - key: readability-identifier-naming.TypeAliasCase @@ -192,10 +192,9 @@ CheckOptions: } function should_analyse() { - local -r diff="${1}" - local -r sources="${2}" + local -r sources="${1}" - ( ! [[ "${diff}" == "diff" ]] || is_changed "${sources}" ) + [[ "${diff}" == "" ]] || is_changed "${sources}" } function wait_for_free_job() { @@ -210,23 +209,3 @@ function wait_for_jobs() { wait $job || result=1 done } - -detect_clang_tidy - -if [[ "${1}" == "diff" ]]; then - set_checks "${2}" - analyse "${1}" -else - set_checks "${1}" - analyse -fi - -wait_for_jobs - -if (( $result == 0 )); then - print_ok "Analysis OK" -else - print_error "ERROR: analysis found issues (see above)" -fi - -exit $result diff --git a/sh/clang-tidy.sh b/sh/analyse_checks.sh similarity index 88% rename from sh/clang-tidy.sh rename to sh/analyse_checks.sh index 9de046c9..c1f871eb 100644 --- a/sh/clang-tidy.sh +++ b/sh/analyse_checks.sh @@ -1,6 +1,9 @@ +[ -n "$ANALYSE_CHECKS_SH" ] && return || readonly ANALYSE_CHECKS_SH=1 + declare -A allChecks -allChecks["bugprone"]="bugprone-bool-pointer-implicit-conversion +allChecks["bugprone"]=\ +"bugprone-bool-pointer-implicit-conversion bugprone-branch-clone bugprone-copy-constructor-init bugprone-dangling-handle @@ -45,7 +48,8 @@ bugprone-unused-return-value bugprone-use-after-move bugprone-virtual-near-miss" -allChecks["cert"]="cert-dcl21-cpp +allChecks["cert"]=\ +"cert-dcl21-cpp cert-dcl58-cpp cert-env33-c cert-err33-c @@ -53,7 +57,8 @@ cert-err58-cpp cert-err60-cpp cert-mem57-cpp" -allChecks["cppcoreguidelines"]="cppcoreguidelines-avoid-non-const-global-variables +allChecks["cppcoreguidelines"]=\ +"cppcoreguidelines-avoid-non-const-global-variables cppcoreguidelines-init-variables cppcoreguidelines-interfaces-global-init cppcoreguidelines-narrowing-conversions @@ -70,17 +75,19 @@ cppcoreguidelines-pro-type-reinterpret-cast cppcoreguidelines-pro-type-static-cast-downcast cppcoreguidelines-pro-type-vararg cppcoreguidelines-slicing -cppcoreguidelines-special-member-functions (IgnorePositiveIntegerLiterals: true) +cppcoreguidelines-special-member-functions cppcoreguidelines-virtual-class-destructor" -allChecks["fuchsia"]="fuchsia-default-arguments-calls +allChecks["fuchsia"]=\ +"fuchsia-default-arguments-calls fuchsia-default-arguments-declarations fuchsia-multiple-inheritance fuchsia-overloaded-operator fuchsia-statically-constructed-objects fuchsia-virtual-inheritance" -allChecks["google"]="google-build-explicit-make-pair +allChecks["google"]=\ +"google-build-explicit-make-pair google-build-namespaces google-build-using-namespace google-default-arguments @@ -89,10 +96,12 @@ google-readability-casting google-runtime-int google-runtime-operator" -allChecks["hicpp"]="hicpp-exception-baseclass +allChecks["hicpp"]=\ +"hicpp-exception-baseclass hicpp-signed-bitwise" -allChecks["misc"]="misc-misleading-bidirectional +allChecks["misc"]=\ +"misc-misleading-bidirectional misc-misleading-identifier misc-misplaced-const misc-new-delete-overloads @@ -106,7 +115,8 @@ misc-unused-alias-decls misc-unused-parameters misc-unused-using-decls" -allChecks["modernize"]="modernize-avoid-bind +allChecks["modernize"]=\ +"modernize-avoid-bind modernize-avoid-c-arrays modernize-deprecated-ios-base-aliases modernize-loop-convert @@ -128,7 +138,8 @@ modernize-use-trailing-return-type modernize-use-transparent-functors modernize-use-using" -allChecks["performance"]="performance-faster-string-find +allChecks["performance"]=\ +"performance-faster-string-find performance-for-range-copy performance-implicit-conversion-in-loop performance-inefficient-algorithm @@ -144,7 +155,8 @@ performance-type-promotion-in-math-fn performance-unnecessary-copy-initialization performance-unnecessary-value-param" -allChecks["readability"]="readability-avoid-const-params-in-decls +allChecks["readability"]=\ +"readability-avoid-const-params-in-decls readability-braces-around-statements readability-const-return-type readability-container-contains diff --git a/sh/coverage.sh b/sh/coverage.sh index 3a6097a3..84cfd509 100755 --- a/sh/coverage.sh +++ b/sh/coverage.sh @@ -3,10 +3,6 @@ source "sh/common.sh" source "sh/coverage_thresholds.sh" -#function | line | region | branch -#e.g. thresholds["abuild.cache.test.exe"]="1 0 1 0" -declare -A thresholds - function coverage() { detect_llvm_cov detect_llvm_profdata @@ -109,6 +105,11 @@ function coverage_project() { } function coverage_all() { + if ! [[ -d "${binDir}" ]]; then + print_error "ERROR: 'clang | coverage' build missing. Please build it with './build.sh clang coverage'." + exit 1 + fi + for test in ${binDir}/*.test${executableExtension}; do coverage_project "${test}" done From 86db320861172b1d9aba4560d8b9c60d5f53f627 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 21:12:26 +0200 Subject: [PATCH 19/34] Update install scripts --- containerfile | 2 +- sh/common.sh | 1 + sh/install/gcc.sh | 4 ++-- sh/install/llvm.sh | 11 ++--------- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/containerfile b/containerfile index e30b8155..d00004d6 100644 --- a/containerfile +++ b/containerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 WORKDIR /adev ADD adev.sh /adev diff --git a/sh/common.sh b/sh/common.sh index 7e53ca57..6d105a2f 100755 --- a/sh/common.sh +++ b/sh/common.sh @@ -77,6 +77,7 @@ function set_linux_properties() { readonly home="/adev" readonly llvmVersion=14 readonly gccVersion=12 + readonly ubuntuRepository="jammy" readonly clang="clang++-${llvmVersion}" readonly clangFormat="clang-format-${llvmVersion}" readonly clangTidy="clang-tidy-${llvmVersion}" diff --git a/sh/install/gcc.sh b/sh/install/gcc.sh index bdf31045..3c071a89 100755 --- a/sh/install/gcc.sh +++ b/sh/install/gcc.sh @@ -4,7 +4,7 @@ if is_windows; then print_error "GCC is not available on Windows" exit 1 else - sudo add-apt-repository -y 'deb http://mirrors.kernel.org/ubuntu hirsute main universe' + sudo add-apt-repository -y "deb http://mirrors.kernel.org/ubuntu ${ubuntuRepository} main universe" sudo apt-get update -y - sudo apt-get install -y g++-12 + sudo apt-get install -y g++-${gccVersion} fi diff --git a/sh/install/llvm.sh b/sh/install/llvm.sh index d181cdf5..c1d28796 100755 --- a/sh/install/llvm.sh +++ b/sh/install/llvm.sh @@ -6,14 +6,7 @@ else sudo apt-get update -y sudo apt-get install -y lsb-release wget software-properties-common apt-utils wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - - sudo add-apt-repository -y "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${llvmVersion} main" + sudo add-apt-repository -y "deb http://apt.llvm.org/${ubuntuRepository}/ llvm-toolchain-${ubuntuRepository}-${llvmVersion} main" sudo apt-get update -y - sudo apt-get install -y ${clang} - sudo apt-get install -y ${clangFormat} - sudo apt-get install -y ${clangTidy} - sudo apt-get install -y libc++-${llvmVersion}-dev - sudo apt-get install -y libc++abi-${llvmVersion}-dev - sudo apt-get install -y ${lld} - sudo apt-get install -y llvm-${llvmVersion} - sudo apt-get install -y libunwind-${llvmVersion}-dev + sudo apt-get install -y ${clang} ${clangFormat} ${clangTidy} libc++-${llvmVersion}-dev libc++abi-${llvmVersion}-dev ${lld} llvm-${llvmVersion} libunwind-${llvmVersion}-dev fi From 8b59d4bdbf34111a15b135ac34c9003ce2783d2c Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 21:20:45 +0200 Subject: [PATCH 20/34] Minor fixes --- containerfile | 2 +- sh/analyse.sh | 2 +- sh/build_common.sh | 2 +- sh/coverage.sh | 4 ++-- sh/docker.sh | 14 +++++++------- sh/format.sh | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/containerfile b/containerfile index d00004d6..b614de18 100644 --- a/containerfile +++ b/containerfile @@ -1,6 +1,6 @@ FROM ubuntu:22.04 WORKDIR /adev -ADD adev.sh /adev +ADD build.sh /adev ADD sh /adev/sh RUN bash sh/docker.sh diff --git a/sh/analyse.sh b/sh/analyse.sh index 2ce0d30d..5a1894b2 100755 --- a/sh/analyse.sh +++ b/sh/analyse.sh @@ -98,7 +98,7 @@ function analyse_sources() { function detect_clang_tidy() { if ! is_available "${clangTidy}"; then - print_error "ERROR: ${clangTidy} is not available. Please install it with './adev.sh install llvm'." + print_error "ERROR: ${clangTidy} is not available. Please install it with './build.sh install llvm'." else if is_linux; then libCppModuleMap="--extra-arg=-fmodule-map-file=/usr/lib/llvm-${llvmVersion}/include/c++/v1/module.modulemap" diff --git a/sh/build_common.sh b/sh/build_common.sh index f69f76a7..48b2f7fb 100755 --- a/sh/build_common.sh +++ b/sh/build_common.sh @@ -150,7 +150,7 @@ function validate_toolchain() { function validate_configuration() { if [[ "${configuration}" == "memory" ]]; then if [[ ! -d "${libCppMsanRoot}" ]]; then - print_error "ERROR: libc++ with memory sanitizer not found. Build it with './adev.sh build libc++-msan'." + print_error "ERROR: libc++ with memory sanitizer not found. Build it with './build.sh libc++-msan'." exit 1 fi elif [[ "${configuration}" == "" ]]; then diff --git a/sh/coverage.sh b/sh/coverage.sh index 84cfd509..1358e771 100755 --- a/sh/coverage.sh +++ b/sh/coverage.sh @@ -122,14 +122,14 @@ function cleanup() { function detect_llvm_cov() { if ! is_available "${llvmCov}"; then - print_error "ERROR: 'llvm-cov' is not available. Try installing it with './adev.sh install llvm'" + print_error "ERROR: 'llvm-cov' is not available. Try installing it with './build.sh install llvm'" exit 1 fi } function detect_llvm_profdata() { if ! is_available "${llvmProfdata}"; then - print_error "ERROR: 'llvm-profdata' is not available. Try installing it with './adev.sh install llvm'" + print_error "ERROR: 'llvm-profdata' is not available. Try installing it with './build.sh install llvm'" exit 1 fi } diff --git a/sh/docker.sh b/sh/docker.sh index b90834f0..3b7552a0 100755 --- a/sh/docker.sh +++ b/sh/docker.sh @@ -11,16 +11,16 @@ function install_prerequisites() { } function install() { - bash ./adev.sh install llvm - bash ./adev.sh install gcc - bash ./adev.sh install doxygen - bash ./adev.sh install ninja - bash ./adev.sh install cmake - bash ./adev.sh build libc++-msan + bash ./build.sh install llvm + bash ./build.sh install gcc + bash ./build.sh install doxygen + bash ./build.sh install ninja + bash ./build.sh install cmake + bash ./build.sh libc++-msan } function cleanup() { - rm "${home}/adev.sh" + rm "${home}/build.sh" rm -rf "${home}/sh" rm -rf "${home}/llvm" } diff --git a/sh/format.sh b/sh/format.sh index 32b65a10..9599f4aa 100755 --- a/sh/format.sh +++ b/sh/format.sh @@ -53,7 +53,7 @@ function format_sources() { function detect_clang_format() { if ! is_available "${clangFormat}"; then - print_error "ERROR: ${clangFormat} is not available. Please install it with './adev.sh install llvm'." + print_error "ERROR: ${clangFormat} is not available. Please install it with './build.sh install llvm'." else ${clangFormat} --version | head -n 1 fi From d642d8407de6b69e2dfd44044cf39bee0a5827df Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sat, 14 May 2022 23:23:49 +0200 Subject: [PATCH 21/34] Linux fixes --- .../abuild.test_utilities/test_project.cpp | 1 + .../abuild.test_utilities/token_operators.cpp | 26 +++++++++++++++++++ projects/aprocesstestapp/main.cpp | 1 + readme.md | 23 ++++++++-------- sh/build_common.sh | 12 ++++----- sh/build_docs.sh | 4 ++- sh/build_libc++_msan.sh | 2 -- sh/coverage.sh | 9 ++++--- sh/coverage_thresholds.sh | 14 +++++++++- 9 files changed, 67 insertions(+), 25 deletions(-) diff --git a/projects/abuild.test_utilities/test_project.cpp b/projects/abuild.test_utilities/test_project.cpp index a2b5b9be..e92a0e9b 100644 --- a/projects/abuild.test_utilities/test_project.cpp +++ b/projects/abuild.test_utilities/test_project.cpp @@ -5,6 +5,7 @@ export import :test_file; namespace abuild { +//! \private export class ProjectRoot { public: diff --git a/projects/abuild.test_utilities/token_operators.cpp b/projects/abuild.test_utilities/token_operators.cpp index d0503ff3..50547168 100644 --- a/projects/abuild.test_utilities/token_operators.cpp +++ b/projects/abuild.test_utilities/token_operators.cpp @@ -5,131 +5,157 @@ export import abuild.cpptokenizer; namespace abuild { +//! \private export [[nodiscard]] constexpr auto operator==([[maybe_unused]] const AndToken &left, [[maybe_unused]] const AndToken &right) noexcept -> bool { return true; } +//! \private export [[nodiscard]] constexpr auto operator==(const DefinedToken &left, const DefinedToken &right) noexcept -> bool { return left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==([[maybe_unused]] const EqualsToken &left, [[maybe_unused]] const EqualsToken &right) noexcept -> bool { return true; } +//! \private export [[nodiscard]] constexpr auto operator==(const GreaterThanOrEqualsToken &left, const GreaterThanOrEqualsToken &right) noexcept -> bool { return left.left == right.left && left.right == right.right; } +//! \private export [[nodiscard]] constexpr auto operator==(const GreaterThanToken &left, const GreaterThanToken &right) noexcept -> bool { return left.left == right.left && left.right == right.right; } +//! \private export [[nodiscard]] constexpr auto operator==([[maybe_unused]] const LeftBracketToken &left, [[maybe_unused]] const LeftBracketToken &right) noexcept -> bool { return true; } +//! \private export [[nodiscard]] constexpr auto operator==(const LessThanOrEqualsToken &left, const LessThanOrEqualsToken &right) noexcept -> bool { return left.left == right.left && left.right == right.right; } +//! \private export [[nodiscard]] constexpr auto operator==(const LessThanToken &left, const LessThanToken &right) noexcept -> bool { return left.left == right.left && left.right == right.right; } +//! \private export [[nodiscard]] constexpr auto operator==(const HasIncludeLocalToken &left, const HasIncludeLocalToken &right) noexcept -> bool { return left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const HasIncludeExternalToken &left, const HasIncludeExternalToken &right) noexcept -> bool { return left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==([[maybe_unused]] const NotToken &left, [[maybe_unused]] const NotToken &right) noexcept -> bool { return true; } +//! \private export [[nodiscard]] constexpr auto operator==([[maybe_unused]] const OrToken &left, [[maybe_unused]] const OrToken &right) noexcept -> bool { return true; } +//! \private export [[nodiscard]] constexpr auto operator==([[maybe_unused]] const RightBracketToken &left, [[maybe_unused]] const RightBracketToken &right) noexcept -> bool { return true; } +//! \private export [[nodiscard]] constexpr auto operator==(const IfToken &left, const IfToken &right) noexcept -> bool { return left.elements == right.elements; } +//! \private export [[nodiscard]] constexpr auto operator==([[maybe_unused]] const ElseToken &left, [[maybe_unused]] const ElseToken &right) noexcept -> bool { return true; } +//! \private export [[nodiscard]] constexpr auto operator==([[maybe_unused]] const EndIfToken &left, [[maybe_unused]] const EndIfToken &right) noexcept -> bool { return true; } +//! \private export [[nodiscard]] constexpr auto operator==(const DefineToken &left, const DefineToken &right) noexcept -> bool { return left.name == right.name && left.value == right.value; } +//! \private export [[nodiscard]] constexpr auto operator==(const ImportIncludeExternalToken &left, const ImportIncludeExternalToken &right) noexcept -> bool { return left.exported == right.exported && left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const ImportIncludeLocalToken &left, const ImportIncludeLocalToken &right) noexcept -> bool { return left.exported == right.exported && left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const ImportModulePartitionToken &left, const ImportModulePartitionToken &right) noexcept -> bool { return left.exported == right.exported && left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const ImportModuleToken &left, const ImportModuleToken &right) noexcept -> bool { return left.exported == right.exported && left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const IncludeExternalToken &left, const IncludeExternalToken &right) noexcept -> bool { return left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const IncludeLocalToken &left, const IncludeLocalToken &right) noexcept -> bool { return left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const ModulePartitionToken &left, const ModulePartitionToken &right) noexcept -> bool { return left.exported == right.exported && left.mod == right.mod && left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const ModuleToken &left, const ModuleToken &right) noexcept -> bool { return left.exported == right.exported && left.name == right.name; } +//! \private export [[nodiscard]] constexpr auto operator==(const UndefToken &left, const UndefToken &right) noexcept -> bool { return left.name == right.name; diff --git a/projects/aprocesstestapp/main.cpp b/projects/aprocesstestapp/main.cpp index 39f68b65..1c718b5e 100644 --- a/projects/aprocesstestapp/main.cpp +++ b/projects/aprocesstestapp/main.cpp @@ -1,6 +1,7 @@ import awinapi; import acommandline; +//! \private struct Inputs { std::int64_t exitCode = 0; diff --git a/readme.md b/readme.md index 85ee4804..f4826193 100644 --- a/readme.md +++ b/readme.md @@ -110,15 +110,14 @@ There are two workflows: ## Known Issues -| Platform | Action | Tool | Version | Description | Workaround | Date | -| -------- | ----------------- | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------- | -| any | coverage | llvm | 13 | LLVM instrumentation has difficulties with `if constexpr` and some other entities showing them "uncovered" even though they are executed. | **None.** Increase coverage thresholds as needed. | 29/09/2021 | -| any | coverage | llvm | 13 | LLVM source code based coverage has difficulties with spawned processes. The resulting `profraw` file is reported as corrupted and cannot be used by `llvm-profdata`. | **None.** Exclude affected projects from coverage. | 25/11/2021 | -| any | analysis | llvm | 13 | `clang-tidy` cannot use TemplateParameterCase style parameter along with other style checks citing "invalid style". | **None.** Do not use for now. | 02/10/2021 | -| Linux | build | gcc | 11 | Unable to use its own STL (`libstdc++`) as header units. Build fails on internal compiler error. The `libc++` does not work either. | **None.** GCC is not usable with modules and STL. | 31/08/2021 | -| Linux | analysis | llvm | 13 | `clang-tidy` has difficulties using Unix headers such as `wait.h` as header units even with correct `module.modulemap`. The build si ok. | Specify the headers in `module.modulemap` manually. | 25/11/2021 | -| Linux | address-sanitizer | llvm | 13.0.1 | Address sanitizer produces `alloc-dealloc-mismatch` false positives coming from `libc++`. | Set `export ASAN_OPTIONS=alloc_dealloc_mismatch=0` before running the tests built with asan. | 18/01/2022 | -| Linux | memory-sanitizer | llvm | 13.0.1 | Memory sanitizer detects uninitialized variables in `libc++` in `std::filesystem` (/llvm/libcxx/src/filesystem/operations.cpp). | Set `fun:*create_file_status*` in `ignorelist.txt` and use `-fsanitize-ignorelist=ignorelist.txt` during the memsan build of `libc++`. | 14/02/2022 | -| Windows | docker | Docker Desktop | 4.1 | It cannot be installed if there is an existing WSL 2 image. Docker Desktop must be installed when there are no other WSL 2 images. | Remove all WSL2 images before installing Docker Desktop. | 02/10/2021 | -| Windows | build | msvc | 16.11.5 | Using `` as a header unit produces warnings 4005, 5105 and 5106 transitively (i.e. all uses even indirect ones). | Suppress `4005`, `5105` and `5106` for all direct and indirect usages of `windows.h`. | 03/11/2021 | -| Windows | analysis | llvm | 14 | `clang-tidy` with `-bugprone-exception-escape` mishandles `std::string` from MSVC STL and flags all usage of potentially throwing rendering this check useless. | **None.** Do not use for now. | 02/10/2021 | +| Platform | Action | Tool | Version | Description | Workaround | Date | +| -------- | ----------------- | -------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ---------- | +| any | coverage | llvm | 13 | LLVM instrumentation has difficulties with `if constexpr` and some other entities showing them "uncovered" even though they are executed. | **None.** Increase coverage thresholds as needed. | 29/09/2021 | +| any | coverage | llvm | 13 | LLVM source code based coverage has difficulties with spawned processes. The resulting `profraw` file is reported as corrupted and cannot be used by `llvm-profdata`. | **None.** Exclude affected projects from coverage. | 25/11/2021 | +| any | analysis | llvm | 13 | `clang-tidy` cannot use TemplateParameterCase style parameter along with other style checks citing "invalid style". | **None.** Do not use for now. | 02/10/2021 | +| Linux | build | gcc | 11 | Unable to use its own STL (`libstdc++`) as header units. Build fails on internal compiler error. The `libc++` does not work either. | **None.** GCC is not usable with modules and STL. | 31/08/2021 | +| Linux | analysis | llvm | 13 | `clang-tidy` has difficulties using Unix headers such as `wait.h` as header units even with correct `module.modulemap`. The build si ok. | Specify the headers in `module.modulemap` manually. | 25/11/2021 | +| Linux | address-sanitizer | llvm | 13.0.1 | Address sanitizer produces `alloc-dealloc-mismatch` false positives coming from `libc++`. | Set `export ASAN_OPTIONS=alloc_dealloc_mismatch=0` before running the tests built with asan. | 18/01/2022 | +| Windows | docker | Docker Desktop | 4.1 | It cannot be installed if there is an existing WSL 2 image. Docker Desktop must be installed when there are no other WSL 2 images. | Remove all WSL2 images before installing Docker Desktop. | 02/10/2021 | +| Windows | build | msvc | 16.11.5 | Using `` as a header unit produces warnings 4005, 5105 and 5106 transitively (i.e. all uses even indirect ones). | Suppress `4005`, `5105` and `5106` for all direct and indirect usages of `windows.h`. | 03/11/2021 | +| Windows | analysis | llvm | 14 | `clang-tidy` with `-bugprone-exception-escape` mishandles `std::string` from MSVC STL and flags all usage of potentially throwing rendering this check useless. | **None.** Do not use for now. | 02/10/2021 | diff --git a/sh/build_common.sh b/sh/build_common.sh index 48b2f7fb..9a9bc1a8 100755 --- a/sh/build_common.sh +++ b/sh/build_common.sh @@ -150,7 +150,7 @@ function validate_toolchain() { function validate_configuration() { if [[ "${configuration}" == "memory" ]]; then if [[ ! -d "${libCppMsanRoot}" ]]; then - print_error "ERROR: libc++ with memory sanitizer not found. Build it with './build.sh libc++-msan'." + print_error "ERROR: libc++ with memory sanitizer not found. Build it with './build.sh build libc++-msan'." exit 1 fi elif [[ "${configuration}" == "" ]]; then @@ -176,8 +176,10 @@ function set_clang_common_flags() { if is_windows; then clangCompilerFlags="${clangCommonFlags}" + elif [[ "${configuration}" != "memory" ]]; then + clangCompilerFlags="${clangCommonFlags} -stdlib=libc++" else - clangCompilerFlags="${clangCompilerFlagsCommon} -stdlib=libc++" + clangCompilerFlags="${clangCommonFlags}" fi } @@ -204,7 +206,7 @@ function set_clang_address_flags() { function set_clang_memory_flags() { clangCompilerFlags=\ -"${clangCommonFlags} \ +"${clangCompilerFlags} \ -g \ -Wno-error=unused-command-line-argument -fsanitize=memory \ @@ -233,7 +235,7 @@ function set_clang_compiler_linker_flags() { readonly clangCompilerLinkerFlags="${clangCompilerFlags}" elif [[ "${configuration}" == "memory" ]]; then readonly clangCompilerLinkerFlags=\ -"${clangCompilerLinkerFlags} \ +"${clangCompilerFlags} \ -L${libCppMsanRoot}/lib \ -lc++ \ -lc++abi \ @@ -308,8 +310,6 @@ function set_build_flags() { fi } - - function build_msvc() { echo "@echo off call \"${msvcEnvScript}\" >nul diff --git a/sh/build_docs.sh b/sh/build_docs.sh index 867c5cae..e64ca6f6 100755 --- a/sh/build_docs.sh +++ b/sh/build_docs.sh @@ -16,7 +16,9 @@ function build_docs () { echo "Doxygen $("$doxygen" --version)" - if $("${doxygen}" .doxyfile); then + "${doxygen}" .doxyfile + + if (( $? != 0 )); then print_error "ERROR: Building documentation failed." exit 1 fi diff --git a/sh/build_libc++_msan.sh b/sh/build_libc++_msan.sh index 4a3bd0c1..1f73e90c 100644 --- a/sh/build_libc++_msan.sh +++ b/sh/build_libc++_msan.sh @@ -10,12 +10,10 @@ function build_libcpp_msan() { cd ${home}/llvm/build_msan/ - #echo "src:/adev/llvm/libcxx/src/filesystem/operations.cpp" > ignorelist.txt local dir=$(pwd) cmake -G Ninja \ ../llvm \ - -D CMAKE_CXX_FLAGS="-fsanitize-ignorelist=${dir}/ignorelist.txt" \ -D CMAKE_BUILD_TYPE=Release \ -D LLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \ -D CMAKE_C_COMPILER=clang-${llvmVersion} \ diff --git a/sh/coverage.sh b/sh/coverage.sh index 1358e771..079826f8 100755 --- a/sh/coverage.sh +++ b/sh/coverage.sh @@ -72,6 +72,7 @@ function match_thresholds() { if [[ "${functionCoverage}" == "${functionThreshold}" ]] && [[ "${lineCoverage}" == "${lineThreshold}" ]] && [[ "${regionCoverage}" == "${regionThreshold}" ]] && [[ "${branchCoverage}" == "${branchThreshold}" ]]; then result=0 else + echo "HERE" result=1 fi } @@ -111,7 +112,9 @@ function coverage_all() { fi for test in ${binDir}/*.test${executableExtension}; do - coverage_project "${test}" + if [[ "${test}" != *awinapi.test ]]; then + coverage_project "${test}" + fi done } @@ -142,8 +145,8 @@ function print_project_summary() { Insufficient coverage: * function: ${functionCoverage} uncovered (must be ${functionThreshold}) * line: ${lineCoverage} uncovered (must be ${lineThreshold}) - * region: ${regionCoverage} uncovered (must be ${branchThreshold}) - * branch: ${branchCoverage} uncovered (must be ${regionThreshold})" + * region: ${regionCoverage} uncovered (must be ${regionThreshold}) + * branch: ${branchCoverage} uncovered (must be ${branchThreshold})" else print_ok "[ PASSED ] ${test}" fi diff --git a/sh/coverage_thresholds.sh b/sh/coverage_thresholds.sh index 9b7af65e..e2a08e82 100644 --- a/sh/coverage_thresholds.sh +++ b/sh/coverage_thresholds.sh @@ -4,9 +4,21 @@ #e.g. thresholds["abuild.cache.test.exe"]="1 0 1 0" declare -A thresholds thresholds["astl.test.exe"]="2 2 2 0" +thresholds["astl.test"]="2 2 2 0" + thresholds["abuild.cache.test.exe"]="3 4 4 0" +thresholds["abuild.cache.test"]="3 4 4 0" + thresholds["abuild.scanners.test.exe"]="0 0 0 1" +thresholds["abuild.scanners.test"]="0 0 0 1" + thresholds["acommandline.test.exe"]="0 1 12 0" +thresholds["acommandline.test"]="0 1 12 0" + thresholds["aprocess.test.exe"]="1 9 5 5" +thresholds["aprocess.test"]="7 78 18 24" + thresholds["atest.test.exe"]="2 31 21 2" -thresholds["awinapi.test.exe"]="0 3 1 1" \ No newline at end of file +thresholds["atest.test"]="2 31 21 2" + +thresholds["awinapi.test.exe"]="0 3 1 1" From 9e7df675ba590841f28750b9a08b0f82073a94c6 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 09:30:14 +0200 Subject: [PATCH 22/34] Static analysis fixes --- projects/aprocess/process.cpp | 2 +- projects/aprocesstestapp/main.cpp | 7 ++++--- projects/astl/test/source_location_test.cpp | 3 +-- projects/atest/test_context.cpp | 2 +- readme.md | 2 +- sh/analyse.sh | 20 +++++++++++++++----- sh/analyse_checks.sh | 7 +------ 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/projects/aprocess/process.cpp b/projects/aprocess/process.cpp index ba350257..797c3675 100644 --- a/projects/aprocess/process.cpp +++ b/projects/aprocess/process.cpp @@ -151,7 +151,7 @@ export class Process //! Process object by moving from itself. //! The Builder object is unusable //! afterwards. - operator Process() + operator Process() // NOLINT(google-explicit-constructor) { return Process{std::move(this->setup)}; } diff --git a/projects/aprocesstestapp/main.cpp b/projects/aprocesstestapp/main.cpp index 1c718b5e..2e95cbcb 100644 --- a/projects/aprocesstestapp/main.cpp +++ b/projects/aprocesstestapp/main.cpp @@ -26,7 +26,7 @@ struct Inputs if (_dupenv_s(&buffer, &size, key) == 0 && buffer != nullptr) { value = buffer; - free(buffer); + free(buffer); // NOLINT(cppcoreguidelines-no-malloc, cppcoreguidelines-owning-memory) } return value; @@ -75,7 +75,7 @@ auto large_echo(const Inputs &inputs) -> void auto input(const Inputs &inputs) -> void { - if (inputs.echoInput != 0) + if (inputs.echoInput) { const auto end = std::chrono::system_clock::now() + std::chrono::milliseconds{inputs.echoInputTimeout}; @@ -111,13 +111,14 @@ auto main(int argc, char *argv[]) -> int try { + static constexpr std::int64_t defaultEchoTimeout{500}; ::acommandline::CommandLine parser; parser.option().long_name("exit-code").description("Exits with the given ").bind_to(&inputs.exitCode); parser.option().long_name("echo").description("Print the given ").bind_to(&inputs.echo); parser.option().long_name("echo-delay").description("Delay each echo by milliseconds").bind_to(&inputs.echoDelay); parser.option().long_name("echo-env").description("Print the value of the environment variable ").bind_to(&inputs.env); parser.option().long_name("echo-input").description("Print the values received on stanard input").bind_to(&inputs.echoInput); - parser.option().long_name("echo-input-timeout").default_value(std::int64_t{500}).description("Print the values received on stanard input for milliseconds").bind_to(&inputs.echoInputTimeout); + parser.option().long_name("echo-input-timeout").default_value(defaultEchoTimeout).description("Print the values received on stanard input for milliseconds").bind_to(&inputs.echoInputTimeout); parser.option().long_name("echo-large").description("A character to repeat in a large echo").bind_to(&inputs.largeEcho); parser.option().long_name("echo-large-size").description("Size of the large echo").bind_to(&inputs.largeEchoSize); parser.option().long_name("echo-working-directory").description("Prints working directory").bind_to(&inputs.echoWorkingDirectory); diff --git a/projects/astl/test/source_location_test.cpp b/projects/astl/test/source_location_test.cpp index c4adcd06..67aca587 100644 --- a/projects/astl/test/source_location_test.cpp +++ b/projects/astl/test/source_location_test.cpp @@ -1,7 +1,6 @@ import atest; import astl; -using ::atest::assert_; using ::atest::expect; using ::atest::suite; using ::atest::test; @@ -20,6 +19,6 @@ static const auto S = suite("source_location", [] { // NOLINT(cert-err58-cpp) std::string fileName = location.file_name(); expect(fileName.ends_with("source_location_test.cpp")).to_be(true); - expect(location.line()).to_be(19U); + expect(location.line()).to_be(18U); // NOLINT(readability-magic-numbers) }); }); diff --git a/projects/atest/test_context.cpp b/projects/atest/test_context.cpp index ab839c9d..a22f3f13 100644 --- a/projects/atest/test_context.cpp +++ b/projects/atest/test_context.cpp @@ -150,7 +150,7 @@ export class TestContext auto operator=(TestContext &&other) noexcept -> TestContext & = delete; private: - TestContext(TestContext *context) noexcept : + explicit TestContext(TestContext *context) noexcept : parentContext{context} { this->initialize_global_test_suite(); diff --git a/readme.md b/readme.md index f4826193..4c3b56ee 100644 --- a/readme.md +++ b/readme.md @@ -120,4 +120,4 @@ There are two workflows: | Linux | address-sanitizer | llvm | 13.0.1 | Address sanitizer produces `alloc-dealloc-mismatch` false positives coming from `libc++`. | Set `export ASAN_OPTIONS=alloc_dealloc_mismatch=0` before running the tests built with asan. | 18/01/2022 | | Windows | docker | Docker Desktop | 4.1 | It cannot be installed if there is an existing WSL 2 image. Docker Desktop must be installed when there are no other WSL 2 images. | Remove all WSL2 images before installing Docker Desktop. | 02/10/2021 | | Windows | build | msvc | 16.11.5 | Using `` as a header unit produces warnings 4005, 5105 and 5106 transitively (i.e. all uses even indirect ones). | Suppress `4005`, `5105` and `5106` for all direct and indirect usages of `windows.h`. | 03/11/2021 | -| Windows | analysis | llvm | 14 | `clang-tidy` with `-bugprone-exception-escape` mishandles `std::string` from MSVC STL and flags all usage of potentially throwing rendering this check useless. | **None.** Do not use for now. | 02/10/2021 | +| Windows | analysis | llvm | 14 | `clang-tidy` with `-bugprone-exception-escape` mishandles `std::string` from MSVC STL and flags all usage of potentially throwing rendering this check useless. | **None.** Do not use for now. | 15/05/2022 | diff --git a/sh/analyse.sh b/sh/analyse.sh index 5a1894b2..33b16e75 100755 --- a/sh/analyse.sh +++ b/sh/analyse.sh @@ -48,7 +48,7 @@ function analyse_project_module_source() { local sources=(projects/${project}/*.cpp) if should_analyse "${sources[@]}"; then - analyse_source "projects/${project}/${project}.cpp" + analyse_source "projects/${project}/${project}.cpp" "-header-filter=.*\\.cpp" fi } @@ -102,9 +102,10 @@ function detect_clang_tidy() { else if is_linux; then libCppModuleMap="--extra-arg=-fmodule-map-file=/usr/lib/llvm-${llvmVersion}/include/c++/v1/module.modulemap" + "${clangTidy}" --version | head -n 1 + else + "${clangTidy}" --version | head -n 2 | tail -n +2 fi - - "${clangTidy}" --version | head -n 2 | tail -n +2 fi } @@ -112,7 +113,7 @@ function do_analyse_source() { local source="${1}" local headerFilter="${2}" local log - log=$(${clangTidy} --quiet ${libCppModuleMap} "-header-filter=.*\\.cpp" ${source} 2>&1) + log=$(${clangTidy} --quiet ${libCppModuleMap} ${headerFilter} ${source} 2>&1) if (( $? != 0 )); then echo "${log}" @@ -151,8 +152,17 @@ function set_checks() { for checkSet in ${checkSets[@]}; do for check in ${allChecks[$checkSet]}; do - checks="${checks} + # MSVC STL has throwing std::string / std::vector + # default constructors (that should not throw) and + # clang-tidy somewhat incorrectly leak that diagnostics + # to user code via 'bugprone-exception-escape' so that + # check cannot be used on Windows for now. + # + # 15. 5. 2022 + if ! is_windows || [[ "${check}" != "bugprone-exception-escape" ]]; then + checks="${checks} ${check}," + fi done done diff --git a/sh/analyse_checks.sh b/sh/analyse_checks.sh index c1f871eb..914ba938 100644 --- a/sh/analyse_checks.sh +++ b/sh/analyse_checks.sh @@ -79,11 +79,7 @@ cppcoreguidelines-special-member-functions cppcoreguidelines-virtual-class-destructor" allChecks["fuchsia"]=\ -"fuchsia-default-arguments-calls -fuchsia-default-arguments-declarations -fuchsia-multiple-inheritance -fuchsia-overloaded-operator -fuchsia-statically-constructed-objects +"fuchsia-multiple-inheritance fuchsia-virtual-inheritance" allChecks["google"]=\ @@ -92,7 +88,6 @@ google-build-namespaces google-build-using-namespace google-default-arguments google-explicit-constructor -google-readability-casting google-runtime-int google-runtime-operator" From 76ae1807e76619bec7373eafb7467af1eb50abb4 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 09:32:53 +0200 Subject: [PATCH 23/34] Fix executable flags --- build.sh | 0 sh/analyse.sh | 0 sh/build.sh | 0 sh/build/abuild.cache.test.sh | 0 sh/build/abuild.cpptokenizer.test.sh | 0 sh/build/abuild.scanners.test.sh | 0 sh/build/acommandline.test.sh | 0 sh/build/aprocess.test.sh | 0 sh/build/astl.test.sh | 0 sh/build/atest.test.sh | 0 sh/build/athreadpool.test.sh | 0 sh/build/awinapi.test.sh | 0 sh/build_common.sh | 0 sh/build_docs.sh | 0 sh/common.sh | 0 sh/coverage.sh | 0 sh/format.sh | 0 sh/help.sh | 0 sh/install.sh | 0 sh/test.sh | 0 20 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh mode change 100755 => 100644 sh/analyse.sh mode change 100755 => 100644 sh/build.sh mode change 100644 => 100755 sh/build/abuild.cache.test.sh mode change 100644 => 100755 sh/build/abuild.cpptokenizer.test.sh mode change 100644 => 100755 sh/build/abuild.scanners.test.sh mode change 100644 => 100755 sh/build/acommandline.test.sh mode change 100644 => 100755 sh/build/aprocess.test.sh mode change 100644 => 100755 sh/build/astl.test.sh mode change 100644 => 100755 sh/build/atest.test.sh mode change 100644 => 100755 sh/build/athreadpool.test.sh mode change 100644 => 100755 sh/build/awinapi.test.sh mode change 100755 => 100644 sh/build_common.sh mode change 100755 => 100644 sh/build_docs.sh mode change 100755 => 100644 sh/common.sh mode change 100755 => 100644 sh/coverage.sh mode change 100755 => 100644 sh/format.sh mode change 100755 => 100644 sh/help.sh mode change 100755 => 100644 sh/install.sh mode change 100755 => 100644 sh/test.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/sh/analyse.sh b/sh/analyse.sh old mode 100755 new mode 100644 diff --git a/sh/build.sh b/sh/build.sh old mode 100755 new mode 100644 diff --git a/sh/build/abuild.cache.test.sh b/sh/build/abuild.cache.test.sh old mode 100644 new mode 100755 diff --git a/sh/build/abuild.cpptokenizer.test.sh b/sh/build/abuild.cpptokenizer.test.sh old mode 100644 new mode 100755 diff --git a/sh/build/abuild.scanners.test.sh b/sh/build/abuild.scanners.test.sh old mode 100644 new mode 100755 diff --git a/sh/build/acommandline.test.sh b/sh/build/acommandline.test.sh old mode 100644 new mode 100755 diff --git a/sh/build/aprocess.test.sh b/sh/build/aprocess.test.sh old mode 100644 new mode 100755 diff --git a/sh/build/astl.test.sh b/sh/build/astl.test.sh old mode 100644 new mode 100755 diff --git a/sh/build/atest.test.sh b/sh/build/atest.test.sh old mode 100644 new mode 100755 diff --git a/sh/build/athreadpool.test.sh b/sh/build/athreadpool.test.sh old mode 100644 new mode 100755 diff --git a/sh/build/awinapi.test.sh b/sh/build/awinapi.test.sh old mode 100644 new mode 100755 diff --git a/sh/build_common.sh b/sh/build_common.sh old mode 100755 new mode 100644 diff --git a/sh/build_docs.sh b/sh/build_docs.sh old mode 100755 new mode 100644 diff --git a/sh/common.sh b/sh/common.sh old mode 100755 new mode 100644 diff --git a/sh/coverage.sh b/sh/coverage.sh old mode 100755 new mode 100644 diff --git a/sh/format.sh b/sh/format.sh old mode 100755 new mode 100644 diff --git a/sh/help.sh b/sh/help.sh old mode 100755 new mode 100644 diff --git a/sh/install.sh b/sh/install.sh old mode 100755 new mode 100644 diff --git a/sh/test.sh b/sh/test.sh old mode 100755 new mode 100644 From 474b43a29d71c4c1e5fdeb0c50d7660f497f13d3 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 12:33:43 +0200 Subject: [PATCH 24/34] Workaround for ICE in clang-tidy --- projects/aprocess/test/is_process_running.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/projects/aprocess/test/is_process_running.cpp b/projects/aprocess/test/is_process_running.cpp index 8271be03..461bfec6 100644 --- a/projects/aprocess/test/is_process_running.cpp +++ b/projects/aprocess/test/is_process_running.cpp @@ -1,9 +1,11 @@ +import aprocess; + #ifdef _WIN32 import awinapi; [[nodiscard]] auto is_process_running(std::int64_t pid) -> bool { - return ::awinapi::Handle{OpenProcess( + return ::awinapi::Handle{::OpenProcess( static_cast(PROCESS_QUERY_INFORMATION) | static_cast(PROCESS_VM_READ), FALSE, static_cast(pid))} @@ -11,12 +13,10 @@ import awinapi; != nullptr; } #else -import astl; -# ifdef __clang__ -import wait_h; -# else -import ; -# endif +// Required to avoid importing wait_h (sys/wait.h) +// that causes ICE for clang-tidy as it is also +// imported (but not exported) by aprocess. +extern auto waitpid(__pid_t __pid, int *__stat_loc, int __options) -> __pid_t; //NOLINT(readability-redundant-declaration, bugprone-reserved-identifier) [[nodiscard]] auto is_process_running(std::int64_t pid) -> bool { From 86f5ccb1865ecaaf1d8ca63b6666958318d99db6 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 18:25:24 +0200 Subject: [PATCH 25/34] Fix astl.cpp analysis --- compile_flags.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/compile_flags.txt b/compile_flags.txt index b943fc28..9dc83ae3 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -22,3 +22,4 @@ -fmodule-map-file=projects/aprocess/module.modulemap -fmodule-map-file=projects/yamlcpp/module.modulemap -I projects/yamlcpp/include +-Isystem /usr/include/c++/12/ From a74ec9c3abb9d5d6d56a4d1d26fe2325995b6ea1 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 18:26:12 +0200 Subject: [PATCH 26/34] Make yamlcpp system include --- compile_flags.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile_flags.txt b/compile_flags.txt index 9dc83ae3..6ad245ca 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -21,5 +21,5 @@ -fmodule-map-file=projects/awinapi/module.modulemap -fmodule-map-file=projects/aprocess/module.modulemap -fmodule-map-file=projects/yamlcpp/module.modulemap --I projects/yamlcpp/include +-Isystem projects/yamlcpp/include -Isystem /usr/include/c++/12/ From b8364056ff35706e5c9d2782d8ea442cf4fb3808 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 19:36:25 +0200 Subject: [PATCH 27/34] Update analyse.sh --- sh/analyse.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/analyse.sh b/sh/analyse.sh index 33b16e75..2b9b9a34 100644 --- a/sh/analyse.sh +++ b/sh/analyse.sh @@ -147,7 +147,7 @@ function set_checks() { local checks="" if [[ "${checkSets[@]}" == "" ]]; then - checkSets=("bugprone cert cppcoreguidelines fuchsia google hicpp misc modernize performance readability") + checkSets=("bugprone cert cppcoreguidelines google misc modernize performance readability") fi for checkSet in ${checkSets[@]}; do From 1541f24307b323e1ea9b1e5f66398badeace50c1 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 19:36:28 +0200 Subject: [PATCH 28/34] Update analyse_checks.sh --- sh/analyse_checks.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sh/analyse_checks.sh b/sh/analyse_checks.sh index 914ba938..68776a9f 100644 --- a/sh/analyse_checks.sh +++ b/sh/analyse_checks.sh @@ -78,10 +78,6 @@ cppcoreguidelines-slicing cppcoreguidelines-special-member-functions cppcoreguidelines-virtual-class-destructor" -allChecks["fuchsia"]=\ -"fuchsia-multiple-inheritance -fuchsia-virtual-inheritance" - allChecks["google"]=\ "google-build-explicit-make-pair google-build-namespaces @@ -89,11 +85,9 @@ google-build-using-namespace google-default-arguments google-explicit-constructor google-runtime-int -google-runtime-operator" - -allChecks["hicpp"]=\ -"hicpp-exception-baseclass -hicpp-signed-bitwise" +google-runtime-operator +fuchsia-multiple-inheritance +fuchsia-virtual-inheritance" allChecks["misc"]=\ "misc-misleading-bidirectional @@ -148,7 +142,9 @@ performance-noexcept-move-constructor performance-trivially-destructible performance-type-promotion-in-math-fn performance-unnecessary-copy-initialization -performance-unnecessary-value-param" +performance-unnecessary-value-param +hicpp-exception-baseclass +hicpp-signed-bitwise" allChecks["readability"]=\ "readability-avoid-const-params-in-decls From 5b4d9fefc4e88297a67eeb7f068df9f45b0d258f Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 19:36:35 +0200 Subject: [PATCH 29/34] Update pr.yml --- .github/workflows/pr.yml | 215 ++++++++++++--------------------------- 1 file changed, 63 insertions(+), 152 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8745c94b..88cc65dc 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -33,75 +33,82 @@ jobs: created: ${{ steps.create_image.outputs.created }} image: ${{ steps.create_image.outputs.image }} - address_sanitizer: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} - needs: [diff, create_container] - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - - run: ./build.sh build address-sanitizer - - run: | - export ASAN_OPTIONS=alloc_dealloc_mismatch=0 - ./build.sh test clang - - analysis_linux: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} + build: + strategy: + matrix: + configuration: ["release", "debug", "coverage", "address", "memory", "thread", "undefined"] + toolchain: ["clang", "gcc", "msvc"] + host: [ubuntu-latest, windows-latest] + include: + - container: + - host: ubuntu-latest + os: linux + container: ${{ needs.create_container.outputs.image }} + - host: windows-latest + os: windows + exclude: + - toolchain: gcc + - toolchain: msvc + host: ubuntu-latest + - toolchain: msvc + configuration: address + - toolchain: msvc + configuration: memory + - toolchain: msvc + configuration: thread + - toolchain: msvc + configuration: undefined + name: build_${{ matrix.os }}_${{ matrix.toolchain }}_${{ matrix.configuration }} + runs-on: ${{ matrix.host }} + env: + ASAN_OPTIONS: alloc_dealloc_mismatch=0 + container: ${{ matrix.container }} needs: [diff, create_container] if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - run: ./build.sh build clang - - run: ./build.sh analyse diff - - analysis_windows: - runs-on: windows-2022 - needs: [diff] - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - shell: bash - run: ./build.sh build clang + run: ./build.sh ${{ matrix.toolchain }} ${{ matrix.configuration }} - shell: bash - run: ./build.sh analyse diff - - coverage_linux: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} - needs: [diff, create_container] - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - - run: ./build.sh build coverage - - run: ./build.sh coverage - - if: always() + run: ./build.sh test ${{ matrix.toolchain }} ${{ matrix.configuration }} 100 + - if: always() && ${{ matrix.configuration }} == 'coverage' uses: actions/upload-artifact@v2 with: - name: adev-pr-${{ github.run_number }}-coverage-linux - path: build/coverage/ + name: adev-pr-${{ github.run_number }}-coverage-${{ matrix.os }} + path: build/${{ matrix.toolchain }}/${{ matrix.configuration }}/reports + if-no-files-found: error + - if: ${{ matrix.configuration }} == 'release' + uses: actions/upload-artifact@v2 + with: + name: adev-pr-${{ github.run_number }}-${{ matrix.os }}-${{ matrix.toolchain }}-${{ matrix.configuration }} + path: build/${{ matrix.toolchain }}/${{ matrix.configuration }} if-no-files-found: error - coverage_windows: - runs-on: windows-2022 - needs: [diff] + analyse: + strategy: + matrix: + checks: ["bugprone", "cert", "cppcoreguidelines", "google", "misc", "modernize", "performance", "readability"] + host: [ubuntu-latest, windows-latest] + include: + - container: + - host: ubuntu-latest + os: linux + container: ${{ needs.create_container.outputs.image }} + - host: windows-latest + os: windows + name: analyse_${{ matrix.os }}_${{ matrix.checks }} + runs-on: ${{ matrix.host }} + container: ${{ matrix.container }} + needs: [diff, create_container] if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - shell: bash - run: ./build.sh build coverage + run: ./build.sh clang release - shell: bash - run: ./build.sh coverage - - if: always() - uses: actions/upload-artifact@v2 - with: - name: adev-pr-${{ github.run_number }}-coverage-windows - path: build/coverage/ - if-no-files-found: error + run: ./build.sh analyse diff ${{ matrix.checks }} documentation: runs-on: ubuntu-latest @@ -110,7 +117,7 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./build.sh build docs + - run: ./build.sh docs - uses: actions/upload-artifact@v2 with: name: adev-pr-${{ github.run_number }}-documentation @@ -128,106 +135,10 @@ jobs: fetch-depth: 0 - run: ./build.sh format check diff - linux_clang_x64: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} - needs: [diff, create_container] - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - - run: ./build.sh build clang - - run: ./build.sh test clang 100 - - if: always() - uses: actions/upload-artifact@v2 - with: - name: adev-pr-${{ github.run_number }}-linux_clang_x64 - path: build/clang/ - if-no-files-found: error - - linux_gcc_x64: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} - needs: [diff, create_container] - if: false - steps: - - uses: actions/checkout@v2 - - run: ./build.sh build gcc - - run: ./build.sh test gcc 100 - - if: always() - uses: actions/upload-artifact@v2 - with: - name: adev-pr-${{ github.run_number }}-linux_gcc_x64 - path: build/gcc/ - if-no-files-found: error - - memory_sanitizer: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} - needs: [diff, create_container] - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - - run: ./build.sh build memory-sanitizer - - run: ./build.sh test clang - - thread_sanitizer: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} - needs: [diff, create_container] - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - - run: ./build.sh build thread-sanitizer - - run: ./build.sh test clang - - undefined_sanitizer: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} - needs: [diff, create_container] - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - - run: ./build.sh build undefined-sanitizer - - run: ./build.sh test clang - - windows_clang_x64: - runs-on: windows-2022 - needs: diff - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - - shell: bash - run: ./build.sh build clang - - shell: bash - run: ./build.sh test clang 100 - - if: always() - uses: actions/upload-artifact@v2 - with: - name: adev-pr-${{ github.run_number }}-windows_clang_x64 - path: build/clang/ - if-no-files-found: error - - windows_msvc_x64: - runs-on: windows-2022 - needs: diff - if: needs.diff.outputs.diff == 'true' - steps: - - uses: actions/checkout@v2 - - shell: bash - run: ./build.sh build msvc - - shell: bash - run: ./build.sh test msvc 100 - - if: always() - uses: actions/upload-artifact@v2 - with: - name: adev-pr-${{ github.run_number }}-windows_msvc_x64 - path: build/msvc/ - if-no-files-found: error - cleanup: runs-on: ubuntu-latest needs: [diff, create_container, analysis_linux, coverage_linux, documentation, formatting, linux_clang_x64, linux_gcc_x64] - if: always() && needs.create_container.outputs.created == 'true' + if: false && always() && needs.create_container.outputs.created == 'true' steps: - uses: actions/checkout@v2 - id: create_image From 7e62018cd0ae1c6472599f9913d7b86bfd41c92d Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 19:38:26 +0200 Subject: [PATCH 30/34] Update pr.yml --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 88cc65dc..d7452c62 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -137,7 +137,7 @@ jobs: cleanup: runs-on: ubuntu-latest - needs: [diff, create_container, analysis_linux, coverage_linux, documentation, formatting, linux_clang_x64, linux_gcc_x64] + needs: [diff, create_container, build, analyse, documentation, formatting] if: false && always() && needs.create_container.outputs.created == 'true' steps: - uses: actions/checkout@v2 From facba3f43d2b0c8013e74734ff54dcd780796ccb Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 20:11:11 +0200 Subject: [PATCH 31/34] Update pr.yml --- .github/workflows/pr.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d7452c62..bb189fda 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -48,15 +48,15 @@ jobs: os: windows exclude: - toolchain: gcc - - toolchain: msvc - host: ubuntu-latest - - toolchain: msvc + - host: ubuntu-latest + toolchain: msvc + - host: windows-latest configuration: address - - toolchain: msvc + - host: windows-latest configuration: memory - - toolchain: msvc + - host: windows-latest configuration: thread - - toolchain: msvc + - host: windows-latest configuration: undefined name: build_${{ matrix.os }}_${{ matrix.toolchain }}_${{ matrix.configuration }} runs-on: ${{ matrix.host }} @@ -99,14 +99,16 @@ jobs: name: analyse_${{ matrix.os }}_${{ matrix.checks }} runs-on: ${{ matrix.host }} container: ${{ matrix.container }} - needs: [diff, create_container] + needs: [diff, create_container, build] if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - shell: bash - run: ./build.sh clang release + - uses: actions/download-artifact@v3 + with: + name: adev-pr-${{ github.run_number }}-${{ matrix.os }}-clang-release + path: build/clang/release - shell: bash run: ./build.sh analyse diff ${{ matrix.checks }} From e24728549ba55ae1c7775c426c0ed21cf4d824eb Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 20:13:53 +0200 Subject: [PATCH 32/34] Update pr.yml --- .github/workflows/pr.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index bb189fda..486927db 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -36,9 +36,9 @@ jobs: build: strategy: matrix: - configuration: ["release", "debug", "coverage", "address", "memory", "thread", "undefined"] - toolchain: ["clang", "gcc", "msvc"] host: [ubuntu-latest, windows-latest] + toolchain: ["clang", "gcc", "msvc"] + configuration: ["release", "debug", "coverage", "address", "memory", "thread", "undefined"] include: - container: - host: ubuntu-latest @@ -58,6 +58,9 @@ jobs: configuration: thread - host: windows-latest configuration: undefined + - host: windows-latest + toolchain: msvc + configuration: coverage name: build_${{ matrix.os }}_${{ matrix.toolchain }}_${{ matrix.configuration }} runs-on: ${{ matrix.host }} env: From f7e7d571bc348fc31251e7c7629294ac6ca2f10e Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Sun, 15 May 2022 21:53:39 +0200 Subject: [PATCH 33/34] Fixes --- projects/abuild.cache/abuild.cache.cpp | 2 ++ sh/build/abuild.cache.sh | 6 +++--- sh/build_common.sh | 28 +++++++++++++------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/projects/abuild.cache/abuild.cache.cpp b/projects/abuild.cache/abuild.cache.cpp index 2664657e..18d8709e 100644 --- a/projects/abuild.cache/abuild.cache.cpp +++ b/projects/abuild.cache/abuild.cache.cpp @@ -2,6 +2,8 @@ export module abuild.cache; #ifndef __clang__ export import :cache; +import :cache_reader; +import :cache_writer; #else export import abuild.cpptokenizer; import yamlcpp; diff --git a/sh/build/abuild.cache.sh b/sh/build/abuild.cache.sh index 5254ad51..3b8804d3 100755 --- a/sh/build/abuild.cache.sh +++ b/sh/build/abuild.cache.sh @@ -78,8 +78,8 @@ cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /if cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-cache_data.ifc\" /Fo\"${buildDir}/${project}-cache_data.obj\" /c /TP \"${projectDir}/cache_data.cpp\" || exit 1 cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-cache_index.ifc\" /Fo\"${buildDir}/${project}-cache_index.obj\" /c /TP \"${projectDir}/cache_index.cpp\" || exit 1 cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcOutput\"${buildDir}/${project}-cache.ifc\" /Fo\"${buildDir}/${project}-cache.obj\" /c /TP \"${projectDir}/cache.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcSearchDir \"${buildRoot}/yamlcpp\" /ifcOutput\"${buildDir}/${project}-cache_reader.ifc\" /Fo\"${buildDir}/${project}-cache_reader.obj\" /c /TP \"${projectDir}/cache_reader.cpp\" || exit 1 -cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcSearchDir \"${buildRoot}/yamlcpp\" /ifcOutput\"${buildDir}/${project}-cache_writer.ifc\" /Fo\"${buildDir}/${project}-cache_writer.obj\" /c /TP \"${projectDir}/cache_writer.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcSearchDir \"${buildRoot}/yamlcpp\" /ifcOutput\"${buildDir}/${project}-cache_reader.ifc\" /Fo\"${buildDir}/${project}-cache_reader.obj\" /c /TP \"${projectDir}/cache_reader.cpp\" || exit 1 +cl.exe ${msvcCompilerFlags} /internalPartition /ifcSearchDir \"${buildDir}\" /ifcSearchDir \"${buildRoot}/abuild.cpptokenizer\" /ifcSearchDir \"${buildRoot}/yamlcpp\" /ifcOutput\"${buildDir}/${project}-cache_writer.ifc\" /Fo\"${buildDir}/${project}-cache_writer.obj\" /c /TP \"${projectDir}/cache_writer.cpp\" || exit 1 cl.exe ${msvcCompilerFlags} ^ /interface ^ @@ -90,7 +90,7 @@ cl.exe ${msvcCompilerFlags} ^ /Fo\"${buildDir}/${project}.obj\" ^ /c \"${projectDir}/${project}.cpp\" || exit 1 -lib.exe /NOLOGO ^ +lib.exe /NOLOGO ^ /OUT:\"${buildDir}/${project}.lib\" ^ \"${buildDir}/${project}.obj\" ^ \"${buildDir}/${project}-project.obj\" ^ diff --git a/sh/build_common.sh b/sh/build_common.sh index 9a9bc1a8..0a8fe462 100644 --- a/sh/build_common.sh +++ b/sh/build_common.sh @@ -279,19 +279,19 @@ function set_gcc_flags() { function set_msvc_flags() { readonly msvcCommonFlags=\ -"/nologo \ -/std:c++latest \ -/EHsc \ -/MT \ -/W4 \ -/WX \ -/wd4005 \ -/wd5105 \ -/wd5106 \ -/ifcSearchDir \"${buildRoot}/astl\" \ -/headerUnit \"projects/astl/astl.hpp=${buildRoot}/astl/astl.hpp.ifc\" \ -/headerUnit \"projects/awinapi/windows.hpp=${buildRoot}/awinapi/windows.hpp.ifc\" \ -/headerUnit \"projects/yamlcpp/yamlcpp.hpp=${buildRoot}/yamlcpp/yamlcpp.hpp.ifc\"" +"/nologo ^ +/std:c++latest ^ +/EHsc ^ +/MT ^ +/W4 ^ +/WX ^ +/wd4005 ^ +/wd5105 ^ +/wd5106 ^ +/ifcSearchDir \"${buildRoot}/astl\" ^ +/headerUnit \"projects/astl/astl.hpp=${buildRoot}/astl/astl.hpp.ifc\" ^ +/headerUnit \"projects/awinapi/windows.hpp=${buildRoot}/awinapi/windows.hpp.ifc\" ^ +/headerUnit \"projects/yamlcpp/yamlcpp.hpp=${buildRoot}/yamlcpp/yamlcpp.hpp.ifc\" " if [[ "${configuration}" == "release" ]]; then readonly msvcCompilerFlags="${msvcCommonFlags} /O2" @@ -321,7 +321,7 @@ ${buildMSVC}" > build.bat readonly status=0 else readonly status=1 - echo "Failed: ${log}" + echo "${log}" fi rm build.bat From eb6917b3e2eb3e37c23a9f27639a889a29a1ccb2 Mon Sep 17 00:00:00 2001 From: michaelvlach Date: Mon, 16 May 2022 09:32:05 +0200 Subject: [PATCH 34/34] Update astl.hpp --- projects/astl/astl.hpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/projects/astl/astl.hpp b/projects/astl/astl.hpp index a083ca82..7d277233 100644 --- a/projects/astl/astl.hpp +++ b/projects/astl/astl.hpp @@ -9,6 +9,13 @@ # endif #endif +// Needs to go first to prevent ICE (MSVC 17.2.0, 16. 5. 2022) +#if __has_include() +# include +#else +# pragma message(" not available") +#endif + // Concepts #if __has_include() # include //C++20 @@ -491,12 +498,6 @@ # pragma message(" not available") #endif -#if __has_include() -# include -#else -# pragma message(" not available") -#endif - #if __has_include() # include #else