diff --git a/.github/workflows/cmake-multi-platform.yml b/.github/workflows/01-cmake-multi-platform.yml similarity index 90% rename from .github/workflows/cmake-multi-platform.yml rename to .github/workflows/01-cmake-multi-platform.yml index 4fbb524..5a1b47f 100644 --- a/.github/workflows/cmake-multi-platform.yml +++ b/.github/workflows/01-cmake-multi-platform.yml @@ -40,8 +40,21 @@ jobs: steps: - - name: (1) Checkout - uses: actions/checkout@v3 + + - name: (1.1) Install Qt + uses: jurplel/install-qt-action@v3 + with: + tools: 'tools_qtcreator,qt.tools.qtcreator' + + - name: (1.2) Check content + if: startsWith(matrix.os, 'windows') == true + run: | + dir ..\Qt\5.15.2\msvc2019_64 + dir ..\Qt\5.15.2\msvc2019_64\bin + dir ..\Qt\5.15.2\msvc2019_64\lib + + - name: (2.0) Checkout self. + uses: actions/checkout@v4 - name: (2.1) Install UG4 - ugcore uses: actions/checkout@v4 @@ -90,8 +103,6 @@ jobs: cmake -B ug4-git/build -S ug4-git/ugcore -DTARGET=libgrid -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release -DProMesh=ON -DLuaShell=ON -DPARALLEL=OFF -Dtetgen=ON -DDIM=3 cmake --build ug4-git/build --config ${{ matrix.build_type }} - - #- name: (2b) Build UG4/tool_tetgen.git # run: | # cmake -B ug4-git/tools/tetgen/build -S ug4-git/tools/tetgen @@ -110,10 +121,6 @@ jobs: # mkdir ug4-git\bin # copy ug4-git\tools\tetgen\build\Release\tetgen.exe ug4-git\bin\tetgen.exe - - - name: (4) Install Qt - uses: jurplel/install-qt-action@v3 - - name: (5) Install GL develop if: startsWith(matrix.os, 'ubuntu') == true @@ -141,15 +148,19 @@ jobs: - - name: (8) Build + + - name: (8.1) Build # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} - + - name: (8.2) Fix content + run: | + ..\Qt\5.15.2\msvc2019_64\bin\windeployqt.exe ${{ github.workspace }}\build\Release + - name: (9) Artifacts uses: actions/upload-artifact@v4 with: - name: my-artifacts + name: artifacts-${{ matrix.os }} path: ${{ github.workspace }}/build # or path/to/artifact - name: (10) Test diff --git a/.github/workflows/02-build-installer.yml b/.github/workflows/02-build-installer.yml new file mode 100644 index 0000000..35a1ae0 --- /dev/null +++ b/.github/workflows/02-build-installer.yml @@ -0,0 +1,60 @@ +name: Build installer + +on: + workflow_dispatch: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + + installer-build: + name: Build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + # Set up a matrix to run the following 3 configurations: + # 1. + # 2. + # 3. + # + # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. + matrix: + # os: [ubuntu-latest, windows-latest] + os: [windows-latest] + build_type: [Release] + + steps: + - name: (0) Checkout self. + uses: actions/checkout@v4 + + - name: (1) Artifacts + uses: actions/download-artifact@v4 + with: + name: artifacts-${{matrix.os}} + path: artifacts + github-token: ${{ github.token }} + repository: ${{ github.repository }} + run-id: 12359566993 + + - name: (2) Move dir. + if: startsWith( ${{ matrix.os }}, "windows-latest") + run: Move-Item -Path artifacts/Release -Destination deployment/win64/artifacts + + - name: (3) Create installer + if: startsWith( ${{ matrix.os }}, "windows-latest") + uses: joncloud/makensis-action@v4.1 + with: + script-file: "deployment/win64/promesh4-installer.nsi" + arguments: "/V3" + + - name: (4) Artifacts + if: startsWith( ${{ matrix.os }}, "windows-latest") + uses: actions/upload-artifact@v4 + with: + name: ProMesh4-Installer-${{ matrix.os }} + path: ${{ github.workspace }}/deployment/win64/ProMesh4-Installer.exe # or path/to/artifact + diff --git a/.github/workflows/03-update-assets.yml b/.github/workflows/03-update-assets.yml new file mode 100644 index 0000000..2645555 --- /dev/null +++ b/.github/workflows/03-update-assets.yml @@ -0,0 +1,83 @@ +on: + workflow_dispatch: + push: + # Sequence of patterns matched against refs/tags + #tags: + # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Upload Release Asset +jobs: + build: + name: Upload Release Asset for ${{ matrix.os }} + + runs-on: ubuntu-latest + + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + matrix: + os: [windows-latest] + build_type: [Release] + + steps: + - name: Checkout self + uses: actions/checkout@v4 + + - name: Download pre-packed asset + uses: actions/download-artifact@v4 + with: + # name: ProMesh4-Installer-${{matrix.os}} + name: ProMesh4-Installer-windows-latest + # path: $GITHUB_WORKSPACE + github-token: ${{ github.token }} + repository: ${{ github.repository }} + run-id: 12355131211 + + - name: Download pre-packed artifact + run: ls . + + #- name: Download pre-packed artifact + # run: ls ./assets + + # Fetch the latest release from GitHub API + - name: Get latest release + id: get_release + run: | + latest_release=$(curl -s \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/releases/latest) + echo "::set-output name=upload_url::$(echo $latest_release | jq -r .upload_url | sed -e "s/{?name,label}//")" + + # - name: Create Release + # id: create_release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ github.ref }} + # release_name: Release ${{ github.ref }} + # draft: false + # prerelease: false + + - name: Test + run: echo "URL=${{ steps.get_release.outputs.upload_url }}" + + #- name: Upload Release Binary + # id: upload-release-asset + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.get_release.outputs.upload_url }} + # #upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: ./ProMesh4-Installer.exe + # asset_name: promesh_setup_win64.exe + # asset_content_type: application/octet-stream + + - name: Upload Release Binary + uses: AButler/upload-release-assets@v3.0 + with: + files: "./ProMesh4-Installer.exe" + repo-token: ${{ secrets.GITHUB_TOKEN }} + release-tag: v0.0.2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3db3d9d..1f3a607 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -263,11 +263,11 @@ else(UNIX) if(MINGW) # resource compilation for MINGW ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ProMeshIcon.o - COMMAND windres.exe -I${CMAKE_SOURCE_DIR}/deploy_data -i${CMAKE_SOURCE_DIR}/deploy_data/ProMeshIcon.rc + COMMAND windres.exe -I${CMAKE_SOURCE_DIR}/deployment/data -i${CMAKE_SOURCE_DIR}/deployment/data/ProMeshIcon.rc -o ${CMAKE_CURRENT_BINARY_DIR}/ProMeshIcon.o ) ADD_EXECUTABLE(ProMesh4 WIN32 ${allSources} ProMeshIcon.o) else(MINGW) - ADD_EXECUTABLE(ProMesh4 WIN32 ${allSources} ${CMAKE_SOURCE_DIR}/deploy_data/ProMeshIcon.rc) + ADD_EXECUTABLE(ProMesh4 WIN32 ${allSources} ${CMAKE_SOURCE_DIR}/deployment/data/ProMeshIcon.rc) endif(MINGW) endif(UNIX) diff --git a/bundle_app b/deployment/bundle-app-macos similarity index 100% rename from bundle_app rename to deployment/bundle-app-macos diff --git a/deploy_data/AppIcon.icns b/deployment/data/AppIcon.icns similarity index 100% rename from deploy_data/AppIcon.icns rename to deployment/data/AppIcon.icns diff --git a/deploy_data/Info.plist b/deployment/data/Info.plist similarity index 100% rename from deploy_data/Info.plist rename to deployment/data/Info.plist diff --git a/deploy_data/ProMeshIcon.ico b/deployment/data/ProMeshIcon.ico similarity index 100% rename from deploy_data/ProMeshIcon.ico rename to deployment/data/ProMeshIcon.ico diff --git a/deploy_data/ProMeshIcon.png b/deployment/data/ProMeshIcon.png similarity index 100% rename from deploy_data/ProMeshIcon.png rename to deployment/data/ProMeshIcon.png diff --git a/deploy_data/ProMeshIcon.rc b/deployment/data/ProMeshIcon.rc similarity index 100% rename from deploy_data/ProMeshIcon.rc rename to deployment/data/ProMeshIcon.rc diff --git a/deployment/win64/promesh4-installer.nsi b/deployment/win64/promesh4-installer.nsi new file mode 100644 index 0000000..d3f04ac --- /dev/null +++ b/deployment/win64/promesh4-installer.nsi @@ -0,0 +1,125 @@ +;-------------------------------- + +; The name of the installer +Name ProMesh4 + +; The file to write +OutFile "ProMesh4-Installer.exe" + +; The default installation directory +InstallDir $PROGRAMFILES64\ProMesh4 + +; Registry key to check for directory (so if you install again, it will +; overwrite the old one automatically) +InstallDirRegKey HKLM "SOFTWARE\G-CSC\ProMesh4" "Install_Dir" + +; Request application privileges for Windows Vista +RequestExecutionLevel admin + +Icon "..\data\ProMeshIcon.ico" + +LicenseBkColor /windows +LicenseData "..\..\LICENSE" + +XPStyle on +ManifestSupportedOS all + +;-------------------------------- + +; Pages + +Page license +Page directory +Page components +Page instfiles + +UninstPage uninstConfirm +UninstPage instfiles + +;-------------------------------- + +; The stuff to install +Section ProMesh4 (required)" + + SectionIn RO + + ; Set output path to the installation directory. + SetOutPath $INSTDIR + + ; Put file there + File "artifacts\ProMesh4.exe" + File "artifacts\\*.dll" + + SetOutPath $INSTDIR\platforms + File "artifacts\platforms\*.dll" + + SetOutPath $INSTDIR\tools + File "artifacts\tools\*.exe" + ; File "artifacts\tools\*LICENSE" + + SetOutPath $INSTDIR\translations + File "artifacts\translations\*" + + SetOutPath $INSTDIR\imageformats + File "artifacts\imageformats\*" + + SetOutPath $INSTDIR\iconengines + File "artifacts\iconengines\*" + + SetOutPath $INSTDIR + + + ; Write the installation path into the registry + WriteRegStr HKLM SOFTWARE\G-CSC\ProMesh4 "Install_Dir" "$INSTDIR" + + ; Write the uninstall keys for Windows + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\G-CSC\ProMesh4" "DisplayName" "ProMesh4" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\G-CSC\ProMesh4" "UninstallString" '"$INSTDIR\uninstall.exe"' + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\G-CSC\ProMesh4" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\G-CSC\ProMesh4" "NoRepair" 1 + WriteUninstaller "uninstall.exe" + +SectionEnd + +; Optional section (can be disabled by the user) +Section "Programs Shortcut" + CreateDirectory "$SMPROGRAMS\ProMesh4" + CreateShortcut "$SMPROGRAMS\ProMesh4\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 + CreateShortcut "$SMPROGRAMS\ProMesh4\ProMesh4.lnk" "$INSTDIR\ProMesh4.exe" "" "$INSTDIR\ProMesh4.exe" 0 +SectionEnd + +Section "Start Menu Shortcut" + CreateShortcut "$STARTMENU\ProMesh4.lnk" "$INSTDIR\ProMesh4.exe" "" "$INSTDIR\ProMesh4.exe" 0 +SectionEnd + +Section "Desktop Shortcut" + CreateShortcut "$DESKTOP\ProMesh4.lnk" "$INSTDIR\ProMesh4.exe" "" "$INSTDIR\ProMesh4.exe" 0 +SectionEnd + + +;-------------------------------- + +; Uninstaller + +Section "Uninstall" + + ; Remove registry keys + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\G-CSC\ProMesh4" + DeleteRegKey HKLM SOFTWARE\G-CSC\ProMesh4 + + ; Remove files and uninstaller + Delete $INSTDIR\ProMesh4.exe + Delete $INSTDIR\*.dll + RMDir /r /REBOOTOK $INSTDIR\platforms + Delete $INSTDIR\uninstall.exe + + ; Remove shortcuts, if any + Delete "$SMPROGRAMS\ProMesh4\*.*" + Delete "$STARTMENU\ProMesh4.lnk" + Delete "$DESKTOP\ProMesh4.lnk" + + ; Remove directories used + RMDir "$SMPROGRAMS\ProMesh4" + RMDir "$INSTDIR" + +SectionEnd