Skip to content

Commit d82487e

Browse files
authored
Merge pull request #11 from chennes/addScript
Update LibPack to Qt6/Py3.12/OCCT7.8 and migrate script to Python 3 (and to this repo)
2 parents 6198898 + 404fcaf commit d82487e

18 files changed

+2274
-1
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
__pycache__
2+
.vscode/
3+
working
4+
LibPack-*
5+
.venv
6+
venv
7+
.idea

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-License-Identifier: LGPL-2.1-or-later
2+
3+
# See https://pre-commit.com for more information
4+
# See https://pre-commit.com/hooks.html for more hooks
5+
exclude: 'patches/.*'
6+
7+
repos:
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v4.5.0
10+
hooks:
11+
- id: trailing-whitespace
12+
- id: end-of-file-fixer
13+
- id: check-yaml
14+
- id: mixed-line-ending
15+
- repo: https://github.com/psf/black
16+
rev: 24.3.0
17+
hooks:
18+
- id: black
19+
args: ['--line-length', '100']

Readme.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
This repository is to provide libraries needed to compile FreeCAD under Windows.
22

3-
The LibPack is tested to work with [Microsoft Visual C++](https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B) (a.k.a. MSVC or VC). It should be possible to use other compilers like MinGW, however this is not tested.
3+
The current LibPack, v3.0, is tested to work with [Microsoft Visual C++](https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B) (a.k.a. MSVC or VC) v14.4 (released mid-2024). It should be possible to use other compilers like MinGW, however this is not tested. This LibPack only supports FreeCAD compilation in Release or RelWithDebInfo mode. It may be possible to compile the LibPack in Debug mode, but changes will certainly be required (and patches are welcome!). In particular, the pip installation of Numpy will have to be adjusted to compile a debug version of Numpy, which will otherwise fail to load from a debug compilation of Python.
44

55
For information how to use the LibPack to compile, see this Wiki page: https://wiki.freecadweb.org/Compile_on_Windows
6+
7+
## Building the LibPack ##
8+
9+
To build the LibPack locally, you will need the following:
10+
* Network access
11+
* A working compiler toolchain for your system, accessible by cMake
12+
* CMake
13+
* git
14+
* 7z (see https://www.7-zip.org)
15+
* Python >= 3.8 (**not** used inside the LibPack itself, just used to run the creation script)
16+
* The "requests" Python package (e.g. 'pip install requests')
17+
* The "diff-match-patch" Python package (e.g. 'pip install diff-match-patch')
18+
* Qt - the base installation plus Qt Image Formats, Qt Webengine, Qt Webview, and Qt PDF
19+
* NOTE: The two Web requirements will be dropped from the LibPack before it is released
20+
* GNU Bison (for Windows see https://github.com/lexxmark/winflexbison/)
21+
22+
With those pieces in place, the next step is to configure the contents of the LibPack by editing `config.json`. This file
23+
lists the source for each LibPack component. Depending on the component, there are three different ways it might be included:
24+
1) Source code checked out from a git repository and built using the local compiler toolchain
25+
1) A pip package installed to the LibPack directory using the LibPack's Python interpreter
26+
* Note that `pip` itself is installed using the `ensure_pip` Python module
27+
1) Files copied from a local source
28+
29+
The JSON file just lists out the sources and versions: beyond specifying which method is used for the installation by setting
30+
either "git-repo" and "git_ref", "pip-install", or "install-directory", the actual details of how things are built when source
31+
code is provided are set in the `compile_all.py` script. In that file, the class `Compiler` contains methods following the
32+
naming convention `build_XXX` where `XXX` is the "name" provided in the JSON configuration file. If you need to add a compiled
33+
or copied package, you must both specify it in the config.json file and provide a matching `build_XXX` method. For pip
34+
installation, only the config.json file needs to be edited to include the new dependency.
35+
36+
To change the way a package is compiled, you edit its entry in `compile_all.py`. See the contents of that file for various
37+
examples.
38+
39+
**NOTE**: In this prerelease LibPack 3.0 builder, you will need to apply the contents of https://github.com/FreeCAD/FreeCAD/pull/10337 to your FreeCAD build.
40+
41+
## Running the build script ##
42+
43+
```
44+
python.exe create_libpack [arguments]
45+
```
46+
Arguments:
47+
* `-m`, `--mode` -- 'release' or 'debug' (Default: 'release')
48+
* `-c`, `--config` -- Path to a JSON configuration file for this utility (Default: './config.json')
49+
* `-w`, `--working` -- Directory to put all the clones and downloads in (Default: './working')
50+
* `-e`, `--no-skip-existing-clone` -- If a given clone (or download) directory exists, delete it and download it again
51+
* `-b`, `--no-skip-existing-build` -- If a given build already exists, run the build process again anyway
52+
* `-s`, `--silent` -- I kow what I'm doing, don't ask me any questions
53+
* `--7zip` -- Path to 7-zip executable
54+
* `--bison` -- Path to Bison executable

0 commit comments

Comments
 (0)