nixpkgs/pkgs/by-name/li/librum/use_mupdf_in_nixpkgs.patch

97 lines
3.4 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 191ff732..4a50f7de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,6 +71,7 @@ endif()
# Dependencies
add_subdirectory(libs/rapidfuzz-cpp)
+include_directories(@nixMupdfIncludePath@)
# Build
diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt
index 0a41c5fd..f8714715 100644
--- a/src/application/CMakeLists.txt
+++ b/src/application/CMakeLists.txt
@@ -107,7 +107,7 @@ if(ANDROID)
endif()
if(UNIX)
- set(MUPDF_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/libs/mupdf/build/$<IF:$<CONFIG:Debug>,shared-debug,shared-release>")
+ set(MUPDF_OUTPUT_DIR "@nixMupdfLibPath@")
set(MUPDF_OUTPUT "${MUPDF_OUTPUT_DIR}/libmupdfcpp.so")
set(MUPDF_OUTPUT "${MUPDF_OUTPUT_DIR}/libmupdfcpp.so" PARENT_SCOPE)
set(MUPDF_BUILD_COMMAND ./scripts/mupdfwrap.py ${VENV_OPTION} -d build/$<IF:$<CONFIG:Debug>,shared-debug,shared-release> -b --m-target 'libs tools' ${EXTRA_MAKE_AGRS} -j 0 m01)
@@ -145,21 +145,6 @@ else()
set(EXECUTABLE_EXTENSION ".exe")
endif()
-add_custom_target(mupdf
- # Build mupdf
- COMMAND ${CMAKE_COMMAND} -E env
- ${ANDROID_COMPILERS}
- "USE_SYSTEM_LIBJPEG=${USE_SYSTEM_LIBJPEG_VALUE}"
- "USE_SONAME=no"
- ${MUPDF_BUILD_COMMAND}
- # Copy mutool to the build directory
- COMMAND ${CMAKE_COMMAND} -E copy
- "${MUPDF_OUTPUT_DIR}/mutool${EXECUTABLE_EXTENSION}"
- "${PROJECT_BINARY_DIR}/mutool${EXECUTABLE_EXTENSION}"
- BYPRODUCTS ${MUPDF_OUTPUT}
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libs/mupdf
- COMMENT "Building mupdf (This takes a while) ..."
-)
#Copy the mupdf dlls to the build directory for windows
@@ -182,7 +167,6 @@ add_library(application
${application_SRC}
)
-add_dependencies(application mupdf) # Ensure the mupdf target is built before the application target
target_compile_definitions(application PRIVATE APPLICATION_LIBRARY)
@@ -202,11 +186,6 @@ target_include_directories(application
${CMAKE_CURRENT_SOURCE_DIR}/core/utils
)
-# Make sure to ignore warnings from mupdf by adding it as a system include directory
-target_include_directories(application SYSTEM PUBLIC
- ${PROJECT_SOURCE_DIR}/libs/mupdf/platform/c++/include
- ${PROJECT_SOURCE_DIR}/libs/mupdf/include
-)
target_compile_definitions(application
PRIVATE
@@ -251,29 +230,10 @@ if(LINUX)
DESTINATION lib
)
- # Install mupdf's shared libraries
- install(FILES ${MUPDF_OUTPUT_DIR}/libmupdfcpp.so
- ${MUPDF_OUTPUT_DIR}/libmupdf.so
- ${MUPDF_OUTPUT_DIR}/mutool${EXECUTABLE_EXTENSION}
- DESTINATION lib)
-
- # Install links with correct permissions
- if(EXISTS "${MUPDF_OUTPUT_DIR}/libmupdfcpp.so.24.0")
- install(FILES ${MUPDF_OUTPUT_DIR}/libmupdfcpp.so.24.0
- ${MUPDF_OUTPUT_DIR}/libmupdf.so.24.0
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
- GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- 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()