diff --git a/src/adapters/controllers/app_info_controller.cpp b/src/adapters/controllers/app_info_controller.cpp index 96439da07..65376afe3 100644 --- a/src/adapters/controllers/app_info_controller.cpp +++ b/src/adapters/controllers/app_info_controller.cpp @@ -70,7 +70,7 @@ QString AppInfoController::getOperatingSystem() const { #ifdef Q_OS_WIN return "WIN"; -#elif Q_OS_MACOS +#elif defined(Q_OS_MAC) return "MACOS"; #else return "UNIX"; diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt index 64f85dd83..2d4ddcc68 100644 --- a/src/application/CMakeLists.txt +++ b/src/application/CMakeLists.txt @@ -111,8 +111,48 @@ add_custom_target(mupdf ALL DEPENDS ${MUPDF_OUTPUT} ) -# Copy the mupdf dll into the binary folder for windows -if(WIN32) +###### Copy the mupdf shared libraries to the build directory ###### +if(LINUX) + # Copy libmupdfcpp.so + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/libmupdfcpp.so + COMMAND ${CMAKE_COMMAND} -E copy + ${MUPDF_OUTPUT_DIR}/libmupdfcpp.so + ${PROJECT_BINARY_DIR}/libmupdfcpp.so + DEPENDS ${MUPDF_OUTPUT} + ) + add_custom_target(libmupdfcpp_copy_target ALL DEPENDS ${PROJECT_BINARY_DIR}/libmupdfcpp.so) + + # Copy libmupdf.so + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/libmupdf.so + COMMAND ${CMAKE_COMMAND} -E copy + ${MUPDF_OUTPUT_DIR}/libmupdf.so + ${PROJECT_BINARY_DIR}/libmupdf.so + DEPENDS ${MUPDF_OUTPUT} + ) + add_custom_target(libmupdf_copy_target ALL DEPENDS ${PROJECT_BINARY_DIR}/libmupdf.so) +elseif(APPLE) + # Copy libmupdfcpp.so + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/libmupdfcpp.so + COMMAND ${CMAKE_COMMAND} -E copy + ${MUPDF_OUTPUT_DIR}/libmupdfcpp.so + ${PROJECT_BINARY_DIR}/libmupdfcpp.so + DEPENDS ${MUPDF_OUTPUT} + ) + add_custom_target(libmupdfcpp_copy_target ALL DEPENDS ${PROJECT_BINARY_DIR}/libmupdfcpp.so) + + # Copy libmupdf.dylib + add_custom_command( + OUTPUT ${PROJECT_BINARY_DIR}/libmupdf.dylib + COMMAND ${CMAKE_COMMAND} -E copy + ${MUPDF_OUTPUT_DIR}/libmupdf.dylib + ${PROJECT_BINARY_DIR}/libmupdf.dylib + DEPENDS ${MUPDF_OUTPUT} + ) + add_custom_target(libmupdf_copy_target ALL DEPENDS ${PROJECT_BINARY_DIR}/libmupdf.dylib) +elseif(WIN32) add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/mupdfcpp64.dll COMMAND ${CMAKE_COMMAND} -E copy @@ -124,6 +164,7 @@ if(WIN32) endif() + # Build application add_library(application SHARED @@ -194,14 +235,23 @@ if (ENABLE_COVERAGE AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") # Only works when endif() -# Install rules -if(UNIX) +###### Install rules ###### +if(LINUX) install(TARGETS application DESTINATION lib ) # Install mupdf's shared libraries - install(FILES ${MUPDF_OUTPUT_DIR}/libmupdfcpp.so + install(FILES ${MUPDF_OUTPUT_DIR}/libmupdfcpp.so ${MUPDF_OUTPUT_DIR}/libmupdf.so DESTINATION lib) -endif() +elseif(APPLE) + install(TARGETS application + DESTINATION lib + ) + + # Install mupdf's shared libraries + install(FILES ${MUPDF_OUTPUT_DIR}/libmupdfcpp.so + ${MUPDF_OUTPUT_DIR}/libmupdf.dylib + DESTINATION lib) +endif() \ No newline at end of file