diff --git a/BUILD_OSX.md b/BUILD_OSX.md
index f3a5aea919..76778d5088 100644
--- a/BUILD_OSX.md
+++ b/BUILD_OSX.md
@@ -1,11 +1,33 @@
+# Contents
+
+
+
+- [Building FreeCAD on Mac OS 10.15.x -- Catalina](#build-freecad-macos-catalina)
+- [Directions](#directions)
+ - [Install Xcode Command line tools](#install-xcode-cli-tools)
+ - [Install Conda](#install-conda)
+ - [Run the shell script](#run-the-shell-script)
+- [Building FreeCAD on macOS using homebrew packages with & without formual file](#homebrew-build-fc-on-macos)
+- [Requirements](#homebrew-requirements)
+ - [Install required FreeCAD dependencies](#homebrew-install-required-deps)
+- [Limitations of using freecad formula file](#homebrew-limits-of-formula-file)
+- [Directions, Installing FreeCAD using brew packages without formula file](#homebrew-install-no-form-file)
+ - [Expanded Directions](#homebrew-expanded-directions)
+ - [Boost v1.75 fix](#homebrew-boost-175-fix)
+- [Errors, Issues, & Possible Solutions](#errors-issues-solutions)
+
+
+
# Building FreeCAD on Mac OS 10.15.x -- Catalina #
+
+
General notes on how the tooling works:
This setup uses [conda](https://docs.conda.io) for dependency management.
Conda is able to pull the deps from a repository called conda-forge and
setup an isolated build environment. Not quite as isolated as docker, but
-it is a good option for Mac and its what the FreeCAD CI system uses.
+it is a good option for Mac and is what the FreeCAD CI system uses.
Once the dependencies are installed into a conda environment, then the
build uses the standard `cmake` configuration process to configure the build
@@ -15,18 +37,26 @@ that architecture.
All of this, and some sanity checks, are in a unified shell script. See below.
-# Directions #
+# Directions
+
+
## Install XCode Command line tools ##
+
+
Run `xcode-select --install` and click through.
## Install Conda ##
+
+
Refer to [MiniConda Docs](https://docs.conda.io/en/latest/miniconda.html).
## Run the shell script ##
+
+
Run the `./build_unix_dev_conda.sh` and go get coffee. Builds take
an hour+ on a 2012 Retina MacBook.
@@ -36,3 +66,234 @@ Output binaries will be in the `./build/bin/FreeCAD` *and*
You can code/build/test using the cmake configuration folder `./build` in
the standard way *from within the freecad_dev conda environment*.
+---
+
+# Building FreeCAD on macOS using homebrew with & without a formula file
+
+
+
+> The below procedure provides an alternative way to install FreeCAD from the git source on macOS without having to use conda, but rather relies on [**mac homebrew**][lnk1] to manage dependencies.
+
+## Requirements
+
+
+
+- macOS, running High Sierra _10.13_ or later
+- homebrew installed and working
+- All required dependencies to build FreeCAD installed using `brew install`
+
+There is an official [**homebrew tap**][lnk2] that provides a list of formulas along with FreeCAD to setup all the dependencies to build FreeCAD from source on macOS, and also provides prebuilt bottles to install FreeCAD from a package rather than building from source.
+
+> 💡 The below steps will build a FreeCAD binary that will launch FreeCAD from a command line interface, and will **NOT** build the **FreeCAD.app** bundle, ie. a double clickable app icon that can be launched from a Finder window.
+
+### Install required FreeCAD dependencies
+
+
+
+- Setup homebrew to use the official [**freecad-homebrew**][lnk2] tap.
+
+```shell
+brew tap FreeCAD/freecad
+```
+
+- Install FreeCAD dependencies provided by the tap
+
+```shell
+brew install --only-dependencies freecad
+```
+
+> The above step will install FreeCAD dependencies provided by the tap, and if a _bottle_ is provided by the tap homebrew will install the bottled version of the dep rather than building from source, unless the `install` command explicitly uses a _flag_ to build from source.
+
+After all the dependencies have been installed, it should be possible to install FreeCAD from the provided bottle.
+
+```shell
+brew install freecad/freecad/freecad
+```
+
+> As of writing this, there are bottles provided for macOS Catalina and Big Sur
+> > If running a different version of macOS then building FreeCAD from source will be required.
+
+To explicitly build FreeCAD from source using the formula file provided by the tap
+
+```shell
+brew install freecad/freecad/freecad --build-from-source --HEAD --verbose
+```
+
+The above command will grab the latest git source of FreeCAD and output the build process to the terminal.
+
+> NOTE: On a MacBookPro 2013 late model it takes ~60 minutes to build FreeCAD from source.
+
+After the _make_ and _make install_ process completes it should be possible to launch FreeCAD from any directory using a terminal with the below commands,
+
+```shell
+FreeCAD
+FreeCADCmd
+```
+
+- `FreeCAD` will launch a GUI version of FreeCAD
+- `FreeCADCmd` will launch **only** a command line version of FreeCAD
+
+## Limitations of using the FreeCAD formula file
+
+
+
+If FreeCAD is installed via the bottle then one will have to wait for a new bottle to be generated to install a later version of FreeCAD. However, if FreeCAD is built from source, then FreeCAD will have all the updates up to the time the build process was started.
+
+If any of the dependencies FreeCAD relies on is updated FreeCAD will likely require a rebuild. Mac homebrew does provide a feature to pin packages at specific versions to prevent them from updating, and also allows setting of an environment variable to prevent homebrew from automatically checking for updates (which can slow things down). All that said, FreeCAD can be built using all the dependencies provided by Mac homebrew, but not using the formula file: instead cloning the source to an arbitrary path on a local filesystem. This provides a couple of advantages:
+
+- If `brew cleanup` is run and FreeCAD was installed using the above-provided command, all source tarballs or bottles that were _checked out_ or downloaded during the install process will be deleted from the system. If a reinstall or upgrade is later required then homebrew will have to refetch the bottles, or reclone the git source again.
+- Mac homebrew provides a method, _install flag_, for keeping the source regardless if the build succeeds or fails. The options are limited, however, and performing a standard `git clone` outside of homebrew is **much** preferred.
+- Cloning the FreeCAD source allows passing **any** cmake flags not provided by the formula file
+ - Allowing the use of other build systems such as _ninja_
+ - Allowing the use of alternate compilers, e.g. _ccache_
+ - Pulling in subsequent updates are quicker because the `git clone` of the FreeCAD source will remain on the local filesystem even if a `brew cleanup` is run
+ - Subsequent recompiles should not take 60 minutes if using a caching strategy such as _ccache_.
+
+## Directions, Installing FreeCAD using brew packages without a formula file
+
+
+
+> ⚠️ The below directions assume macOS High Sierra or later is being used, homebrew is setup properly, and all dependencies were installed successfully.
+
+**TL;DR**
+
+- Clone the FreeCAD source, pass cmake args/flags within source dir, run make, and make install, then profit 💰
+
+### Expanded Directions
+
+
+
+- Clone the FreeCAD source from GitHub
+
+```shell
+git clone https://github.com/freecad/freecad
+cd ./freecad
+git fetch
+```
+
+> The above _fetch_ cmd will take some time to fetch the commit history for the repo, but if a shallow clone is performed then FreeCAD will not show to correct build number in the About dialog [**learn more**][lnk3].
+
+Advanced users may alter the process below to build in a different location, use a different compiler, etc. but these instructions represent a procedure that works successfully for this author.
+
+Set the path / environment variables for specifying the compilers to use
+
+```
+export CC="/usr/local/opt/llvm/bin/clang"
+export CXX="/usr/local/opt/llvm/bin/clang++"
+```
+
+- Linking the brew-provided install of python 3 will be required in order for cmake to find the proper python and python libraries.
+
+```shell
+brew link python@3.9
+```
+
+#### Boost v1.75 fix
+
+
+
+- Due to recent changes in boost v1.75, building FreeCAD will fail with the below linking error message (for a more exhaustive error message, [**learn more**][lnk4])
+
+To work around the linking issue until the [**PR**][lnk5] is merged install boost will the patches applied within the PR.
+
+```shell
+ld: library not found for -licudata
+```
+
+```shell
+git checkout -b mybuild
+
+cmake \
+-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG \
+-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG \
+-DCMAKE_INSTALL_PREFIX=/opt/beta/freecad \
+-DCMAKE_INSTALL_LIBDIR=lib \
+-DCMAKE_BUILD_TYPE=Release \
+-DCMAKE_FIND_FRAMEWORK=LAST
+-DCMAKE_VERBOSE_MAKEFILE=ON \
+-Wno-dev \
+-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/macOSX10.14.sdk \
+-std=c++14 \
+-DCMAKE_CXX_STANDARD=14 \
+-DBUILD_ENABLE_CXX_STD:STRING=C++14 \
+-Wno-deprecated-declarations \
+-DUSE_PYTHON3=1 -DPYTHON_EXECUTABLE=/usr/local/bin/python3 \
+-DBUILD_FEM_NETGEN=1 \
+-DBUILD_FEM=1 \
+-DBUILD_TECHDRAW=0 \
+-DFREECAD_USE_EXTERNAL_KDL=ON \
+-DFREECAD_CREATE_MAC_APP=OFF
+-DCMAKE_PREFIX_PATH="/usr/local/opt/qt/lib/cmake;/usr/local/opt/nglib/Contents/Resources;/usr/local/opt/vtk@8.2/lib/cmake;/usr/local;" .
+```
+
+After the configuration completes run the below commands to start the build & install process
+
+```shell
+make
+make install
+```
+
+> 💡 Author's note: The above cmake build flags are the ones I've had good luck with, but that's not to say other ones can be added or removed. And for reasons unknown to me the above build process takes ~ twice along than using `brew install --build-from-source`
+
+If everything goes well FreeCAD should be able to launch from a terminal
+
+## Errors and Issues + possible solutions
+
+
+
+Some common pitfalls are listed in this section.
+
+---
+
+
+error: no member named
+
+```shell
+[ 18%] Building CXX object src/Gui/CMakeFiles/FreeCADGui.dir/DlgProjectInformationImp.cpp.o
+cd /opt/code/github/public/forks/freecad/build/src/Gui && /usr/local/bin/ccache /usr/local/opt/llvm/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PP_VARIADICS=1 -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DBUILD_ADDONMGR -DCMAKE_BUILD_TYPE=\"Release\" -DFreeCADGui_EXPORTS -DGL_SILENCE_DEPRECATION -DHAVE_CONFIG_H -DHAVE_FREEIMAGE -DHAVE_PYSIDE2 -DHAVE_RAPIDJSON -DHAVE_SHIBOKEN2 -DHAVE_TBB -DNDEBUG -DOCC_CONVERT_SIGNALS -DPYSIDE_QML_SUPPORT=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB -DQT_UITOOLS_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -D_OCC64 -I/opt/code/github/public/forks/freecad/build -I/opt/code/github/public/forks/freecad/build/src -I/opt/code/github/public/forks/freecad/src -I/opt/code/github/public/forks/freecad/src/Gui -I/opt/code/github/public/forks/freecad/src/Gui/Quarter -I/opt/code/github/public/forks/freecad/build/src/Gui -I/opt/code/github/public/forks/freecad/src/Gui/.. -I/opt/code/github/public/forks/freecad/build/src/Gui/.. -I/opt/code/github/public/forks/freecad/build/src/Gui/Language -I/opt/code/github/public/forks/freecad/build/src/Gui/propertyeditor -I/opt/code/github/public/forks/freecad/build/src/Gui/TaskView -I/opt/code/github/public/forks/freecad/build/src/Gui/Quarter -I/opt/code/github/public/forks/freecad/build/src/Gui/DAGView -I/usr/local/include/eigen3 -I/usr/local/include/PySide2/QtCore -I/usr/local/include/PySide2/QtGui -I/usr/local/include/PySide2/QtWidgets -isystem /usr/local/include -isystem /usr/local/Frameworks/Python.framework/Versions/3.9/include/python3.9 -iframework /usr/local/opt/qt/lib -isystem /usr/local/opt/qt/lib/QtCore.framework/Headers -isystem /usr/local/opt/qt/./mkspecs/macx-clang -isystem /usr/local/opt/qt/lib/QtWidgets.framework/Headers -isystem /usr/local/opt/qt/lib/QtGui.framework/Headers -isystem /Library/Developer/CommandLineTools/SDKs/macOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Headers -isystem /usr/local/opt/qt/lib/QtOpenGL.framework/Headers -isystem /usr/local/opt/qt/lib/QtPrintSupport.framework/Headers -isystem /usr/local/opt/qt/lib/QtSvg.framework/Headers -isystem /usr/local/opt/qt/lib/QtNetwork.framework/Headers -isystem /usr/local/opt/qt/include -isystem /usr/local/opt/qt/include/QtUiTools -isystem /usr/local/include/shiboken2 -isystem /usr/local/include/PySide2 -isystem /usr/local/opt/qt/lib/QtXml.framework/Headers -Wall -Wextra -Wpedantic -Wno-write-strings -Wno-undefined-var-template -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/macOSX10.14.sdk -fPIC -I/usr/local/Cellar/open-mpi/4.0.5/include -fPIC -std=gnu++14 -o CMakeFiles/FreeCADGui.dir/DlgProjectInformationImp.cpp.o -c /opt/code/github/public/forks/freecad/src/Gui/DlgProjectInformationImp.cpp
+/opt/code/github/public/forks/freecad/src/Gui/DlgProjectInformationImp.cpp:56:9: error: no member named 'lineEditProgramVersion' in 'Gui::Dialog::Ui_DlgProjectInformation'
+ ui->lineEditProgramVersion->setText(QString::fromUtf8(doc->getProgramVersion()));
+ ~~ ^
+1 error generated.
+make[2]: *** [src/Gui/CMakeFiles/FreeCADGui.dir/DlgProjectInformationImp.cpp.o] Error 1
+make[1]: *** [src/Gui/CMakeFiles/FreeCADGui.dir/all] Error 2
+make: *** [all] Error 2
+```
+
+
+
+FreeCAD may fail to build if creating a build directory within the _src_ directory and running `cmake ..` within the newly created _build_ directory. As it currently stands, `cmake` needs run within the _src_ directory or the this error message will likely appear during the build process.
+
+---
+
+
+ ⚠️ warning: specified path differs in case from file name on disk
+
+```
+/opt/code/github/public/forks/FreeCAD/src/Gui/moc_DlgParameterFind.cpp:10:10: warning: non-portable path to file '"../../../FreeCAD/src/Gui/DlgParameterFind.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
+#include "../../../freecad/src/Gui/DlgParameterFind.h"
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ "../../../FreeCAD/src/Gui/DlgParameterFind.h"
+1 warning generated.
+```
+
+
+
+On macOS most filesystems are case **insensitive**, whereas most GNU+Linux distros use _case sensitive_ file systems. So if FreeCAD source is cloned within a `FreeCAD` directory the build process on macOS may look for a `freecad` that is _case sensitive_ however the file system isn't case sensitive, thus the compiler will provide the above warning message.
+
+One way to resolve such error message is to rename `FreeCAD` to `freecad`
+
+```shell
+mv FreeCAD freecadd;
+mv freecadd freecad;
+```
+
+---
+
+
+
+[lnk1]:
+[lnk2]:
+[lnk3]:
+[lnk4]:
+[lnk5]:
diff --git a/cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake b/cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake
index 514c4aad24..9a936bffbe 100644
--- a/cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake
+++ b/cMake/FreeCAD_Helpers/SetGlobalCompilerAndLinkerSettings.cmake
@@ -62,17 +62,25 @@ macro(SetGlobalCompilerAndLinkerSettings)
endif(MSVC)
if(MINGW)
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12477
- # Actually '-Wno-inline-dllimport' should work to suppress warnings of the form:
- # inline function 'foo' is declared as dllimport: attribute ignored
- # But it doesn't work with MinGW gcc 4.5.0 while using '-Wno-attributes' seems to
- # do the trick.
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads -Wno-attributes")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthreads -Wno-attributes")
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mthreads -Wl,--export-all-symbols")
- # http://stackoverflow.com/questions/8375310/warning-auto-importing-has-been-activated-without-enable-auto-import-specifie
- # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
- link_libraries(-lgdi32)
+ if(CMAKE_COMPILER_IS_CLANGXX)
+ # clang for MSYS doesn't support -mthreads
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-attributes")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols")
+ #set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols")
+ else()
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12477
+ # Actually '-Wno-inline-dllimport' should work to suppress warnings of the form:
+ # inline function 'foo' is declared as dllimport: attribute ignored
+ # But it doesn't work with MinGW gcc 4.5.0 while using '-Wno-attributes' seems to
+ # do the trick.
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-attributes")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols")
+ #set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols")
+ # http://stackoverflow.com/questions/8375310/warning-auto-importing-has-been-activated-without-enable-auto-import-specifie
+ # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
+ link_libraries(-lgdi32)
+ endif()
endif(MINGW)
endmacro(SetGlobalCompilerAndLinkerSettings)
diff --git a/ci/.gitlab-ci.yml b/ci/.gitlab-ci.yml
new file mode 100644
index 0000000000..edb7bd10b9
--- /dev/null
+++ b/ci/.gitlab-ci.yml
@@ -0,0 +1,56 @@
+# This file is a template, and might need editing before it works on your project.
+# To contribute improvements to CI/CD templates, please follow the Development guide at:
+# https://docs.gitlab.com/ee/development/cicd/templates.html
+# This specific template is located at:
+# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
+
+# This is a sample GitLab CI/CD configuration file that should run without any modifications.
+# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
+# it uses echo commands to simulate the pipeline execution.
+#
+# A pipeline is composed of independent jobs that run scripts, grouped into stages.
+# Stages run in sequential order, but jobs within stages run in parallel.
+#
+# For more information, see: https://docs.gitlab.com/ee/ci/yaml/README.html#stages
+
+# this image is on dockerhub. Dockerfile is here: https://gitlab.com/PrzemoF/FreeCAD/-/blob/gitlab-v1/ci/Dockerfile
+image: freecadci/runner
+
+stages: # List of stages for jobs, and their order of execution
+ - build
+ - test
+
+before_script:
+ - apt-get update -yqq
+ # CCache Config
+ - mkdir -p ccache
+ - export CCACHE_BASEDIR=${PWD}
+ - export CCACHE_DIR=${PWD}/ccache
+
+cache:
+ paths:
+ - ccache/
+
+build-job: # This job runs in the build stage, which runs first.
+ stage: build
+
+ script:
+ - echo "Compiling the code..."
+ - mkdir build
+ - cd build
+ - ccache cmake ../
+ - ccache cmake --build ./ -j$(nproc)
+ - echo "Compile complete."
+
+ artifacts:
+ paths:
+ - build/
+
+test-job: # This job runs in the test stage.
+ stage: test # It only starts when the job in the build stage completes successfully.
+ script:
+ - echo "Running unit tests... "
+ - cd build/bin/
+ # Testing currently doesn't work due to problems with libraries ot being visible by the binary.
+ - ./FreeCADCmd -t 0
+
diff --git a/ci/Dockerfile b/ci/Dockerfile
new file mode 100644
index 0000000000..fb5196ed4d
--- /dev/null
+++ b/ci/Dockerfile
@@ -0,0 +1,118 @@
+FROM ubuntu:20.04
+MAINTAINER Przemo Firszt
+# This is the docker image definition used to build FreeCAD. It's currently accessible on:
+# https://hub.docker.com/repository/docker/freecadci/runner
+# on under name freecadci/runner when using docker
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update -y
+RUN apt-get update -y && apt-get install -y gnupg2
+RUN echo "deb http://ppa.launchpad.net/freecad-maintainers/freecad-daily/ubuntu focal main" >> /etc/apt/sources.list.d/freecad-daily.list
+RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 83193AA3B52FF6FCF10A1BBF005EAE8119BB5BCA
+RUN apt-get update -y
+
+# those 3 are for debugging purposes only. Not required to build FreeCAD
+RUN apt-get install -y \
+ vim \
+ nano \
+ bash
+
+# Main set of FreeCAD dependencies. To be verified.
+RUN apt-get install -y \
+ ccache \
+ cmake \
+ debhelper \
+ dh-exec \
+ dh-python \
+ doxygen \
+ git \
+ graphviz \
+ libboost-date-time-dev \
+ libboost-dev \
+ libboost-filesystem-dev \
+ libboost-filesystem1.71-dev \
+ libboost-graph-dev \
+ libboost-iostreams-dev \
+ libboost-program-options-dev \
+ libboost-program-options1.71-dev \
+ libboost-python1.71-dev \
+ libboost-regex-dev \
+ libboost-regex1.71-dev \
+ libboost-serialization-dev \
+ libboost-system1.71-dev \
+ libboost-thread-dev \
+ libboost-thread1.71-dev \
+ libboost1.71-dev \
+ libcoin-dev \
+ libdouble-conversion-dev \
+ libeigen3-dev \
+ libglew-dev \
+ libgts-bin \
+ libgts-dev \
+ libkdtree++-dev \
+ liblz4-dev \
+ libmedc-dev \
+ libmetis-dev \
+ libnglib-dev \
+ libocct-data-exchange-dev \
+ libocct-ocaf-dev \
+ libocct-visualization-dev \
+ libopencv-dev \
+ libproj-dev \
+ libpyside2-dev \
+ libqt5opengl5 \
+ libqt5opengl5-dev \
+ libqt5svg5-dev \
+ libqt5webkit5 \
+ libqt5webkit5-dev \
+ libqt5x11extras5-dev \
+ libqt5xmlpatterns5-dev \
+ libshiboken2-dev \
+ libspnav-dev \
+ libvtk7-dev \
+ libvtk7.1p \
+ libvtk7.1p-qt \
+ libx11-dev \
+ libxerces-c-dev \
+ libzipios++-dev \
+ lsb-release \
+ nastran \
+ netgen \
+ netgen-headers \
+ occt-draw \
+ pybind11-dev \
+ pyqt5-dev-tools \
+ pyside2-tools \
+ python3-dev \
+ python3-matplotlib \
+ python3-pivy \
+ python3-ply \
+ python3-pyqt5 \
+ python3-pyside2.* \
+ python3-pyside2.qtcore \
+ python3-pyside2.qtgui \
+ python3-pyside2.qtsvg \
+ python3-pyside2.qtuitools \
+ python3-pyside2.qtwidgets \
+ python3-pyside2.qtxml \
+ python3-requests \
+ python3-yaml \
+ qt5-default \
+ qt5-qmake \
+ qtbase5-dev \
+ qttools5-dev \
+ qtwebengine5-dev \
+ swig
+
+RUN apt-get update -y --fix-missing
+
+# Clean
+RUN apt-get clean \
+ && rm /var/lib/apt/lists/* \
+ /usr/share/doc/* \
+ /usr/share/locale/* \
+ /usr/share/man/* \
+ /usr/share/info/* -fR
+
+
diff --git a/src/3rdParty/libkdtree/kdtree++/iterator.hpp b/src/3rdParty/libkdtree/kdtree++/iterator.hpp
index 801dc40ae4..b6f7933442 100644
--- a/src/3rdParty/libkdtree/kdtree++/iterator.hpp
+++ b/src/3rdParty/libkdtree/kdtree++/iterator.hpp
@@ -54,8 +54,8 @@ namespace KDTree
inline _Base_iterator(_Base_const_ptr const __N = NULL)
: _M_node(__N) {}
- inline _Base_iterator(_Base_iterator const& __THAT)
- : _M_node(__THAT._M_node) {}
+ //inline _Base_iterator(_Base_iterator const& __THAT)
+ // : _M_node(__THAT._M_node) {}
inline void
_M_increment()
diff --git a/src/3rdParty/salomesmesh/CMakeLists.txt b/src/3rdParty/salomesmesh/CMakeLists.txt
index 104ffebba6..9f53ee423a 100644
--- a/src/3rdParty/salomesmesh/CMakeLists.txt
+++ b/src/3rdParty/salomesmesh/CMakeLists.txt
@@ -243,7 +243,7 @@ TARGET_LINK_LIBRARIES(DriverSTL ${SMESH_LIBS} Driver SMDS ${Boost_LIBRARIES})
SET_BIN_DIR(DriverSTL DriverSTL)
if(WIN32)
- set_target_properties(DriverSTL PROPERTIES COMPILE_FLAGS "-DMESHDRIVERSTL_EXPORTS -DBASICS_EXPORT -DSMESHUtils_EXPORTS -DBASICS_EXPORTS")
+ set_target_properties(DriverSTL PROPERTIES COMPILE_FLAGS "-DMESHDRIVERSTL_EXPORTS -DSMESHUtils_EXPORTS -DBASICS_EXPORTS")
endif(WIN32)
diff --git a/src/3rdParty/salomesmesh/inc/Basics_Utils.hxx b/src/3rdParty/salomesmesh/inc/Basics_Utils.hxx
index 20d0923c97..3e9a2fd392 100644
--- a/src/3rdParty/salomesmesh/inc/Basics_Utils.hxx
+++ b/src/3rdParty/salomesmesh/inc/Basics_Utils.hxx
@@ -34,7 +34,7 @@
#else
// avoid name collision with std::byte in C++17
#define NOCRYPT
-#define NOGDI
+#define NOGDI NOGDI
#include
#include
#pragma comment(lib,"winmm.lib")
diff --git a/src/3rdParty/salomesmesh/inc/ObjectPool.hxx b/src/3rdParty/salomesmesh/inc/ObjectPool.hxx
index f27161122c..6212cbbf5c 100644
--- a/src/3rdParty/salomesmesh/inc/ObjectPool.hxx
+++ b/src/3rdParty/salomesmesh/inc/ObjectPool.hxx
@@ -126,14 +126,14 @@ public:
void destroy(X* obj)
{
- long adrobj = (long) (obj);
+ intptr_t adrobj = (intptr_t) (obj);
for (size_t i = 0; i < _chunkList.size(); i++)
{
X* chunk = _chunkList[i];
- long adrmin = (long) (chunk);
+ intptr_t adrmin = (intptr_t) (chunk);
if (adrobj < adrmin)
continue;
- long adrmax = (long) (chunk + _chunkSize);
+ intptr_t adrmax = (intptr_t) (chunk + _chunkSize);
if (adrobj >= adrmax)
continue;
int rank = (adrobj - adrmin) / sizeof(X);
diff --git a/src/3rdParty/salomesmesh/inc/SMDS_SpacePosition.hxx b/src/3rdParty/salomesmesh/inc/SMDS_SpacePosition.hxx
index 31f6423442..f19c752e00 100644
--- a/src/3rdParty/salomesmesh/inc/SMDS_SpacePosition.hxx
+++ b/src/3rdParty/salomesmesh/inc/SMDS_SpacePosition.hxx
@@ -36,7 +36,7 @@ class SMDS_EXPORT SMDS_SpacePosition:public SMDS_Position
public:
SMDS_SpacePosition(double x=0, double y=0, double z=0);
- virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const;
+ virtual SMDS_TypeOfPosition GetTypeOfPosition() const;
static SMDS_PositionPtr originSpacePosition();
private:
static SMDS_SpacePosition* _originPosition;
diff --git a/src/3rdParty/salomesmesh/inc/SMESH_ExceptHandlers.hxx b/src/3rdParty/salomesmesh/inc/SMESH_ExceptHandlers.hxx
index 50cd06c805..d0d8e4604c 100644
--- a/src/3rdParty/salomesmesh/inc/SMESH_ExceptHandlers.hxx
+++ b/src/3rdParty/salomesmesh/inc/SMESH_ExceptHandlers.hxx
@@ -50,7 +50,7 @@ typedef void (*PVF)();
class SMESH_EXPORT Unexpect { //save / retrieve unexpected exceptions treatment
PVF old;
public :
-#ifndef WNT
+#ifndef _MSC_VER
// std::set_unexpected has been removed in C++17
Unexpect( PVF f )
{ /*old = std::set_unexpected(f);*/old = f; }
@@ -66,7 +66,7 @@ class SMESH_EXPORT Terminate {//save / retrieve terminate function
PVF old;
public :
-#ifndef WNT
+#ifndef _MSC_VER
Terminate( PVF f )
{ old = std::set_terminate(f); }
~Terminate() { std::set_terminate(old); }
diff --git a/src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx b/src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx
index e5f1f1b661..a776949b58 100644
--- a/src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx
+++ b/src/3rdParty/salomesmesh/inc/SMESH_Mesh.hxx
@@ -46,7 +46,7 @@
#include
-#ifdef WIN32
+#ifdef _MSC_VER
#pragma warning(disable:4251) // Warning DLL Interface ...
#pragma warning(disable:4290) // Warning Exception ...
#endif
diff --git a/src/3rdParty/salomesmesh/inc/Utils_ExceptHandlers.hxx b/src/3rdParty/salomesmesh/inc/Utils_ExceptHandlers.hxx
index 6985f8fa67..8f2362ded1 100644
--- a/src/3rdParty/salomesmesh/inc/Utils_ExceptHandlers.hxx
+++ b/src/3rdParty/salomesmesh/inc/Utils_ExceptHandlers.hxx
@@ -38,7 +38,7 @@ typedef void (*PVF)();
class UTILS_EXPORT Unexpect { //save / retrieve unexpected exceptions treatment
PVF old;
public :
-#ifndef WIN32
+#ifndef _MSC_VER
// std::set_unexpected has been removed in C++17
Unexpect( PVF f )
{ /*old = std::set_unexpected(f);*/old = f; }
@@ -54,7 +54,7 @@ class UTILS_EXPORT Terminate {//save / retrieve terminate function
PVF old;
public :
-#ifndef WIN32
+#ifndef _MSC_VER
Terminate( PVF f )
{ old = std::set_terminate(f); }
~Terminate() { std::set_terminate(old); }
diff --git a/src/3rdParty/salomesmesh/src/DriverSTL/DriverSTL_W_SMDS_Mesh.cpp b/src/3rdParty/salomesmesh/src/DriverSTL/DriverSTL_W_SMDS_Mesh.cpp
index 05b0480936..749f241ec0 100644
--- a/src/3rdParty/salomesmesh/src/DriverSTL/DriverSTL_W_SMDS_Mesh.cpp
+++ b/src/3rdParty/salomesmesh/src/DriverSTL/DriverSTL_W_SMDS_Mesh.cpp
@@ -23,8 +23,10 @@
#include "DriverSTL_W_SMDS_Mesh.h"
#ifdef WIN32
+#ifndef NOMINMAX
#define NOMINMAX
#endif
+#endif
#include
diff --git a/src/3rdParty/salomesmesh/src/DriverSTL/SMESH_File.cpp b/src/3rdParty/salomesmesh/src/DriverSTL/SMESH_File.cpp
index 43d567298c..481110f4b2 100644
--- a/src/3rdParty/salomesmesh/src/DriverSTL/SMESH_File.cpp
+++ b/src/3rdParty/salomesmesh/src/DriverSTL/SMESH_File.cpp
@@ -141,7 +141,8 @@ void SMESH_File::close()
_pos = _end = 0;
_size = -1;
}
- else if ( _file >= 0 )
+ //else if ( _file >= 0 )
+ else if ( _file != 0 )
{
#ifdef WIN32
if(_file != INVALID_HANDLE_VALUE) {
diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_ProjectionUtils.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_ProjectionUtils.cpp
index 4905d0d062..5ec96bdbec 100644
--- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_ProjectionUtils.cpp
+++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_ProjectionUtils.cpp
@@ -102,11 +102,11 @@ namespace HERE = StdMeshers_ProjectionUtils;
namespace {
static SMESHDS_Mesh* theMeshDS[2] = { 0, 0 }; // used for debug only
- inline long shapeIndex(const TopoDS_Shape& S)
+ inline intptr_t shapeIndex(const TopoDS_Shape& S)
{
if ( theMeshDS[0] && theMeshDS[1] )
return max(theMeshDS[0]->ShapeToIndex(S), theMeshDS[1]->ShapeToIndex(S) );
- return long(S.TShape().operator->());
+ return intptr_t(S.TShape().operator->());
}
//================================================================================
diff --git a/src/App/Document.cpp b/src/App/Document.cpp
index bcbf6b3849..a30293128e 100644
--- a/src/App/Document.cpp
+++ b/src/App/Document.cpp
@@ -66,6 +66,7 @@ recompute path. Also, it enables more complicated dependencies beyond trees.
# include
# include
# include
+# include
#endif
#include
@@ -142,6 +143,8 @@ using namespace zipios;
# define FC_LOGFEATUREUPDATE
#endif
+namespace fs = boost::filesystem;
+
// typedef boost::property VertexProperty;
typedef boost::adjacency_list <
boost::vecS, // class OutEdgeListS : a Sequence or an AssociativeContainer
@@ -2398,8 +2401,8 @@ private:
Base::FileInfo tmp(sourcename);
if (tmp.renameFile(targetname.c_str()) == false) {
- Base::Console().Warning("Cannot rename file from '%s' to '%s'\n",
- sourcename.c_str(), targetname.c_str());
+ throw Base::FileException(
+ "Cannot rename tmp save file to project file", targetname);
}
}
void applyTimeStamp(const std::string& sourcename, const std::string& targetname) {
@@ -2531,9 +2534,8 @@ private:
Base::FileInfo tmp(sourcename);
if (tmp.renameFile(targetname.c_str()) == false) {
- Base::Console().Error("Save interrupted: Cannot rename file from '%s' to '%s'\n",
- sourcename.c_str(), targetname.c_str());
- //throw Base::FileException("Save interrupted: Cannot rename temporary file to project file", tmp);
+ throw Base::FileException(
+ "Save interrupted: Cannot rename temporary file to project file", tmp);
}
if (numberOfFiles <= 0) {
@@ -2610,6 +2612,10 @@ bool Document::saveToFile(const char* filename) const
fn += uuid;
}
Base::FileInfo tmp(fn);
+ // In case some folders in the path do not exist
+ fs::path parent = fs::path(filename).parent_path();
+ if (!parent.empty() && !parent.filename_is_dot() && !parent.filename_is_dot_dot())
+ fs::create_directories(parent);
// open extra scope to close ZipWriter properly
{
diff --git a/src/App/Expression.cpp b/src/App/Expression.cpp
index 1edc62605b..8149ce708b 100644
--- a/src/App/Expression.cpp
+++ b/src/App/Expression.cpp
@@ -484,11 +484,11 @@ App::any pyObjectToAny(Py::Object value, bool check) {
if (PyLong_Check(pyvalue))
return App::any(PyLong_AsLong(pyvalue));
else if (PyUnicode_Check(pyvalue)) {
- const char* value = PyUnicode_AsUTF8(pyvalue);
- if (!value) {
+ const char* utf8value = PyUnicode_AsUTF8(pyvalue);
+ if (!utf8value) {
FC_THROWM(Base::ValueError, "Invalid unicode string");
}
- return App::any(std::string(value));
+ return App::any(std::string(utf8value));
}
else {
return App::any(pyObjectWrap(pyvalue));
diff --git a/src/App/Link.cpp b/src/App/Link.cpp
index 7c4859fd7b..3e67cbe16c 100644
--- a/src/App/Link.cpp
+++ b/src/App/Link.cpp
@@ -1322,8 +1322,8 @@ void LinkBaseExtension::setLink(int index, DocumentObject *obj,
auto objs = getElementListValue();
getElementListProperty()->setValue();
- for(auto obj : objs)
- detachElement(obj);
+ for(auto thisObj : objs)
+ detachElement(thisObj);
return;
}
diff --git a/src/App/ObjectIdentifier.cpp b/src/App/ObjectIdentifier.cpp
index 3b47871109..0aebc7f48d 100644
--- a/src/App/ObjectIdentifier.cpp
+++ b/src/App/ObjectIdentifier.cpp
@@ -1490,14 +1490,14 @@ void ObjectIdentifier::String::checkImport(const App::DocumentObject *owner,
else {
str.resize(str.size()-1);
auto mapped = reader->getName(str.c_str());
- auto obj = owner->getDocument()->getObject(mapped);
- if (!obj) {
+ auto objForMapped = owner->getDocument()->getObject(mapped);
+ if (!objForMapped) {
FC_ERR("Cannot find object " << str);
}
else {
isString = true;
forceIdentifier = false;
- str = obj->Label.getValue();
+ str = objForMapped->Label.getValue();
}
}
}
diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp
index 44b79a607c..e78abd3c22 100644
--- a/src/App/PropertyLinks.cpp
+++ b/src/App/PropertyLinks.cpp
@@ -2729,9 +2729,9 @@ public:
// potentially unchanged. So we just touch at most one.
std::set docs;
for(auto link : links) {
- auto doc = static_cast(link->getContainer())->getDocument();
- auto ret = docs.insert(doc);
- if(ret.second && !doc->isTouched())
+ auto linkdoc = static_cast(link->getContainer())->getDocument();
+ auto ret = docs.insert(linkdoc);
+ if(ret.second && !linkdoc->isTouched())
link->touch();
}
}
diff --git a/src/App/PropertyUnits.cpp b/src/App/PropertyUnits.cpp
index 8e3443cc01..6189e144fb 100644
--- a/src/App/PropertyUnits.cpp
+++ b/src/App/PropertyUnits.cpp
@@ -324,6 +324,18 @@ PropertyPressure::PropertyPressure()
setUnit(Base::Unit::Pressure);
}
+//**************************************************************************
+//**************************************************************************
+// PropertyStiffness
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+TYPESYSTEM_SOURCE(App::PropertyStiffness, App::PropertyQuantity)
+
+PropertyStiffness::PropertyStiffness()
+{
+ setUnit(Base::Unit::Stiffness);
+}
+
//**************************************************************************
//**************************************************************************
// PropertyForce
diff --git a/src/App/PropertyUnits.h b/src/App/PropertyUnits.h
index a95a201d3f..fdc4b453f3 100644
--- a/src/App/PropertyUnits.h
+++ b/src/App/PropertyUnits.h
@@ -227,6 +227,18 @@ public:
virtual ~PropertyPressure(){}
};
+/** Stiffness property
+ * This is a property for representing stiffness. It is basically a float
+ * property. On the Gui it has a quantity like m/s^2.
+ */
+class AppExport PropertyStiffness: public PropertyQuantity
+{
+ TYPESYSTEM_HEADER();
+public:
+ PropertyStiffness(void);
+ virtual ~PropertyStiffness(){}
+};
+
/** Force property
* This is a property for representing acceleration. It is basically a float
* property. On the Gui it has a quantity like m/s^2.
diff --git a/src/App/Range.h b/src/App/Range.h
index 86872a4436..554a02057a 100644
--- a/src/App/Range.h
+++ b/src/App/Range.h
@@ -24,6 +24,9 @@
#define RANGE_H
#include
+#ifndef FC_GLOBAL_H
+#include
+#endif
namespace App {
diff --git a/src/Base/BaseClass.h b/src/Base/BaseClass.h
index 66be845d6a..f5b5a20f4f 100644
--- a/src/Base/BaseClass.h
+++ b/src/Base/BaseClass.h
@@ -63,7 +63,6 @@ void * _class_::create(void){\
/// define to implement a subclass of Base::BaseClass
#define TYPESYSTEM_SOURCE_TEMPLATE_P(_class_) \
-template<> Base::Type _class_::classTypeId = Base::Type::badType(); \
template<> Base::Type _class_::getClassTypeId(void) { return _class_::classTypeId; } \
template<> Base::Type _class_::getTypeId(void) const { return _class_::classTypeId; } \
template<> void * _class_::create(void){\
diff --git a/src/Base/Builder3D.h b/src/Base/Builder3D.h
index 239f56e5a2..927e0880d9 100644
--- a/src/Base/Builder3D.h
+++ b/src/Base/Builder3D.h
@@ -29,6 +29,9 @@
#include
#include
#include "Vector3D.h"
+#ifndef FC_GLOBAL_H
+#include
+#endif
namespace Base
{
diff --git a/src/Base/Debugger.h b/src/Base/Debugger.h
index 114b7e38b0..503b3fba3a 100644
--- a/src/Base/Debugger.h
+++ b/src/Base/Debugger.h
@@ -26,6 +26,9 @@
#include
#include
+#ifndef FC_GLOBAL_H
+#include
+#endif
namespace Base {
/**
diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp
index 1efd8c0110..8f8cfc74cf 100644
--- a/src/Base/Exception.cpp
+++ b/src/Base/Exception.cpp
@@ -248,17 +248,13 @@ const char* XMLAttributeError::what() const throw()
FileException::FileException(const char * sMessage, const char * sFileName)
: Exception( sMessage ),file(sFileName)
{
- if (sFileName) {
- _sErrMsgAndFileName = _sErrMsg + ": ";
- _sErrMsgAndFileName += sFileName;
- }
+ setFileName(sFileName);
}
FileException::FileException(const char * sMessage, const FileInfo& File)
: Exception( sMessage ),file(File)
{
- _sErrMsgAndFileName = _sErrMsg + ": ";
- _sErrMsgAndFileName += File.fileName();
+ setFileName(File.fileName().c_str());
}
FileException::FileException()
@@ -274,6 +270,15 @@ FileException::FileException(const FileException &inst)
{
}
+void FileException::setFileName(const char * sFileName) {
+ file.setFile(sFileName);
+ _sErrMsgAndFileName = _sErrMsg;
+ if (sFileName) {
+ _sErrMsgAndFileName += ": ";
+ _sErrMsgAndFileName += sFileName;
+ }
+}
+
std::string FileException::getFileName() const
{
return file.fileName();
@@ -324,7 +329,7 @@ void FileException::setPyObject( PyObject * pydict)
Py::Dict edict(pydict);
if (edict.hasKey("filename"))
- file.setFile(static_cast(Py::String(edict.getItem("filename"))));
+ setFileName(Py::String(edict.getItem("filename")).as_std_string("utf-8").c_str());
}
}
diff --git a/src/Base/Exception.h b/src/Base/Exception.h
index 7fd38ce75a..0aff3c9e1f 100644
--- a/src/Base/Exception.h
+++ b/src/Base/Exception.h
@@ -262,6 +262,7 @@ protected:
// necessary for what() legacy behaviour as it returns a buffer that
// can not be of a temporary object to be destroyed at end of what()
std::string _sErrMsgAndFileName;
+ void setFileName(const char * sFileName=0);
};
/**
diff --git a/src/Base/Factory.h b/src/Base/Factory.h
index 06b51322cc..92699083cf 100644
--- a/src/Base/Factory.h
+++ b/src/Base/Factory.h
@@ -25,11 +25,13 @@
#ifndef BASE_FACTORY_H
#define BASE_FACTORY_H
-#include
-#include
-#include