diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2557030..bba20a6 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- run: |
- gh release create "${TAG}" --notes "Lua ${TAG}" ./build/*.zip
+ gh release create "${TAG}" --notes "Lua ${TAG}" ./build/*.msi ./build/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ inputs.tag }}
diff --git a/.github/workflows/reusable-package.yml b/.github/workflows/reusable-package.yml
index 6324e97..95d7774 100644
--- a/.github/workflows/reusable-package.yml
+++ b/.github/workflows/reusable-package.yml
@@ -7,7 +7,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install required tools
- run: choco install ninja
+ run: choco install ninja ghostscript
- name: Generate Ninja build
run: cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_COMPILER=clang
- name: Package
@@ -16,5 +16,6 @@ jobs:
with:
name: build
path: |
+ build/*.msi
build/*.zip
if-no-files-found: error
diff --git a/.gitignore b/.gitignore
index 4c1eb47..a2b73ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ lua-*/
luarocks-*/
*.gz
*.zip
+lua-logo-nolabel.ps
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf4d63e..198282e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,20 @@ if(WIN32)
DESTINATION ${CMAKE_CURRENT_LIST_DIR}
)
endif()
+
+ set(LUA_LOGO lua-logo-nolabel.ps)
+ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${LUA_LOGO})
+ file(DOWNLOAD https://www.lua.org/images/${LUA_LOGO}
+ ${CMAKE_CURRENT_LIST_DIR}/${LUA_LOGO}
+ )
+ endif()
+
+ add_custom_command(OUTPUT lua.ico
+ COMMAND magick ${CMAKE_CURRENT_LIST_DIR}/${LUA_LOGO} -resize 256x256 lua.ico
+ MAIN_DEPENDENCY ${CMAKE_CURRENT_LIST_DIR}/${LUA_LOGO}
+ COMMENT "Generating Lua icon"
+ )
+ add_custom_target(luaicon ALL DEPENDS lua.ico)
endif()
set(LUA_SRC lua-${CMAKE_PROJECT_VERSION}/src)
@@ -117,18 +131,22 @@ install(TARGETS lualib FILE_SET include)
install(FILES ${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt TYPE DOC)
if(WIN32)
- set(CPACK_GENERATOR ZIP)
+ set(CPACK_GENERATOR ZIP WIX)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/lua.pdb
${CMAKE_CURRENT_BINARY_DIR}/luac.pdb
${CMAKE_CURRENT_BINARY_DIR}/lua54.pdb
DESTINATION bin)
+ set(CPACK_WIX_UPGRADE_GUID "3e5a792d-9d31-41d5-a93f-629ab7c7683d")
+ set(CPACK_WIX_PRODUCT_ICON lua.ico)
+ list(APPEND CPACK_WIX_EXTENSIONS WixUtilExtension)
+ list(APPEND CPACK_WIX_PATCH_FILE ${CMAKE_CURRENT_LIST_DIR}/WixPatch.xml)
else()
install(FILES ${LUA_DOC}/lua.1 ${LUA_DOC}/luac.1
DESTINATION man/man1
)
endif()
-set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
+set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt)
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR DEVCOM)
diff --git a/README.md b/README.md
index e312171..20e83c5 100644
--- a/README.md
+++ b/README.md
@@ -23,14 +23,30 @@ winget install --id DEVCOM.Lua
[Clang](https://clang.llvm.org/))
- [CMake](https://cmake.org/)
- [Ninja](https://ninja-build.org/)
+- [ImageMagick](https://imagemagick.org/)
+- [GhostScript](https://www.ghostscript.com/)
+- [WiX v3](https://wixtoolset.org/docs/wix3/)
-You can install these components with the following
+You can install the first five components with the following
[winget](https://learn.microsoft.com/windows/package-manager/winget/) commands:
```powershell
winget install --id LLVM.LLVM
winget install --id Kitware.CMake
winget install --id Ninja-build.Ninja
+winget install --id ImageMagick.ImageMagick
+winget install --id ArtifexSoftware.GhostScript
+```
+
+WiX v3 is available at . It
+requires .NET Framework 3.5 that can be installed with the following command:
+
+```powershell
+Start-Process `
+ -FilePath pwsh `
+ -ArgumentList "-Command `"& {Enable-WindowsOptionalFeature -Online -FeatureName NetFx3}`"" `
+ -Wait `
+ -Verb RunAs
```
Update your path environment with `setx` (supposing you installed the tools in
@@ -47,6 +63,8 @@ Check if `PATH` was set correctly:
Get-Command clang
Get-Command cmake
Get-Command ninja
+Get-Command magick
+Get-Command gswin64
```
You may need to restart your Windows session if you can't find `ninja` even
@@ -54,7 +72,8 @@ after restarting your terminal.
## Build
-Use the following commands to generate a ZIP package with Lua and LuaRocks:
+Use the following commands to generate the installation package in both ZIP and
+MSI formats:
```powershell
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo
@@ -66,4 +85,4 @@ code and LuaRocks binaries.
For convenience, you can use the `Build-Lua.ps1` script to run these commands.
-If successful, the ZIP file will be available in the `build` directory.
+If successful, the ZIP and MSI files will be available in the `build` directory.
diff --git a/WixPatch.xml b/WixPatch.xml
new file mode 100644
index 0000000..e9d3a66
--- /dev/null
+++ b/WixPatch.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+