|
| 1 | +### cbp2ndk export utility |
| 2 | + |
| 3 | +The goal of the `cbp2ndk` utility is to transfer settings and settings made in `Code::Blocks` to the format of `Android NDK` |
| 4 | + |
| 5 | +### Supported C::B configuration blocks: |
| 6 | + |
| 7 | +- both global settings blocks and corresponding tags are supported |
| 8 | +- compiler flags settings |
| 9 | +- setting options linker |
| 10 | +- list of link libraries |
| 11 | +- list of compiled project files |
| 12 | + |
| 13 | + |
| 14 | +### Data conversion for NDK configuration, Android.mk file: |
| 15 | + |
| 16 | +- automatic calculation of paths for `include` and their inclusion in the variable `LOCAL_C_INCLUDES` |
| 17 | +- automatic calculation of connected libraries and their inclusion in the variable `LOCAL_LDLIBS` |
| 18 | +- automatic calculation of extensions of compiled files and their inclusion in the variable `LOCAL_CPP_EXTENSION` |
| 19 | +- automatic distribution of flags between the variables `LOCAL_CFLAGS` and `LOCAL_CPPFLAGS` according to their language |
| 20 | +- listing the compiled project files and adding them to the variable `LOCAL_SRC_FILES` |
| 21 | +- export the command line for the autorun application from `Project -> Program launch parameters` in `Makefile` and the startup script |
| 22 | +- if the file `Android.mk` is not in the directory pointed to by the path to the `.cbp` project, it will be created automatically. If you create `Android.mk`, the name for the application will be taken from the name of the project and all the specials. characters and spaces will be replaced with the underscore `_`. |
| 23 | +- the files `Application.mk` and `Makefile` in the absence of the directory pointed to by the path to the project `.cbp`, will be created automatically. In `Makefile` you need to edit the variable` NDKROOT` indicating the path to `Android NDK` on your system. |
| 24 | +- by default, the debug print library for Android, liblog is always included in the variable `LOCAL_LDLIBS`, and the project root directory is included in the variable `LOCAL_C_INCLUDES` |
| 25 | + |
| 26 | + |
| 27 | +### Rewritable variables in the Android.mk file: |
| 28 | + |
| 29 | +The following variables can be overwritten, do not fill them in manually. |
| 30 | + |
| 31 | +- `LOCAL_CPP_EXTENSION` |
| 32 | +- `LOCAL_SRC_FILES` |
| 33 | +- `LOCAL_CFLAGS` |
| 34 | +- `LOCAL_CPPFLAGS` |
| 35 | +- `LOCAL_LDFLAGS` |
| 36 | +- `LOCAL_LDLIBS` |
| 37 | +- `LOCAL_C_INCLUDES` |
| 38 | +- `LOCAL_MODULE` (in case of file creation) |
| 39 | + |
| 40 | +Variables not included in this list will be saved with the values and overwritten with the new configuration. |
| 41 | + |
| 42 | +### Command line parameters: |
| 43 | + |
| 44 | + Options: |
| 45 | + -a, --auto find .cbp project file from current directory |
| 46 | + -c, --cbp path to .cbp project file |
| 47 | + -d, --dump dump current configuration |
| 48 | + -t, --tag building tag: Debug|Release|OtherTag |
| 49 | + -q, --quiet quiet all messages |
| 50 | + -v, --verbose verbose output to console |
| 51 | + -n --nodefault no set default values (libs, include paths) |
| 52 | + --cbtmpl install C::B wizard template Makefile file |
| 53 | + --api android API number (Application.mk) |
| 54 | + --abi android ABI platform (Application.mk) |
| 55 | + --ndkopt android NDK options (Application.mk) |
| 56 | + |
| 57 | + Using: |
| 58 | + cbp2ndk.exe <BuildTag> <path\project.cbp> |
| 59 | + cbp2ndk.exe -t <BuildTag> -c <path\project.cbp> -v |
| 60 | + cbp2ndk.exe -a --api android-28 --abi armeabi-v7a --ndkopt debug |
| 61 | + cbp2ndk.exe -a |
| 62 | + |
| 63 | + |
| 64 | +### Adding a menu to C::B |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +### Sources: |
| 69 | + |
| 70 | +Download [cbp2ndk v.0.0.14.79 / win32 (07/03/2019)](https://clnviewer.github.io/Code-Blocks-Android-NDK/cbp2ndk.zip) |
| 71 | +See [cbp2ndk directory](https://github.com/ClnViewer/Code-Blocks-Android-NDK/tree/master/cbp2ndk) |
| 72 | +Learn more about the format and capabilities of the file [Android.mk](https://developer.android.com/ndk/guides/android_mk) |
| 73 | + |
| 74 | + |
| 75 | +### Recommendations: |
| 76 | + |
| 77 | +> Always use a Unix-style slash (/) in assembly files. The build system incorrectly handles the backslash in Windows style. |
| 78 | +
|
| 79 | + |
| 80 | +> Try not to change the level of optimization / debugging in your `Android.mk` file. This allows the build system to generate useful data files used during debugging. It is meant to exclude the use of the flags `-g`,` -s`, `-O` and their analogues. |
| 81 | + |
| 82 | +## License |
| 83 | + |
| 84 | + _MIT_ |
| 85 | + |
| 86 | + |
| 87 | + |
0 commit comments