Compile FreeCAD on Windows

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
dcapeletti
Posts: 504
Joined: Wed Jul 23, 2014 2:27 pm

Compile FreeCAD on Windows

Post by dcapeletti »

Estimates,
what I want to do is to compile freecad to make some changes to the title of the application and change the startup image as described in this article https://www.freecadweb.org/wiki/Branding that comes from my question in this thread https://forum.freecadweb.org/viewtopic.php?f=8&t=29831
Currently I would like to compile under Windows 10, but I think it is more difficult than doing it under linux, what is your opinion or suggestion about it?
On the other hand, if I compile under linux (Ubuntu), is it possible to make an executable for windows? or is it easier to compile it directly in windows.

I have seen this chapter on compiling in Windows https://www.freecadweb.org/wiki/CompileOnWindows but don't know if it is up to date to compile the latest version of freecad.
If there is a video on how to compile freecad in windows step by step it will help me a lot.

Greetings
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Compile FreeCAD on Windows

Post by wmayer »

what I want to do is to compile freecad to make some changes to the title of the application and change the startup image as described in this article https://www.freecadweb.org/wiki/Branding that comes from my question in this thread https://forum.freecadweb.org/viewtopic.php?f=8&t=29831
As you has been told in the other thread you don't have to compile FreeCAD only to change some icons or the title bar. As referenced read through the Branding stuff and especially check the branding.xml format. With this you can do all the needed changes.
Currently I would like to compile under Windows 10, but I think it is more difficult than doing it under linux
Not really, it just needs a bit more time to setup your build environment.
On the other hand, if I compile under linux (Ubuntu), is it possible to make an executable for windows? or is it easier to compile it directly in windows.
Cross-compiling might be an option but I guess it's much harder than building on the target platform directly.
I have seen this chapter on compiling in Windows https://www.freecadweb.org/wiki/CompileOnWindows but don't know if it is up to date to compile the latest version of freecad.
If there is a video on how to compile freecad in windows step by step it will help me a lot.
The required ingredients are:
* the MSVC compiler (VS2013)
* the libpack which you can download from our github page
* cmake

