From b37be0464051554f90f7f70e0d189ba40e16f84e Mon Sep 17 00:00:00 2001 From: HS Date: Tue, 28 Dec 2021 13:19:18 -0800 Subject: [PATCH] Make the repository/branch Davenche specific * Pull Davenche modules * Add CI workflow to build as per Davenche specification --- .github/workflows/main.yml | 1233 ++++++----------------------- .gitmodules | 3 +- CMakeLists.txt | 5 +- Makefile | 10 +- deploy/CMakeLists.txt | 91 +++ src/Common/PlatformFileSystem.cpp | 4 +- third_party/UHDM | 2 +- 7 files changed, 353 insertions(+), 995 deletions(-) create mode 100644 deploy/CMakeLists.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9d76ca5c1..3e2e973c5a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,615 +6,70 @@ concurrency: on: push: - pull_request: workflow_dispatch: -jobs: - -# Linux build, test, and publish - linux-install: - name: "Linux | Install | ${{ matrix.compiler }} | ${{ matrix.config }}" - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - compiler: - - gcc - - clang - config: - - debug - - release - - env: - artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }} - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - # Fetch tags for CMakeLists version check - # https://github.com/actions/checkout/issues/701 - - name: Git fetch tags - run: git fetch --tags origin - - - uses: ./.github/linux-setup - with: - compiler: ${{ matrix.compiler }} - ccache-key: linux-install-${{ matrix.compiler }}-${{ matrix.config }} - - - name: Build, install & test - run: | - if [ "${{ matrix.config }}" == "debug" ]; then - export BUILD_TYPE=Debug - export CMAKE_ADDITIONAL_ARGS=-DSURELOG_WITH_TCMALLOC=Off - else - export BUILD_TYPE=Release - export CMAKE_ADDITIONAL_ARGS= - fi - - export INSTALL_DIR=`pwd`/install - - cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $CMAKE_ADDITIONAL_ARGS -S . -B build - cmake --build build -j $(nproc) - cmake --install build - - cmake --build build --target UnitTests -j $(nproc) - pushd build && ctest --output-on-failure && popd - - rm -rf build # make sure we only see installation artifacts - - # This shouldn''t be necessary, and can't be reproduced outside CI - export CMAKE_PREFIX_PATH=$INSTALL_DIR - - cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DINSTALL_DIR=$INSTALL_DIR -S tests/TestInstall -B tests/TestInstall/build - cmake --build tests/TestInstall/build -j $(nproc) - - echo "-- pkg-config content --" - cat $INSTALL_DIR/lib/pkgconfig/Surelog.pc - PREFIX=$INSTALL_DIR make test_install_pkgconfig - - - name: Prepare build artifacts - run: | - mkdir artifacts - mv install ${{ env.artifact-name }} - tar czfp artifacts/${{ env.artifact-name }}.tar.gz ${{ env.artifact-name }} - - - name: Upload build artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.artifact-name }} - path: artifacts/${{ env.artifact-name }}.tar.gz - - -# Linux regression - linux-regression: - name: "Linux | Regression | ${{ matrix.compiler }} | ${{ matrix.config }} [${{ matrix.shard }}]" - runs-on: ubuntu-20.04 - needs: linux-install - strategy: - fail-fast: false - matrix: - num_shards: [6] - shard: [0, 1, 2, 3, 4, 5] - compiler: - - gcc - - clang - config: - - release - env: - build-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }} - regression-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }}-regression-${{ matrix.shard }} - - steps: - - name: Install dependencies - run: | - sudo apt-get update -qq && - sudo apt install -y google-perftools libgoogle-perftools-dev - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - architecture: x64 - - - name: Setup Python Packages - run: | - pip3 install orderedmultidict - pip3 install psutil - - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: ${{ env.build-artifact-name }} - - - name: Run regression ${{ matrix.shard }}/${{ matrix.num_shards }} - timeout-minutes: 120 - run: | - tar xzfp ${{ env.build-artifact-name }}.tar.gz - mv ${{ env.build-artifact-name }} build - rm ${{ env.build-artifact-name }}.tar.gz - - python3 scripts/regression.py run \ - --uhdm-lint-filepath bin/uhdm-lint \ - --jobs $(nproc) \ - --show-diffs \ - --num_shards=${{ matrix.num_shards }} \ - --shard=${{ matrix.shard }} - git status - - - name: Prepare regression artifacts - if: always() - run: | - cd build - mv regression ${{ env.regression-artifact-name }} - find ${{ env.regression-artifact-name }} -name "*.tar.gz" | tar czfp ${{ env.regression-artifact-name }}.tar.gz -T - - - - name: Upload regression artifacts - if: always() - uses: actions/upload-artifact@v3 - with: - name: ${{ env.regression-artifact-name }} - path: build/${{ env.regression-artifact-name }}.tar.gz - - -# Various other builds where just one compiler is sufficient to test with. - linux-pythonapi: - name: "Linux | Python API | ${{ matrix.compiler }} | ${{ matrix.config }}" - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - compiler: - - gcc - config: - - release - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - uses: ./.github/linux-setup - with: - compiler: ${{ matrix.compiler }} - ccache-key: linux-pythonapi-${{ matrix.compiler }}-${{ matrix.config }} - - - name: PythonAPI - run: make ${{ matrix.config }} ADDITIONAL_CMAKE_OPTIONS="-DSURELOG_WITH_PYTHON=1 -DCMAKE_CXX_FLAGS=-fpermissive" - - - linux-coverage: - name: "Linux | Coverage | ${{ matrix.compiler }} | ${{ matrix.config }}" - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - compiler: - - gcc - config: - - debug - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - uses: ./.github/linux-setup - with: - compiler: ${{ matrix.compiler }} - ccache-key: linux-coverage-${{ matrix.compiler }}-${{ matrix.config }} - - - name: Coverage - run: make coverage-build/surelog.coverage - - - name: Upload coverage - # will show up under https://app.codecov.io/gh/chipsalliance/Surelog - uses: codecov/codecov-action@v3 - with: - files: coverage-build/surelog.coverage - fail_ci_if_error: false - - -# Valgrind - linux-valgrind: - name: "Linux | Valgrind | ${{ matrix.project }} | ${{ matrix.compiler }} | ${{ matrix.config }}" - runs-on: ubuntu-20.04 - needs: linux-install - strategy: - fail-fast: false - matrix: - compiler: - - gcc - config: - - debug - project: - - TypeParamElab - - ArianeElab - - ArianeElab2 - - BlackParrotMuteErrors - env: - build-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }} - regression-artifact-name: sl-${{ github.run_number }}-linux-${{ matrix.compiler }}-${{ matrix.config }}-valgrind-${{ matrix.project }} - - steps: - - name: Install dependencies - run: | - sudo apt-get update -qq && - sudo apt install -y google-perftools libgoogle-perftools-dev valgrind - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - architecture: x64 - - - name: Setup Python Packages - run: | - pip3 install orderedmultidict - pip3 install psutil - - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: ${{ env.build-artifact-name }} - - - name: Valgrind ${{ matrix.project }} - timeout-minutes: 90 - run: | - tar xzfp ${{ env.build-artifact-name }}.tar.gz - mv ${{ env.build-artifact-name }} build - rm ${{ env.build-artifact-name }}.tar.gz - - python3 scripts/regression.py run \ - --uhdm-lint-filepath bin/uhdm-lint \ - --tool valgrind \ - --filters ${{ matrix.project }} - - - name: Prepare regression artifacts - if: always() - run: | - cd build - mv regression ${{ env.regression-artifact-name }} - find ${{ env.regression-artifact-name }} -name "*.tar.gz" | tar czfp ${{ env.regression-artifact-name }}.tar.gz -T - - - - name: Upload regression artifacts - if: always() - uses: actions/upload-artifact@v3 - with: - name: ${{ env.regression-artifact-name }} - path: build/${{ env.regression-artifact-name }}.tar.gz - - -# MSYS2 build, test, and publish - msys2-install: - name: "MSYS2 (MSYS) | Install | ${{ matrix.compiler }} | ${{ matrix.config }}" - runs-on: windows-2022 - defaults: - run: - shell: msys2 {0} - strategy: - fail-fast: false - matrix: - compiler: - - gcc - config: - - release - env: - artifact-name: sl-${{ github.run_number }}-msys2-${{ matrix.compiler }}-${{ matrix.config }} - - steps: - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - architecture: x64 - - - name: Setup Python Packages - shell: cmd - run: | - pip3 install orderedmultidict - pip3 install psutil - - - name: Setup Msys2 - uses: msys2/setup-msys2@v2 - with: - msystem: MSYS - update: true - install: make cmake ninja gcc git diffutils zlib-devel - env: - MSYS2_PATH_TYPE: inherit - - - name: Setup Java - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 11 - java-package: jre - architecture: x64 - - - name: Configure Git - shell: bash - run: git config --global core.autocrlf input - - - name: Move builds to C:\ drive - shell: cmd - run: | - mkdir C:\Surelog - cd /D C:\Surelog - rd /S /Q %GITHUB_WORKSPACE% - mklink /D %GITHUB_WORKSPACE% C:\Surelog - - - name: Configure Pagefile - uses: al-cheb/configure-pagefile-action@v1.3 - with: - minimum-size: 8GB - maximum-size: 16GB - disk-root: "D:" - - - name: Git pull - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Use ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: msys2-install-${{ matrix.compiler }}-${{ matrix.config }} - - - name: Configure shell environment variables - run: | - export CWD=`pwd` - export JAVA_HOME=`cygpath -u $JAVA_HOME_11_X64` - export Py3_ROOT_DIR=`cygpath -u $pythonLocation` - - echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV - echo 'CMAKE_GENERATOR=Ninja' >> $GITHUB_ENV - echo 'CC=gcc' >> $GITHUB_ENV - echo 'CXX=g++' >> $GITHUB_ENV - echo "PREFIX=${CWD}/install" >> $GITHUB_ENV - echo "Py3_ROOT_DIR=$Py3_ROOT_DIR" >> $GITHUB_ENV - echo "ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=$Py3_ROOT_DIR -DSURELOG_WITH_TCMALLOC=Off" >> $GITHUB_ENV - echo "PATH=$JAVA_HOME/bin:$Py3_ROOT_DIR:/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" >> $GITHUB_ENV - - echo "$JAVA_HOME/bin" >> $GITHUB_PATH - echo "$Py3_ROOT_DIR" >> $GITHUB_PATH - echo "/usr/lib/ccache" >> $GITHUB_PATH - echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - - - name: Show shell configuration - run: | - env - where git && git --version - where cmake && cmake --version - where make && make --version - where java && java -version - where python && python --version - where ninja && ninja --version - where $CC && $CC --version - where $CXX && $CXX --version - - - name: Build, install & test - run: | - make ${{ matrix.config }} - make install - - make test/unittest - make clean - make test_install - #make test_install_pkgconfig # not working yet. - - - name: Prepare build artifacts - run: | - mkdir artifacts - mv install ${{ env.artifact-name }} - tar czfp artifacts/${{ env.artifact-name }}.tar.gz ${{ env.artifact-name }} - - - name: Upload build artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.artifact-name }} - path: artifacts/${{ env.artifact-name }}.tar.gz - - -# MSYS2 regression - msys2-regression: - name: "MSYS2 (MSYS) | Regression | ${{ matrix.compiler }} | ${{ matrix.config }} [${{ matrix.shard }}]" - runs-on: windows-2022 - needs: msys2-install - defaults: - run: - shell: msys2 {0} - strategy: - fail-fast: false - matrix: - num_shards: [6] - shard: [0, 1, 2, 3, 4, 5] - compiler: - - gcc - config: - - release - env: - build-artifact-name: sl-${{ github.run_number }}-msys2-${{ matrix.compiler }}-${{ matrix.config }} - regression-artifact-name: sl-${{ github.run_number }}-msys2-${{ matrix.compiler }}-${{ matrix.config }}-regression-${{ matrix.shard }} - - steps: - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - architecture: x64 - - - name: Setup Python Packages - shell: cmd - run: | - pip3 install orderedmultidict - pip3 install psutil - - - name: Setup Msys2 - uses: msys2/setup-msys2@v2 - with: - msystem: MSYS - update: true - install: make git diffutils - env: - MSYS2_PATH_TYPE: inherit - - - name: Configure Git - run: git config --global core.autocrlf input - shell: bash - - - name: Move builds to C:\ drive - shell: cmd - run: | - mkdir C:\Surelog - cd /D C:\Surelog - rd /S /Q %GITHUB_WORKSPACE% - mklink /D %GITHUB_WORKSPACE% C:\Surelog - - - name: Configure Pagefile - uses: al-cheb/configure-pagefile-action@v1.3 - with: - minimum-size: 8GB - maximum-size: 16GB - disk-root: "D:" - - - name: Git pull - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: ${{ env.build-artifact-name }} - - - name: Configure shell environment variables - run: | - export Py3_ROOT_DIR=`cygpath -u $pythonLocation` - - echo "Py3_ROOT_DIR=$Py3_ROOT_DIR" >> $GITHUB_ENV - echo "$Py3_ROOT_DIR" >> $GITHUB_PATH - - - name: Show shell configuration - run: | - # Not entirely sure why this export statement is required. - # But the log shows system's PATH variable and env.PATH are still different. - export PATH=$Py3_ROOT_DIR:$PATH - - env - where git && git --version - where make && make --version - where python3 && python3 --version - - - name: Run regression ${{ matrix.shard }}/${{ matrix.num_shards }} - timeout-minutes: 120 - run: | - export PATH=$Py3_ROOT_DIR:$PATH - - tar xzfp ${{ env.build-artifact-name }}.tar.gz - mv ${{ env.build-artifact-name }} build - rm ${{ env.build-artifact-name }}.tar.gz - - python3 scripts/regression.py run \ - --uhdm-lint-filepath bin/uhdm-lint.exe \ - --jobs $(nproc) \ - --show-diffs \ - --num_shards=${{ matrix.num_shards }} \ - --shard=${{ matrix.shard }} - git status - - - name: Prepare regression artifacts - if: always() - run: | - cd build - mv regression ${{ env.regression-artifact-name }} - find ${{ env.regression-artifact-name }} -name "*.tar.gz" | tar czfp ${{ env.regression-artifact-name }}.tar.gz -T - - - - name: Upload regression artifacts - if: always() - uses: actions/upload-artifact@v3 - with: - name: ${{ env.regression-artifact-name }} - path: build/${{ env.regression-artifact-name }}.tar.gz +env: + MODULE_NAME: Surelog + PYTHON3_VERSION: 3.8.6 + JAVA_VERSION: 11 + SURELOG_WITH_TCMALLOC: Off +jobs: + build: + name: "Build | ${{ matrix.config.artifact-tag }} | ${{ matrix.config.build-type }}" + runs-on: ${{ matrix.config.os }} -# Windows install - windows-install: - name: "Windows | Install | ${{ matrix.compiler }} | ${{ matrix.config }}" - runs-on: windows-2022 - defaults: - run: - shell: cmd strategy: fail-fast: false matrix: - compiler: - - cl - - clang config: - - release + - { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: debug } + - { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: release } + - { os: windows-2022, artifact-tag: windows-cl, build-type: debug } + - { os: windows-2022, artifact-tag: windows-cl, build-type: release } + env: - artifact-name: sl-${{ github.run_number }}-windows-${{ matrix.compiler }}-${{ matrix.config }} + artifact-name: Surelog_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}_${{ github.run_number }} steps: - name: Install Core Dependencies + if: runner.os == 'Linux' run: | - choco install -y make - choco install -y ninja - vcpkg install zlib zlib:x64-windows + sudo apt-get update -qq + sudo apt install -y g++-9 + sudo apt install -y default-jre + sudo apt install -y cmake + sudo apt install -y build-essential + sudo apt install -y uuid-dev + sudo apt install -y ninja-build - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v4.5.0 with: - python-version: 3.8 - architecture: x64 + python-version: ${{ env.PYTHON3_VERSION }} + architecture: 'x64' + + - name: Install Core Dependencies + if: runner.os == 'Windows' + shell: cmd + run: | + choco install -y python3 --version=${{ env.PYTHON3_VERSION }} --installargs="/quiet Include_debug=1 TargetDir=%pythonLocation%" + vcpkg install zlib zlib:x64-windows - name: Setup Python Packages run: | pip3 install orderedmultidict - pip3 install psutil - name: Setup Java uses: actions/setup-java@v3 with: distribution: temurin - java-version: 11 + java-version: ${{ env.JAVA_VERSION }} java-package: jre architecture: x64 - - name: Setup Clang - if: matrix.compiler == 'clang' - uses: egor-tensin/setup-clang@v1 - with: - version: 13 - platform: x64 - cygwin: 0 - - - run: git config --global core.autocrlf input - shell: bash - - name: Move builds to C:\ drive + if: runner.os == 'Windows' shell: cmd run: | mkdir C:\Surelog @@ -622,153 +77,126 @@ jobs: rd /S /Q %GITHUB_WORKSPACE% mklink /D %GITHUB_WORKSPACE% C:\Surelog - - name: Configure Pagefile - uses: al-cheb/configure-pagefile-action@v1.3 - with: - minimum-size: 8GB - maximum-size: 16GB - disk-root: "D:" - - - uses: actions/checkout@v3 + - name: Git Pull + uses: actions/checkout@v3.4.0 with: submodules: recursive fetch-depth: 0 - - name: Build & Test (cl compiler) - if: matrix.compiler == 'cl' + - name: Build on Linux + if: runner.os == 'Linux' + shell: bash + env: + CC: gcc-9 + CXX: g++-9 run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - - set CMAKE_GENERATOR=Ninja - set CC=cl - set CXX=cl - set PREFIX=%GITHUB_WORKSPACE%\install - set CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%\install - set CPU_CORES=%NUMBER_OF_PROCESSORS% - - set MAKE_DIR=C:\make\bin - set PATH=%pythonLocation%;%JAVA_HOME%\bin;%MAKE_DIR%;%PATH% - set ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=%pythonLocation% -DSURELOG_WITH_TCMALLOC=Off -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake. + env + which cmake && cmake --version + which java && java -version + which python && python --version + which ninja && ninja --version + which $CC && $CC --version + which $CXX && $CXX --version - set - where cmake && cmake --version - where make && make --version - where java && java -version - where python && python --version - where ninja && ninja --version + if [[ "${{ matrix.config.build-type }}" == "debug" ]]; then + cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DPython3_ROOT_DIR=$pythonLocation -DWITH_STATIC_CRT=0 -DCMAKE_INSTALL_PREFIX=out/install -S . -B out/build + else + cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPython3_ROOT_DIR=$pythonLocation -DWITH_STATIC_CRT=0 -DCMAKE_INSTALL_PREFIX=out/install -S . -B out/build + fi - make ${{ matrix.config }} - if %errorlevel% neq 0 exit /b %errorlevel% - make install - if %errorlevel% neq 0 exit /b %errorlevel% - make test_install - if %errorlevel% neq 0 exit /b %errorlevel% - make test/unittest - if %errorlevel% neq 0 exit /b %errorlevel% + cmake --build out/build -j `nproc` + cmake --install out/build - - name: Build & Test (clang compiler) - if: matrix.compiler == 'clang' + - name: Build on Windows + if: runner.os == 'Windows' + shell: cmd + env: + CC: cl + CXX: cl run: | - set CMAKE_GENERATOR=Ninja - set CC=clang - set CXX=clang++ - set PREFIX=%GITHUB_WORKSPACE%\install - set CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%\install - set CPU_CORES=%NUMBER_OF_PROCESSORS% + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + if %errorlevel% neq 0 exit /b %errorlevel% - set MAKE_DIR=C:\make\bin - set PATH=%pythonLocation%;%JAVA_HOME%\bin;%MAKE_DIR%;%PATH% - set ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=%pythonLocation% -DSURELOG_WITH_TCMALLOC=Off -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake. + set PATH=%JAVA_HOME%\bin;%PATH% set where cmake && cmake --version - where make && make --version where java && java -version where python && python --version where ninja && ninja --version - where clang && clang --version - where clang++ && clang++ --version - - make ${{ matrix.config }} + where %CC% && %CC% + where %CXX% && %CXX% + + if "${{ matrix.config.build-type }}" EQU "debug" ( + cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DPython3_ROOT_DIR=%pythonLocation% -DWITH_STATIC_CRT=0 -DCMAKE_INSTALL_PREFIX=out/install -S . -B out/build + ) else ( + cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPython3_ROOT_DIR=%pythonLocation% -DWITH_STATIC_CRT=0 -DCMAKE_INSTALL_PREFIX=out/install -S . -B out/build + ) if %errorlevel% neq 0 exit /b %errorlevel% - make install - if %errorlevel% neq 0 exit /b %errorlevel% - make test_install - if %errorlevel% neq 0 exit /b %errorlevel% - make test/unittest + + cmake --build out/build -j %NUMBER_OF_PROCESSORS% if %errorlevel% neq 0 exit /b %errorlevel% + cmake --install out/build - - name: Prepare build artifacts + - name: Build compressed artifacts + if: always() shell: bash run: | - mkdir artifacts + cp deploy/CMakeLists.txt out/install/. + cd out + + mv install/lib install/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }} + mkdir install/lib + mv install/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }} install/lib/. + + mv install/bin install/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }} + mkdir install/bin + mv install/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }} install/bin/. + mv install ${{ env.artifact-name }} - tar czfp artifacts/${{ env.artifact-name }}.tar.gz ${{ env.artifact-name }} + tar czfp ${{ env.artifact-name }}.tar.gz ${{ env.artifact-name }} - - name: Upload build artifacts + - name: Archive artifacts + if: always() uses: actions/upload-artifact@v3 with: name: ${{ env.artifact-name }} - path: artifacts/${{ env.artifact-name }}.tar.gz + path: out/${{ env.artifact-name }}.tar.gz +####################################################################################################################### + + test: + name: "Test | ${{ matrix.config.artifact-tag }} | ${{ matrix.shard }}" + needs: build + runs-on: ${{ matrix.config.os }} -# Windows regression - windows-regression: - name: "Windows | Regression | ${{ matrix.compiler }} | ${{ matrix.config }} [${{ matrix.shard }}]" - runs-on: windows-2022 - needs: windows-install - defaults: - run: - shell: cmd strategy: fail-fast: false matrix: num_shards: [6] shard: [0, 1, 2, 3, 4, 5] - compiler: - - cl - - clang config: - - release + - { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: release } + - { os: windows-2022, artifact-tag: windows-cl, build-type: release } + env: - build-artifact-name: sl-${{ github.run_number }}-windows-${{ matrix.compiler }}-${{ matrix.config }} - regression-artifact-name: sl-${{ github.run_number }}-windows-${{ matrix.compiler }}-${{ matrix.config }}-regression-${{ matrix.shard }} + build-artifact-name: Surelog_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}_${{ github.run_number }} + regression-artifact-name: Surelog_regression_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}_${{ github.run_number }}_${{ matrix.shard }} steps: - - name: Install Core Dependencies - run: | - choco install -y make - - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v4.5.0 with: - python-version: 3.8 - architecture: x64 + python-version: ${{ env.PYTHON3_VERSION }} + architecture: 'x64' - name: Setup Python Packages run: | pip3 install orderedmultidict pip3 install psutil - - run: git config --global core.autocrlf input - shell: bash - - - name: Move builds to C:\ drive - shell: cmd - run: | - mkdir C:\Surelog - cd /D C:\Surelog - rd /S /Q %GITHUB_WORKSPACE% - mklink /D %GITHUB_WORKSPACE% C:\Surelog - - - name: Configure Pagefile - uses: al-cheb/configure-pagefile-action@v1.3 - with: - minimum-size: 8GB - maximum-size: 16GB - disk-root: "D:" - - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 with: submodules: recursive fetch-depth: 0 @@ -787,328 +215,165 @@ jobs: mv ${{ env.build-artifact-name }} build rm ${{ env.build-artifact-name }}.tar.gz - - name: Run regression ${{ matrix.shard }}/${{ matrix.num_shards }} + - name: Run regression + if: runner.os == 'Linux' + shell: bash timeout-minutes: 120 run: | - python3 scripts/regression.py run^ - --uhdm-lint-filepath bin/uhdm-lint.exe^ - --jobs %NUMBER_OF_PROCESSORS%^ - --show-diffs^ - --num_shards=${{ matrix.num_shards }}^ + python3 scripts/regression.py run \ + --build-dirpath build/bin/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }} \ + --surelog-filepath surelog \ + --uhdm-lint-filepath uhdm-lint \ + --roundtrip-filepath roundtrip \ + --output-dirpath ../../regression \ + --jobs $(nproc) \ + --show-diffs \ + --num_shards=${{ matrix.num_shards }} \ --shard=${{ matrix.shard }} - if %errorlevel% neq 0 exit /b %errorlevel% git status - - name: Prepare regression artifacts - shell: bash - if: always() - run: | - cd build - mv regression ${{ env.regression-artifact-name }} - find ${{ env.regression-artifact-name }} -name "*.tar.gz" | tar czfp ${{ env.regression-artifact-name }}.tar.gz -T - - - - name: Upload regression artifacts - if: always() - uses: actions/upload-artifact@v3 - with: - name: ${{ env.regression-artifact-name }} - path: build/${{ env.regression-artifact-name }}.tar.gz - - -# Mac build, test, and publish - macos-install: - name: "Mac OS | Install | ${{ matrix.compiler }} | ${{ matrix.config }}" - runs-on: macos-12 - strategy: - fail-fast: false - matrix: - compiler: - - gcc - - clang - config: - - release - env: - artifact-name: sl-${{ github.run_number }}-macos-${{ matrix.compiler }}-${{ matrix.config }} - - steps: - - name: Setup Java - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: 11 - java-package: jre - architecture: x64 - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - architecture: x64 - - - name: Setup Python Packages - run: | - pip3 install orderedmultidict - pip3 install psutil - - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Use ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: macos-install-${{ matrix.compiler }}-${{ matrix.config }} - - - name: Configure compiler - run: | - # Default xcode version 14.0.1 has reported bugs with linker - # Current recommended workaround is to downgrade to last known good version. - # https://github.com/actions/runner-images/issues/6350 - sudo xcode-select -s '/Applications/Xcode_13.4.1.app/Contents/Developer' - - if [ "${{ matrix.compiler }}" == "clang" ]; then - echo 'CC=clang' >> $GITHUB_ENV - echo 'CXX=clang++' >> $GITHUB_ENV - else - echo 'CC=gcc-11' >> $GITHUB_ENV - echo 'CXX=g++-11' >> $GITHUB_ENV - fi - - - name: Configure shell - run: | - echo "PATH=$(brew --prefix)/opt/ccache/libexec:$PATH" >> $GITHUB_ENV - echo "PREFIX=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV - echo "CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/install" >> $GITHUB_ENV - echo 'ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=${pythonLocation}' >> $GITHUB_ENV - - - name: Show shell configuration - run: | - env - which cmake && cmake --version - which make && make --version - which java && java -version - which python && python --version - which $CC && $CC --version - which $CXX && $CXX --version - - - name: Build, install & test - run: | - make ${{ matrix.config }} - make install - - make test/unittest - make clean # make sure we only see installation artifacts - make test_install - make test_install_pkgconfig - - - name: Prepare build artifacts - run: | - mkdir artifacts - mv install ${{ env.artifact-name }} - tar czfp artifacts/${{ env.artifact-name }}.tar.gz ${{ env.artifact-name }} - - - name: Upload build artifacts - uses: actions/upload-artifact@v3 - with: - name: ${{ env.artifact-name }} - path: artifacts/${{ env.artifact-name }}.tar.gz - - -# Mac regression - macos-regression: - name: "Mac OS | Regression | ${{ matrix.compiler }} | ${{ matrix.config }} [${{ matrix.shard }}]" - runs-on: macos-12 - needs: macos-install - strategy: - fail-fast: false - matrix: - num_shards: [6] - shard: [0, 1, 2, 3, 4, 5] - compiler: - - gcc - - clang - config: - - release - env: - build-artifact-name: sl-${{ github.run_number }}-macos-${{ matrix.compiler }}-${{ matrix.config }} - regression-artifact-name: sl-${{ github.run_number }}-macos-${{ matrix.compiler }}-${{ matrix.config }}-regression-${{ matrix.shard }} - - steps: - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - architecture: x64 - - - name: Setup Python Packages - run: | - pip3 install orderedmultidict - pip3 install psutil - - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Configure shell - run: | - echo 'PREFIX=${GITHUB_WORKSPACE}/install' >> $GITHUB_ENV - - - name: Show shell configuration - run: | - env - which cmake && cmake --version - which make && make --version - which python && python --version - - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: ${{ env.build-artifact-name }} - - - name: Run regression ${{ matrix.shard }}/${{ matrix.num_shards }} + - name: Run regression + if: runner.os == 'Windows' + shell: cmd timeout-minutes: 120 run: | - tar xzfp ${{ env.build-artifact-name }}.tar.gz - mv ${{ env.build-artifact-name }} build - rm ${{ env.build-artifact-name }}.tar.gz - - python3 scripts/regression.py run \ - --uhdm-lint-filepath bin/uhdm-lint \ - --jobs $(sysctl -n hw.physicalcpu) \ - --show-diffs \ - --num_shards=${{ matrix.num_shards }} \ + python3 scripts/regression.py run^ + --build-dirpath build/bin/${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}^ + --surelog-filepath surelog.exe^ + --uhdm-lint-filepath uhdm-lint.exe^ + --roundtrip-filepath roundtrip.exe^ + --output-dirpath ../../regression^ + --jobs %NUMBER_OF_PROCESSORS%^ + --show-diffs^ + --num_shards=${{ matrix.num_shards }}^ --shard=${{ matrix.shard }} + if %errorlevel% neq 0 exit /b %errorlevel% git status - name: Prepare regression artifacts if: always() run: | + ls -l build cd build + ls -l regression mv regression ${{ env.regression-artifact-name }} find ${{ env.regression-artifact-name }} -name "*.tar.gz" | tar czfp ${{ env.regression-artifact-name }}.tar.gz -T - - - name: Upload regression artifacts + - name: Archive artifacts if: always() uses: actions/upload-artifact@v3 with: name: ${{ env.regression-artifact-name }} path: build/${{ env.regression-artifact-name }}.tar.gz - release-tagging: - name: Version Tagging - runs-on: ubuntu-20.04 - if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')}} - permissions: - contents: write - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Tag with CMake version if not already. - run: | - git config --local user.name "Development bot" - git config --local user.email "surelog-dev+bot@chipsalliance.org" - - # We want to tag whenever the cmake version changes. So extract the - # hash of when the current version was entered. - read TAG_HASH TAG_VERSION <<<$(git annotate -l CMakeLists.txt | sed 's/\(^[0-9A-Fa-f]\+\).*project(SURELOG VERSION \([0-9]\+\.[0-9]\+\).*/\1 \2/p;d') - - TAG="v${TAG_VERSION}" - echo "Surelog Version ${TAG} at hash ${TAG_HASH}" - - # If this is the first time we see this tag: apply. - if [ -z "$(git tag -l "${TAG}")" ]; then - git tag -a "${TAG}" ${TAG_HASH} -m "Update to ${TAG}" - echo "TAG=$TAG" >> $GITHUB_ENV - echo "TAG_SHA=$TAG_HASH" >> $GITHUB_ENV - else - echo "Tag already applied, nothing to do." - fi - - - name: Publish tag - if: ${{ env.TAG != '' }} - uses: actions/github-script@v6 - env: - TAG_NAME: ${{env.TAG}} - TAG_SHA: ${{env.TAG_SHA}} - with: - script: | - const { TAG_NAME, TAG_SHA } = process.env; - github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/${TAG_NAME}`, - sha: TAG_SHA}); - -# Code formatting - CodeFormatting: - runs-on: ubuntu-20.04 - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install Dependencies - run: | - sudo apt-get install clang-format - clang-format --version - - - name: Run formatting style check - run: ./.github/bin/run-clang-format.sh - - -# Code Tideness - ClangTidy: - runs-on: ubuntu-20.04 - - steps: - - name: Install Dependencies - run: | - sudo apt-get update -qq - sudo apt -qq -y install clang-tidy-12 \ - g++-9 default-jre cmake \ - uuid-dev build-essential - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.8 - architecture: x64 - - - name: Setup Python Packages - run: | - pip3 install orderedmultidict - pip3 install psutil - - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - - - name: Use ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: clang-tidy-codegen - - - name: Configure shell - run: | - echo 'PATH=/usr/lib/ccache:'"$PATH" >> $GITHUB_ENV - - - name: Prepare source - run: | - make run-cmake-release - make -j2 -C build GenerateParser - make -j2 -C build GenerateParserListeners - make -j2 -C build GenerateCacheSerializers - ln -sf build/compile_commands.json . - - - name: Run clang tidy - run: | - ./.github/bin/run-clang-tidy.sh limited +####################################################################################################################### +# +# deploy: +# name: "Deploy | ${{ matrix.config.artifact-tag }} | ${{ matrix.config.artifact-tag }}" +# if: github.ref == 'refs/heads/master' +# +# needs: test +# runs-on: ubuntu-latest +# +# strategy: +# fail-fast: false +# matrix: +# config: +# - { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: debug } +# - { os: ubuntu-20.04, artifact-tag: focal-gcc, build-type: release } +# - { os: windows-2022, artifact-tag: windows-cl, build-type: debug } +# - { os: windows-2022, artifact-tag: windows-cl, build-type: release } +# +# env: +# artifact-name: Surelog_${{ matrix.config.artifact-tag }}_${{ matrix.config.build-type }}_${{ github.run_number }} +# +# steps: +# - name: Setup environment +# run: | +# export COMMITTED_AT=$(date -d ${{ steps.author-date.outputs.result }} +'%Y.%m.%d_%H.%M.%S') +# echo "COMMITTED_AT=$COMMITTED_AT" >> $GITHUB_ENV +# echo "ARTIFACT_BIONIC_GCC_DEBUG=${{ env.MODULE_NAME }}-bionic-gcc-debug" >> $GITHUB_ENV +# echo "ARTIFACT_BIONIC_GCC_RELEASE=${{ env.MODULE_NAME }}-bionic-gcc-release" >> $GITHUB_ENV +# echo "ARTIFACT_WINDOWS_CL_DEBUG=${{ env.MODULE_NAME }}-windows-cl-debug" >> $GITHUB_ENV +# echo "ARTIFACT_WINDOWS_CL_RELEASE=${{ env.MODULE_NAME }}-windows-cl-release" >> $GITHUB_ENV +# +# - name: Download artifact (bionic-gcc-debug) +# uses: actions/download-artifact@v2 +# with: +# name: ${{ env.ARTIFACT_BIONIC_GCC_DEBUG }} +# +# - name: Download artifact (bionic-gcc-release) +# uses: actions/download-artifact@v2 +# with: +# name: ${{ env.ARTIFACT_BIONIC_GCC_RELEASE }} +# +# - name: Download artifact (windows-cl-debug) +# uses: actions/download-artifact@v2 +# with: +# name: ${{ env.ARTIFACT_WINDOWS_CL_DEBUG }} +# +# - name: Download artifact (windows-cl-release) +# uses: actions/download-artifact@v2 +# with: +# name: ${{ env.ARTIFACT_WINDOWS_CL_RELEASE }} +# +# - name: List directory contents +# run: ls -R +# +# - name: Create Release +# id: create_release +# uses: actions/create-release@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# tag_name: ${{ env.COMMITTED_AT }} +# release_name: ${{ env.MODULE_NAME }} +# draft: false +# prerelease: false +# +# - name: Upload Release Asset (bionic-gcc-debug) +# uses: actions/upload-release-asset@v1.0.1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.create_release.outputs.upload_url }} +# asset_path: ${{ env.ARTIFACT_BIONIC_GCC_DEBUG }}.tar.gz +# asset_name: 'bionic-gcc-debug.tar.gz' +# asset_content_type: application/zip +# +# - name: Upload Release Asset (bionic-gcc-release) +# uses: actions/upload-release-asset@v1.0.1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.create_release.outputs.upload_url }} +# asset_path: ${{ env.ARTIFACT_BIONIC_GCC_RELEASE }}.tar.gz +# asset_name: 'bionic-gcc-release.tar.gz' +# asset_content_type: application/zip +# +# - name: Upload Release Asset (windows-cl-debug) +# uses: actions/upload-release-asset@v1.0.1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.create_release.outputs.upload_url }} +# asset_path: ${{ env.ARTIFACT_WINDOWS_CL_DEBUG }}.tar.gz +# asset_name: 'windows-cl-debug.tar.gz' +# asset_content_type: application/zip +# +# - name: Upload Release Asset (windows-cl-release) +# uses: actions/upload-release-asset@v1.0.1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# with: +# upload_url: ${{ steps.create_release.outputs.upload_url }} +# asset_path: ${{ env.ARTIFACT_WINDOWS_CL_RELEASE }}.tar.gz +# asset_name: 'windows-cl-release.tar.gz' +# asset_content_type: application/zip +# +# - name: Delete some old releases +# uses: dev-drprasad/delete-older-releases@v0.2.0 +# with: +# keep_latest: 5 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitmodules b/.gitmodules index f620d5a527..536373c334 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,8 +6,7 @@ [submodule "third_party/UHDM"] path = third_party/UHDM - url = https://github.com/chipsalliance/UHDM.git - branch = v1.74 + url = https://github.com/Apotell/UHDM.git [submodule "third_party/antlr4"] path = third_party/antlr4 url = https://github.com/antlr/antlr4.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 8316e933a8..8c3a6d83d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,7 +213,7 @@ if(MSVC) "${CMAKE_CXX_FLAGS_DEBUG} ${TCMALLOC_COMPILE_OPTIONS} /Zc:__cplusplus /W4 /bigobj ${MY_CXX_WARNING_FLAGS}" ) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO - "${CMAKE_CXX_FLAGS_RELEASE} ${TCMALLOC_COMPILE_OPTIONS} /Zc:__cplusplus /W4 /bigobj ${MY_CXX_WARNING_FLAGS}" + "${CMAKE_CXX_FLAGS_RELEASE} ${TCMALLOC_COMPILE_OPTIONS} /Zi /Zc:__cplusplus /W4 /bigobj ${MY_CXX_WARNING_FLAGS}" ) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${TCMALLOC_COMPILE_OPTIONS} /Zc:__cplusplus /W4 /bigobj ${MY_CXX_WARNING_FLAGS}" @@ -233,6 +233,9 @@ else() set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${TCMALLOC_COMPILE_OPTIONS} -Wall -O0 -g ${MSYS_COMPILE_OPTIONS} ${MY_CXX_WARNING_FLAGS} ${MEM_SANITIZER_FLAGS}" ) + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${TCMALLOC_COMPILE_OPTIONS} -Wall -O3 -g ${MSYS_COMPILE_OPTIONS} -DNDEBUG ${MY_CXX_WARNING_FLAGS}" + ) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${TCMALLOC_COMPILE_OPTIONS} -Wall -O3 ${MSYS_COMPILE_OPTIONS} -DNDEBUG ${MY_CXX_WARNING_FLAGS} ${MEM_SANITIZER_FLAGS}" ) diff --git a/Makefile b/Makefile index 3935c7f6ed..d395d7b239 100644 --- a/Makefile +++ b/Makefile @@ -43,16 +43,16 @@ quick: run-cmake-quick cmake --build dbuild -j $(CPU_CORES) run-cmake-release: - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DBUILD_SHARED_LIBS=OFF $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build + cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DBUILD_SHARED_LIBS=OFF $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build run-cmake-release-shared: - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DBUILD_SHARED_LIBS=ON $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build + cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DBUILD_SHARED_LIBS=ON $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build run-cmake-release-with-python: - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -DSURELOG_WITH_PYTHON=1 -DCMAKE_CXX_FLAGS=-fpermissive -S . -B build + cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -DSURELOG_WITH_PYTHON=1 -DCMAKE_CXX_FLAGS=-fpermissive -S . -B build run-cmake-release_no_tcmalloc: - cmake -DSURELOG_WITH_TCMALLOC=Off -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build + cmake -DSURELOG_WITH_TCMALLOC=Off -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -S . -B build run-cmake-debug: cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DSURELOG_WITH_TCMALLOC=Off $(ADDITIONAL_CMAKE_OPTIONS) -S . -B dbuild @@ -134,7 +134,7 @@ install-shared: release-shared cmake --install build test_install: - cmake -DCMAKE_BUILD_TYPE=Release -DINSTALL_DIR=$(PREFIX) -DCMAKE_PREFIX_PATH=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -S tests/TestInstall -B tests/TestInstall/build + cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DINSTALL_DIR=$(PREFIX) -DCMAKE_PREFIX_PATH=$(PREFIX) $(ADDITIONAL_CMAKE_OPTIONS) -S tests/TestInstall -B tests/TestInstall/build cmake --build tests/TestInstall/build -j $(CPU_CORES) # Using pkg-config. Its search-path might be set in different ways. Set both. diff --git a/deploy/CMakeLists.txt b/deploy/CMakeLists.txt new file mode 100644 index 0000000000..57f0162d0d --- /dev/null +++ b/deploy/CMakeLists.txt @@ -0,0 +1,91 @@ +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) +project(Surelog CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +set(UHDM_INCLUDES + ${PROJECT_SOURCE_DIR}/include +) + +set(Surelog_INCLUDES + ${PROJECT_SOURCE_DIR}/include/surelog +) + +set(UHDM_DEFINITIONS + PLI_DLLISPEC= + PLI_DLLESPEC= +) + +set(Surelog_DEFINITIONS + ANTLR4CPP_STATIC=1 +) + +if (CMAKE_BUILD_TYPE STREQUAL Debug) + set(Surelog_CONFIG_DIRECTORY debug) +else() + set(Surelog_CONFIG_DIRECTORY release) +endif() + +add_library(kj STATIC IMPORTED GLOBAL) +add_library(flatbuffers STATIC IMPORTED GLOBAL) + +add_library(capnp STATIC IMPORTED GLOBAL) +target_link_libraries(capnp INTERFACE kj) + +add_library(uhdm STATIC IMPORTED GLOBAL) +target_link_libraries(uhdm INTERFACE capnp) + +add_library(antlr4 STATIC IMPORTED GLOBAL) + +add_library(surelog STATIC IMPORTED GLOBAL) +target_link_libraries(surelog INTERFACE antlr4 flatbuffers uhdm) + +if (MSVC) + set_target_properties(kj PROPERTIES + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/windows-cl-${Surelog_CONFIG_DIRECTORY}/uhdm/kj.lib" + ) + set_target_properties(capnp PROPERTIES + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/windows-cl-${Surelog_CONFIG_DIRECTORY}/uhdm/capnp.lib" + ) + set_target_properties(uhdm PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${UHDM_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${UHDM_INCLUDES}" + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/windows-cl-${Surelog_CONFIG_DIRECTORY}/uhdm/uhdm.lib" + ) + set_target_properties(flatbuffers PROPERTIES + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/windows-cl-${Surelog_CONFIG_DIRECTORY}/surelog/flatbuffers.lib" + ) + set_target_properties(antlr4 PROPERTIES + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/windows-cl-${Surelog_CONFIG_DIRECTORY}/surelog/antlr4-runtime-static.lib" + ) + set_target_properties(surelog PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${Surelog_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${Surelog_INCLUDES}" + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/windows-cl-${Surelog_CONFIG_DIRECTORY}/surelog/surelog.lib" + ) +elseif(UNIX) + set_target_properties(kj PROPERTIES + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/bionic-gcc-${Surelog_CONFIG_DIRECTORY}/uhdm/libkj.a" + ) + set_target_properties(capnp PROPERTIES + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/bionic-gcc-${Surelog_CONFIG_DIRECTORY}/uhdm/libcapnp.a" + ) + set_target_properties(uhdm PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${UHDM_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${UHDM_INCLUDES}" + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/bionic-gcc-${Surelog_CONFIG_DIRECTORY}/uhdm/libuhdm.a" + ) + set_target_properties(flatbuffers PROPERTIES + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/bionic-gcc-${Surelog_CONFIG_DIRECTORY}/surelog/libflatbuffers.a" + ) + set_target_properties(antlr4 PROPERTIES + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/bionic-gcc-${Surelog_CONFIG_DIRECTORY}/surelog/libantlr4-runtime.a" + ) + set_target_properties(surelog PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${Surelog_DEFINITIONS}" + INTERFACE_INCLUDE_DIRECTORIES "${Surelog_INCLUDES}" + IMPORTED_LOCATION "${PROJECT_SOURCE_DIR}/lib/bionic-gcc-${Surelog_CONFIG_DIRECTORY}/surelog/libsurelog.a" + ) +endif() diff --git a/src/Common/PlatformFileSystem.cpp b/src/Common/PlatformFileSystem.cpp index 6441c46e39..1433e4752a 100644 --- a/src/Common/PlatformFileSystem.cpp +++ b/src/Common/PlatformFileSystem.cpp @@ -429,8 +429,8 @@ PathId PlatformFileSystem::getPrecompiledDir(PathId programId, const std::filesystem::path programPath = programFile.parent_path(); const std::vector search_paths = { - programPath, // Build path - programPath / ".." / "share" / "surelog", // Install path + programPath, // Build path + programPath / ".." / ".." / "share" / "surelog", // Install path }; std::error_code ec; diff --git a/third_party/UHDM b/third_party/UHDM index 601d08aeab..092f101d47 160000 --- a/third_party/UHDM +++ b/third_party/UHDM @@ -1 +1 @@ -Subproject commit 601d08aeab470f17c26c148d855a1f5f82a0c0cd +Subproject commit 092f101d4775c5f6f3510182612acab65e0bdc31