Windows/VC getting started compiling

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
alanbaljeu
Posts: 4
Joined: Wed Mar 15, 2023 10:26 pm

Windows/VC getting started compiling

Post by alanbaljeu »

Thus far I haveVisual Studio Community 2022, Python 3.9, QT6 installation, Cmake, and Visual Studio Code because it has a nice Cmake runner.

My current issue is figuring out libpack and Qt. My issue is the instructions are unclear.

"set the FREECAD_LIBPACK_DIR to the libpack directory." Where and how?
"Using Qt5 directory from LibPack in D:/opensource/freecad/lib/cmake/Qt5"

Qt5 from Libpack? I thought it couldn't find libpack? Also, it failed.

"Consider setting Qt5_DIR or [cmake] Qt6_DIR (as needed)."

Again, where and how? Do I set Qt6_DIR someplace = c:/Qt? (also surprised it doesn't know to find it there, given how clever all the rest was.

[main] Configuring project: freecad
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SD:/opensource/freecad -Bd:/opensource/freecad/build -G "Visual Studio 17 2022" -T host=x64 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
[cmake] -- Compiler: MSVC, version: 19.34.31937.0
[cmake] Libpack NOT found.
[cmake] If you intend to use a Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.
[cmake] -- prefix: C:/Program Files/FreeCAD
[cmake] -- bindir: bin
[cmake] -- datadir: data
[cmake] -- docdir: doc
[cmake] -- includedir: include
[cmake] -- libdir: lib
[cmake] -- cmake: 3.26.0
[cmake] -- Visit: https://github.com/apeltauer/FreeCAD/releases/ for Windows libpack downloads.
[cmake] -- Using Qt5 directory from LibPack in D:/opensource/freecad/lib/cmake/Qt5
[cmake] CMake Error at cMake/FreeCAD_Helpers/ChooseQtVersion.cmake:79 (message):
[cmake] Could not find a valid Qt installation. Consider setting Qt5_DIR or
[cmake] Qt6_DIR (as needed).
[cmake] Call Stack (most recent call first):
[cmake] cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake:65 (ChooseQtVersion)
[cmake] CMakeLists.txt:41 (InitializeFreeCADBuildOptions)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\CMake\bin\cmake.exe" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SD:/opensource/freecad -Bd:/opensource/freecad/build -G "Visual Studio 17 2022" -T host=x64 -A x64 exited with code: 1
[visual-studio] Patch Windows SDK path from C:\Program Files (x86)\Windows Kits\10\bin\x64 to C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64 for D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat
Last edited by alanbaljeu on Thu Mar 16, 2023 9:42 pm, edited 3 times in total.
alanbaljeu
Posts: 4
Joined: Wed Mar 15, 2023 10:26 pm

Re: Windows/VC getting started.

Post by alanbaljeu »

I found this instruction: "You can include the folder of your LibPack in your system PATH variable. This is useful if you plan to build multiple configurations/versions of FreeCAD."

So to clarify, I do not intend to build multiple configurations. I also don't think I want to fill the PATH variable.

For what it's worth here's my directory:

Directory of D:\opensource

2023-03-14 08:31 PM <DIR> .
2023-03-14 08:31 PM <DIR> ..
2020-11-03 07:18 PM <DIR> c#
2018-11-15 09:51 PM <DIR> clipper_ver6.4.2
2019-02-28 01:06 PM <DIR> cross-monitor
2023-03-15 06:41 PM <DIR> freecad
2023-03-15 06:58 PM <DIR> LibPack-OCC76-V2-6
alanbaljeu
Posts: 4
Joined: Wed Mar 15, 2023 10:26 pm

Re: Windows/VC getting started compiling

Post by alanbaljeu »

Okay I tried adding FREECAD_LIBPACK_DIR to environment variables. No effect.

Then I tried adding this line to CMakeLists.txt

set(FREECAD_LIBPACK_DIR "D:/opensource/LibPack-OCC76-V2-6")

When I save, it runs Cmake again

Very confusing output: (My comments interspersed)

[main] Configuring project: freecad
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -SD:/opensource/freecad -Bd:/opensource/freecad/build -G "Visual Studio 17 2022" -T host=x64 -A x64
[cmake] Not searching for unused variables given on the command line.
[cmake] -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
[cmake] -- Compiler: MSVC, version: 19.34.31937.0
[cmake] Libpack NOT found.
[cmake] If you intend to use a Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.

same error as always. It would be nice if the error gave a source line, as you see Qt below does. Then I could examine the source to trace what it expects.

[cmake] -- prefix: C:/Program Files/FreeCAD
[cmake] -- bindir: bin
[cmake] -- datadir: data
[cmake] -- docdir: doc
[cmake] -- includedir: include
[cmake] -- libdir: lib
[cmake] -- cmake: 3.26.0
[cmake] -- Found libpack env variable: D:/opensource/freecad

Where would it find this? I have a libpack variable but it is not set to /freecad.

[cmake] -- Visit: https://github.com/apeltauer/FreeCAD/releases/ for Windows libpack downloads.

Yes that's where I got libpack

[cmake] -- Using Qt5 directory from LibPack in D:/opensource/freecad/lib/cmake/Qt5

That's not where libpack is. I didn't see instructions to put it there. tried moving libpack to freecad/lib to no avail..

[cmake] CMake Error at cMake/FreeCAD_Helpers/ChooseQtVersion.cmake:79 (message):
[cmake] Could not find a valid Qt installation. Consider setting Qt5_DIR or
[cmake] Qt6_DIR (as needed).
[cmake] Call Stack (most recent call first):
[cmake] cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake:65 (ChooseQtVersion)
[cmake] CMakeLists.txt:41 (InitializeFreeCADBuildOptions)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
alanbaljeu
Posts: 4
Joined: Wed Mar 15, 2023 10:26 pm

Re: Windows/VC getting started compiling

Post by alanbaljeu »

I decided to restart. Keeping the packages downloaded before, I used git to reverse all edits. Open the Cmake tool directly. Click configure.

Code: Select all

Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19045.
CMake Error at 3rdParty/lazy_loader/CMakeLists.txt:8 (SET_PYTHON_PREFIX_SUFFIX):
  Unknown CMake command "SET_PYTHON_PREFIX_SUFFIX".
Oh weird. "Where is the source code", the correct answer is not freecad/src. It's freecad root. That corrects this.

And now it finds the environment variables I set before that it wouldn't under vscode's cmake runner. Seems to be working.

Proceeding:
Building with Visual Studio 15 (2017) or newer
Release Build
Start the Visual Studio IDE. This can either be done by pressing the button Open Project in the CMake GUI or by double-clicking on the file FreeCAD.sln that you find in your build folder.
FreeCad.sln does not exist in this repo.


Ah found instruction video. Appears I missed clicking Generate, and that would have make it....
Post Reply