From 334045582a57a8a56848fc9ab58078ab17960f40 Mon Sep 17 00:00:00 2001 From: amyspark <13498015+amyspark@users.noreply.github.com> Date: Mon, 10 Jan 2022 20:13:06 -0300 Subject: [PATCH] Propagate Android CMake configuration to external projects (#1579) Signed-off-by: L. E. Segovia <13498015+amyspark@users.noreply.github.com> Signed-off-by: Patrick Hodoul --- share/cmake/modules/FindHalf.cmake | 8 ++++++++ share/cmake/modules/FindImath.cmake | 8 ++++++++ share/cmake/modules/Findexpat.cmake | 8 ++++++++ share/cmake/modules/Findlcms2.cmake | 8 ++++++++ share/cmake/modules/Findpybind11.cmake | 8 ++++++++ share/cmake/modules/Findpystring.cmake | 9 +++++++++ share/cmake/modules/Findyaml-cpp.cmake | 9 +++++++++ 7 files changed, 58 insertions(+) diff --git a/share/cmake/modules/FindHalf.cmake b/share/cmake/modules/FindHalf.cmake index 17862f42f0..907a9543f8 100644 --- a/share/cmake/modules/FindHalf.cmake +++ b/share/cmake/modules/FindHalf.cmake @@ -190,6 +190,14 @@ if(NOT Half_FOUND) ${Half_CMAKE_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + if (ANDROID) + set(Half_CMAKE_ARGS + ${Half_CMAKE_ARGS} + -DANDROID_PLATFORM=${ANDROID_PLATFORM} + -DANDROID_ABI=${ANDROID_ABI} + -DANDROID_STL=${ANDROID_STL}) + endif() + # Hack to let imported target be built from ExternalProject_Add file(MAKE_DIRECTORY ${Half_INCLUDE_DIR}) diff --git a/share/cmake/modules/FindImath.cmake b/share/cmake/modules/FindImath.cmake index 44a55e8f1d..86cab7b68f 100644 --- a/share/cmake/modules/FindImath.cmake +++ b/share/cmake/modules/FindImath.cmake @@ -188,6 +188,14 @@ if(NOT Imath_FOUND) ${Imath_CMAKE_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + if (ANDROID) + set(Imath_CMAKE_ARGS + ${Imath_CMAKE_ARGS} + -DANDROID_PLATFORM=${ANDROID_PLATFORM} + -DANDROID_ABI=${ANDROID_ABI} + -DANDROID_STL=${ANDROID_STL}) + endif() + # Hack to let imported target be built from ExternalProject_Add file(MAKE_DIRECTORY ${Imath_INCLUDE_DIR}) diff --git a/share/cmake/modules/Findexpat.cmake b/share/cmake/modules/Findexpat.cmake index 29b2ddbb15..9f6ed59217 100644 --- a/share/cmake/modules/Findexpat.cmake +++ b/share/cmake/modules/Findexpat.cmake @@ -226,6 +226,14 @@ if(NOT expat_FOUND) ${EXPAT_CMAKE_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + if (ANDROID) + set(EXPAT_CMAKE_ARGS + ${EXPAT_CMAKE_ARGS} + -DANDROID_PLATFORM=${ANDROID_PLATFORM} + -DANDROID_ABI=${ANDROID_ABI} + -DANDROID_STL=${ANDROID_STL}) + endif() + # Hack to let imported target be built from ExternalProject_Add file(MAKE_DIRECTORY ${expat_INCLUDE_DIR}) diff --git a/share/cmake/modules/Findlcms2.cmake b/share/cmake/modules/Findlcms2.cmake index 38d1a49ddc..edba20fb3a 100644 --- a/share/cmake/modules/Findlcms2.cmake +++ b/share/cmake/modules/Findlcms2.cmake @@ -147,6 +147,14 @@ if(NOT lcms2_FOUND) ${lcms2_CMAKE_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + if (ANDROID) + set(lcms2_CMAKE_ARGS + ${lcms2_CMAKE_ARGS} + -DANDROID_PLATFORM=${ANDROID_PLATFORM} + -DANDROID_ABI=${ANDROID_ABI} + -DANDROID_STL=${ANDROID_STL}) + endif() + # Hack to let imported target be built from ExternalProject_Add file(MAKE_DIRECTORY ${lcms2_INCLUDE_DIR}) diff --git a/share/cmake/modules/Findpybind11.cmake b/share/cmake/modules/Findpybind11.cmake index 0e1c1b725d..012588a5b8 100644 --- a/share/cmake/modules/Findpybind11.cmake +++ b/share/cmake/modules/Findpybind11.cmake @@ -179,6 +179,14 @@ if(NOT pybind11_FOUND) ${pybind11_CMAKE_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + if (ANDROID) + set(pybind11_CMAKE_ARGS + ${pybind11_CMAKE_ARGS} + -DANDROID_PLATFORM=${ANDROID_PLATFORM} + -DANDROID_ABI=${ANDROID_ABI} + -DANDROID_STL=${ANDROID_STL}) + endif() + ExternalProject_Add(pybind11_install GIT_REPOSITORY "https://github.com/pybind/pybind11.git" GIT_TAG "v${pybind11_FIND_VERSION}" diff --git a/share/cmake/modules/Findpystring.cmake b/share/cmake/modules/Findpystring.cmake index 0328ff1dcd..2214cd08d9 100644 --- a/share/cmake/modules/Findpystring.cmake +++ b/share/cmake/modules/Findpystring.cmake @@ -107,6 +107,15 @@ if(NOT pystring_FOUND) ${pystring_CMAKE_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + + if (ANDROID) + set(pystring_CMAKE_ARGS + ${pystring_CMAKE_ARGS} + -DANDROID_PLATFORM=${ANDROID_PLATFORM} + -DANDROID_ABI=${ANDROID_ABI} + -DANDROID_STL=${ANDROID_STL}) + endif() + if(NOT BUILD_SHARED_LIBS) #TODO: Find a way to merge in the static libs when built with internal pystring message(WARNING diff --git a/share/cmake/modules/Findyaml-cpp.cmake b/share/cmake/modules/Findyaml-cpp.cmake index 63e9778952..aad3e74e9a 100644 --- a/share/cmake/modules/Findyaml-cpp.cmake +++ b/share/cmake/modules/Findyaml-cpp.cmake @@ -196,6 +196,15 @@ if(NOT yaml-cpp_FOUND) ${yaml-cpp_CMAKE_ARGS} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}) endif() + + if (ANDROID) + set(yaml-cpp_CMAKE_ARGS + ${yaml-cpp_CMAKE_ARGS} + -DANDROID_PLATFORM=${ANDROID_PLATFORM} + -DANDROID_ABI=${ANDROID_ABI} + -DANDROID_STL=${ANDROID_STL}) + endif() + if(NOT BUILD_SHARED_LIBS) #TODO: Find a way to merge in the static libs when built with internal yamlcpp message(WARNING