K
Let's start with a little, how to do it. Android NDK to C::BThere are two ways:I want you to write a profile on every platform with the completed files on the platform. I think it's exhausting, a lot of things, and I don't understand why. Given that if one is also collected under all platforms, the volume of body movements with configuration changes is quite large.
I'm default. arm64-v8a, armeabi-v7a, x86, x86_64♪Use the home collection system ndk-build♪ This is the simplest and most elegant solution that does not conflict with most inspections C::Bbut in the building C::B Every detail is important, it's quite casual, and inaccurate, it can be easy to break.Integrating Android NDKTile application ideology and gauge Android NDK as close as possible to the model conduct C::Bprocess logic:Mode Release- Phases: always new assembly of the annex, copying it to the device, launching the application. All actions are displayed in the sun C::B♪Mode Debug- Phases: always new assembly of the application, copying it to the device, copying NDK-парт files for fixing gdbserver♪ gdb.setupLaunch gdbserver on the device, waiting for the debag to connect GDB I'm sorry.regime запуска приложения- Phases: start on the application device with the results in the console.regime Отладка -> Старт - Phases: always new assembly of the application, copying it to the device, copying NDK-партfiles for fixing gdbserv♪ gdb.setupLaunch gdbserv on the device, automatic debag GDBand the transition to the smoothing mode. in regimes Debug♪ Отладка -> Старт, launch window gdbserver Starts in a minimised state and automatically closes at the end of the lock.Box files:Project C::Bimportant sections:<Build><Option output> - indicates the remote-launch of the application on the device - RunRemote.cmd♪ The violin is generated automatically. <Build><Option compiler="android_ndk-build"> - it's a processed name of a builder. C::B ♪ Android NDK-Build♪ The record of the new compiler is shown below.Section <Extensions><debugger><remote_debugging> Remote refrigeration facilities implemented by means of GDB:options ip_address="127.0.0.1" ip_port="59999" extended_remote="0"if there is a need to change the port number, it should also be done. Makefile♪ If the opaque extended_remote It's gonna be great from scratch, the remote launch window. gdbserver It doesn't close automatically after the fix.AndroidNdkTemplate.cbp Project file C::B:<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="C::B Android Ndk project Template" />
<Option makefile_is_custom="1" />
<Option pch_mode="2" />
<Option compiler="android_ndk-build" />
<Option check_files="0" />
<Build>
<Target title="Release">
<Option output="RunRemote.cmd" prefix_auto="0" extension_auto="0" />
<Option type="1" />
<Option compiler="android_ndk-build" />
</Target>
<Target title="Debug">
<Option output="RunRemote.cmd" prefix_auto="0" extension_auto="0" />
<Option type="1" />
<Option compiler="android_ndk-build" />
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="main.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<envvars />
<debugger>
<search_path add="obj/local/armeabi-v7a" />
<search_path add="obj/local/arm64-v8a" />
<search_path add="obj/local/x86" />
<search_path add="obj/local/x86_64" />
<remote_debugging target="Debug">
<options conn_type="0" serial_baud="115200" ip_address="127.0.0.1" ip_port="59999" additional_cmds_before="set solib-search-path obj/local/armeabi-v7a
file obj/local/armeabi-v7a/hello_world
" />
</remote_debugging>
</debugger>
</Extensions>
</Project>
</CodeBlocks_project_file>
Directory reference files NDK Project:Application.mk - assembly parameters:APP_ABI := all
APP_STL := c++_static
APP_OPTIM := debug
APP_PLATFORM := android-22
APP_BUILD_SCRIPT := Android.mk
Android.mk - in fact, it's a meke file unique to everyone. NDK (Annexes):LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello_world
LOCAL_SRC_FILES := ./main.c
LOCAL_C_INCLUDES := ./
LOCAL_LDLIBS := -llog
include $(BUILD_EXECUTABLE)
Makefile - directly launched C::B:PLATFORM := armeabi-v7a
NDKROOT := C:\__BuildSource\__LIB__\android-ndk-r20-beta2
PROJECT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
BUILDTAG := $(filter-out $@,$(MAKECMDGOALS))
BUILDOPT :=
include Application.mk
include $(APP_BUILD_SCRIPT)
ifneq ($(APP_ABI),all)
PLATFORM = $(APP_ABI)
endif
ifeq ($(BUILDTAG),Debug)
BUILDOPT = V=1 NDK_DEBUG=1
else
BUILDOPT = -j 4
endif
all: allndk
Debug: allndk adbsetup adbdebug buildscript rundebug
Release: allndk adbsetup adbexec buildscript
cleanDebug: clean
cleanRelease: clean
cleanall: clean
allndk:
@echo '==== Build $(BUILDTAG) -> $(APP_ABI) platform -> active device: [ $(PLATFORM) ] ===='
@Cmd.exe /C $(NDKROOT)\ndk-build.cmd NDK_APPLICATION_MK=$(PROJECT)Application.mk NDK_PROJECT_PATH=$(PROJECT) $(BUILDOPT)
clean:
@echo '==== Clean ===='
@Cmd.exe /C $(NDKROOT)\ndk-build.cmd NDK_APPLICATION_MK=$(PROJECT)Application.mk NDK_PROJECT_PATH=$(PROJECT) clean
@Cmd.exe /C adb.exe shell rm -f /data/local/tmp/$(LOCAL_MODULE)
adbsetup:
@echo '==== ADB SETUP: [ $(PLATFORM) ] ===='
@Cmd.exe /C adb.exe push $(PROJECT)libs$(PLATFORM)$(LOCAL_MODULE) /data/local/tmp/$(LOCAL_MODULE)
@Cmd.exe /C adb.exe shell /system/bin/chmod 0777 /data/local/tmp/$(LOCAL_MODULE)
adbexec:
@echo '==== ADB RUN: [ $(PLATFORM) ] ===='
@Cmd.exe /C adb.exe shell /data/local/tmp/$(LOCAL_MODULE)
adbdebug:
@echo '==== GDB Debug: [ $(PLATFORM) ] ===='
@Cmd.exe /C adb.exe push $(PROJECT)libs$(PLATFORM)\gdb.setup /data/local/tmp/gdb.setup
@Cmd.exe /C adb.exe push $(PROJECT)libs$(PLATFORM)\gdbserver /data/local/tmp/gdbserver
@Cmd.exe /C adb.exe shell /system/bin/chmod 0777 /data/local/tmp/gdbserver
rundebug:
@Cmd.exe /C DebugRemote.cmd
buildscript:
ifeq (,$(wildcard ./RunRemote.cmd))
@echo "adb.exe shell /data/local/tmp/$(LOCAL_MODULE)" >RunRemote.cmd
endif
ifeq (,$(wildcard ./DebugRemote.cmd))
@echo "adb.exe forward tcp:59999 tcp:59999" >DebugRemote.cmd
@echo "start "$(PLATFORM) GDB server" /MIN adb.exe shell /data/local/tmp/gdbserver :59999 /data/local/tmp/$(LOCAL_MODULE)" >>DebugRemote.cmd
@echo "exit" >>DebugRemote.cmd
endif
.PHONY: clean all
Files Application.mk and Makefile are universal for all projects collected with assistance NDK and don't demand the right.To understand the structure of the project NDK Appendices,:│ Android.mk
│ AndroidNdkTemplate.cbp
│ Application.mk
│ main.c
│ Makefile
│
├───libs
│ ├───arm64-v8a
│ │ gdb.setup
│ │ gdbserver
│ │ hello_world
│ ├───armeabi-v7a
│ │ gdb.setup
│ │ gdbserver
│ │ hello_world
│ ├───x86
│ │ gdb.setup
│ │ gdbserver
│ │ hello_world
│ └───x86_64
│ gdb.setup
│ gdbserver
│ hello_world
│
└───obj
└───local
├───arm64-v8a
│ │ hello_world
│ ├───objs
│ │ └───hello_world
│ └───objs-debug
│ └───hello_world
│ main.o
│ main.o.d
├───armeabi-v7a
│ │ hello_world
│ │
│ ├───objs
│ │ └───hello_world
│ └───objs-debug
│ └───hello_world
│ main.o
│ main.o.d
├───x86
│ │ hello_world
│ │
│ ├───objs
│ │ └───hello_world
│ └───objs-debug
│ └───hello_world
│ main.o
│ main.o.d
└───x86_64
│ hello_world
│
├───objs
│ └───hello_world
└───objs-debug
└───hello_world
main.o
main.o.d
GUI project design type C::B: Describe the possible ways in which the objective files with the sweet symbols are located:obj/local/armeabi-v7a obj/local//arm64-v8aobj/local/x86obj/local/x86_64 Teams need to be added GDB transmitting information on the location of the sweet symbols for the platform of the connector:set solib-search-path obj/local/armeabi-v7a - Location of sweet symbols for active oyster.file obj/local/armeabi-v7a/<имя приложения> - the name of the adjustable application. Type of construction compiler C::B: Additional menu of refrigeration NDK Annexes:Both scruples used in the menu have a fixed name and are automatically generated during performance Makefilefor convenience, it is reasonable to add them to the menu: The method of refining the annex consists of model actions, e.g. through F8 or menu Отладка -> Старт♪ As soon as the debager's up, you have to call from the menu. ADB Debug Remote serverthis team you're gonna launch. GDB сервер on a device that will launch your application. You're on your way. GDB серверу Remotely and you can conduct the smoothies.Mode Debug The launch of a remote server is automatic and does not require a menu to be called.Look at the squeak of debager in the project.This refrigeration diagram is maintained and not rotated.Global debagers NDK It looks like: Device: Measuring of the application NDK: Benefits of NDK:In contrast to static collection under a specified platform:There's no need to compil binary files statically, so the size of the output double file will be smaller.You can use androids. C/C++ libraries, such as liblog, to be able to logcat out of the appendix.Opportunities for this decision:No rotary device requiredcomplete assembly, no additional tools (NDK toolbox)full assembly Debug/Release regimescomplete start of application (s)starting/stop gdbserver of the devicenot required Gradle/Java code, works directly with the device.Full HOWTO code NDK C::B template I don't know. https://clnviewer.github.io/Code-Blocks-Android-NDK/