taka-no-me / android-cmake

CMake toolchain file and other scripts for the Android NDK
1.22k stars 438 forks source link

STL include dirs for standalone toolchain #3

Closed akikoskinen closed 11 years ago

akikoskinen commented 11 years ago

The STL include directories get set wrongly for standalone toolchain.

I've got:

I don't know if the toolchain structure has changed or what but at least currently the C++ headers are in the root of the toolchain directory. The android.toolchain.cmake seems to look for them from the ${ANDROID_TOOLCHAIN_MACHINE_NAME} subdirectory. With the below patch I get the correct include directories set.

diff --git a/android.toolchain.cmake b/android.toolchain.cmake
index d7f09c7..2e550c0 100644
--- a/android.toolchain.cmake
+++ b/android.toolchain.cmake
@@ -970,7 +970,7 @@ if( BUILD_WITH_STANDALONE_TOOLCHAIN )
  set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" )

  if( NOT ANDROID_STL STREQUAL "none" )
-  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}" )
+  set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/include/c++/${ANDROID_COMPILER_VERSION}" )
   if( ARMEABI_V7A AND EXISTS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}/bits" )
    list( APPEND ANDROID_STL_INCLUDE_DIRS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}" )
   elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD AND EXISTS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/thumb/bits" )
taka-no-me commented 11 years ago

Thanks for the report. I've changed the fix to preserve compatibility with older toolchains.

akikoskinen commented 11 years ago

On 06/28/2013 01:35 PM, Andrey Kamaev wrote:

I've changed the fix to preserve compatibility with older toolchains.

I was expecting that :) Well done!