Skip to content

Commit

Permalink
Merge pull request #4 from 3MFConsortium/3dJan/fixdebianpackage
Browse files Browse the repository at this point in the history
3d jan/fixdebianpackage
  • Loading branch information
3dJan authored Dec 20, 2024
2 parents c3a4545 + 81ea7e6 commit 9ac44c8
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 22 deletions.
52 changes: 39 additions & 13 deletions gladius/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ find_package(ZLIB REQUIRED)
find_package(lodepng CONFIG REQUIRED)
find_package(pugixml CONFIG REQUIRED)
find_package(lib3mf CONFIG REQUIRED)
find_package(minizip CONFIG REQUIRED)
find_package(unofficial-minizip CONFIG REQUIRED)
if (ENABLE_TRACY)
find_package(Tracy CONFIG REQUIRED)
endif()
Expand Down Expand Up @@ -158,6 +158,15 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(GLADIUSLOCATION GladiusLib)
message("GLADIUSLOCATION=${GLADIUSLOCATION}")

# Determine the installation directories based on the platform
if(WIN32)
set(INSTALL_PREFIX .)
else()
set(INSTALL_PREFIX /opt/gladius/${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set(INSTALL_BIN_DIR ${INSTALL_PREFIX})
set(SYMLINK_BIN_DIR /usr/bin)
endif()

add_subdirectory(tests)
add_subdirectory(src)
add_subdirectory(src/compute)
Expand All @@ -181,32 +190,44 @@ configure_file(${CMAKE_SOURCE_DIR}/src/gladius.ico src/gladius.ico COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/src/gladius.rc src/gladius.rc COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/src/gladius.rc.res gladius.rc.res COPYONLY)

configure_file(${CMAKE_SOURCE_DIR}/src/api/GladiusLib_component/Examples/Python/GladiusLib_Example.py src/api/GladiusLib_component/Examples/Python/GladiusLib_Example.py COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/src/api/GladiusLib_component/Examples/Python/ToyTrack.py src/api/GladiusLib_component/Examples/Python/ToyTrack.py COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/src/api/GladiusLib_component/Bindings/Python/GladiusLib.py src/api/GladiusLib_component/Examples/Python/GladiusLib.py COPYONLY)
# currently out of date
# configure_file(${CMAKE_SOURCE_DIR}/src/api/GladiusLib_component/Examples/Python/GladiusLib_Example.py src/api/GladiusLib_component/Examples/Python/GladiusLib_Example.py COPYONLY)
# configure_file(${CMAKE_SOURCE_DIR}/src/api/GladiusLib_component/Examples/Python/ToyTrack.py src/api/GladiusLib_component/Examples/Python/ToyTrack.py COPYONLY)
# configure_file(${CMAKE_SOURCE_DIR}/src/api/GladiusLib_component/Bindings/Python/GladiusLib.py src/api/GladiusLib_component/Examples/Python/GladiusLib.py COPYONLY)

#configure_file(${CMAKE_SOURCE_DIR}/LICENSE src/copyright/LICENSE COPYONLY)
#configure_file(${CMAKE_SOURCE_DIR}/url src/copyright/url COPYONLY)

file(COPY examples DESTINATION "src/")

file(COPY components/licenses DESTINATION "src/")


install(DIRECTORY components/fonts/fontawesome-free-5.14.0-web/ DESTINATION misc/fonts/)
install(DIRECTORY components/licenses DESTINATION .)
install(FILES src/imgui.ini DESTINATION .)
install(FILES ${CMAKE_SOURCE_DIR}/documentation/img/gladius.ico DESTINATION .)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/documentation/ DESTINATION documentation)


install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples/ DESTINATION examples/)
# Install fonts
install(DIRECTORY components/fonts/fontawesome-free-5.14.0-web/ DESTINATION ${INSTALL_PREFIX}/misc/fonts/)

# Install licenses
install(DIRECTORY components/licenses DESTINATION ${INSTALL_PREFIX}/doc/licenses/)

# Install imgui.ini
install(FILES src/imgui.ini DESTINATION ${INSTALL_PREFIX})

# Install icon
install(FILES ${CMAKE_SOURCE_DIR}/documentation/img/gladius.ico DESTINATION ${INSTALL_PREFIX}/share/pixmaps/)

# Install documentation - not yet available
# install(DIRECTORY ${CMAKE_SOURCE_DIR}/documentation/ DESTINATION ${INSTALL_PREFIX}/share/doc/)

# Install examples
install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples/ DESTINATION ${INSTALL_PREFIX}/examples/)

