Skip to content

Commit 1fd8b1f

Browse files
author
Daniil Tcelikin
committed
boost speed via flag -Ofast and enable openMp
1 parent d937064 commit 1fd8b1f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

android/app/src/main/cpp/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# For more information about using CMake with Android Studio, read the
22
# documentation: https://d.android.com/studio/projects/add-native-code.html.
33
# For more examples on how to use CMake, see https://github.com/android/ndk-samples.
4-
54
# Sets the minimum CMake version required for this project.
65
cmake_minimum_required(VERSION 3.22.1)
76

@@ -24,6 +23,12 @@ project("inference")
2423
# System.loadLibrary() and pass the name of the library defined here;
2524
# for GameActivity/NativeActivity derived applications, the same library name must be
2625
# used in the AndroidManifest.xml file.
26+
27+
set(OPTIMIZATION_FLAGS
28+
-Ofast
29+
-fopenmp
30+
)
31+
2732
add_library(${CMAKE_PROJECT_NAME} SHARED
2833
# List C/C++ source files with relative paths to this CMakeLists.txt.
2934
inference.c
@@ -35,4 +40,7 @@ add_library(${CMAKE_PROJECT_NAME} SHARED
3540
target_link_libraries(${CMAKE_PROJECT_NAME}
3641
# List libraries link to the target library
3742
android
38-
log)
43+
log
44+
-fopenmp -static-openmp)
45+
46+
target_compile_options(${PROJECT_NAME} PUBLIC $<$<COMPILE_LANGUAGE:C>:${OPTIMIZATION_FLAGS}>)

0 commit comments

Comments
 (0)