Skip to content

Commit

Permalink
Clear compilation warnings (JingMatrix#121)
Browse files Browse the repository at this point in the history
* Fix warnings of CMake

To completely remove CMake version warnings, one may need to change the CMakeLists.txt file in the NDK installation.

* Add compiler flag -Wpedantic

Show compilation errors for the core subject, while ignore some of them
  • Loading branch information
JingMatrix authored Dec 9, 2024
1 parent 8dff17c commit e7a5835
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 6 deletions.
12 changes: 11 additions & 1 deletion core/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.10)
project(core)

set(CMAKE_CXX_STANDARD 23)

add_subdirectory(${EXTERNAL_ROOT} external)

aux_source_directory(src SRC_LIST)
Expand All @@ -9,8 +11,16 @@ aux_source_directory(src/xz SRC_LIST)

add_library(${PROJECT_NAME} STATIC ${SRC_LIST})

set(IGNORED_WARNINGS
-Wno-c99-extensions
-Wno-gnu-zero-variadic-macro-arguments
-Wno-gnu-flexible-array-initializer
-Wno-variadic-macros
-Wno-zero-length-array)

target_include_directories(${PROJECT_NAME} PUBLIC include)
target_include_directories(${PROJECT_NAME} PRIVATE src ${EXTERNAL_ROOT}/xz-embedded/linux/include)
target_compile_options(${PROJECT_NAME} PRIVATE -Wpedantic ${IGNORED_WARNINGS})

target_link_libraries(${PROJECT_NAME} PUBLIC dobby_static lsplant_static xz_static log fmt-header-only)
target_link_libraries(${PROJECT_NAME} PRIVATE dex_builder_static)
2 changes: 1 addition & 1 deletion daemon/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.10)
project(daemon)

add_subdirectory(${EXTERNAL_ROOT} external)
Expand Down
2 changes: 1 addition & 1 deletion dex2oat/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.10)
project(dex2oat)

add_executable(dex2oat dex2oat.c)
Expand Down
1 change: 1 addition & 0 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ set(XZ_SOURCES
set(XZ_INCLUDES xz-embedded/linux/include/linux xz-embedded/userspace)
list(TRANSFORM XZ_SOURCES PREPEND xz-embedded/linux/lib/xz/)
add_library(xz_static STATIC ${XZ_SOURCES})
target_compile_options(xz_static PRIVATE -DXZ_USE_CRC64)
target_include_directories(xz_static PRIVATE ${XZ_INCLUDES})

link_libraries(cxx)
Expand Down
2 changes: 1 addition & 1 deletion external/lsplant
2 changes: 1 addition & 1 deletion magisk-loader/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.10)
project(lspd)

add_subdirectory(${CORE_ROOT} core)
Expand Down

0 comments on commit e7a5835

Please sign in to comment.