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' diff --git a/adev.doxyfile b/.doxyfile similarity index 100% rename from adev.doxyfile rename to .doxyfile 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: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 396c35c6..486927db 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -33,75 +33,87 @@ 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: ./adev.sh build address-sanitizer - - run: | - export ASAN_OPTIONS=alloc_dealloc_mismatch=0 - ./adev.sh test clang - - analysis_linux: - runs-on: ubuntu-latest - container: ${{ needs.create_container.outputs.image }} + build: + strategy: + matrix: + host: [ubuntu-latest, windows-latest] + toolchain: ["clang", "gcc", "msvc"] + configuration: ["release", "debug", "coverage", "address", "memory", "thread", "undefined"] + include: + - container: + - host: ubuntu-latest + os: linux + container: ${{ needs.create_container.outputs.image }} + - host: windows-latest + os: windows + exclude: + - toolchain: gcc + - host: ubuntu-latest + toolchain: msvc + - host: windows-latest + configuration: address + - host: windows-latest + configuration: memory + - host: windows-latest + 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: + 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: ./adev.sh build clang - - run: ./adev.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: ./adev.sh build clang + run: ./build.sh ${{ matrix.toolchain }} ${{ matrix.configuration }} - shell: bash - run: ./adev.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: ./adev.sh build coverage - - run: ./adev.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, build] if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - shell: bash - run: ./adev.sh build coverage - - shell: bash - run: ./adev.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 + fetch-depth: 0 + - 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 }} documentation: runs-on: ubuntu-latest @@ -110,7 +122,7 @@ jobs: if: needs.diff.outputs.diff == 'true' steps: - uses: actions/checkout@v2 - - run: ./adev.sh build docs + - run: ./build.sh docs - uses: actions/upload-artifact@v2 with: name: adev-pr-${{ github.run_number }}-documentation @@ -126,108 +138,12 @@ jobs: - uses: actions/checkout@v2 with: fetch-depth: 0 - - run: ./adev.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: ./adev.sh build clang - - run: ./adev.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: ./adev.sh build gcc - - run: ./adev.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: ./adev.sh build memory-sanitizer - - run: ./adev.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: ./adev.sh build thread-sanitizer - - run: ./adev.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: ./adev.sh build undefined-sanitizer - - run: ./adev.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: ./adev.sh build clang - - shell: bash - run: ./adev.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: ./adev.sh build msvc - - shell: bash - run: ./adev.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 + - run: ./build.sh format check diff 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' + needs: [diff, create_container, build, analyse, documentation, formatting] + if: false && always() && needs.create_container.outputs.created == 'true' steps: - uses: actions/checkout@v2 - id: create_image diff --git a/.gitignore b/.gitignore index cc65fb91..7bef51eb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.pcm *.pch *.profraw +*.profdata /gcm.cache/ #JS @@ -18,3 +19,5 @@ node_modules/ #adev /build/ /.vscode/ +/build.bat +/.clang-tidy diff --git a/adev.sh b/adev.sh deleted file mode 100755 index 64547852..00000000 --- a/adev.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -source "sh/common.sh" - -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 -elif [[ "${action}" == "format" ]]; then - sh/format.sh $2 $3 -elif [[ "${action}" == "install" ]]; then - sh/install.sh $2 $3 -elif [[ "${action}" == "test" ]]; then - sh/test.sh $2 $3 -else - print_error "ERROR: unknown action '${action}'. Run './adev.sh' to display available actions." -fi diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..5f3b3386 --- /dev/null +++ b/build.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +source "sh/analyse.sh" +source "sh/build.sh" +source "sh/format.sh" +source "sh/help.sh" +source "sh/install.sh" +source "sh/test.sh" + +readonly action="${1}" + +if [[ "${action}" == "analyse" ]]; then + analyse "${2}" "${3}" +elif [[ "${action}" == "help" ]]; then + help_ +elif [[ "${action}" == "format" ]]; then + format "${2}" "${3}" +elif [[ "${action}" == "install" ]]; then + install "${2}" +elif [[ "${action}" == "test" ]]; then + test_ "${2}" "${3}" "${4}" "${5}" +else + build_ "${1}" "${2}" "${3}" +fi diff --git a/compile_flags.txt b/compile_flags.txt index ff07b4f4..6ad245ca 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -6,19 +6,20 @@ -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 +-Isystem projects/yamlcpp/include +-Isystem /usr/include/c++/12/ diff --git a/containerfile b/containerfile index 37242f58..b614de18 100644 --- a/containerfile +++ b/containerfile @@ -1,7 +1,6 @@ -FROM ubuntu:20.04 +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/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..18d8709e 100644 --- a/projects/abuild/cache/cache.cpp +++ b/projects/abuild.cache/abuild.cache.cpp @@ -1,7 +1,9 @@ export module abuild.cache; #ifndef __clang__ -export import :cache_impl; +export import :cache; +import :cache_reader; +import :cache_writer; #else export import abuild.cpptokenizer; import yamlcpp; @@ -21,14 +23,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 99% rename from projects/abuild/test_utilities/test_project.cpp rename to 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 similarity index 93% rename from projects/abuild/test_utilities/token_operators.cpp rename to 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/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/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 { 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/projects/aprocess/test/aprocesstestapp/main.cpp b/projects/aprocesstestapp/main.cpp similarity index 92% rename from projects/aprocess/test/aprocesstestapp/main.cpp rename to projects/aprocesstestapp/main.cpp index 39f68b65..2e95cbcb 100644 --- a/projects/aprocess/test/aprocesstestapp/main.cpp +++ b/projects/aprocesstestapp/main.cpp @@ -1,6 +1,7 @@ import awinapi; import acommandline; +//! \private struct Inputs { std::int64_t exitCode = 0; @@ -25,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; @@ -74,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}; @@ -110,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/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 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 2179f26d..4c3b56ee 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) @@ -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. | 15/05/2022 | diff --git a/sh/analyse.sh b/sh/analyse.sh old mode 100755 new mode 100644 index d98e5abe..2b9b9a34 --- a/sh/analyse.sh +++ b/sh/analyse.sh @@ -1,131 +1,111 @@ -source sh/common.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}" + pids=() + + set_analyse_properties "${1}" "${2}" + + if [[ "${file}" != "" ]]; then + analyse_source "${file}" else - analyse_project "${parameter}" + analyse_projects fi -} -function analyse_source() { - if [[ "${1}" == projects/yamlcpp/* ]]; then - return; + wait_for_jobs + + if (( $result == 0 )); then + print_ok "Analysis OK" + else + print_error "ERROR: analysis found issues (see above)" fi - wait_for_free_job 8 # $(nproc) - do_analyse_source $1 $2 & - pids+=($!) -} - -function analyse_sources() { - local path="${1}" - local diff="${2}" - - 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" "-header-filter=.*\\.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 } 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" + "${clangTidy}" --version | head -n 1 + else + "${clangTidy}" --version | head -n 2 | tail -n +2 fi - - "${clangTidy}" --version | head -n 2 | tail -n +2 fi } @@ -145,11 +125,86 @@ 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="" + + if [[ "${checkSets[@]}" == "" ]]; then + checkSets=("bugprone cert cppcoreguidelines google misc modernize performance readability") + fi + + for checkSet in ${checkSets[@]}; do + for check in ${allChecks[$checkSet]}; do + # 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 + + echo "Checks: '${checks} +' +WarningsAsErrors: '${checks} +' +FormatStyle: file +CheckOptions: + - key: hicpp-signed-bitwise.IgnorePositiveIntegerLiterals + value: true + - 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 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 + value: 'CamelCase' + - key: readability-identifier-naming.VariableCase + value: 'camelBack'" > ./.clang-tidy +} + function should_analyse() { - local diff="${1}" - local sources="${2}" + local -r sources="${1}" - ( ! [[ "${diff}" == "diff" ]] || is_changed "${sources}" ) + [[ "${diff}" == "" ]] || is_changed "${sources}" } function wait_for_free_job() { @@ -164,15 +219,3 @@ function wait_for_jobs() { wait $job || result=1 done } - -detect_clang_tidy -analyse "${1}" -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/analyse_checks.sh b/sh/analyse_checks.sh new file mode 100644 index 00000000..68776a9f --- /dev/null +++ b/sh/analyse_checks.sh @@ -0,0 +1,187 @@ +[ -n "$ANALYSE_CHECKS_SH" ] && return || readonly ANALYSE_CHECKS_SH=1 + +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 +cppcoreguidelines-virtual-class-destructor" + +allChecks["google"]=\ +"google-build-explicit-make-pair +google-build-namespaces +google-build-using-namespace +google-default-arguments +google-explicit-constructor +google-runtime-int +google-runtime-operator +fuchsia-multiple-inheritance +fuchsia-virtual-inheritance" + +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 +hicpp-exception-baseclass +hicpp-signed-bitwise" + +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-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/build.sh b/sh/build.sh old mode 100755 new mode 100644 index 3ac4c930..7550a05d --- 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..3b8804d3 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 +lib.exe /NOLOGO ^ + /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 100755 index 00000000..742239e9 --- /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..739b14de 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 100755 index 00000000..61303211 --- /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..9bfbdd5d 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 100755 index 00000000..7f92a4ef --- /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..25b57dc3 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 100755 index 00000000..c30256e0 --- /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..7b423fb3 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 100755 index 00000000..f7dc5f4c --- /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..d2dc5677 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 100755 index 00000000..913d4973 --- /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..f1daf096 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 100755 index 00000000..8ba5ecbc --- /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 100755 index 00000000..2e2b8862 --- /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 100755 index 00000000..5a16ff46 --- /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 old mode 100755 new mode 100644 index 527a5b44..0a8fe462 --- a/sh/build_common.sh +++ b/sh/build_common.sh @@ -1,114 +1,26 @@ +[ -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'." - exit 1 - fi +function build_project() { + local -r buildScript="sh/build/${1}.sh" - 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 - 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 \ - /O2 \ - /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 [[ -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 - exit 0 + return fi - echo "*** ${project} ***" + build_dependencies "${1}" + + echo "*** ${project} | ${toolchain} | ${configuration} ***" mkdir -p "${binDir}" mkdir -p "${buildDir}" @@ -116,41 +28,307 @@ 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_dependencies() { + local -r dependencies="${1}" + + for dependency in ${dependencies[@]}; do + build_project "${dependency}" + done } -function build_msvc() { +function is_clang_configuration() { + [[ "${configuration}" == "memory" ]] || [[ "${configuration}" == "coverage" ]] +} + +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}" + elif ! is_number $1; then + 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}" + elif ! is_number $1; then + print_error "ERROR: second build argument '${1}' is not a toolchain or configuration" + exit 1 + fi + + if [[ "${2}" != "" ]]; then + set_third_argument "${2}" + fi +} + +function set_third_argument() { + if is_configuration "${1}"; then + readonly configuration="${1}" + elif ! is_number $1; then + 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_clang_configuration; then + readonly toolchain="clang" + elif 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 './build.sh build libc++-msan'." + exit 1 + fi + elif [[ "${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 \ +-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="${clangCommonFlags}" + elif [[ "${configuration}" != "memory" ]]; then + clangCompilerFlags="${clangCommonFlags} -stdlib=libc++" + else + clangCompilerFlags="${clangCommonFlags}" + fi +} + +function set_clang_release_flags() { + clangCompilerFlags="${clangCompilerFlags} \ + -O3" +} + +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=\ +"${clangCompilerFlags} \ +-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" +} - local buildScript=" -@echo off +function set_clang_compiler_linker_flags() { + if is_windows; then + readonly clangCompilerLinkerFlags="${clangCompilerFlags}" + elif [[ "${configuration}" == "memory" ]]; then + readonly clangCompilerLinkerFlags=\ +"${clangCompilerFlags} \ +-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 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\" " + + if [[ "${configuration}" == "release" ]]; then + readonly msvcCompilerFlags="${msvcCommonFlags} /O2" + elif [[ "${configuration}" == "debug" ]]; then + readonly msvcCompilerFlags="${msvcCommonFlags} /Z7" + fi +} + +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_msvc() { + 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 "${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 old mode 100755 new mode 100644 index 204d7974..e64ca6f6 --- a/sh/build_docs.sh +++ b/sh/build_docs.sh @@ -1,30 +1,25 @@ +[ -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 + "${doxygen}" .doxyfile if (( $? != 0 )); 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 70% rename from sh/build_libc++.sh rename to sh/build_libc++_msan.sh index c150b95f..1f73e90c --- a/sh/build_libc++.sh +++ b/sh/build_libc++_msan.sh @@ -1,8 +1,33 @@ -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/ + + local dir=$(pwd) + + cmake -G Ninja \ + ../llvm \ + -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 +36,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 +45,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/common.sh b/sh/common.sh old mode 100755 new mode 100644 index 30636f8e..6d105a2f --- 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,20 @@ function is_changed() { [[ "${diff}" != "" ]] } +function is_configuration() { + [[ "${1}" == "release" ]] \ + || [[ "${1}" == "debug" ]] \ + || [[ "${1}" == "coverage" ]] \ + || [[ "${1}" == "address" ]] \ + || [[ "${1}" == "memory" ]] \ + || [[ "${1}" == "thread" ]] \ + || [[ "${1}" == "undefined" ]] +} + +function is_ignored() { + [[ "${1}" == projects/yamlcpp/* ]] +} + function is_linux() { [[ $OSTYPE == "linux-gnu" ]] } @@ -25,80 +33,81 @@ 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 script="${1}" - local arg1="${2}" - local arg2="${3}" - local arg3="${4}" - "${script[@]}" "${arg1}" "${arg2}" "${arg3}" - local status=$? - - if (( $status != 0 )); then - print_error "ERROR: ${script} failed: ${status}" + local -r script="${1}" + local -r arg1="${2}" + local -r arg2="${3}" + local -r arg3="${4}" + + "${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 ubuntuRepository="jammy" + 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/coverage.sh b/sh/coverage.sh old mode 100755 new mode 100644 index 0f5c1ece..079826f8 --- a/sh/coverage.sh +++ b/sh/coverage.sh @@ -1,130 +1,167 @@ -source "sh/common.sh" +[ -n "$COVERAGE_SH" ] && return || readonly COVERAGE_SH=1 -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 +source "sh/common.sh" +source "sh/coverage_thresholds.sh" function coverage() { detect_llvm_cov detect_llvm_profdata + readonly ignoredSources="(\\\\|\\|\/)(test|test_utilities|yamlcpp)(\\\\|\\|\/)" result=0 - local objectArgs="" - local profData="" - local 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 - 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 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_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 + echo "HERE" 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() { + if ! [[ -d "${binDir}" ]]; then + print_error "ERROR: 'clang | coverage' build missing. Please build it with './build.sh clang coverage'." + exit 1 fi - if [[ "${line}" != "${uncoveredLines}" ]]; then - print_error " * line: ${line} uncovered (${uncoveredLines} expected)" - else - print_ok " * line: ${line} uncovered" + for test in ${binDir}/*.test${executableExtension}; do + if [[ "${test}" != *awinapi.test ]]; then + coverage_project "${test}" + fi + 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 './build.sh install llvm'" + exit 1 fi +} - if [[ "${region}" != "${uncoveredRegions}" ]]; then - print_error " * region: ${region} uncovered (${uncoveredRegions} expected)" - else - print_ok " * region: ${region} uncovered" +function detect_llvm_profdata() { + if ! is_available "${llvmProfdata}"; then + print_error "ERROR: 'llvm-profdata' is not available. Try installing it with './build.sh install llvm'" + exit 1 fi +} - if [[ "${branch}" != "${uncoveredBranches}" ]]; then - print_error " * branch: ${branch} uncovered (${uncoveredBranches} expected)" +function print_project_summary() { + local -r test="${1}" + + 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 ${regionThreshold}) + * branch: ${branchCoverage} uncovered (must be ${branchThreshold})" else - print_ok " * branch: ${branch} uncovered" + print_ok "[ PASSED ] ${test}" fi } -coverage +function set_sources() { + local -r test="${1}" + local -r baseName=$(basename ${test}) + sources="" + + if [[ "${baseName}" == *.exe ]]; then + local -r projectName="${baseName:: -9}" + else + 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/coverage_thresholds.sh b/sh/coverage_thresholds.sh new file mode 100644 index 00000000..e2a08e82 --- /dev/null +++ b/sh/coverage_thresholds.sh @@ -0,0 +1,24 @@ +[ -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["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["atest.test"]="2 31 21 2" + +thresholds["awinapi.test.exe"]="0 3 1 1" 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 old mode 100755 new mode 100644 index 020794f5..9599f4aa --- a/sh/format.sh +++ b/sh/format.sh @@ -1,77 +1,72 @@ -source "sh/common.sh" - -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 -} +[ -n "$FORMAT_SH" ] && return || readonly FORMAT_SH=1 -function format_check_source() { - local source="${1}" +source "sh/common.sh" - if [[ ${source} == projects/yamlcpp/* ]]; then - return - fi +function format() { + detect_clang_format - 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 . +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 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. +./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.sh b/sh/install.sh old mode 100755 new mode 100644 index 66c7bb22..73214fb9 --- a/sh/install.sh +++ b/sh/install.sh @@ -1,16 +1,24 @@ +[ -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 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}'..." 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/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..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++-11 + 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 diff --git a/sh/test.sh b/sh/test.sh old mode 100755 new mode 100644 index f237616b..e5c928f4 --- a/sh/test.sh +++ b/sh/test.sh @@ -1,25 +1,43 @@ -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 } function run_test() { - local test="${1}" + local -r test="${1}" local failures=0 local i=0 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,30 @@ function run_test() { result=$(( $result + $failures )) } -function run_tests() { - local testDir="build/${toolchain}/bin" +function run_all_tests() { 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 done fi +} + +function run_tests() { + if [[ "${project}" != "" ]]; then + run_test "${binDir}/${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