Git Product home page Git Product logo

Comments (5)

DoDoENT avatar DoDoENT commented on August 22, 2024

Here is my patch which workarounds the issue by disabling usage of PCH for all files that have tags:

diff  orig/build-binary.mk build-binary.mk 
443,444c443,454
<     # All obj files are dependent on the PCH
<     $(foreach src,$(filter $(all_cpp_patterns),$(LOCAL_SRC_FILES)),\
---
>      # Filter obj files that are dependent on the PCH (only those without tags)
>     ifeq (true,$(LOCAL_ARM_NEON))
>         TAGS_TO_FILTER=arm
>     else
>         TAGS_TO_FILTER=arm neon
>     endif
> 
>     allowed_src := $(foreach src,$(filter $(all_cpp_patterns),$(LOCAL_SRC_FILES)),\
>         $(if $(filter $(TAGS_TO_FILTER),$(LOCAL_SRC_FILES_TAGS.$(src))),,$(src))\
>     )
>     # All files without tags depend on PCH
>     $(foreach src,$(allowed_src),\
447,449c457,458
< 
<     # Files from now on build with PCH
<     LOCAL_CPPFLAGS += -Winvalid-pch -include $(LOCAL_OBJS_DIR)/$(LOCAL_BUILT_PCH)
---
>     # Make sure those files are built with PCH
>     $(call add-src-files-target-cflags,$(allowed_src),-Winvalid-pch -include $(LOCAL_OBJS_DIR)/$(LOCAL_BUILT_PCH))

from ndk.

DanAlbert avatar DanAlbert commented on August 22, 2024

Thanks for the patch. I added a test case and uploaded for review:https://android-review.googlesource.com/207977

from ndk.

DoDoENT avatar DoDoENT commented on August 22, 2024

@DanAlbert, thank you for accepting the patch. I would only like to note that this patch works by disabling PCH for tagged files (i.e. files tagged with arm or neon will not use PCH). While this works fine for our use case when such files are minority, the real fix would actually be to create a separate PCH for each tag combination in use (I believe this is what Xcode does when compiling iOS projects).

from ndk.

DanAlbert avatar DanAlbert commented on August 22, 2024

Yeah, I had considered that. There are bigger problems to chase right now, so I figure something is better than nothing :)

One thing that can be done to avoid this is to use a separate (intermediate) static library for the sources that would normally be tagged. This way you can set LOCAL_ARM_MODE and LOCAL_ARM_NEON correctly for each static lib and the LOCAL_PCH will automatically be built with the right flags for each lib. Then you just use them via LOCAL_WHOLE_STATIC_LIBRARIES to ensure you get the full library included.

from ndk.

DoDoENT avatar DoDoENT commented on August 22, 2024

Thanks @DanAlbert, that is a good idea.

from ndk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.