Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
hlorus committed Sep 16, 2024
2 parents 306fb23 + b4923d1 commit ffa926c
Show file tree
Hide file tree
Showing 607 changed files with 60,348 additions and 57,940 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/actions/linux/generateCacheKey/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ inputs:
compiler:
description: "Binary name/path of compiler to be used"
required: true
qt_major_version:
description: "Major version number of qt to be used"
required: true
outputs:
cacheKey:
description: "Cache key with distro and compiler version"
Expand All @@ -39,6 +42,6 @@ runs:
- id: generateCacheKey
shell: bash -l {0}
run: |
cacheKey=$(lsb_release -ds | tr -d ' ')-$(basename ${{ inputs.compiler }})$(${{ inputs.compiler }} -dumpfullversion -dumpversion)
cacheKey=$(lsb_release -ds | tr -d ' ')-$(basename ${{ inputs.compiler }})$(${{ inputs.compiler }} -dumpfullversion -dumpversion)-qt${{ inputs.qt_major_version }}
echo "Generated cache key : $cacheKey"
echo "cacheKey=$cacheKey" >> $GITHUB_OUTPUT
2 changes: 1 addition & 1 deletion .github/workflows/actions/windows/getCcache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ runs:
id: getCached
with:
path: ${{ inputs.ccachebindir }}
key: ccacheforwin
key: ccacheforwin-${{ inputs.ccacheversion }}
- name: Download ccache
shell: bash
if: steps.getCached.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/actions/windows/getLibpack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ runs:
id: getCached
with:
path: ${{ inputs.libpackdir }}
key: libpackforwin
key: libpackforwin-${{ inputs.libpackname }}
- name: Download libpack
shell: bash
if: steps.getCached.outputs.cache-hit != 'true'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sub_buildUbuntu2004.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ jobs:
uses: ./.github/workflows/actions/linux/generateCacheKey
with:
compiler: ${{ env.CXX }}
qt_major_version: 5
- name: Restore Compiler Cache
uses: actions/cache@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sub_buildUbuntu2204Conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:
uses: ./.github/workflows/actions/linux/generateCacheKey
with:
compiler: ${{ env.CXX }}
qt_major_version: 5
- name: Restore Compiler Cache
uses: actions/cache@v4
with:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/sub_buildUbuntu2204CondaQt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ jobs:
uses: ./.github/workflows/actions/linux/generateCacheKey
with:
compiler: ${{ env.CXX }}
qt_major_version: 6
- name: Restore Compiler Cache
uses: actions/cache@v4
with:
save-always: true
path: ${{ env.CCACHE_DIR }}
key: FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-${{ github.run_id }}-qt6
key: FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-qt6-
FC-${{ steps.genCacheKey.outputs.cacheKey }}-qt6-
FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-
FC-${{ steps.genCacheKey.outputs.cacheKey }}-
- name: Print CCache statistics before build, reset stats and print config
run: |
ccache -s
Expand Down
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ endif()

project(FreeCAD)

