Skip to content

Latest commit

 

History

History
147 lines (117 loc) · 6.46 KB

develop.md

File metadata and controls

147 lines (117 loc) · 6.46 KB

Testing and Debugging FreeCAD with dependencies from conda

This section is for testing new branches, or your own implementations/additions of Freecad with conda. This is interesting because conda gives us a nice way to gather all the sources we need to build FreeCAD. No need to download all the necessary libraries which have conflicts within them and with each other. Simply use the develop branch of this repo and follow these instruction:

  1. Clone this repository with: git clone https://github.com/looooo/FreeCAD_Conda
  2. Go to FreeCAD_Conda/.FreeCAD_debug/build.sh and modify the FREECAD_SOURCE variable at the top of the document.

While you're at it, have a look at the gcc options. An older version is necessary! I have tested with 4.8 and 4.9. But most-likely the gcc shipped with conda is not compatible with the system libstd... So manually specifying gcc is necessary! This is not true for building with old linux versions. Especially if you build with docker and any-linux gcc from conda can be used (see build.md).

  1. In the terminal cd ./FreeCAD_Conda/develop/FreeCAD_debug/
  2. Run conda build .

Note: you can also use the --dirty flag BUT this will run CMake again, so there are more things getting rebuilt in the build directory. It is also possible to use cmake-gui and use a graphical dialog to set/unset cmake flags.

Setup with KDevelop (Linux)

Read more about setting up KDevelop... ### Preparation - conda installed - channeld freecad and conda-forge added

Setup

  1. Build with conda
cd FreeCAD_Conda/develop/FreeCAD_debug
conda build .
# abort once cmake is ready
ln -s ~/conda/conda-bld/freecad_debug/...b_env... ~/conda/env/fc_debug
  1. Activate the build environment: source activate fc_debug
  2. Start kdevelop from terminal (fc_debug environment)
  3. Open a project and choose the CMakeList.txt from FreeCAD
  4. Set build dir to ~/conda/conda-bld/freecad_debug..../work
  5. in KDevelop press Build (wait until build is done)
  6. configure executable in KDevelop:
  • select FreeCAD in the project tree
  • menu at top -> Run -> Configure Launches -> AddNew -> Compiled Binary
  • check executable
  • select ~/conda/conda-bld/freecad_debug/work/bin/FreeCAD
  1. press Execute

if you want to run cmake again simply do:

cd FreeCAD_Conda/develop/FreeCAD_debug
conda build . --dirty

Known Issues

There is the possibility that the default conda install and the build environment are using the same python version. If this is the case you should set the variable PYTHONHOME explicitly to the build environment.

In KDevelop it's done like so:

  • Run/Configure launches
  • Select problematic version
  • Environment (press on the button on the right side)
  • On top press the arrow-"x" and type a new name
  • "add new group"
  • In the table enter "PYTHONHOME" and as value look for the path to the build-environment

Basic Development Setup using KDevelop (Windows)

Read more about Basic dev setup on windows...

Win is always a bit more problematic. But with some hacks it's possible to setup a development base with KDevelop on windows.

Prerequisites

  • Make sure you have installed conda
  • Make sure you are familiar with basic conda commands
  • Download and install latest KDevelop for windows https://www.kdevelop.org/download

Get the FreeCAD source

  • git clone https://github.com/FreeCAD/FreeCAD
  • Make note of the path where the source was cloned to, this location will be called %FREECAD_SRC%

Get the source for building FreeCAD with conda

  • git clone https://github.com/FreeCAD/FreeCAD_Conda
  • The location where the FreeCAD conda install scripts were cloned to will be called %FC_CONDA_SCRIPTS%

Creating a development build

  • cd %FC_CONDA_SCRIPTS%\freecad_debug
  • conda build .
  • once the build process is starting press ctrl-c to abort

Setup KDevelop (Windows)

Configure kdevelop

  • This script works to invoke kdevelop with the right settings for the created build-environment. Note: edit the paths of the script to match your system.
call "C:\Users\fc_builder\Miniconda3\Scripts\activate.bat" "C:\Users\fc_builder\Miniconda3\envs\fc_debug"
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\..\..\VC\vcvarsall.bat" amd64

FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\Software\KDE\KDevelop" /v Install_Dir`) DO (
    set appdir=%%A %%B
)

if NOT DEFINED appdir (
    FOR /F "usebackq tokens=3*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\Software\Wow6432Node\KDE\KDevelop" /v Install_Dir`) DO (
        set appdir=%%A %%B
    )
)

START "" "%appdir%\bin\kdevelop.exe"
  • Once kdevelop is launched this way: create a new environment-:
    • project/openconfiguration/show advanced/configure-environment (right button)
    • Enter a name for the "Environment-group" (eg.: "fc_debug")
    • Go to batch-edit-mode (second button on the right side (hover over the buttons if you are not sure))
    • Enter these lines and configure to match your system:
FC_PYTHONHOME=C:\Users\fc_builder\Miniconda3\envs\fc_debug
QT_QPA_PLATFORM_PLUGIN_PATH=C:\Users\fc_builder\Miniconda3\envs\fc_debug\Library\plugins\platforms

Setup with Visual Studio 2015 (Windows)

Read more about setting up VS2015 on Windows... - Get Visual Studio 2015 community: I downloaded it from [here](https://www.computerbase.de/downloads/systemtools/entwicklung/visual-studio-2015/) - Use a script to launch visual-studio: (**TODO: Fix this broken script**)
call "C:\Users\fc_builder\Miniconda3\Scripts\activate.bat" "C:\Users\fc_builder\Miniconda3\envs\fc_debug_vs"
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\..\..\VC\vcvarsall.bat" amd64

START  "" "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe"

TODO

  • Update this document (it's out of date)
  • other editors beside kdevelop
  • Tips and tricks section
    • How to download a FreeCAD/FreeCAD branch(aka PR) for testing
    • How to test new dependencies in FC (e.g. upstream OCC betas etc...)
    • using cmake
  • Perhaps cross polinate with FreeCAD Mod Dev Guide