Can you provide some hello world working example using prelibs?
I have zero experience with cmake, because I’ve used ndk-build so far.
Here’s a log from gradle console:
Build command failed.
Error while executing process /Users/piotr/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/piotr/Documents/projekty/gry/Bee/proj.android-studio/Bee/jni/Android.mk NDK_APPLICATION_MK=/Users/piotr/Documents/projekty/gry/Bee/proj.android-studio/Bee/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-15 NDK_OUT=/Users/piotr/Documents/pierdoly/android_studio_build/Bee/Bee/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=/Users/piotr/Documents/pierdoly/android_studio_build/Bee/Bee/intermediates/ndkBuild/release/lib NDK_MODULE_PATH=/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git:/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git/cocos:/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git/external -DCOCOS_PREBUILT_ROOT=/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git/prebuilt/android -DGEN_COCOS_PREBUILT=OFF -DUSE_COCOS_PREBUILT=ON -j4 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- D
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- G
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- E
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- N
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- _
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- U
Usage: make [options] [target] ...
Options:
-b, -m Ignored for compatibility.
-B, --always-make Unconditionally make all targets.
-C DIRECTORY, --directory=DIRECTORY
Change to DIRECTORY before doing anything.
-d Print lots of debugging information.
--debug[=FLAGS] Print various types of debugging information.
-e, --environment-overrides
Environment variables override makefiles.
-f FILE, --file=FILE, --makefile=FILE
Read FILE as a makefile.
-h, --help Print this message and exit.
-i, --ignore-errors Ignore errors from commands.
-I DIRECTORY, --include-dir=DIRECTORY
Search DIRECTORY for included makefiles.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-k, --keep-going Keep going when some targets can't be made.
-l [N], --load-average[=N], --max-load[=N]
Don't start multiple jobs unless load is below N.
-L, --check-symlink-times Use the latest mtime between symlinks and target.
-n, --just-print, --dry-run, --recon
Don't actually run any commands; just print them.
-o FILE, --old-file=FILE, --assume-old=FILE
Consider FILE to be very old and don't remake it.
-p, --print-data-base Print make's internal database.
-q, --question Run no commands; exit status says if up to date.
-r, --no-builtin-rules Disable the built-in implicit rules.
-R, --no-builtin-variables Disable the built-in variable settings.
-s, --silent, --quiet Don't echo commands.
-S, --no-keep-going, --stop
Turns off -k.
-t, --touch Touch targets instead of remaking them.
-v, --version Print the version number of make and exit.
-w, --print-directory Print the current directory.
--no-print-directory Turn off -w, even if it was turned on implicitly.
-W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
Consider FILE to be infinitely new.
--warn-undefined-variables Warn when an undefined variable is referenced.
This program built for x86_64-apple-darwin
Report bugs to <bug-make@gnu.org>
Build command failed.
Error while executing process /Users/piotr/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/piotr/Documents/projekty/gry/Bee/proj.android-studio/Bee/jni/Android.mk NDK_APPLICATION_MK=/Users/piotr/Documents/projekty/gry/Bee/proj.android-studio/Bee/jni/Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=1 APP_PLATFORM=android-15 NDK_OUT=/Users/piotr/Documents/pierdoly/android_studio_build/Bee/Bee/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Users/piotr/Documents/pierdoly/android_studio_build/Bee/Bee/intermediates/ndkBuild/debug/lib NDK_MODULE_PATH=/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git:/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git/cocos:/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git/external -DCOCOS_PREBUILT_ROOT=/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git/prebuilt/android -DGEN_COCOS_PREBUILT=OFF -DUSE_COCOS_PREBUILT=ON -j4 APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- D
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- G
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- E
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- N
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- _
/Users/piotr/sdk/ndk-bundle/build/../prebuilt/darwin-x86_64/bin/make: invalid option -- U
Usage: make [options] [target] ...
Options:
-b, -m Ignored for compatibility.
-B, --always-make Unconditionally make all targets.
-C DIRECTORY, --directory=DIRECTORY
Change to DIRECTORY before doing anything.
-d Print lots of debugging information.
--debug[=FLAGS] Print various types of debugging information.
-e, --environment-overrides
Environment variables override makefiles.
-f FILE, --file=FILE, --makefile=FILE
Read FILE as a makefile.
-h, --help Print this message and exit.
-i, --ignore-errors Ignore errors from commands.
-I DIRECTORY, --include-dir=DIRECTORY
Search DIRECTORY for included makefiles.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-k, --keep-going Keep going when some targets can't be made.
-l [N], --load-average[=N], --max-load[=N]
Don't start multiple jobs unless load is below N.
-L, --check-symlink-times Use the latest mtime between symlinks and target.
-n, --just-print, --dry-run, --recon
Don't actually run any commands; just print them.
-o FILE, --old-file=FILE, --assume-old=FILE
Consider FILE to be very old and don't remake it.
-p, --print-data-base Print make's internal database.
-q, --question Run no commands; exit status says if up to date.
-r, --no-builtin-rules Disable the built-in implicit rules.
-R, --no-builtin-variables Disable the built-in variable settings.
-s, --silent, --quiet Don't echo commands.
-S, --no-keep-going, --stop
Turns off -k.
-t, --touch Touch targets instead of remaking them.
-v, --version Print the version number of make and exit.
-w, --print-directory Print the current directory.
--no-print-directory Turn off -w, even if it was turned on implicitly.
-W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
Consider FILE to be infinitely new.
--warn-undefined-variables Warn when an undefined variable is referenced.
This program built for x86_64-apple-darwin
Report bugs to <bug-make@gnu.org>
Unable to find module with Gradle path ':libcocos2dx' (needed by module 'Bee'.)
What I’ve done:
- Added
PROP_BUILD_TYPE=cmake
in gradle.properties
-
Modified main gradle file:
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.rosapp.bee"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.00"
ext {
cocospath = "/Users/piotr/Documents/pierdoly/cocos2d-x-3.17_git"
}
externalNativeBuild {
ndkBuild {
targets "MyGame"
arguments "NDK_MODULE_PATH=$cocospath:$cocospath/cocos:$cocospath/external"
arguments "-DCOCOS_PREBUILT_ROOT=$cocospath/prebuilt/android"
arguments "-DGEN_COCOS_PREBUILT=OFF", "-DUSE_COCOS_PREBUILT=ON"
arguments "-j" + Runtime.runtime.availableProcessors()
abiFilters "armeabi-v7a"
}
}
}
-
Copy-pasted CMakeLists.txt from a freshly generated new project as I haven’t got one in my project.