Skip to content

Commit 3acf42a

Browse files
committed
better support for windows
1 parent 374f42e commit 3acf42a

File tree

12 files changed

+46
-15
lines changed

12 files changed

+46
-15
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ $NDK/ndk-build
6969
#And remove the loading part of ffmpeg&facetracker
7070
$NDK/ndk-build
7171

72-
#For Window user, you should include the `.cmd` extension to `ndk-build` like this:
73-
cd your_path_to\android-gpuimage-plus-master\library\src\main\jni
74-
your_path_to_ndk\ndk-bundle\ndk-build.cmd
72+
#For Windows user, you should include the `.cmd` extension to `ndk-build` like this:
73+
cd <your\path\to\this\repo>\library\src\main\jni
74+
<your\path\to\ndk>\ndk-build.cmd
7575

7676
#Also remember to comment out these line in NativeLibraryLoader
7777
//System.loadLibrary("ffmpeg");

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# The setting is particularly useful for tweaking memory settings.
99
# Default value: -Xmx10248m -XX:MaxPermSize=256m
1010

11-
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
11+
org.gradle.jvmargs+=-Dfile.encoding=UTF-8
1212

1313
# When configured, Gradle will run in incubating parallel mode.
1414
# This option should only be used with decoupled projects. More details, visit

library/src/main/jni/CMakeLists.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,23 @@ else ()
4545
file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../libs/${ANDROID_ABI}")
4646
endif ()
4747

48-
execute_process(COMMAND find ${CMAKE_CURRENT_SOURCE_DIR}/cge -maxdepth 3 -type d OUTPUT_VARIABLE CGE_CORE_HEADER_DIR)
49-
execute_process(COMMAND bash -c "find \"${CMAKE_CURRENT_SOURCE_DIR}/cge\" -type f -iname '*.cpp' -o -iname '*.c'" OUTPUT_VARIABLE CGE_CORE_SRC)
50-
48+
if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
49+
execute_process(COMMAND cmd.exe /C "dir /L /S /B /A:D"
50+
OUTPUT_VARIABLE CGE_CORE_HEADER_DIR
51+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cge)
52+
else()
53+
execute_process(COMMAND find ${CMAKE_CURRENT_SOURCE_DIR}/cge -maxdepth 3 -type d OUTPUT_VARIABLE CGE_CORE_HEADER_DIR)
54+
endif()
55+
56+
message("CGE_CORE_HEADER_DIR=${CGE_CORE_HEADER_DIR}")
5157
string(REGEX REPLACE "\n" ";" CGE_CORE_HEADER_DIR ${CGE_CORE_HEADER_DIR})
52-
string(REGEX REPLACE "\n" ";" CGE_CORE_SRC ${CGE_CORE_SRC})
5358

54-
file(GLOB_RECURSE CGE_CORE_SRC_INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/interface/*.cpp")
55-
list(APPEND CGE_CORE_SRC ${CGE_CORE_SRC_INTERFACE})
59+
# execute_process(COMMAND bash -c "find \"${CMAKE_CURRENT_SOURCE_DIR}/cge\" -type f -iname '*.cpp' -o -iname '*.c'" OUTPUT_VARIABLE CGE_CORE_SRC)
60+
# string(REGEX REPLACE "\n" ";" CGE_CORE_SRC ${CGE_CORE_SRC})
61+
62+
file(GLOB_RECURSE CGE_CORE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/cge/*.cpp"
63+
"${CMAKE_CURRENT_SOURCE_DIR}/cge/*.c"
64+
"${CMAKE_CURRENT_SOURCE_DIR}/interface/*.cpp")
5665

5766
include_directories(
5867
${CGE_CORE_HEADER_DIR}

library/src/main/jni/buildJNI

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,26 @@
44
#NDK=/Users/wangyang/android_dev/android-ndk
55

66
if [[ "$NDK" == "" ]]; then
7-
8-
echo "Please specify the NDK variable to your ndk-dir"
9-
exit
10-
7+
if command -v ndk-build; then
8+
export $NDK=$(command -v ndk-build)
9+
elif command -v ndk-build.cmd; then
10+
export $NDK=$(command -v ndk-build.cmd)
11+
else
12+
if ! command -v cmd; then
13+
function cmd() {
14+
if [[ -f "/mnt/c/Windows/system32/cmd.exe" ]]; then
15+
/mnt/c/Windows/system32/cmd.exe $@
16+
fi
17+
}
18+
fi
19+
20+
echo "command -v cmd=$(command -v cmd)"
21+
22+
if [[ -z "$(command -v cmd &>/dev/null && cmd /C set | grep -i 'NDK')" ]]; then
23+
echo "Please specify the NDK variable to your ndk-dir"
24+
exit
25+
fi
26+
fi
1127
fi
1228

1329
cd $(dirname $0)
@@ -71,4 +87,10 @@ if [[ -z "$THREADS" ]] || [[ "$THREADS" -eq "0" ]]; then
7187
THREADS=8
7288
fi
7389

74-
$NDK/ndk-build ${BUILD_ARG} -j${THREADS}
90+
if [[ -n "$NDK" ]] && [[ -f "$NDK/ndk-build" ]]; then
91+
"$NDK/ndk-build" ${BUILD_ARG} -j${THREADS}
92+
elif [[ -n $(command -v cmd && cmd /C set | grep -i 'NDK') ]]; then
93+
cmd /C "set CGE_USE_VIDEO_MODULE=1 && %NDK%/ndk-build.cmd" ${BUILD_ARG} -j${THREADS}
94+
else
95+
echo "Can not find NDK!"
96+
fi
27.9 KB
Binary file not shown.
16 Bytes
Binary file not shown.
22.5 KB
Binary file not shown.
-100 Bytes
Binary file not shown.
22.9 KB
Binary file not shown.
-116 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)