From 2b2ebf2ce800345c6781feac4a7a17c4c97e3b9d Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Sun, 30 Jul 2023 23:35:46 -0500 Subject: [PATCH] Update README.md Update instructions to reflect current practice. --- src/WindowsInstaller/README.md | 98 +++++++++++++++++----------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/src/WindowsInstaller/README.md b/src/WindowsInstaller/README.md index 9e194776c627..9db81808d83a 100644 --- a/src/WindowsInstaller/README.md +++ b/src/WindowsInstaller/README.md @@ -1,57 +1,59 @@ -# FreeCADInstProj -A Windows installer for FreeCAD +# Creating a Windows installer for FreeCAD -To build the installer you can do the following: -1. Get the latest zip-file of the whole installer source code "FC-standard-installer.zip" from
- https://github.com/donovaly/FreeCADInstProj/releases -2. Extract it to e.g. the path "C:\FreeCAD\Installer" -3. Open the file *Settings.nsh* with a text editor
- (the editor jEdit (jedit.org) can be recommended to edit NSIS files)
- and adapt there the following paths to the ones on your PC, e.g.:
- `!define FILES_FREECAD "C:\FreeCAD\Installer\FreeCAD"`
- `!define FILES_DEPS "C:\FreeCAD\Installer\MSVCRedist"` -4. Specify in Settings.nsh if it should be an installer for 32bit by commenting the line
- `!define MULTIUSER_USE_PROGRAMFILES64` -5. Install the latest version 3.x of NSIS (https://nsis.sourceforge.io/Download) -6. Download these special release files of NSIS that support large strings:
+These are instructions for building an NSIS-based installer for FreeCAD. They were designed for FreeCAD 0.21 and later, +and presume that you have cloned a copy of FreeCAD's source code, and therefore have the directory *src/WindowsInstaller*. + +## Install NSIS +To set up your system for building an NSIS installer: +1. Install the latest version 3.x of NSIS (https://nsis.sourceforge.io/Download) +2. Download these special release files of NSIS that support large strings:
https://nsis.sourceforge.io/Special_Builds#Large_strings
- and copy the containing files into the corresponding NSIS installations folders -7. Download these special release files of NSIS that support logging:
+ and copy the contained files into the corresponding NSIS installations folders +3. Download these special release files of NSIS that support logging:
https://nsis.sourceforge.io/Special_Builds#Advanced_logging
- and copy the containing files into the corresponding NSIS installations folders -8. Copy the file *~\nsprocess\Include\nsProcess.nsh* to the folder
- *\Include* of NSIS's installation folder.
- Copy the file *~\nsprocess\Plugins\x86-unicode\nsProcess.dll* to the folder
- *\Plugins\x86-unicode* of NSIS's installation folder.
- (You can alternatively get nsProcess from https://nsis.sourceforge.io/NsProcess_plugin) - -Now you have 2 options: + and copy the contained files into the corresponding NSIS installations folders +4. Download and install the nsProcess plugin from https://nsis.sourceforge.io/NsProcess_plugin -- you will need the version that supports Unicode, so make sure to follow the appropriate instructions on their site to install that one (as of this writing it involves manually copying and renaming the plugin DLL file). -* Either you got an already compiled FreeCAD, then copy all FreeCAD files to the folder
- *~\FreeCAD" e.g. "C:\FreeCAD\Installer\FreeCAD* -* Or you compiled FreeCAD on your own as described [here](https://wiki.freecad.org/Compile_on_Windows). Then: - * Open the file *Settings.nsh* as described in step 3. above and set there
- `!define FILES_FREECAD` to the folder you specified as `CMAKE_INSTALL_PREFIX` - * Copy into that folder the file *Delete.bat* that is part of the installer - * change to that folder and search it for **\*_debug.\*** - * delete all found files - * repeat this for the searches with **\*_d.\***, **\*.pyc** and **\*.pdb** - * open a command line in Windows and change in this to the folder - * run the comamand
- `Delete.bat` - * (These steps assure that the installer only contains files users need. Moreover it assures that the - overall files size is below 2 GB and we can use the most compact compression for the installer.) - -10. If you use a version of FreeCAD that was compiled using another MSVC version than MSVC 2019, - copy its distributable DLLs to the folder FILES_DEPS (see step 3). -11. Right-click on the file *FreeCAD-installer.nsi* and choose **Compile NSIS script** +## Build the installer +Next, update the installer settings for the current version of FreeCAD. Starting from the *src/WindowsInstaller* folder in the FreeCAD source tree: +1. Set the appropriate version strings for the release you are creating. These are used to construct the filename of the installer, among other things. If you have to upload a new version of the installer for the exact same release of FreeCAD, increment `APP_VERSION BUILD` as needed. +``` +!define APP_VERSION_MAJOR 0 +!define APP_VERSION_MINOR 21 +!define APP_VERSION_REVISION 0 +!define APP_VERSION_EMERGENCY "RC1" +!define APP_VERSION_BUILD 1 +``` +2. Within the folder *src/WindowsInstaller*, create a new folder called MSVCRedist and copy the following files from your MSVC installation into it: +``` +vcruntime140.dll +concrt140.dll +msvcp140.dll +vcamp140.dll +vccorlib140.dll +vcomp140.dll +``` +3. Open the file *Settings.nsh* with a text editor (both jEdit and Visual Studio Code are good editors for NSIS files). Edit the following paths to correspond to your system: `FILES_FREECAD` corresponds to your installation directory (e.g. `CMAKE_INSTALL_PREFIX` if you self-compiled) and `FILES_DEPS` is the folder you created with the MSVC redistributable files in it. +``` +!define FILES_FREECAD "C:\FreeCAD\Installer\FreeCAD" +!define FILES_DEPS "C:\FreeCAD\Installer\MSVCRedist" +``` +4. Ensure the FreeCAD files are in place. Here you have two options: + * If you are working from an already-compiled version of FreeCAD provided to you by an outside source: in this case, simply ensure that `FILES_FREECAD` is set to the directory containing those files. + * If you compiled FreeCAD on your own as described [here](https://wiki.freecad.org/Compile_on_Windows) (and using the Install option outlined there). Then: + * Open the file *Settings.nsh* as described in step 3. above and set there
+ `!define FILES_FREECAD` to the folder you specified as `CMAKE_INSTALL_PREFIX` + * Copy into that folder the file *Delete.bat* that is part of the installer + * open a command line in Windows and change to the folder + * run the comamand
+ `Delete.bat` + * (These steps assure that the installer only contains files users need. Moreover it assures that the + overall files size is below 2 GB and we can use the most compact compression for the installer.) +5. Right-click on the file *FreeCAD-installer.nsi* and choose **Compile NSIS script** to compile the installer. -12. The folder *~\MSVCRedist* contains already all MSVC 2019 x64 redistributable DLLs necessary - for FreeCAD 0.20. If another MSVC version was used to compile FreeCAD, replace the DLLs by - the ones of the used MSVC. (They are usually available in the folder - *C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC*) -For test builds of the installer you can turn off the compression. This speeds up + +NOTE: For test builds of the installer you can turn off the compression. This speeds up the build time for the installer a lot but increases its file size. The compression is turned off by uncommenting the line
`SetCompressor /SOLID lzma`