The steps are:
* start cmake-gui and define path to the source code and build directory (it's best to define a build directory outside the source code)
* when running cmake configure the first time it will report some errors because it won't find the libpack dev files. After specifying its path cmake configure should succeed
* start VS and load the FreeCAD.sln project file and press F7 to start the build
User avatar
dcapeletti
Posts: 504
Joined: Wed Jul 23, 2014 2:27 pm

Re: Compile FreeCAD on Windows

Post by dcapeletti »

Thank you for your clarification.
I found libpack for version 0.16, I couldn't find it for version 0.17 of freecad. If he exists, I haven't been able to find his link.
On the other hand I have created an xml file for the branding which had no effect on freecad, but I will continue that discussion in its corresponding thread https://forum.freecadweb.org/viewtopic.php?f=8&t=29831

Thank you
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Compile FreeCAD on Windows

Post by GeneFC »

The libraries are not easy to find if you don't already have a link.

Here are a couple I have successfully used with the MSVC compiler (VS2013).

https://github.com/sgrogan/FreeCAD/rele ... 64_VC12.7z

https://github.com/sgrogan/FreeCAD/rele ... 64_VC12.7z


I do not know if there is a better central location for libpacks. You should also be aware that these libpacks do not contains all of the latest versions of OCC and other dependencies.

Gene
User avatar
dcapeletti
Posts: 504
Joined: Wed Jul 23, 2014 2:27 pm

Re: Compile FreeCAD on Windows

Post by dcapeletti »

I have created the following video using cmake.
https://peertube.video/videos/watch/53b ... e76bd199ab

There are some caveats in it that I don't think are problematic. There is a dependency on the flatmesh module that is not up to date, can you tell me how to update it, could it cause problems when building freecad?
Now I have opened the FreeCAD_trunk file with visual studio but the compilation takes a long time.

Thank you
User avatar
dcapeletti
Posts: 504
Joined: Wed Jul 23, 2014 2:27 pm

Re: Compile FreeCAD on Windows

Post by dcapeletti »

I opened Visual Studio and went to the menu File-Open->Project/Solution.
You have opened the FreeCAD_trunk.sln file
Then I did the following: right-click on FreeCADMain in the Solution Explorer and select Set as StartUp Project. Next step is right click on FreeCADMain in the Solution Explorer and choose Set as StartUp Project. You will then need copy the libpack bin folder to the build bin folder. See https://forum.freecadweb.org/viewtopic. ... =10#p66333

Thanks
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Compile FreeCAD on Windows

Post by sgrogan »

dcapeletti wrote: Mon Jul 23, 2018 7:06 pm There are some caveats in it that I don't think are problematic. There is a dependency on the flatmesh module that is not up to date, can you tell me how to update it, could it cause problems when building freecad?
The flatmesh module requires a newer version of Eign3 than is the Libpack you are using. FreeCAD simply disables compilation of the flatmesh module. This causes no problems, but obviously the flatmesh functionality will not be available.

There is a newer Libpack here: https://github.com/FreeCAD/FreeCAD-port ... /tag/v0.18
This Libpack contains a newer version of Eigen3, so the flatmesh module will compile. This is the Libpack I am using for the 0.18-dev release builds. You will need to add the occt include path in CMake. The problem is that the debug libs are incomplete/obsolete. Do to my time/skill constraints, by the time I get the release libs incorporated into the Libpack and start working on the debug libs, I need to update the release libs again (OCCT 7.3 is the next update on my list)
GeneFC wrote: Mon Jul 23, 2018 3:47 pm The libraries are not easy to find if you don't already have a link.
Yea, guilty as charged. I'm hesitant to post these Libpacks as official given all the flaws. Anyone who has compiled FreeCAD probably has most of the skills necessary to compile some of the dependencies and update the Libpack, but I understand that people aren't compiling FreeCAD to work on the dependency stack. If anyone is interested I can try to help.

Unfortunately my time has been pretty limited and probably will be for the near future.
"fight the good fight"
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Compile FreeCAD on Windows

Post by wmayer »

dcapeletti wrote: Mon Jul 23, 2018 2:26 pm On the other hand I have created an xml file for the branding which had no effect on freecad, but I will continue that discussion in its corresponding thread https://forum.freecadweb.org/viewtopic.php?f=8&t=29831
You have to be careful when copying the content of branding.xml on the Wiki page because it contains some spaces at the beginning and thus causes syntax errors. I have tested this

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<Branding>
 	<Application>FooApp</Application>
 	<WindowTitle>Foo App in title bar</WindowTitle>
 	<BuildVersionMajor>1</BuildVersionMajor>
 	<BuildVersionMinor>0</BuildVersionMinor>
 	<BuildRevision>1234</BuildRevision>
 	<BuildRevisionDate>2014/1/1</BuildRevisionDate>
 	<CopyrightInfo>(c) My copyright</CopyrightInfo>
 	<MaintainerUrl>Foo App URL</MaintainerUrl>
 	<ProgramLogo>Path to logo (appears in bottom right corner)</ProgramLogo>
 	<WindowIcon>Path to icon file</WindowIcon>
 	<ProgramIcons>Path to program icons</ProgramIcons>
 	<SplashScreen>splashscreen.png</SplashScreen>
 	<SplashAlignment>Bottom|Left</SplashAlignment>
 	<SplashTextColor>#ffffff</SplashTextColor>
 	<SplashInfoColor>#c8c8c8</SplashInfoColor>
 	<StartWorkbench>PartDesignWorkbench</StartWorkbench>
</Branding>
 
with the 0.17 release and it works without problems. The file must be located in the same directory where the FreeCAD.exe resides.
Post Reply