install strip env #516
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows | |
on: [push, pull_request] | |
jobs: | |
build-mingw: | |
if: false | |
name: ${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}} | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
env: | |
CCACHE_DIR: ${{github.workspace}}/ccache | |
strategy: | |
fail-fast: true | |
matrix: | |
build_type: [Release, Debug] | |
sys: [mingw32, mingw64] | |
lib: [shared, static] | |
components: [minimal, lgpl, gpl] | |
metis: [no-metis, metis] | |
exclude: | |
# METIS is only usable if CHOLMOD is compiled | |
- components: minimal | |
metis: metis | |
include: | |
- sys: mingw32 | |
env: i686 | |
- sys: mingw64 | |
env: x86_64 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Dependencies | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
install: >- | |
mingw-w64-${{matrix.env}}-ccache | |
mingw-w64-${{matrix.env}}-cmake | |
mingw-w64-${{matrix.env}}-gcc | |
mingw-w64-${{matrix.env}}-gcc-fortran | |
mingw-w64-${{matrix.env}}-intel-tbb | |
mingw-w64-${{matrix.env}}-lapack | |
mingw-w64-${{matrix.env}}-ninja | |
mingw-w64-${{matrix.env}}-openblas | |
mingw-w64-${{matrix.env}}-openmp | |
unzip | |
wget | |
- name: Setup METIS Dependencies | |
if: ${{matrix.metis == 'metis'}} | |
run: >- | |
pacman --noconfirm -S | |
mingw-w64-${{matrix.env}}-metis | |
- name: Setup Environment | |
if: ${{matrix.build_type == 'Release'}} | |
run: | | |
echo 'CFLAGS=-flto' >> ~/.bash_profile | |
echo 'CXXFLAGS=-flto' >> ~/.bash_profile | |
- name: Cache Build | |
id: cache-build | |
uses: actions/cache@v3 | |
with: | |
path: ${{env.CCACHE_DIR}} | |
key: ${{runner.os}}-${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}-ccache-${{github.run_id}} | |
restore-keys: ${{runner.os}}-${{matrix.sys}}-${{matrix.env}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}-ccache- | |
- name: Configure | |
run: | | |
cmake -S . -B build_${{matrix.build_type}}/ \ | |
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=ccache \ | |
-DCMAKE_INSTALL_PREFIX:PATH=./install \ | |
-DCMAKE_REQUIRE_FIND_PACKAGE_METIS=${{matrix.metis == 'metis'}} \ | |
-DWITH_GPL=${{matrix.components == 'gpl'}} \ | |
-DWITH_LGPL=${{contains(matrix.components, 'gpl')}} \ | |
-DWITH_METIS=${{matrix.metis == 'metis'}} \ | |
-G Ninja | |
- name: Build | |
run: | | |
cmake --build build_${{matrix.build_type}}/ \ | |
--config ${{matrix.build_type}} | |
- name: Install | |
run: | | |
cmake --build build_${{matrix.build_type}}/ \ | |
--config ${{matrix.build_type}} \ | |
--target install | |
build-msvc: | |
name: ${{matrix.msvc}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}} | |
runs-on: ${{matrix.os}} | |
env: | |
CCACHE_DIR: ${{github.workspace}}/ccache | |
CL: /MP | |
defaults: | |
run: | |
shell: powershell | |
strategy: | |
fail-fast: true | |
matrix: | |
build_type: [Release, Debug] | |
msvc: [VS-17-2022] | |
sys: [mingw64] | |
lib: [shared] | |
components: [gpl] | |
metis: [metis] | |
include: | |
- sys: mingw64 | |
env: x86_64 | |
system: Win64 | |
- msvc: VS-17-2022 | |
generator: "Visual Studio 17 2022" | |
os: windows-2022 | |
marker: vc17 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.sys}} | |
path-type: inherit | |
install: >- | |
wget | |
mingw-w64-${{matrix.env}}-ccache | |
mingw-w64-${{matrix.env}}-cmake | |
mingw-w64-${{matrix.env}}-gcc | |
mingw-w64-${{matrix.env}}-gcc-fortran | |
mingw-w64-${{matrix.env}}-ninja | |
- name: Setup MSYS2 Deployment | |
if: ${{matrix.build_type == 'Release'}} | |
shell: msys2 {0} | |
run: | | |
echo INSTALL_TARGET_SUFFIX=/strip >> $GITHUB_ENV | |
- name: Cache METIS | |
if: matrix.metis == 'metis' | |
id: cache-metis | |
uses: actions/cache@v3 | |
with: | |
path: metis/ | |
key: ${{matrix.sys}}-metis-5.1.1-${{matrix.build_type}}-shared | |
- name: Download METIS | |
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true' | |
run: | | |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/KarypisLab/METIS/archive/refs/tags/v5.1.1-DistDGL-v0.5.zip", "v5.1.1-DistDGL-v0.5.zip"); | |
(New-Object System.Net.WebClient).DownloadFile("https://github.com/KarypisLab/GKlib/archive/refs/tags/METIS-v5.1.1-DistDGL-0.5.zip", "v5.1.1-DistDGL-v0.5-GKlib.zip"); | |
7z x v5.1.1-DistDGL-v0.5.zip; | |
7z x v5.1.1-DistDGL-v0.5-GKlib.zip; | |
- name: Build METIS | |
if: matrix.metis == 'metis' && steps.cache-metis.outputs.cache-hit != 'true' | |
shell: msys2 {0} | |
run: | | |
sed -i '/sys\/resource.h/d' ./GKlib-METIS-v5.1.1-DistDGL-0.5/gk_arch.h | |
sed -i -E 's|\<__(arg[cv])\>|\1|g' ./GKlib-METIS-v5.1.1-DistDGL-0.5/gk_getopt.h | |
pushd ./METIS-5.1.1-DistDGL-v0.5/ | |
mkdir -p ./build/xinclude/ | |
echo '#define IDXTYPEWIDTH 32' > ./build/xinclude/metis.h | |
echo '#define REALTYPEWIDTH 32' >> ./build/xinclude/metis.h | |
cat ./include/metis.h >> ./build/xinclude/metis.h | |
cp ./include/CMakeLists.txt ./build/xinclude/ | |
popd | |
cmake -S ./METIS-5.1.1-DistDGL-v0.5/ -B ./build-metis/ \ | |
-DCMAKE_GNUtoMS=ON \ | |
-DCMAKE_C_STANDARD_LIBRARIES=-lregex \ | |
-DSHARED=ON \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DGKLIB_PATH='${{github.workspace}}/GKlib-METIS-v5.1.1-DistDGL-0.5' \ | |
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/metis' | |
cmake --build ./build-metis/ --target install/${{env.INSTALL_TARGET_SUFFIX}} | |
mv '${{github.workspace}}/metis/lib/libmetis.lib' '${{github.workspace}}/metis/lib/metis.lib' | |
- name: Cache LAPACK | |
id: cache-lapack | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{env.CCACHE_DIR}} | |
${{github.workspace}}/install | |
key: ${{matrix.msvc}}-lapack-3.11.0-${{matrix.build_type}} | |
- name: Download LAPACK | |
if: steps.cache-lapack.outputs.cache-hit != 'true' | |
shell: msys2 {0} | |
run: | | |
wget https://github.com/Reference-LAPACK/lapack/archive/refs/tags/v3.11.tar.gz | |
tar xvf v3.11.tar.gz | |
- name: Build LAPACK | |
if: steps.cache-lapack.outputs.cache-hit != 'true' | |
shell: msys2 {0} | |
run: | | |
cmake -S lapack-3.11 -B build_lapack_${{matrix.build_type}}/ \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ | |
-DCMAKE_C_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \ | |
-DCMAKE_Fortran_COMPILER_LAUNCHER:FILEPATH=$(which ccache) \ | |
-DCMAKE_GNUtoMS=ON \ | |
-DCMAKE_INSTALL_PREFIX=./install \ | |
-G Ninja | |
cmake --build build_lapack_${{matrix.build_type}}/ \ | |
--config ${{matrix.build_type}} \ | |
--target install/${{env.INSTALL_TARGET_SUFFIX}} | |
- name: Setup MSYS2 Environment | |
shell: msys2 {0} | |
run: | | |
echo "$(cygpath -m /${{matrix.sys}}/bin)" >> $GITHUB_PATH | |
- name: Setup Environment | |
run: | | |
echo "${{github.workspace}}/install/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "${{github.workspace}}/metis/lib" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
echo "VERSION_SUFFIX=${{github.ref_name}}-${{matrix.marker}}-${{matrix.system}}-${{matrix.build_type}}-${{matrix.lib}}-${{matrix.components}}-${{matrix.metis}}".replace('/', '-') | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Configure | |
run: | | |
cmake -S . -B build_${{matrix.build_type}}/ ` | |
-A x64 ` | |
-DBLAS_blas_LIBRARY=${{github.workspace}}/install/lib/libblas.lib ` | |
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} ` | |
-DCMAKE_Fortran_COMPILER= ` | |
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install-suitesparse ` | |
-DCMAKE_PREFIX_PATH=${{github.workspace}}/metis ` | |
-DCMAKE_REQUIRE_FIND_PACKAGE_METIS=${{matrix.metis == 'metis'}} ` | |
-DLAPACK_lapack_LIBRARY=${{github.workspace}}/install/lib/liblapack.lib ` | |
-DWITH_FORTRAN=OFF ` | |
-DWITH_GPL=${{matrix.components == 'gpl'}} ` | |
-DWITH_LGPL=${{contains(matrix.components, 'gpl')}} ` | |
-DWITH_METIS=${{matrix.metis == 'metis'}} ` | |
-G "${{matrix.generator}}" | |
- name: Build | |
run: | | |
cmake --build build_${{matrix.build_type}}/ ` | |
--config ${{matrix.build_type}} | |
- name: Install | |
run: | | |
cmake --build build_${{matrix.build_type}}/ ` | |
--config ${{matrix.build_type}} ` | |
--target install | |
- name: Prepare Deployment | |
run: | | |
New-Item -ItemType "directory" -Path "${{github.workspace}}/deploy" | |
Copy-Item -Path "${{github.workspace}}/install/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force | |
Copy-Item -Path "${{github.workspace}}/install-suitesparse/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force | |
- name: Prepare METIS Deployment | |
if: matrix.metis == 'metis' | |
run: | | |
Copy-Item -Path "${{github.workspace}}/metis/*" -Destination "${{github.workspace}}/deploy/" -Recurse -Force | |
- name: Generate Archive | |
run: | | |
Compress-Archive -Path "${{github.workspace}}/deploy/*" -Destination "SuiteSparse-${{env.VERSION_SUFFIX}}.zip" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: SuiteSparse-${{env.VERSION_SUFFIX}} | |
path: | | |
deploy/ | |
- name: Deploy | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') && matrix.lib == 'shared' | |
with: | |
files: | |
SuiteSparse-${{env.VERSION_SUFFIX}}.zip |