Skip to content

Commit

Permalink
Simplify usage in Final Report and move Libpack copy stuff out
Browse files Browse the repository at this point in the history
Added report function to separate logic from presentation and automate layout
Removed Libpack stuff to its own cmake file CopyLibpackDirectories.cmake
Added call in main CMakeLists.txt to libpack stuff
  • Loading branch information
berniev authored and chennes committed Jan 28, 2023
1 parent c318bc0 commit 243ad94
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 165 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ BuildAndInstallDesignerPlugin()

CreatePackagingTargets()

PrintFinalReport()
if(MSVC AND FREECAD_LIBPACK_USE AND LIBPACK_FOUND)
CopyLibpackDirectories()
endif()

if (BUILD_TEST)
add_subdirectory(tests)
endif()

PrintFinalReport()
56 changes: 56 additions & 0 deletions cMake/FreeCAD_Helpers/CopyLibpackDirectories.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
macro(CopyLibpackDirectories)
# Copy libpack dependency directories to build folder for user as part of overall build process
if(FREECAD_COPY_DEPEND_DIRS_TO_BUILD)
message(STATUS "=======================================\n"
"Copying libpack dependency directories to build directory for Windows MSVC build.\n")
file(COPY ${FREECAD_LIBPACK_DIR}/bin/assistant.exe DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/bin/QtWebEngineProcess.exe DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/bin/QtWebEngineProcessd.exe DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/bin/qt.conf DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/platforms DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/imageformats DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/iconengines DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/sqldrivers DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/styles DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/printsupport DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR})
file(COPY ${FREECAD_LIBPACK_DIR}/translations/qtwebengine_locales DESTINATION ${CMAKE_BINARY_DIR}/translations)
message(STATUS "... end copying.\n=======================================\n")
endif()

if(COPY_LIBPACK_BIN_TO_BUILD)
if(FREECAD_COPY_LIBPACK_BIN_TO_BUILD)
message("=======================================\n"
"Copying libpack 'bin' directory to build directory.\n")
file(COPY ${FREECAD_LIBPACK_DIR}/bin DESTINATION ${CMAKE_BINARY_DIR})
message("... done copying libpack 'bin' directory.\n=======================================\n")
endif()
if(FREECAD_COPY_PLUGINS_BIN_TO_BUILD)
message(STATUS "=======================================\n"
"Copying plugins to build directory.")
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/imageformats DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/platforms DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/styles DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/bin/QtWebEngineProcess.exe DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/bin/QtWebEngineProcessd.exe DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/translations/qtwebengine_locales DESTINATION ${CMAKE_BINARY_DIR}/translations)
file(COPY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR})
file(WRITE ${CMAKE_BINARY_DIR}/bin/qt.conf "[Paths]\nPrefix=..\n")
endif()
endif()

if(FREECAD_INSTALL_DEPEND_DIRS)
# Test install command for installing/copying directories
message(STATUS "=======================================")
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/platforms DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/imageformats DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/iconengines DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/sqldrivers DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/styles DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/printsupport DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/translations/qtwebengine_locales DESTINATION ${CMAKE_INSTALL_PREFIX}/translations)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/bin DESTINATION ${CMAKE_INSTALL_PREFIX})
message(STATUS "Created install commands for INSTALL target.\n")
endif()
endmacro()
Loading

0 comments on commit 243ad94

Please sign in to comment.