Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid NDK - Force library rebuild on configuration change
    primarykey
    data
    text
    <p><strong>Is there a way to force the Android NDK to rebuild a particular library when changing build configurations in Eclipse?</strong></p> <p>I am building building an Android Project using the Android NDK to build C++ libraries. I am using Eclipse with the Sequoyah plugin. Everything is set up and works well.</p> <p>However, I have run into an issue with build configurations. You can manage build configurations by right-clicking the project->properties and then go to the C/C++ Build section. This allows you to create the traditional Debug, and Release builds that most C++ libraries depend on in some way.</p> <p>Here is an example of my "Debug" configuration:</p> <pre><code>V=1 NDK_DEBUG=1 NDK_APPLICATION_MK=config/debug/Application.mk </code></pre> <p>These work well, except that when I switch back and forth between configurations, it does not trigger a rebuild of the libraries I am building. This would be expected for something like Visual Studio where each build config dumps to a different directory, but in Eclipse everything gets dumped to the same directory. I am forced to actually change relevant source files to trigger a rebuild. So what ends up happening is I end up running (for instance) in the Debug configuration but linking to libraries that were built in Release.</p> <p>So my question is: <strong>is there a way to force the NDK to rebuild a library when changing configurations?</strong> I am aware of the -B command I can add, but that rebuilds <em>everything</em>, <em>everytime</em>. I would be OK rebuilding every time, if I could do it for just <em>one specific</em> library (in this case libBootInfo).</p> <p>Here is what my root Android.mk file looks like:</p> <pre><code>LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := game$(MY_BUILD_CONFIG_EXTENSION) # Include files are relative to the NDK root directly (fix by prepending with $(LOCAL_PATH)) # Source files are relative $(LOCAL_PATH) #LOCAL_LDLIBS := -landroid # Add all source file names to be included in lib separated by a whitespace LOCAL_SRC_FILES := ../../../../../../engine/code/main/mainandroid.cpp # Module dependencies are expressed with LOCAL_STATIC_LIBRARIES and LOCAL_SHARED_LIBRARIES. # we're building the "main" entry point, so it doesn't depend on much LOCAL_STATIC_LIBRARIES := libDebug$(MY_BUILD_CONFIG_EXTENSION) libCore$(MY_BUILD_CONFIG_EXTENSION) include $(BUILD_SHARED_LIBRARY) $(call import-module,libBdCore) $(call import-module,libDebug) ################################################################## ## In addition to the core game library, we also build another ## *.so file here: "libBootInfo". This very small library is used ## by Java to find out which version of game to load based on ## the current build configuration. ## LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := libBootInfo # Add all source file names to be included in lib separated by a whitespace # TODO: This path is relative to "android-ndk\build\core" which seems # different from the LOCAL_SRC_FILES in game above. It seems like # the build process leaves us in a different directory than we started. # We make need to look into a way to make sure that this path always # works regardless of what came before it. # LOCAL_SRC_FILES := ../../../../engine/code/main/bootinfo.cpp include $(BUILD_SHARED_LIBRARY) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload