diff --git a/CMakeLists.txt b/CMakeLists.txt index 7205ac83d..d7bdda4fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,6 +165,8 @@ endif() set(MAGNUM_DEPLOY_PREFIX "." CACHE STRING "Prefix where to put final application executables") +set(MAGNUM_INCLUDE_INSTALL_PREFIX "." + CACHE STRING "Prefix where to put platform-independent include and other files") option(BUILD_STATIC "Build static libraries (default are shared)" OFF) option(BUILD_STATIC_PIC "Build static libraries and plugins with position-independent code" ON) @@ -270,11 +272,11 @@ endif() include(${CORRADE_LIB_SUFFIX_MODULE}) set(MAGNUM_BINARY_INSTALL_DIR bin) set(MAGNUM_LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}) -set(MAGNUM_DATA_INSTALL_DIR share/magnum) -set(MAGNUM_CMAKE_MODULE_INSTALL_DIR share/cmake/Magnum) -set(MAGNUM_INCLUDE_INSTALL_DIR include/Magnum) -set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR include/MagnumExternal) -set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR include/MagnumPlugins) +set(MAGNUM_DATA_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/share/magnum) +set(MAGNUM_CMAKE_MODULE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/share/cmake/Magnum) +set(MAGNUM_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/Magnum) +set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/MagnumExternal) +set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/MagnumPlugins) # Separate install dirs for debug and release plugins set(MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_BINARY_INSTALL_DIR}/magnum-d) diff --git a/doc/building.dox b/doc/building.dox index 6649bac94..d6e2052f8 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -358,6 +358,13 @@ installed files. The following variables are supported: are installed, so you can have libraries installed to a system location and utilities to your webserver, for example. Defaults to ``.``. If a relative path is used, it's relative to `CMAKE_INSTALL_PREFIX`. +- `MAGNUM_INCLUDE_INSTALL_PREFIX` --- Used on @ref CORRADE_TARGET_ANDROID "Android" + to override location where platform-independent include files, CMake + scripts and other files are installed. CMake on Android by default searches + for binaries in <ndk>/platforms/android-<api>/arch-<arch>/usr + based on target API and platform, but looks for headers in a central + location at <ndk>/sysroot/usr. Defaults to ``.``. If a + relative path is used, it's relative to `CMAKE_INSTALL_PREFIX`. The library is constantly evolving and thus some APIs are deprecated and then later removed in favor of better ones. To preserve backwards compatibility, @@ -834,8 +841,12 @@ use and `CMAKE_ANDROID_ARCH_ABI` to target platform ABI. Check the for further information. If you set `CMAKE_INSTALL_PREFIX` to `/usr` subdirectory of the particular -Android sysroot, the package will get found automatically when compiling -subprojects, otherwise you may need to explicitly set `CMAKE_PREFIX_PATH`. +Android platform sysroot, the package will get found automatically when +compiling subprojects. Gradle and other Android buildsystems expect +platform-independent includes and other files to be stored in a central +location, you can set `MAGNUM_INCLUDE_INSTALL_PREFIX` to `/usr` subdirectory of +the global NDK sysroot. Another option is to explicitly set `CMAKE_PREFIX_PATH` +to the install location in depending projects. Note that `BUILD_STATIC` is implicitly enabled, because manually loading all depending shared libraries using JNI would be too inconvenient. The engine is @@ -850,8 +861,8 @@ cmake .. \ -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \ -DCMAKE_ANDROID_STL_TYPE=c++_static \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-22/arch-arm/usr \ -DCMAKE_INSTALL_PREFIX=/opt/android-ndk/platforms/android-22/arch-arm/usr \ + -DMAGNUM_INCLUDE_INSTALL_PREFIX=/opt/android-ndk/sysroot/usr \ -DTARGET_GLES2=OFF \ -DWITH_ANDROIDAPPLICATION=ON cmake --build . diff --git a/doc/cmake.dox b/doc/cmake.dox index 8b1631bb7..41826c79d 100644 --- a/doc/cmake.dox +++ b/doc/cmake.dox @@ -62,6 +62,9 @@ This module tries to find base Magnum library and then defines: - `MAGNUM_DEPLOY_PREFIX` --- Prefix where to put final application executables, defaults to `.`. If a relative path is used, it's relative to `CMAKE_INSTALL_PREFIX`. +- `MAGNUM_INCLUDE_INSTALL_PREFIX` --- Prefix where to put + platform-independent include and other files, defaults to `.`. If a + relative path is used, it's relative to `CMAKE_INSTALL_PREFIX`. - `MAGNUM_PLUGINS_DEBUG_DIR` --- Base directory with dynamic plugins for debug builds, defaults to `magnum-d/` subdirectory of dir where Magnum library was found diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index ce70def76..97cc64921 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -13,6 +13,9 @@ # MAGNUM_DEPLOY_PREFIX - Prefix where to put final application # executables, defaults to ``.``. If a relative path is used, it's relative # to :variable:`CMAKE_INSTALL_PREFIX`. +# MAGNUM_INCLUDE_INSTALL_PREFIX - Prefix where to put platform-independent +# include and other files, defaults to ``.``. If a relative path is used, +# it's relative to :variable:`CMAKE_INSTALL_PREFIX`. # MAGNUM_PLUGINS_DEBUG_DIR - Base directory with dynamic plugins for # debug builds, defaults to magnum-d/ subdirectory of dir where Magnum # library was found @@ -787,11 +790,13 @@ endif() # Installation and deploy dirs set(MAGNUM_DEPLOY_PREFIX "." CACHE STRING "Prefix where to put final application executables") +set(MAGNUM_INCLUDE_INSTALL_PREFIX "." + CACHE STRING "Prefix where to put platform-independent include and other files") include(${CORRADE_LIB_SUFFIX_MODULE}) set(MAGNUM_BINARY_INSTALL_DIR bin) set(MAGNUM_LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}) -set(MAGNUM_DATA_INSTALL_DIR share/magnum) +set(MAGNUM_DATA_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/share/magnum) set(MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_BINARY_INSTALL_DIR}/magnum-d) set(MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum-d) set(MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_BINARY_INSTALL_DIR}/magnum) @@ -814,8 +819,8 @@ set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/audioimporters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/audioimporters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/audioimporters) -set(MAGNUM_INCLUDE_INSTALL_DIR include/Magnum) -set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR include/MagnumPlugins) +set(MAGNUM_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/Magnum) +set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${MAGNUM_INCLUDE_INSTALL_PREFIX}/include/MagnumPlugins) # Get base plugin directory from main library location. This is *not* PATH, # because CMake always converts the path to an absolute location internally, diff --git a/package/archlinux/PKGBUILD-android-arm64 b/package/archlinux/PKGBUILD-android-arm64 index 0c8f06f64..8293a67e1 100644 --- a/package/archlinux/PKGBUILD-android-arm64 +++ b/package/archlinux/PKGBUILD-android-arm64 @@ -31,6 +31,7 @@ build() { cmake .. \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/opt/android-ndk/platforms/android-22/arch-arm64/usr \ + -DMAGNUM_INCLUDE_INSTALL_PREFIX=/opt/android-ndk/sysroot/usr \ -DWITH_MAGNUMFONT=ON \ -DWITH_OBJIMPORTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \