Skip to content

Commit

Permalink
Fixed build for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLazarescu committed Oct 23, 2023
1 parent e623c00 commit 42d7435
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/adapters/controllers/app_info_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
62 changes: 56 additions & 6 deletions src/application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -124,6 +164,7 @@ if(WIN32)
endif()



# Build application
add_library(application
SHARED
Expand Down Expand Up @@ -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()

0 comments on commit 42d7435

Please sign in to comment.