set(PACKAGE_VERSION_NAME "Vulcan")
set(PACKAGE_VERSION_MAJOR "0")
set(PACKAGE_VERSION_MINOR "22")
set(PACKAGE_VERSION_MAJOR "1")
set(PACKAGE_VERSION_MINOR "1")
set(PACKAGE_VERSION_PATCH "0") # number of patch release (e.g. "4" for the 0.18.4 release)
set(PACKAGE_VERSION_SUFFIX "dev") # either "dev" for development snapshot or "" (empty string)
set(PACKAGE_BUILD_VERSION "0") # used when the same FreeCAD version will be re-released (for example using an updated LibPack)
Expand Down
4 changes: 4 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@
},
"cmakeExecutable": "${sourceDir}/conda/cmake.sh",
"cacheVariables": {
"CMAKE_IGNORE_PREFIX_PATH": {
"type": "STRING",
"value": "/opt/homebrew;/usr/local/homebrew"
},
"CMAKE_INCLUDE_PATH": {
"type": "FILEPATH",
"value": "${sourceDir}/.conda/freecad/include"
Expand Down
2 changes: 1 addition & 1 deletion cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ macro(CompilerChecksAndSetups)
set(CMAKE_CXX_STANDARD 23)
elseif(${BUILD_ENABLE_CXX_STD} MATCHES "C\\+\\+20")
set(CMAKE_CXX_STANDARD 20)
elseif(${BUILD_ENABLE_CXX_STD} MATCHES "C\\+\\+17")
else()#Enabled C++17
set(CMAKE_CXX_STANDARD 17)
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ macro(SetGlobalCompilerAndLinkerSettings)
if(FREECAD_RELEASE_PDB)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
endif(FREECAD_RELEASE_PDB)
if(FREECAD_RELEASE_SEH)
# remove /EHsc or /EHs flags because they are incompatible with /EHa
Expand Down
1 change: 1 addition & 0 deletions conda/environment-qt6.devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies:
- xorg-x11-server-xvfb-cos7-aarch64 # [linux and aarch64]
- sed # [unix]
- ccache
- clang-format
- cmake
- coin3d
- compilers
Expand Down
1 change: 1 addition & 0 deletions conda/environment.devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ dependencies:
- xorg-x11-server-xvfb-cos7-aarch64 # [linux and aarch64]
- sed # [unix]
- ccache
- clang-format
- cmake
- coin3d
- compilers
Expand Down
2 changes: 1 addition & 1 deletion src/3rdParty/OndselSolver
Submodule OndselSolver updated 186 files
11 changes: 10 additions & 1 deletion src/3rdParty/libE57Format/src/CheckedFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
* DEALINGS IN THE SOFTWARE.
*/

// convenience for all the BSDs
#if defined( __FreeBSD__) || defined( __NetBSD__) || defined( __OpenBSD__)
#define __BSD
#endif

#if defined( _WIN32 )
#if defined( _MSC_VER )
#include <codecvt>
Expand All @@ -44,6 +49,10 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#elif defined(__BSD)
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#elif defined( __APPLE__ )
#include <sys/types.h>
#include <unistd.h>
Expand Down Expand Up @@ -483,7 +492,7 @@ uint64_t CheckedFile::lseek64( int64_t offset, int whence )
#endif
#elif defined( __linux__ )
int64_t result = ::lseek64( fd_, offset, whence );
#elif defined( __APPLE__ )
#elif defined( __APPLE__ ) || defined(__BSD)
int64_t result = ::lseek( fd_, offset, whence );
#else
#error "no supported OS platform defined"
Expand Down
41 changes: 40 additions & 1 deletion src/App/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3323,7 +3323,46 @@ void Application::ExtractUserPath()
mConfig["UserMacroPath"] = Base::FileInfo::pathToString(macro) + PATHSEP;
}

#if defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_BSD)
// TODO: Consider using this for all UNIX-like OSes
#if defined(__OpenBSD__)
#include <cstdio>
#include <cstdlib>
#include <sys/param.h>
#include <QCoreApplication>

std::string Application::FindHomePath(const char* sCall)
{
// We have three ways to start this application either use one of the two executables or
// import the FreeCAD.so module from a running Python session. In the latter case the
// Python interpreter is already initialized.
std::string absPath;
std::string homePath;
if (Py_IsInitialized()) {
// Note: realpath is known to cause a buffer overflow because it
// expands the given path to an absolute path of unknown length.
// Even setting PATH_MAX does not necessarily solve the problem
// for sure but the risk of overflow is rather small.
char resolved[PATH_MAX];
char* path = realpath(sCall, resolved);
if (path)
absPath = path;
}
else {
int argc = 1;
QCoreApplication app(argc, (char**)(&sCall));
absPath = QCoreApplication::applicationFilePath().toStdString();
}

// should be an absolute path now
std::string::size_type pos = absPath.find_last_of("/");
homePath.assign(absPath,0,pos);
pos = homePath.find_last_of("/");
homePath.assign(homePath,0,pos+1);

return homePath;
}

#elif defined (FC_OS_LINUX) || defined(FC_OS_CYGWIN) || defined(FC_OS_BSD)
#include <cstdio>
#include <cstdlib>
#include <sys/param.h>
Expand Down
8 changes: 4 additions & 4 deletions src/App/ComplexGeoData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,10 @@ void ComplexGeoData::readElements(Base::XMLReader& reader, size_t count)
}
}
}
_elementMap->setElementName(IndexedName(reader.getAttribute("value"), types),
MappedName(reader.getAttribute("key")),
Tag,
&sids);
ensureElementMap()->setElementName(IndexedName(reader.getAttribute("value"), types),
MappedName(reader.getAttribute("key")),
Tag,
&sids);
}
if (invalid_count != 0) {
FC_ERR("Found " << invalid_count << " invalid string id"); // NOLINT
Expand Down
6 changes: 6 additions & 0 deletions src/App/DocumentObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ class AppExport DocumentObject: public App::TransactionalObject
/* Return true to cause PropertyView to show linked object's property */
virtual bool canLinkProperties() const {return true;}

/* Return whether this object is a link */
virtual bool isLink() const {return false;};

/* Return whether this object is a link group */
virtual bool isLinkGroup() const {return false;};

/* Return true to bypass duplicate label checking */
virtual bool allowDuplicateLabel() const {return false;}

Expand Down
62 changes: 62 additions & 0 deletions src/App/GeoFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include <App/GeoFeaturePy.h>

#include <Base/Tools.h>

#include "ComplexGeoData.h"
#include "Document.h"
#include "GeoFeature.h"
Expand Down Expand Up @@ -270,3 +272,63 @@ GeoFeature::getHigherElements(const char *element, bool silent) const
return {};
return prop->getComplexData()->getHigherElements(element, silent);
}

