Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions audio-echo/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.22.1)
project(echo LANGUAGES C CXX)

add_compile_options(-Wall -Wextra -Werror)
include(AppLibrary)

add_library(echo
add_app_library(echo
SHARED
audio_main.cpp
audio_player.cpp
Expand Down
4 changes: 2 additions & 2 deletions base/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.22.1)
project(Base LANGUAGES CXX)

add_compile_options(-Wall -Werror -Wextra)
include(AppLibrary)

add_library(base
add_app_library(base
STATIC
logging.cpp
)
Expand Down
6 changes: 3 additions & 3 deletions bitmap-plasma/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.22.1)
project(BitmapPlasma LANGUAGES C)
project(BitmapPlasma LANGUAGES CXX)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wno-unused-function")
include(AppLibrary)

add_library(plasma SHARED plasma.c)
add_app_library(plasma SHARED plasma.cpp)

# Include libraries needed for plasma lib
target_link_libraries(plasma
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,10 @@ static __inline__ Fixed angle_sin(Angle a) {
return angle_sin_tab[(uint32_t)a & (ANGLE_2PI - 1)];
}

static __inline__ Fixed angle_cos(Angle a) { return angle_sin(a + ANGLE_PI2); }

static __inline__ Fixed fixed_sin(Fixed f) {
return angle_sin(ANGLE_FROM_FIXED(f));
}

static __inline__ Fixed fixed_cos(Fixed f) {
return angle_cos(ANGLE_FROM_FIXED(f));
}

/* Color palette used for rendering the plasma */
#define PALETTE_BITS 8
#define PALETTE_SIZE (1 << PALETTE_BITS)
Expand Down Expand Up @@ -180,8 +174,7 @@ static void fill_plasma(AndroidBitmapInfo* info, void* pixels, double t) {
#define YT1_INCR FIXED_FROM_FLOAT(1 / 100.)
#define YT2_INCR FIXED_FROM_FLOAT(1 / 163.)

int yy;
for (yy = 0; yy < info->height; yy++) {
for (uint32_t yy = 0; yy < info->height; yy++) {
uint16_t* line = (uint16_t*)pixels;
Fixed base = fixed_sin(yt1) + fixed_sin(yt2);
Fixed xt1 = xt10;
Expand Down Expand Up @@ -335,7 +328,7 @@ static void stats_endFrame(Stats* s) {
}

JNIEXPORT void JNICALL Java_com_example_plasma_PlasmaView_renderPlasma(
JNIEnv* env, jobject obj, jobject bitmap, jlong time_ms) {
JNIEnv* env, jclass, jobject bitmap, jlong time_ms) {
AndroidBitmapInfo info;
void* pixels;
int ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
externalNativeBuild {
cmake {
arguments.add("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON")
arguments.add("-DCMAKE_MODULE_PATH=${rootDir.resolve("cmake")}")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
externalNativeBuild {
cmake {
arguments.add("-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON")
arguments.add("-DCMAKE_MODULE_PATH=${rootDir.resolve("cmake")}")
}
}
ndk {
Expand Down
15 changes: 15 additions & 0 deletions cmake/AppLibrary.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
include_guard()

# Wrapper for add_library which enables common options we want for all
# libraries.
function(add_app_library name)
cmake_parse_arguments(PARSE_ARGV 1 arg "" "" "")
add_library(${name} ${arg_UNPARSED_ARGUMENTS})

target_compile_options(${name}
PRIVATE
-Wall
-Wextra
-Werror
)
endfunction()
5 changes: 2 additions & 3 deletions vectorization/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
cmake_minimum_required(VERSION 3.22.1)
project(Vectorization LANGUAGES CXX)

add_compile_options(-Wall -Wextra -Werror)

include(AppLibrary)
find_package(base REQUIRED CONFIG)

add_library(app
add_app_library(app
SHARED
benchmark.cpp
jni.cpp
Expand Down