|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +--- |
| 4 | + |
| 5 | +# Maintaining the FreeCAD LibPack for Windows |
| 6 | + |
| 7 | +To create a new LibPack for Windows, begin by creating an empty directory. The suggested naming scheme |
| 8 | +is to name it "LibPack-XX-YY-ARCH" where XX is the release of FreeCAD the pack is intented to work with, |
| 9 | +YY is a version number of the LibPack itself, and ARCH is the architecture the LibPack was build for |
| 10 | +(e.g. x86_64 or arm64). The rest of this document will refer to that directory as *LIBPACK*. |
| 11 | + |
| 12 | +Note that in several places below you are instructed to load a developer's power shell: you may use |
| 13 | +whichever shell you'd like, but ensure that you are loading the shell configured with the x64 native |
| 14 | +compilation tools if you are compiling on an Intel processor. ARM compilation is untested. |
| 15 | + |
| 16 | +For the most part, the libraries below are self-compiled in order to reduce dependency on third-party |
| 17 | +packagers. In some cases it is feasible to download precompiled binaries of the individual items. Major |
| 18 | +exceptions here are that both Python and Qt are used in their precompiled forms since the packages are |
| 19 | +provided for Windows by the first parties in each case. |
| 20 | + |
| 21 | +WORK IN PROGRESS!! |
| 22 | + |
| 23 | +Perform the following in this order (the order does not *always* matter, but sometimes does): |
| 24 | +* **[Python](https://python.org)** -- Install in a newly-created *LIBPACK\bin* subdirectory using the basic Python installer. Only install |
| 25 | + Python itself: the Idle IDE, debug symbols, etc. are not included in the LibPack. |
| 26 | +* **[Qt](https://qt.io)** -- The Open Source installer is found at https://www.qt.io/download-open-source |
| 27 | +* Most of the optional components of Qt can be omitted, except for: |
| 28 | + - Qt WebEngine |
| 29 | + - Qt PDF |
| 30 | + - Qt Image Formats |
| 31 | +* Qt should be installed into an arbitrary location outside of the LibPack you are creating: the Qt installer |
| 32 | + will create a subdirectory structure that is based on the version number and architecture of the installation. |
| 33 | + Within that subdirectory are many directories: `bin`,`doc`,`include`, etc. These should all be copied into |
| 34 | + the top level of the LibPack |
| 35 | +* **[Boost](https://boost.org)** -- this is split into its headers and libraries: |
| 36 | + - Many Boost libraries are header-only, but FreeCAD does require several compiled libraries |
| 37 | + - Follow the Boost instructions for compiling: the easiest is to run `bootstrap` from a developer's command prompt |
| 38 | + - Copy the libraries from *BOOST_ROOT\stage\lib* into *LIBPACK\lib* |
| 39 | + - Copy the entire *BOOST_ROOT\boost* directory into *LIBPACK\include* |
| 40 | +* **[Coin](https://www.coin3d.org)** -- obtained by cloning and compiling https://github.com/coin3d/coin |
| 41 | + - Make sure you compile against the Boost libraries downloaded above by setting BOOST_ROOT to the top of the *LIBPACK* |
| 42 | + - Set CMAKE_INSTALL_PATH to the top of the *LIBPACK* |
| 43 | + - Add include directory to find the Boost include files by editing CXXFLAGS and adding "/I C:\path\to\libpack\include" to it |
| 44 | + - Do not build the Tests or Documentation |
| 45 | + - In Visual Studio, run the ALL_BUILD and then INSTALL targets in Release mode. |
| 46 | +* **[Quarter](https://www.coin3d.org)** -- obtained by cloning and compiling https://github.com/coin3d/quarter |
| 47 | + - Set Coin_DIR to *LIBPACK/lib/cmake/Coin-4.0.1* (or the current version, if it is not 4.0.1) |
| 48 | + - Set Qt6_DIR to *LIBPACK/lib/cmake/Qt6* |
| 49 | + - Set CMAKE_INSTALL_PREFIX to *LIBPACK* |
| 50 | + - In some cases even with Qt6_DIR specified, Quarter will fail to find all necessary Qt library cmake files. In |
| 51 | + those cases you will need to manually set the path to the cmake files as *LIBPACK/lib/cmake/Qt6XXX*. |
| 52 | + - Do not build the examples, tests, or documentation |
| 53 | + - At this time this guide was written, Quarter did not correctly support Qt 6.4: the file QuarterWidgetP.cpp had to |
| 54 | + be modified to add `#include <QOpenGLContext>` in the Qt includes section at the top of the file. |
| 55 | + - Build the ALL_BUILD and INSTALL targets in Release mode |
| 56 | +* **[SWIG](https://www.swig.org)** -- obtained from https://www.swig.org, prebuilt binaries are available for Windows |
| 57 | + - Copy the downloaded folder to *LIBPACK\bin\swig* (e.g. change its name to remove the version number) |
| 58 | +* **[Pivy](https://www.coin3d.org)** -- obtained by cloning and compiling https://github.com/coin3d/pivy |
| 59 | + - Set Python_ROOT_DIR to *LIBPACK/bin* |
| 60 | + - Set SWIG_EXECUTABLE to *LIBPACK/bin/swig/swig.exe* |
| 61 | + - Set SWIG_DIR to *LIBPACK/bin/swig/Lib* (note the "Lib" at the end of the path!) |
| 62 | + - Set Coin_DIR to *LIBPACK/lib/cmake/Coin-4.0.1* (or the current version, if it is not 4.0.1) |
| 63 | + - NOTE: Do *not* install SoQt -- doing so will trigger a dependency on Qt5 |
| 64 | + - Set Qt6_DIR to *LIBPACK/lib/cmake/Qt6* |
| 65 | + - In some cases even with Qt6_DIR specified, Quarter will fail to find all necessary Qt library cmake files. In |
| 66 | + those cases you will need to manually set the path to the cmake files as *LIBPACK/lib/cmake/Qt6XXX*. |
| 67 | + - Set CMAKE_INSTALL_PREFIX to *LIBPACK* |
| 68 | + - Build the ALL_BUILD and INSTALL targets in Release mode |
| 69 | +* **[libclang](https://clang.llvm.org)** -- Needed by pyside6, and provided prebuilt by Qt |
| 70 | + - Download from https://download.qt.io/development_releases/prebuilt/libclang/ |
| 71 | + - Decompress and move the contents to the *LIBPACK* directory |
| 72 | +* **[Pyside](https://pypi.org/project/PySide6)** -- now part of the Qt project, installed as a Python package with pip |
| 73 | + - E.g. `LIBPACK/bin/python.exe -m pip install pyside6==6.5.2` |
| 74 | + - Note that this will also install Shiboken, in the same location |
| 75 | +* **[VTK](https://vtk.org)** -- installed with pip |
| 76 | + - E.g. `LIBPACK/bin/python.exe -m pip install vtk==9.2.4` |
| 77 | +* **[HarfBuzz](https://harfbuzz.github.io)** -- Required by FreeType (and thus by OCCT) |
| 78 | + - Clone https://github.com/harfbuzz/harfbuzz |
| 79 | + - Switch to the latest release branch |
| 80 | + - Set PYTHON_EXECUTABLE to *LIBPACK/bin/python.exe* |
| 81 | + - Set CMAKE_INSTALL_PREFIX to *LIBPACK* |
| 82 | + - Build the ALL_BUILD and INSTALL targets in Release mode |
| 83 | +* **[ZLIB](http://zlib.net)** -- Required by FreeType (and thus by OCCT) |
| 84 | + - Download and unpack the latest source code |
| 85 | + - Set CMAKE_INSTALL_PREFIX to *LIBPACK* (note: must be done prior to running Configure if using the GUI) |
| 86 | + - Build the ALL_BUILD and INSTALL targets in Release mode |
| 87 | +* **[libpng](http://www.libpng.org)** -- Required by FreeType (and thus by OCCT) |
| 88 | + - Download the zipfile of the source code and extract it |
| 89 | + - Set ZLIB_INCLUDE_DIR to *LIBPACK/include* |
| 90 | + - Set ZLIB_LIBRARY_RELEASE to *LIBPACK/lib/zlib.lib* |
| 91 | + - Set CMAKE_INSTALL_PREFIX to *LIBPACK* |
| 92 | + - Build the ALL_BUILD and INSTALL targets in Release mode |
| 93 | +* **[bzip2](https://sourceware.org.bzip2)** -- Required by FreeType (and this by OCCT) |
| 94 | + - Download the source from https://sourceware.org/bzip2/downloads.html |
| 95 | + - Extract it to a directory with no spaces or non-ASCII characters in it |
| 96 | + - Open a Developer's PowerShell |
| 97 | + - `cd X:\path\to\extracted\files` |
| 98 | + - `nmake -f .\makefile.msc` |
| 99 | + - Copy libbz2.lib into *LIBPACK\lib* |
| 100 | + - Copy all header files into *LIBPACK\include* |
| 101 | +* **[FreeType](https://freetype.org)** -- Required by OCCT |
| 102 | + - Download the latest version from https://sourceforge.net/projects/freetype/files/freetype2/ (a Windows .zip file is available) |
| 103 | + - Extract the files and run cMake |
| 104 | + - Set HarfBuzz_INCLUDE_DIR to *LIBPACK/include* |
| 105 | + - Set HarfBuzz_LIBRARY to *LIBPACK/lib/harfbuzz.lib* |
| 106 | + - Set ZLIB_INCLUDE_DIR to *LIBPACK/include* |
| 107 | + - Set ZLIB_LIBRARY_RELEASE to *LIBPACK/lib/zlib.lib* |
| 108 | + - Set PNG_INCLUDE_DIR to *LIBPACK/include* |
| 109 | + - Set PNG_LIBRARY_RELEASE to *LIBPACK/lib/libpng16.lib* |
| 110 | + - Set BZIP2_INCLUDE_DIR to *LIBPACK/include* |
| 111 | + - Set BZIP2_LIBRARY_RELEASE to *LIBPACK/lib/libbz2.lib* |
| 112 | + - Set CMAKE_INSTALL_PREFIX to *LIBPACK* |
| 113 | + - Add BUILD_SHARED_LIBS as a boolean value, set to true |
| 114 | + - Add BUILD_STATIC_LIBS as a boolean value, set to true |
| 115 | +* **[Tcl/Tk](https://www.tcl.tk)** |
| 116 | + - Download the latest source code for Tcl and Tk |
| 117 | + - Unpack each, and for each |
| 118 | + - Open a Developer's Powershell window and change to the *win* subdirectory in the source download |
| 119 | + - Run `nmake -f makefile.vc release` |
| 120 | + - Run `nmake -f makefile.vc install INSTALLDIR=C:\path\to\libpack` |
| 121 | +* **[OpenCASCADE](https://www.opencascade.org)** -- Also known as OCCT, the core CAD kernel used by FreeCAD is fetched from a gitlab mirror that |
| 122 | + provides additional improvements over the upstream version |
| 123 | + - Clone https://gitlab.com/blobfish/occt |
| 124 | + - Run cMake |
| 125 | + - Enable USE_VTK |
| 126 | + - For each of TCL, TK, VTK, and FreeType (represented below by XXX): |
| 127 | + - Set 3RDPARTY_XXX_DIR to *LIBPACK* |
| 128 | + - Set 3RDPARTY_XXX_DLL_DIR to *LIBPACK/bin/* |
| 129 | + - Set 3RDPARTY_XXX_LIBRARY_DIR to *LIBPACK/lib/* |
| 130 | + - Set 3RDPARTY_XXX_LIBRARY to *LIBPACK/lib/xxxYYY.lib* (the name of the library varies, use whatever is present) |
| 131 | + - Set INSTALL_DIR to *LIBPACK* |
| 132 | + - Configure, Generate, and open the project in Visual Studio |
| 133 | + - Switch to Release and build the ALL_BUILD target |
| 134 | +* **[Netgen](https://ngsolve.org)** |
| 135 | + - Clone https://github.com/NGSolve/netgen |
| 136 | + - Switch to the tag you wish to compile (e.g. `git checkout v6.2.2304`) |
| 137 | + - Run cMake |
| 138 | +* **[GMSH](https://gmsh.info)** |
0 commit comments