Base::Placement GeoFeature::getPlacementFromProp(App::DocumentObject* obj, const char* propName)
{
Base::Placement plc = Base::Placement();
auto* propPlacement = dynamic_cast<App::PropertyPlacement*>(obj->getPropertyByName(propName));
if (propPlacement) {
plc = propPlacement->getValue();
}
return plc;
}

Base::Placement GeoFeature::getGlobalPlacement(App::DocumentObject* targetObj,
App::DocumentObject* rootObj,
const std::string& sub)
{
if (!targetObj || !rootObj || sub.empty()) {
return Base::Placement();
}
std::vector<std::string> names = Base::Tools::splitSubName(sub);

App::Document* doc = rootObj->getDocument();
Base::Placement plc = getPlacementFromProp(rootObj, "Placement");

if (targetObj == rootObj) return plc;

for (auto& name : names) {
App::DocumentObject* obj = doc->getObject(name.c_str());
if (!obj) {
return Base::Placement();
}

plc = plc * getPlacementFromProp(obj, "Placement");

if (obj == targetObj) {
return plc;
}
if (obj->isLink()) {
// Update doc in case its an external link.
doc = obj->getLinkedObject()->getDocument();
}
}

// If targetObj has not been found there's a problem
return Base::Placement();
}

Base::Placement GeoFeature::getGlobalPlacement(App::DocumentObject* targetObj,
App::PropertyXLinkSub* prop)
{
if (!targetObj || !prop) {
return Base::Placement();
}

std::vector<std::string> subs = prop->getSubValues();
if (subs.empty()) {
return Base::Placement();
}

return getGlobalPlacement(targetObj, prop->getValue(), subs[0]);
}
4 changes: 4 additions & 0 deletions src/App/GeoFeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ class AppExport GeoFeature : public App::DocumentObject
/// Return the higher level element names of the given element
virtual std::vector<Data::IndexedName> getHigherElements(const char *name, bool silent=false) const;

static Base::Placement getPlacementFromProp(DocumentObject* obj, const char* propName);
static Base::Placement getGlobalPlacement(DocumentObject* targetObj, DocumentObject* rootObj, const std::string& sub);
static Base::Placement getGlobalPlacement(DocumentObject* targetObj, PropertyXLinkSub* prop);

protected:
void onChanged(const Property* prop) override;
// void onDocumentRestored() override;
Expand Down
15 changes: 15 additions & 0 deletions src/App/Link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2282,6 +2282,16 @@ bool Link::canLinkProperties() const {
return true;
}

bool Link::isLink() const
{
return ElementCount.getValue() == 0;
}

bool Link::isLinkGroup() const
{
return ElementCount.getValue() > 0;
}

//////////////////////////////////////////////////////////////////////////////////////////

namespace App {
Expand Down Expand Up @@ -2309,6 +2319,11 @@ bool LinkElement::canDelete() const {
return !owner || !owner->getDocument()->getObjectByID(_LinkOwner.getValue());
}

bool LinkElement::isLink() const
{
return true;
}

App::Link* LinkElement::getLinkGroup() const
{
std::vector<App::DocumentObject*> inList = getInList();
Expand Down
6 changes: 6 additions & 0 deletions src/App/Link.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,10 @@ class AppExport Link : public App::DocumentObject, public App::LinkExtension
}

bool canLinkProperties() const override;

bool isLink() const override;

bool isLinkGroup() const override;
};

using LinkPython = App::FeaturePythonT<Link>;
Expand Down Expand Up @@ -600,6 +604,8 @@ class AppExport LinkElement : public App::DocumentObject, public App::LinkBaseEx
_handleChangedPropertyName(reader,TypeName,PropName);
}

bool isLink() const override;

App::Link* getLinkGroup() const;
};

Expand Down
5 changes: 5 additions & 0 deletions src/App/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ directly. If you did not intend to use a system-defined macro

using namespace App;
namespace fs = boost::filesystem;
#ifndef XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_QUALIFIER
using namespace XERCES_CPP_NAMESPACE;
#else
XERCES_CPP_NAMESPACE_USE
#endif

namespace MetadataInternal
{
Expand Down
5 changes: 5 additions & 0 deletions src/App/MetadataPyImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
#include "MetadataPy.cpp"

using namespace Base;
#ifndef XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_QUALIFIER
using namespace XERCES_CPP_NAMESPACE;
#else
XERCES_CPP_NAMESPACE_USE
#endif

// Returns a string which represents the object e.g. when printed in Python
std::string MetadataPy::representation() const
Expand Down
Loading

0 comments on commit ffa926c

Please sign in to comment.