Skip to content

Commit 211b691

Browse files
committed
fix unable to strip err when using cmake
1 parent 13712d3 commit 211b691

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

cgeDemo/build.gradle

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
apply plugin: 'com.android.application'
22

3+
def usingCMakeCompile() {
4+
/// define gradle.ext.usingCMakeCompile = false to disable CMakeCompile Mode.
5+
return gradle.ext != null && gradle.ext.has("usingCMakeCompile") && gradle.ext.usingCMakeCompile;
6+
}
7+
8+
def usingCMakeCompileDebug() {
9+
/// define gradle.ext.usingCMakeCompileDebug = true to enable CMake Debug Mode.
10+
return gradle.ext != null && gradle.ext.has("usingCMakeCompileDebug") && gradle.ext.usingCMakeCompileDebug;
11+
}
12+
313
android {
414
compileSdkVersion rootProject.ext.android.compileSdkVersion
515
buildToolsVersion rootProject.ext.android.buildToolsVersion
616

17+
if (usingCMakeCompile()) {
18+
ndkVersion "23.1.7779620"
19+
}
20+
721
defaultConfig {
822
applicationId rootProject.ext.android.applicationId
923
minSdkVersion rootProject.ext.android.minSdkVersion

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Wed Jan 04 11:21:04 CST 2023
1+
#Thu Jan 05 14:44:46 CST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
44
distributionPath=wrapper/dists

library/build.gradle

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ android {
4545
"-DANDROID_GRADLE=ON",
4646
cmakeBuildType
4747

48-
cFlags "-mfloat-abi=softfp -mfpu=vfp -Os -ffast-math -fPIC -DNO_LOCALE_SUPPORT -DANDROID_NDK"
49-
cppFlags "-frtti -std=c++14 -fPIE -fPIC -fno-exceptions -fvisibility-inlines-hidden -DNO_LOCALE_SUPPORT -DANDROID_NDK ${cppExtraFlags}"
50-
51-
48+
cFlags "-ffast-math -fPIE -fPIC -DNO_LOCALE_SUPPORT=1 -DANDROID_NDK=1 -D__STDC_CONSTANT_MACROS=1 ${cppExtraFlags}"
49+
cppFlags "-ffast-math -fPIE -fPIC -DNO_LOCALE_SUPPORT=1 -DANDROID_NDK=1 -D__STDC_CONSTANT_MACROS=1 -frtti -std=c++14 -fno-exceptions -fvisibility-inlines-hidden ${cppExtraFlags}"
5250

5351
println("cmake arguments: " + arguments)
5452
println("cppFlags: " + cppFlags)
@@ -83,10 +81,10 @@ android {
8381
////////////////////////////////////////
8482

8583
sourceSets.main {
86-
if (!usingCMakeCompile()) {
87-
jniLibs.srcDir 'src/main/libs' //set libs as .so's location instead of jni
88-
jni.srcDirs = [] //disable automatic ndk-build call with auto-generated Android.mk file
89-
}
84+
if (!usingCMakeCompile()) {
85+
jniLibs.srcDir 'src/main/libs' //set libs as .so's location instead of jni
86+
jni.srcDirs = [] //disable automatic ndk-build call with auto-generated Android.mk file
87+
}
9088
}
9189
compileOptions {
9290
sourceCompatibility JavaVersion.VERSION_1_8

library/src/main/jni/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ include_directories(
6363
${CMAKE_CURRENT_SOURCE_DIR}/custom
6464
${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg)
6565

66-
add_definitions(-DANDROID_NDK -DCGE_LOG_TAG=\"libCGE\" -DCGE_TEXTURE_PREMULTIPLIED=1 -D_CGE_USE_FFMPEG_ -D__STDC_CONSTANT_MACROS -D_CGE_DISABLE_GLOBALCONTEXT_ -O3 -D_CGE_ONLY_FILTERS_=1 -D__STDC_CONSTANT_MACROS=1)
66+
add_definitions(-DANDROID_NDK -DCGE_LOG_TAG=\"libCGE\" -DCGE_TEXTURE_PREMULTIPLIED=1 -D_CGE_USE_FFMPEG_ -D_CGE_DISABLE_GLOBALCONTEXT_ -O3 -D_CGE_ONLY_FILTERS_=1)
6767

6868
if (CGE_USE_VIDEO_MODULE)
6969

0 commit comments

Comments
 (0)