# Install binaries and libraries
install(
DIRECTORY ${PROJECT_BINARY_DIR}/src/
DESTINATION .
DESTINATION ${INSTALL_PREFIX}
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.so.*"
PATTERN "*.so"
PATTERN "*.ttf"
PATTERN "*.rtf"
Expand All @@ -223,6 +244,11 @@ install(
PATTERN "kernel" EXCLUDE
)

# Create a symbolic link in /usr/bin
if(UNIX)
install(CODE "execute_process(COMMAND ln -sf ${INSTALL_BIN_DIR}/gladius ${SYMLINK_BIN_DIR}/gladius)")
endif()


set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gladius is a framework for processing 3MF files using the Volumetric and Implicit Extension.")
set(CPACK_PACKAGE_DESCRIPTION "Gladius is a framework for processing 3MF files using the Volumetric and Implicit Extension.")
Expand Down
4 changes: 2 additions & 2 deletions gladius/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ set(DEPENDENCIES
pugixml::pugixml
${OPENMESH_LIBRARIES}
lib3mf::lib3mf
minizip::minizip
unofficial::minizip::minizip
imgui::imgui
unofficial::imgui-node-editor::imgui-node-editor
)
Expand All @@ -60,4 +60,4 @@ endif()
target_link_libraries(${BINARY}_lib PUBLIC ${DEPENDENCIES})
target_link_libraries(${BINARY} PUBLIC ${BINARY}_lib)

install(TARGETS ${BINARY} RUNTIME DESTINATION .)
install(TARGETS ${BINARY} RUNTIME DESTINATION ${INSTALL_PREFIX}/)
4 changes: 2 additions & 2 deletions gladius/src/api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

add_subdirectory(GladiusLib_component/Implementations/Cpp)

install(DIRECTORY GladiusLib_component/Bindings/ DESTINATION bindings/)
install(DIRECTORY GladiusLib_component/Implementations/Cpp/Interfaces/ DESTINATION bindings/CppDynamic/)
install(DIRECTORY GladiusLib_component/Bindings/ DESTINATION ${INSTALL_PREFIX}/bindings/)
install(DIRECTORY GladiusLib_component/Implementations/Cpp/Interfaces/ DESTINATION ${INSTALL_PREFIX}/bindings/CppDynamic/)
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ target_include_directories(gladiuslib PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Stub)
target_include_directories(gladiuslib PUBLIC ${AdditionalIncludes} ${STB_INCLUDE_DIRS})
target_link_libraries(gladiuslib PUBLIC gladius_lib)

install(TARGETS gladiuslib DESTINATION /)
install(TARGETS gladiuslib DESTINATION ${INSTALL_PREFIX}/)
37 changes: 34 additions & 3 deletions gladius/src/ui/ModelEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ namespace gladius::ui
auto const beginId = currentModel()->getBeginNode()->getId();
auto depthMap = determineDepth(graph, beginId);



auto getDepth = [&](nodes::NodeId nodeId)
{
auto const depthIter = depthMap.find(nodeId);
Expand All @@ -917,12 +919,43 @@ namespace gladius::ui
return 0;
};

auto getDepthCloseToSuccessor = [&](nodes::NodeId nodeId)
{
auto successsor = graph::determineSuccessor(graph, nodeId);
// find lowest depth of the successor
int lowestDepth = std::numeric_limits<int>::max();
for (auto const succ : successsor)
{
auto const depthIter = depthMap.find(succ);
if (depthIter != std::end(depthMap))
{
lowestDepth = std::min(lowestDepth, depthIter->second);
}
}

if (lowestDepth != std::numeric_limits<int>::max())
{
return lowestDepth - 1;
}
return 0;
};

auto determineDepth = [&](nodes::NodeId nodeId)
{
auto const depth = getDepth(nodeId);
if (depth == 0)
{
return getDepthCloseToSuccessor(nodeId);
}
return depth;
};

// Step 1: Assign Layers
std::map<int, std::vector<nodes::NodeBase *>> layers;
std::map<int, float> layersWidth;
for (auto & [id, node] : *currentModel())
{
auto const depth = (id == beginId) ? 0 : getDepth(id);
auto const depth = (id == beginId) ? 0 : determineDepth(id);
layers[depth].push_back(node.get());
auto const nodeWidth = ed::GetNodeSize(node->getId()).x;
layersWidth[depth] = std::max(layersWidth[depth], nodeWidth);
Expand All @@ -946,8 +979,6 @@ namespace gladius::ui
}

// Step 3: Assign Coordinates

bool success = true;
for (auto & [depth, nodes] : layers)
{
// substract distance from every second layer to create a zigzag pattern
Expand Down
2 changes: 1 addition & 1 deletion gladius/tests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(MSVC)
endif()
target_include_directories(${BINARY} PUBLIC ../../src ../../components/nanovdb)

set(DEPENDENCIES ${CMAKE_PROJECT_NAME}_lib GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main ${FMT_LIBRARY} ${OPENMESH_LIBRARIES} Eigen3::Eigen lodepng Boost::boost minizip::minizip)
set(DEPENDENCIES ${CMAKE_PROJECT_NAME}_lib GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main ${FMT_LIBRARY} ${OPENMESH_LIBRARIES} Eigen3::Eigen lodepng Boost::boost unofficial::minizip::minizip)

if (ENABLE_TRACY)
set(DEPENDENCIES ${DEPENDENCIES} Tracy::TracyClient)
Expand Down

0 comments on commit 9ac44c8

Please sign in to comment.