Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Config] Fix QGLViewer find module on windows #4611

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d0ed989
[all] Fix warnings (#4291)
hugtalbot Dec 1, 2023
5469837
[Haption] Partially fix the plugin (#4338)
alxbilger Dec 12, 2023
1ada9a2
[Topology] Check indices out-of-bound in TriangleSetTopologyContainer…
olivier-goury Dec 12, 2023
187b956
[All] Add GIT_REF option for external plugins (#4448)
bakpaul Jan 26, 2024
7602c8e
[Testing] Externalize (find_package() or fetch) googletest/gtest (#4471)
fredroy Feb 7, 2024
29b1a13
[all] Replace tinyxml by external tinyxml2 (#4240)
olivier-roussel Feb 15, 2024
7545784
[SofaAssimp] Fix the FindAssimp.cmake (#4326)
bakpaul Feb 15, 2024
63f6753
Change plugin reference
bakpaul Feb 19, 2024
9ec0c14
[VolumetricRendering] Fix the compilation (#4398)
alxbilger Jan 5, 2024
43b1e74
[All] Fix subplugin regression tests (#4420)
bakpaul Jan 10, 2024
43db0aa
[Simulation.Common] Fix downstream project compilation with tinyXML2 …
bakpaul Feb 19, 2024
755c7ce
[VolumetricRendering] Fix crashes in batch mode (#4436)
fredroy Jan 17, 2024
b84c138
[LinearSolver.Direct] Fix metis dependency (#4450)
olivier-roussel Feb 27, 2024
8cdbb67
[Simulation.Common] Fix tinyXML2 install for windows (#4525)
bakpaul Feb 27, 2024
6bc3aa8
FIX linking of library not present in the v23.12 branch
bakpaul Feb 27, 2024
9c506f4
FIX metis dependency, not working because the commit #4477 is not bac…
bakpaul Feb 27, 2024
460312f
[Testing] Fix installation of gtest headers (#4489)
fredroy Feb 9, 2024
a2198b2
[Config] Add cxxopts cmake find module (#4538)
olivier-roussel Feb 29, 2024
7b20d84
Updage CHANGELOG for v23.12 release
hugtalbot Feb 29, 2024
ab1a6bf
[CMake] Bump version to v23.12.00
hugtalbot Feb 29, 2024
b28fa85
[all] Install FindTinyXML2 (#4545)
bakpaul Feb 29, 2024
2045c5d
[cmake] Remove error in Findcxxopt (#4554)
bakpaul Mar 6, 2024
f21ee35
Merge pull request #4558 from bakpaul/fix_public_linkage_to_tinyxml_g…
olivier-roussel Mar 4, 2024
ce05d76
[Config] Fix findcxxopt when version is not specified (#4564)
bakpaul Mar 8, 2024
513a06c
[Config] Fix Findmetis module when using config mode (#4570)
olivier-roussel Mar 8, 2024
b27a54d
[all] Fix tinyxml2 dependency (#4574)
bakpaul Mar 8, 2024
d578a66
Updage CHANGELOG for v23.12 release
bakpaul Mar 11, 2024
0130e23
add QGLViewer2 as lib name candidate as conda windows package install…
olivier-roussel Mar 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
265 changes: 265 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include(CMakeDependentOption)
# Manually define VERSION
set(Sofa_VERSION_MAJOR 23)
set(Sofa_VERSION_MINOR 12)
set(Sofa_VERSION_PATCH 99)
set(Sofa_VERSION_PATCH 00)
set(Sofa_VERSION ${Sofa_VERSION_MAJOR}.${Sofa_VERSION_MINOR}.${Sofa_VERSION_PATCH})

set(SOFA_VERSION_STR "\"${Sofa_VERSION}\"")
Expand Down Expand Up @@ -37,7 +37,7 @@ option(SOFA_BUILD_RELEASE_PACKAGE "Run package specific configure" OFF)
# Option to allow some dependencies such as cxxopts to be fetched by cmake if
# the package is not found
option(SOFA_ALLOW_FETCH_DEPENDENCIES "Allow compatible dependencies to be fetched if the package is not found by cmake.
List of dependencies that can be fetched: cxxopts" ON)
List of dependencies that can be fetched: cxxopts, gtest, metis, CImg" ON)

# Option to accelerate the compilation
# see https://cmake.org/cmake/help/v3.16/command/target_precompile_headers.html
Expand Down Expand Up @@ -91,6 +91,7 @@ install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindEigen3.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/macdeployqt.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/windeployqt.cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/FindTinyXML2.cmake"
DESTINATION lib/cmake/Modules
COMPONENT headers
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct FixedPlaneConstraint_test : public BaseSimulationTest

/// Scene initialization
sofa::simulation::Simulation* simulation;
sofa::simulation::setSimulation(simulation = new sofa::simulation::graph::DAGSimulation());
simulation = sofa::simulation::getSimulation();
simulation::Node::SPtr root = simulation->createNewGraph("root");
root->setGravity( type::Vec3(0,0,0) );

Expand Down
4 changes: 2 additions & 2 deletions Sofa/Component/IO/Mesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ set(SOURCE_FILES
${SOFACOMPONENTIOMESH_SOURCE_DIR}/STLExporter.cpp
)

sofa_find_package(TinyXML REQUIRED) # BaseVTKReader
sofa_find_package(TinyXML2 REQUIRED) # BaseVTKReader
sofa_find_package(ZLIB REQUIRED) # BlenderExporter
sofa_find_package(Sofa.Simulation.Core REQUIRED)

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${WRAPPER_FILES})
target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Core)
target_link_libraries(${PROJECT_NAME} PRIVATE tinyxml)
target_link_libraries(${PROJECT_NAME} PRIVATE tinyxml2::tinyxml2)
target_link_libraries(${PROJECT_NAME} PUBLIC ZLIB::ZLIB)
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
sofa_install_libraries(TARGETS ZLIB::ZLIB)
Expand Down
77 changes: 39 additions & 38 deletions Sofa/Component/IO/Mesh/src/sofa/component/io/mesh/MeshVTKLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ using sofa::component::io::mesh::BaseVTKReader ;
/// This is needed for template specialization.
#include <sofa/component/io/mesh/BaseVTKReader.inl>

#include <tinyxml.h>
#include <tinyxml2.h>

//XML VTK Loader
#define checkError(A) if (!A) { return false; }
#define checkErrorPtr(A) if (!A) { return nullptr; }
#define checkErrorMsg(A, B) if (!A) { msg_error() << B << "\n" ; return false; }
#define checkErrorMsgAuto(A) if(A != tinyxml2::XML_SUCCESS) { msg_error() << "TinyXML error message : " << tinyxml2::XMLDocument::ErrorIDToName(A) << "\n" ; return false; }

namespace sofa::component::io::mesh
{
Expand Down Expand Up @@ -69,15 +70,15 @@ class XMLVTKReader : public BaseVTKReader
public:
bool readFile(const char* filename) override;
protected:
bool loadUnstructuredGrid(TiXmlHandle datasetFormatHandle);
bool loadPolydata(TiXmlHandle datasetFormatHandle);
bool loadRectilinearGrid(TiXmlHandle datasetFormatHandle);
bool loadStructuredGrid(TiXmlHandle datasetFormatHandle);
bool loadStructuredPoints(TiXmlHandle datasetFormatHandle);
bool loadImageData(TiXmlHandle datasetFormatHandle);
BaseVTKDataIO* loadDataArray(TiXmlElement* dataArrayElement, int size, string type);
BaseVTKDataIO* loadDataArray(TiXmlElement* dataArrayElement, int size);
BaseVTKDataIO* loadDataArray(TiXmlElement* dataArrayElement);
bool loadUnstructuredGrid(tinyxml2::XMLHandle datasetFormatHandle);
bool loadPolydata(tinyxml2::XMLHandle datasetFormatHandle);
bool loadRectilinearGrid(tinyxml2::XMLHandle datasetFormatHandle);
bool loadStructuredGrid(tinyxml2::XMLHandle datasetFormatHandle);
bool loadStructuredPoints(tinyxml2::XMLHandle datasetFormatHandle);
bool loadImageData(tinyxml2::XMLHandle datasetFormatHandle);
BaseVTKDataIO* loadDataArray(tinyxml2::XMLElement* dataArrayElement, int size, string type);
BaseVTKDataIO* loadDataArray(tinyxml2::XMLElement* dataArrayElement, int size);
BaseVTKDataIO* loadDataArray(tinyxml2::XMLElement* dataArrayElement);
};

////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -950,19 +951,19 @@ bool LegacyVTKReader::readFile(const char* filename)

bool XMLVTKReader::readFile(const char* filename)
{
TiXmlDocument vtkDoc(filename);
tinyxml2::XMLDocument vtkDoc(true,tinyxml2::COLLAPSE_WHITESPACE);
//quick check
checkErrorMsg(vtkDoc.LoadFile(), "Unknown error while loading VTK Xml doc");
checkErrorMsgAuto(vtkDoc.LoadFile(filename))

const TiXmlHandle hVTKDoc(&vtkDoc);
TiXmlElement* pElem;
TiXmlHandle hVTKDocRoot(nullptr);
tinyxml2::XMLHandle hVTKDoc(&vtkDoc);
tinyxml2::XMLElement* pElem;
tinyxml2::XMLHandle hVTKDocRoot(nullptr);

//block VTKFile
pElem = hVTKDoc.FirstChildElement().ToElement();
checkErrorMsg(pElem, "VTKFile Node not found");

hVTKDocRoot = TiXmlHandle(pElem);
hVTKDocRoot = tinyxml2::XMLHandle(pElem);

//Endianness
const char* endiannessStrTemp = pElem->Attribute("byte_order");
Expand Down Expand Up @@ -1003,7 +1004,7 @@ bool XMLVTKReader::readFile(const char* filename)
checkErrorMsg(false, "Dataset format " << datasetFormatStr << " not recognized");
}

const TiXmlHandle datasetFormatHandle = TiXmlHandle(hVTKDocRoot.FirstChild( datasetFormatStr.c_str() ).ToElement());
const tinyxml2::XMLHandle datasetFormatHandle = tinyxml2::XMLHandle(hVTKDocRoot.FirstChildElement( datasetFormatStr.c_str() ));

bool stateLoading = false;
switch (datasetFormat)
Expand Down Expand Up @@ -1035,17 +1036,17 @@ bool XMLVTKReader::readFile(const char* filename)
return true;
}

BaseVTKReader::BaseVTKDataIO* XMLVTKReader::loadDataArray(TiXmlElement* dataArrayElement)
BaseVTKReader::BaseVTKDataIO* XMLVTKReader::loadDataArray(tinyxml2::XMLElement* dataArrayElement)
{
return loadDataArray(dataArrayElement, 0);
}

BaseVTKReader::BaseVTKDataIO* XMLVTKReader::loadDataArray(TiXmlElement* dataArrayElement, int size)
BaseVTKReader::BaseVTKDataIO* XMLVTKReader::loadDataArray(tinyxml2::XMLElement* dataArrayElement, int size)
{
return loadDataArray(dataArrayElement, size, "");
}

BaseVTKReader::BaseVTKDataIO* XMLVTKReader::loadDataArray(TiXmlElement* dataArrayElement, int size, string type)
BaseVTKReader::BaseVTKDataIO* XMLVTKReader::loadDataArray(tinyxml2::XMLElement* dataArrayElement, int size, string type)
{
//Type
const char* typeStrTemp;
Expand Down Expand Up @@ -1085,7 +1086,7 @@ BaseVTKReader::BaseVTKDataIO* XMLVTKReader::loadDataArray(TiXmlElement* dataArra

//NumberOfComponents
int numberOfComponents;
if (dataArrayElement->QueryIntAttribute("NumberOfComponents", &numberOfComponents) != TIXML_SUCCESS)
if (dataArrayElement->QueryIntAttribute("NumberOfComponents", &numberOfComponents) != tinyxml2::XML_SUCCESS)
{
numberOfComponents = 1;
}
Expand Down Expand Up @@ -1124,19 +1125,19 @@ BaseVTKReader::BaseVTKDataIO* XMLVTKReader::loadDataArray(TiXmlElement* dataArra
return d;
}

bool XMLVTKReader::loadUnstructuredGrid(TiXmlHandle datasetFormatHandle)
bool XMLVTKReader::loadUnstructuredGrid(tinyxml2::XMLHandle datasetFormatHandle)
{
TiXmlElement* pieceElem = datasetFormatHandle.FirstChild( "Piece" ).ToElement();
tinyxml2::XMLElement* pieceElem = datasetFormatHandle.FirstChildElement( "Piece" ).ToElement();

checkError(pieceElem);
for( ; pieceElem; pieceElem = pieceElem->NextSiblingElement())
{
pieceElem->QueryIntAttribute("NumberOfPoints", &numberOfPoints);
pieceElem->QueryIntAttribute("NumberOfCells", &numberOfCells);

TiXmlNode* dataArrayNode;
TiXmlElement* dataArrayElement;
TiXmlNode* node = pieceElem->FirstChild();
tinyxml2::XMLNode* dataArrayNode;
tinyxml2::XMLElement* dataArrayElement;
tinyxml2::XMLNode* node = pieceElem->FirstChild();

for ( ; node ; node = node->NextSibling())
{
Expand All @@ -1145,7 +1146,7 @@ bool XMLVTKReader::loadUnstructuredGrid(TiXmlHandle datasetFormatHandle)
if (currentNodeName.compare("Points") == 0)
{
/* Points */
dataArrayNode = node->FirstChild("DataArray");
dataArrayNode = node->FirstChildElement("DataArray");
checkError(dataArrayNode);
dataArrayElement = dataArrayNode->ToElement();
checkError(dataArrayElement);
Expand All @@ -1157,8 +1158,8 @@ bool XMLVTKReader::loadUnstructuredGrid(TiXmlHandle datasetFormatHandle)
if (currentNodeName.compare("Cells") == 0)
{
/* Cells */
dataArrayNode = node->FirstChild("DataArray");
for ( ; dataArrayNode; dataArrayNode = dataArrayNode->NextSibling( "DataArray"))
dataArrayNode = node->FirstChildElement("DataArray");
for ( ; dataArrayNode; dataArrayNode = dataArrayNode->NextSiblingElement( "DataArray"))
{
dataArrayElement = dataArrayNode->ToElement();
checkError(dataArrayElement);
Expand Down Expand Up @@ -1187,8 +1188,8 @@ bool XMLVTKReader::loadUnstructuredGrid(TiXmlHandle datasetFormatHandle)

if (currentNodeName.compare("PointData") == 0)
{
dataArrayNode = node->FirstChild("DataArray");
for ( ; dataArrayNode; dataArrayNode = dataArrayNode->NextSibling( "DataArray"))
dataArrayNode = node->FirstChildElement("DataArray");
for ( ; dataArrayNode; dataArrayNode = dataArrayNode->NextSiblingElement( "DataArray"))
{
dataArrayElement = dataArrayNode->ToElement();
checkError(dataArrayElement);
Expand All @@ -1203,8 +1204,8 @@ bool XMLVTKReader::loadUnstructuredGrid(TiXmlHandle datasetFormatHandle)
}
if (currentNodeName.compare("CellData") == 0)
{
dataArrayNode = node->FirstChild("DataArray");
for ( ; dataArrayNode; dataArrayNode = dataArrayNode->NextSibling( "DataArray"))
dataArrayNode = node->FirstChildElement("DataArray");
for ( ; dataArrayNode; dataArrayNode = dataArrayNode->NextSiblingElement( "DataArray"))
{
dataArrayElement = dataArrayNode->ToElement();
checkError(dataArrayElement);
Expand All @@ -1221,35 +1222,35 @@ bool XMLVTKReader::loadUnstructuredGrid(TiXmlHandle datasetFormatHandle)
return true;
}

bool XMLVTKReader::loadPolydata(TiXmlHandle datasetFormatHandle)
bool XMLVTKReader::loadPolydata(tinyxml2::XMLHandle datasetFormatHandle)
{
SOFA_UNUSED(datasetFormatHandle);
msg_error() << "Polydata dataset not implemented yet" ;
return false;
}

bool XMLVTKReader::loadRectilinearGrid(TiXmlHandle datasetFormatHandle)
bool XMLVTKReader::loadRectilinearGrid(tinyxml2::XMLHandle datasetFormatHandle)
{
SOFA_UNUSED(datasetFormatHandle);
msg_error() << "RectilinearGrid dataset not implemented yet" ;
return false;
}

bool XMLVTKReader::loadStructuredGrid(TiXmlHandle datasetFormatHandle)
bool XMLVTKReader::loadStructuredGrid(tinyxml2::XMLHandle datasetFormatHandle)
{
SOFA_UNUSED(datasetFormatHandle);
msg_error() << "StructuredGrid dataset not implemented yet" ;
return false;
}

bool XMLVTKReader::loadStructuredPoints(TiXmlHandle datasetFormatHandle)
bool XMLVTKReader::loadStructuredPoints(tinyxml2::XMLHandle datasetFormatHandle)
{
SOFA_UNUSED(datasetFormatHandle);
msg_error() << "StructuredPoints dataset not implemented yet" ;
return false;
}

bool XMLVTKReader::loadImageData(TiXmlHandle datasetFormatHandle)
bool XMLVTKReader::loadImageData(tinyxml2::XMLHandle datasetFormatHandle)
{
SOFA_UNUSED(datasetFormatHandle);
msg_error() << "ImageData dataset not implemented yet" ;
Expand Down
20 changes: 14 additions & 6 deletions Sofa/Component/LinearSolver/Direct/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,19 @@ set(SOURCE_FILES
${SOFACOMPONENTLINEARSOLVERDIRECT_SOURCE_DIR}/TypedMatrixLinearSystem[BTDMatrix].cpp
)

sofa_find_package(metis QUIET) # Unix users can have an installed version of metis
if(NOT metis_FOUND)
message(STATUS "${PROJECT_NAME}: using built-in metis library")
option(METIS-GKLIB_GKRAND "enable GKRAND support" ON) #GKRAND support allows the portability of random number generation across different architectures
add_subdirectory(extlibs/metis-5.1.0)
find_package(metis 5.1.0 EXACT QUIET)
if(NOT metis_FOUND AND SOFA_ALLOW_FETCH_DEPENDENCIES)
message("Sofa.Component.LinearSolver.Direct: DEPENDENCY metis NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is ON, fetching metis...")
include(FetchContent)
FetchContent_Declare(metis
GIT_REPOSITORY https://github.com/sofa-framework/METIS
GIT_TAG v5.1.0-ModernInstall
)
FetchContent_MakeAvailable(metis)
elseif (NOT metis_FOUND)
message(FATAL_ERROR "Sofa.Component.LinearSolver.Direct: DEPENDENCY metis NOT FOUND. SOFA_ALLOW_FETCH_DEPENDENCIES is OFF and thus cannot be fetched. Install metis (version=5.1.0), or enable SOFA_ALLOW_FETCH_DEPENDENCIES to fix this issue.")
endif()

sofa_set_01(SOFA_COMPONENT_LINEARSOLVER_DIRECT_HAVE_METIS VALUE TRUE)

# make sure you have threads for AsyncSparseLDLSolver
Expand All @@ -70,8 +77,9 @@ sofa_find_package(Sofa.Simulation.Core REQUIRED)
sofa_find_package(Sofa.Component.LinearSolver.Iterative REQUIRED) # Only for MatrixLinearSolver which will move to core

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${WRAPPER_FILES})

target_link_libraries(${PROJECT_NAME} PUBLIC Sofa.Simulation.Core Sofa.Component.LinearSolver.Iterative)
target_link_libraries(${PROJECT_NAME} PUBLIC metis)
target_link_libraries(${PROJECT_NAME} PRIVATE metis)
target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads)

sofa_create_package_with_targets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ find_package(Threads QUIET REQUIRED)

set(SOFA_COMPONENT_LINEARSOLVER_DIRECT_HAVE_METIS @SOFA_COMPONENT_LINEARSOLVER_DIRECT_HAVE_METIS@)

if(SOFA_COMPONENT_LINEARSOLVER_DIRECT_HAVE_METIS)
find_package(Metis QUIET REQUIRED HINTS "${CMAKE_CURRENT_LIST_DIR}/..")
endif()

if(NOT TARGET @PROJECT_NAME@)
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
endif()
Expand Down

This file was deleted.

Loading
Loading