diff --git a/CMakeLists.txt b/CMakeLists.txt index 658acbe..2d0dcc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,26 @@ if (LINUX_GCC) find_package(TBB REQUIRED) endif() +option(PDF4QT_INSTALL_TO_USR "Install to usr directory" OFF) + +if(PDF4QT_LINUX) + set(PDF4QT_INSTALL_LIB_DIR_IMPL lib) + set(PDF4QT_INSTALL_BIN_DIR_IMPL bin) +else() + set(PDF4QT_INSTALL_LIB_DIR_IMPL bin) + set(PDF4QT_INSTALL_BIN_DIR_IMPL bin) +endif() + +if(PDF4QT_INSTALL_TO_USR) + set(PDF4QT_INSTALL_LIB_DIR usr/${PDF4QT_INSTALL_LIB_DIR_IMPL}) + set(PDF4QT_INSTALL_BIN_DIR usr/${PDF4QT_INSTALL_BIN_DIR_IMPL}) + set(PDF4QT_INSTALL_SHARE_DIR usr/share) +else() + set(PDF4QT_INSTALL_LIB_DIR ${PDF4QT_INSTALL_LIB_DIR_IMPL}) + set(PDF4QT_INSTALL_BIN_DIR ${PDF4QT_INSTALL_BIN_DIR_IMPL}) + set(PDF4QT_INSTALL_SHARE_DIR share) +endif() + add_subdirectory(Pdf4QtLib) add_subdirectory(CodeGenerator) add_subdirectory(JBIG2_Viewer) @@ -97,16 +117,16 @@ add_subdirectory(WixInstaller) message("CMAKE_PREFIX_PATH = " ${CMAKE_PREFIX_PATH}) message("CMAKE_TOOLCHAIN_FILE = " ${CMAKE_TOOLCHAIN_FILE}) -install(FILES Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtDocDiff.desktop Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtDocPageOrganizer.desktop Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtViewerLite.desktop Desktop/io.github.JakubMelka.Pdf4qt.desktop DESTINATION share/applications) -install(FILES Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtDocDiff.svg Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtDocPageOrganizer.svg Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtViewerLite.svg Desktop/io.github.JakubMelka.Pdf4qt.svg DESTINATION share/icons/hicolor/scalable/apps) -install(FILES Desktop/io.github.JakubMelka.Pdf4qt.appdata.xml DESTINATION share/metainfo) -install(FILES Desktop/128x128/io.github.JakubMelka.Pdf4qt.Pdf4QtDocDiff.png Desktop/128x128/io.github.JakubMelka.Pdf4qt.Pdf4QtDocPageOrganizer.png Desktop/128x128/io.github.JakubMelka.Pdf4qt.Pdf4QtViewerLite.png Desktop/128x128/io.github.JakubMelka.Pdf4qt.png DESTINATION share/icons/hicolor/128x128/apps) +install(FILES Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtDocDiff.desktop Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtDocPageOrganizer.desktop Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtViewerLite.desktop Desktop/io.github.JakubMelka.Pdf4qt.desktop DESTINATION ${PDF4QT_INSTALL_SHARE_DIR}/applications) +install(FILES Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtDocDiff.svg Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtDocPageOrganizer.svg Desktop/io.github.JakubMelka.Pdf4qt.Pdf4QtViewerLite.svg Desktop/io.github.JakubMelka.Pdf4qt.svg DESTINATION ${PDF4QT_INSTALL_SHARE_DIR}/icons/hicolor/scalable/apps) +install(FILES Desktop/io.github.JakubMelka.Pdf4qt.appdata.xml DESTINATION ${PDF4QT_INSTALL_SHARE_DIR}/metainfo) +install(FILES Desktop/128x128/io.github.JakubMelka.Pdf4qt.Pdf4QtDocDiff.png Desktop/128x128/io.github.JakubMelka.Pdf4qt.Pdf4QtDocPageOrganizer.png Desktop/128x128/io.github.JakubMelka.Pdf4qt.Pdf4QtViewerLite.png Desktop/128x128/io.github.JakubMelka.Pdf4qt.png DESTINATION ${PDF4QT_INSTALL_SHARE_DIR}/icons/hicolor/128x128/apps) configure_file(make-package.sh.in make-package.sh) if(PDF4QT_INSTALL_DEPENDENCIES) install(DIRECTORY ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/ - TYPE BIN + RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/ FILES_MATCHING PATTERN "*.dll" PATTERN "*.so" @@ -119,14 +139,14 @@ if(PDF4QT_INSTALL_DEPENDENCIES) if(PDF4QT_INSTALL_QT_DEPENDENCIES) install(DIRECTORY ${PDF4QT_QT_ROOT}/bin/ - RUNTIME DESTINATION bin/ + RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/ FILES_MATCHING REGEX "(Qt6Core|Qt6Gui|Qt6PrintSupport|Qt6Svg|Qt6TextToSpeech|Qt6Widgets|Qt6Xml|Qt6OpenGL|Qt6OpenGLWidgets|Qt6Multimedia|Qt6Network)\\..*" PATTERN "Debug" EXCLUDE ) install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/platforms/ - RUNTIME DESTINATION bin/platforms/ + RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/platforms/ FILES_MATCHING PATTERN "qwindows.dll" PATTERN "*.so" @@ -134,13 +154,13 @@ if(PDF4QT_INSTALL_DEPENDENCIES) ) install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/iconengines/ - RUNTIME DESTINATION bin/iconengines/ + RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/iconengines/ FILES_MATCHING REGEX "qsvgicon\\..*" ) install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/imageformats/ - RUNTIME DESTINATION bin/imageformats/ + RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/imageformats/ FILES_MATCHING PATTERN "*.dll" PATTERN "*.so" @@ -149,7 +169,7 @@ if(PDF4QT_INSTALL_DEPENDENCIES) ) install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/styles/ - RUNTIME DESTINATION bin/styles/ + RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/styles/ FILES_MATCHING PATTERN "*.dll" PATTERN "*.so" @@ -158,7 +178,7 @@ if(PDF4QT_INSTALL_DEPENDENCIES) ) install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/texttospeech/ - RUNTIME DESTINATION bin/texttospeech/ + RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/texttospeech/ FILES_MATCHING PATTERN "*.dll" PATTERN "*.so" @@ -172,7 +192,7 @@ if(PDF4QT_INSTALL_DEPENDENCIES) message(STATUS "MSVC Redistributable Package Path = ${MSVC_REDISTRIBUTABLES_PATH}") install(DIRECTORY ${MSVC_REDISTRIBUTABLES_PATH}/ - RUNTIME DESTINATION bin/ + RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/ FILES_MATCHING PATTERN "*.dll" ) diff --git a/CodeGenerator/CMakeLists.txt b/CodeGenerator/CMakeLists.txt index f9ad1b1..2a6cf60 100644 --- a/CodeGenerator/CMakeLists.txt +++ b/CodeGenerator/CMakeLists.txt @@ -19,7 +19,7 @@ add_executable(CodeGenerator codegenerator.cpp main.cpp generatormainwindow.cpp - generatormainwindow.ui + generatormainwindow.ui ) target_link_libraries(CodeGenerator PRIVATE Pdf4QtLib Qt6::Core Qt6::Widgets Qt6::Gui Qt6::Xml) @@ -27,4 +27,6 @@ target_link_libraries(CodeGenerator PRIVATE Pdf4QtLib Qt6::Core Qt6::Widgets Qt6 set_target_properties(CodeGenerator PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} ) diff --git a/JBIG2_Viewer/CMakeLists.txt b/JBIG2_Viewer/CMakeLists.txt index aad8624..f52cfd4 100644 --- a/JBIG2_Viewer/CMakeLists.txt +++ b/JBIG2_Viewer/CMakeLists.txt @@ -26,4 +26,6 @@ target_link_libraries(JBIG2_VIEWER PRIVATE Pdf4QtLib Qt6::Core Qt6::Widgets Qt6: set_target_properties(JBIG2_VIEWER PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} ) diff --git a/Pdf4QtDocDiff/CMakeLists.txt b/Pdf4QtDocDiff/CMakeLists.txt index ac4faf7..96a306b 100644 --- a/Pdf4QtDocDiff/CMakeLists.txt +++ b/Pdf4QtDocDiff/CMakeLists.txt @@ -35,6 +35,8 @@ target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Wi set_target_properties(Pdf4QtDocDiff PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} ) -install(TARGETS Pdf4QtDocDiff) +install(TARGETS Pdf4QtDocDiff RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR} LIBRARY DESTINATION ${PDF4QT_INSTALL_LIB_DIR}) diff --git a/Pdf4QtDocPageOrganizer/CMakeLists.txt b/Pdf4QtDocPageOrganizer/CMakeLists.txt index 271e51d..c24579e 100644 --- a/Pdf4QtDocPageOrganizer/CMakeLists.txt +++ b/Pdf4QtDocPageOrganizer/CMakeLists.txt @@ -36,6 +36,8 @@ target_link_libraries(Pdf4QtDocPageOrganizer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gu set_target_properties(Pdf4QtDocPageOrganizer PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} ) -install(TARGETS Pdf4QtDocPageOrganizer) +install(TARGETS Pdf4QtDocPageOrganizer RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR} LIBRARY DESTINATION ${PDF4QT_INSTALL_LIB_DIR}) diff --git a/Pdf4QtLib/CMakeLists.txt b/Pdf4QtLib/CMakeLists.txt index d92f1fe..3300d3f 100644 --- a/Pdf4QtLib/CMakeLists.txt +++ b/Pdf4QtLib/CMakeLists.txt @@ -131,6 +131,8 @@ target_include_directories(Pdf4QtLib PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUD set_target_properties(Pdf4QtLib PROPERTIES VERSION ${PDF4QT_VERSION} - SOVERSION ${PDF4QT_VERSION}) + SOVERSION ${PDF4QT_VERSION} + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}) -install(TARGETS Pdf4QtLib) +install(TARGETS Pdf4QtLib RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR} LIBRARY DESTINATION ${PDF4QT_INSTALL_LIB_DIR}) diff --git a/Pdf4QtViewer/CMakeLists.txt b/Pdf4QtViewer/CMakeLists.txt index 386afd0..cfcca12 100644 --- a/Pdf4QtViewer/CMakeLists.txt +++ b/Pdf4QtViewer/CMakeLists.txt @@ -65,6 +65,8 @@ target_include_directories(Pdf4QtViewer PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INC set_target_properties(Pdf4QtLib PROPERTIES VERSION ${PDF4QT_VERSION} - SOVERSION ${PDF4QT_VERSION}) + SOVERSION ${PDF4QT_VERSION} + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}) -install(TARGETS Pdf4QtViewer) +install(TARGETS Pdf4QtViewer RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR} LIBRARY DESTINATION ${PDF4QT_INSTALL_LIB_DIR}) diff --git a/Pdf4QtViewerLite/CMakeLists.txt b/Pdf4QtViewerLite/CMakeLists.txt index da36dbc..18f6ceb 100644 --- a/Pdf4QtViewerLite/CMakeLists.txt +++ b/Pdf4QtViewerLite/CMakeLists.txt @@ -25,6 +25,8 @@ target_link_libraries(Pdf4QtViewerLite PRIVATE Pdf4QtLib Pdf4QtViewer Qt6::Core set_target_properties(Pdf4QtViewerLite PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} ) -install(TARGETS Pdf4QtViewerLite) +install(TARGETS Pdf4QtViewerLite RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR} LIBRARY DESTINATION ${PDF4QT_INSTALL_LIB_DIR}) diff --git a/Pdf4QtViewerPlugins/CMakeLists.txt b/Pdf4QtViewerPlugins/CMakeLists.txt index a050094..a1ef10d 100644 --- a/Pdf4QtViewerPlugins/CMakeLists.txt +++ b/Pdf4QtViewerPlugins/CMakeLists.txt @@ -16,9 +16,9 @@ # along with PDF4QT. If not, see . if(PDF4QT_LINUX) - set(PDF4QT_PLUGINS_DIR lib/pdf4qt) + set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdf4qt) else() - set(PDF4QT_PLUGINS_DIR bin/pdfplugins) + set(PDF4QT_PLUGINS_DIR ${PDF4QT_INSTALL_LIB_DIR}/pdfplugins) endif() add_subdirectory(AudioBookPlugin) diff --git a/Pdf4QtViewerProfi/CMakeLists.txt b/Pdf4QtViewerProfi/CMakeLists.txt index 0e7ca0e..c9ce4f7 100644 --- a/Pdf4QtViewerProfi/CMakeLists.txt +++ b/Pdf4QtViewerProfi/CMakeLists.txt @@ -25,6 +25,8 @@ target_link_libraries(Pdf4QtViewerProfi PRIVATE Pdf4QtLib Pdf4QtViewer Qt6::Core set_target_properties(Pdf4QtViewerProfi PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} ) -install(TARGETS Pdf4QtViewerProfi) +install(TARGETS Pdf4QtViewerProfi RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR} LIBRARY DESTINATION ${PDF4QT_INSTALL_LIB_DIR}) diff --git a/PdfExampleGenerator/CMakeLists.txt b/PdfExampleGenerator/CMakeLists.txt index 81637fd..7bf8266 100644 --- a/PdfExampleGenerator/CMakeLists.txt +++ b/PdfExampleGenerator/CMakeLists.txt @@ -21,3 +21,10 @@ add_executable(PdfExampleGenerator ) target_link_libraries(PdfExampleGenerator PRIVATE Pdf4QtLib Qt6::Core Qt6::Widgets Qt6::Gui) + +set_target_properties(PdfExampleGenerator PROPERTIES + WIN32_EXECUTABLE ON + MACOSX_BUNDLE ON + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} +) diff --git a/PdfTool/CMakeLists.txt b/PdfTool/CMakeLists.txt index 0a3ef59..0778c5c 100644 --- a/PdfTool/CMakeLists.txt +++ b/PdfTool/CMakeLists.txt @@ -52,4 +52,11 @@ if(MINGW) target_link_libraries(PdfTool PRIVATE ole32 sapi) endif() -install(TARGETS PdfTool) +set_target_properties(PdfTool PROPERTIES + WIN32_EXECUTABLE OFF + MACOSX_BUNDLE OFF + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} +) + +install(TARGETS PdfTool RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR} LIBRARY DESTINATION ${PDF4QT_INSTALL_LIB_DIR}) diff --git a/UnitTests/CMakeLists.txt b/UnitTests/CMakeLists.txt index da01540..266102a 100644 --- a/UnitTests/CMakeLists.txt +++ b/UnitTests/CMakeLists.txt @@ -20,3 +20,10 @@ add_executable(UnitTests ) target_link_libraries(UnitTests PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Test) + +set_target_properties(UnitTests PROPERTIES + WIN32_EXECUTABLE OFF + MACOSX_BUNDLE OFF + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR} +)