开发者

C++ Extensions in Android.mk Files

开发者 https://www.devze.com 2023-03-18 22:35 出处:网络
Is it possible to compile C++ source files with multiple extensions in a single Android.mk file in 开发者_Python百科the ndk?You can modify the C++ extension (which is .cpp by default) via the LOCAL_CP

Is it possible to compile C++ source files with multiple extensions in a single Android.mk file in 开发者_Python百科the ndk? You can modify the C++ extension (which is .cpp by default) via the LOCAL_CPP_EXTENSION variable, but it appears you can only have it set to one single extension (aka, you couldn't have both .cc and .cpp files compiling in the same Android.mk file)..

Thanks in advance!


NDK >= r7 supports multiple values, eg:

LOCAL_CPP_EXTENSION := .cc .cpp .cxx

Do a 'clean' build after modifying LOCAL_CPP_EXTENSION to avoid errors.


No. In build/core/build-binary.mk, 'LOCAL_CPP_EXTENSION must be one word only.'

#
# Check LOCAL_CPP_EXTENSION, use '.cpp' by default
#
LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
ifeq ($(LOCAL_CPP_EXTENSION),)
  LOCAL_CPP_EXTENSION := .cpp
else
  ifneq ($(words $(LOCAL_CPP_EXTENSION)),1)
    $(call __ndk_info, LOCAL_CPP_EXTENSION in $(LOCAL_MAKEFILE) must be one word only, not '$(LOCAL_CPP_EXTENSION)')
    $(call __ndk_error, Aborting)
  endif
endif
0

精彩评论

暂无评论...
验证码 换一张
取 消