diff --git a/CMakeLists.txt b/CMakeLists.txt index 61f339a20..191ff7321 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,12 +4,14 @@ project(Librum VERSION 0.1 # Set output directory -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}") -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}") -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}") -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}") -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}") -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}") +if(NOT ANDROID AND NOT IOS) + SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}") + SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}") + SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}") + SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}") + SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}") + SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}") +endif() # Configuration @@ -28,7 +30,6 @@ set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) - # Create a set of warnings for windows systems if(WIN32) add_compile_options(-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -utf-8 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458) @@ -75,7 +76,6 @@ add_subdirectory(libs/rapidfuzz-cpp) # Build add_subdirectory(src/) - # Tests if(BUILD_TESTS) include(CTest) diff --git a/libs/googletest b/libs/googletest index a6d7fa8c0..5df0241ea 160000 --- a/libs/googletest +++ b/libs/googletest @@ -1 +1 @@ -Subproject commit a6d7fa8c0cebaa8b493a1cecdfa05018f6adc8df +Subproject commit 5df0241ea4880e5a846775d3efc8b873f7b36c31 diff --git a/libs/mupdf b/libs/mupdf index 673612ea3..aa9fb0e98 160000 --- a/libs/mupdf +++ b/libs/mupdf @@ -1 +1 @@ -Subproject commit 673612ea398450f76ca5c6a3ca7c77267aab461a +Subproject commit aa9fb0e983f608eecb6ea86bea17dcc2e4b12d29 diff --git a/libs/rapidfuzz-cpp b/libs/rapidfuzz-cpp index 4317e59c8..ef8999342 160000 --- a/libs/rapidfuzz-cpp +++ b/libs/rapidfuzz-cpp @@ -1 +1 @@ -Subproject commit 4317e59c8dea40268db711dffa1cc27c9b963554 +Subproject commit ef8999342dfd7b8d4603cda73c1da0df847782f9 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6ae9c12df..a912e4882 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,9 +25,6 @@ get_target_property(ADAPTERS_BIN_DIR adapters CMAKE_BINARY_DIR) add_subdirectory(presentation/) - - - # Building set(app_icon_resource_windows "${CMAKE_CURRENT_SOURCE_DIR}/resources.rc") qt_add_executable(librum @@ -44,6 +41,19 @@ if(WIN32) set_target_properties(librum PROPERTIES WIN32_EXECUTABLE true) endif() +# On android, we need to manually move the mupdf and openssl libraries to the apk +# by setting QT_ANDROID_EXTRA_LIBS +if(ANDROID) + list(APPEND CUSTOM_ANDROID_EXTRA_LIBS "${PROJECT_SOURCE_DIR}/libs/mupdf/build/shared-debug/libmupdf.so") + list(APPEND CUSTOM_ANDROID_EXTRA_LIBS "${PROJECT_SOURCE_DIR}/libs/mupdf/build/shared-debug/libmupdfcpp.so") + string(REPLACE ";" "," CUSTOM_ANDROID_EXTRA_LIBS_STRING "${CUSTOM_ANDROID_EXTRA_LIBS}") + + set_property(TARGET librum PROPERTY QT_ANDROID_EXTRA_LIBS + ${ANDROID_SDK_ROOT}/android_openssl/ssl_3/arm64-v8a/libcrypto_3.so + ${ANDROID_SDK_ROOT}/android_openssl/ssl_3/arm64-v8a/libssl_3.so + ${CUSTOM_ANDROID_EXTRA_LIBS_STRING}) +endif() + target_compile_definitions(librum PRIVATE $<$,$>:QT_QML_DEBUG> diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt index 08ba2e73c..3924a4ee7 100644 --- a/src/application/CMakeLists.txt +++ b/src/application/CMakeLists.txt @@ -86,17 +86,22 @@ set(application_SRC ) -# Build mupdf + +########## Build mupdf ########## set(VENV_OPTION "") if(NOT ${NO_VENV}) set(VENV_OPTION "--venv") endif() +if(ANDROID) + set(EXTRA_MAKE_AGRS --m-vars 'HAVE_OBJCOPY=no HAVE_LIBCRYPTO=no') +endif() + if(UNIX) set(MUPDF_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/libs/mupdf/build/$,shared-debug,shared-release>") 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/$,shared-debug,shared-release> -b -j 0 m01) + set(MUPDF_BUILD_COMMAND ./scripts/mupdfwrap.py ${VENV_OPTION} -d build/$,shared-debug,shared-release> -b --m-target libs ${EXTRA_MAKE_AGRS} -j 0 m01) elseif(WIN32) set(MUPDF_OUTPUT_DIR "${PROJECT_SOURCE_DIR}/libs/mupdf/platform/win32/x64/$,Debug,Release>") set(MUPDF_OUTPUT "${MUPDF_OUTPUT_DIR}/mupdfcpp64.lib" PARENT_SCOPE) @@ -107,6 +112,14 @@ endif() message("MuPdf build command: " ${MUPDF_BUILD_COMMAND}) +set(CC_COMMAND "${CMAKE_C_COMPILER}") +set(CXX_COMMAND "${CMAKE_CXX_COMPILER}") + +if(ANDROID) + string(APPEND CC_COMMAND " --target=aarch64-none-linux-android23 --sysroot=/home/creapermann/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot") + string(APPEND CXX_COMMAND " --target=aarch64-none-linux-android23 --sysroot=/home/creapermann/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot") +endif() + # On linux, we want to use the system provided libjpeg, # since the one that comes with mupdf is not compatible with the one that comes with Qt. @@ -119,6 +132,8 @@ endif() add_custom_target(mupdf COMMAND ${CMAKE_COMMAND} -E env + "CC=${CC_COMMAND}" + "CXX=${CXX_COMMAND}" "USE_SYSTEM_LIBJPEG=${USE_SYSTEM_LIBJPEG_VALUE}" ${MUPDF_BUILD_COMMAND} BYPRODUCTS ${MUPDF_OUTPUT} @@ -127,7 +142,7 @@ add_custom_target(mupdf ) -###### Copy the mupdf dlls to the build directory for windows ###### +#Copy the mupdf dlls to the build directory for windows if(WIN32) add_custom_command( TARGET mupdf POST_BUILD @@ -141,13 +156,13 @@ endif() -# Build application +########## Build application ########## add_library(application SHARED ${application_SRC} ) -add_dependencies(application mupdf) +add_dependencies(application mupdf) # Ensure the mupdf target is built before the application target target_compile_definitions(application PRIVATE APPLICATION_LIBRARY)