This repository has been archived by the owner on Aug 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
CMakeLists.magiskboot.txt
91 lines (83 loc) · 3.66 KB
/
CMakeLists.magiskboot.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# partially copied from Magisk
corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/Magisk/native/src/Cargo.toml
CRATES magiskboot)
if (RUSTFLAGS)
corrosion_add_target_rustflags(magiskboot ${RUSTFLAGS})
endif()
if (CARGO_FLAGS)
corrosion_set_cargo_flags(magiskboot ${CARGO_FLAGS})
endif()
corrosion_set_env_vars(magiskboot
CXXBRIDGE_GEN_TARGET_OS=${CXXBRIDGE_GEN_TARGET_OS}
RUSTC_BOOTSTRAP=${RUSTC_BOOTSTRAP})
add_custom_target(workspace_cleanup
COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_CURRENT_SOURCE_DIR}/src/Magisk/native/src/.cargo/config.toml
COMMENT "Cleaning up workspace")
add_dependencies(_cargo-build_magiskboot workspace_cleanup)
add_library(libbase STATIC
src/Magisk/native/src/base/files.cpp
src/Magisk/native/src/base/misc.cpp
src/Magisk/native/src/base/logging.cpp
src/Magisk/native/src/base/stream.cpp
src/Magisk/native/src/external/cxx-rs/src/cxx.cc
src/magiskbase-rs-wrapper.cc)
add_dependencies(libbase magiskboot-static)
target_compile_definitions(libbase PRIVATE -DRUST_CXX_NO_EXCEPTIONS)
add_dependencies(libbase prepared_generated_directory)
target_include_directories(libbase PRIVATE
src/Magisk/native/src/base
src/Magisk/native/src/external/cxx-rs/include
${CMAKE_CURRENT_BINARY_DIR}/generated)
target_include_directories(libbase PUBLIC
src/Magisk/native/src/include
src/Magisk/native/src/base/include)
if (CMAKE_SYSTEM_NAME MATCHES "Android")
message(STATUS "Native liblog enabled")
target_link_libraries(libbase log)
else()
target_compile_options(libbase PUBLIC --include=${CMAKE_CURRENT_SOURCE_DIR}/include-android/fortify_stub.h)
include(CheckSymbolExists)
check_symbol_exists("__printflike" "sys/cdefs.h" HAVE_PRINTFLIKE)
if (NOT HAVE_PRINTFLIKE)
target_compile_options(libbase PUBLIC --include=${CMAKE_CURRENT_SOURCE_DIR}/include-android/libbsd_stub.h)
endif()
message(STATUS "Using bundled liblog")
target_link_libraries(libbase android_liblog)
endif()
add_library(libzopfli STATIC
src/Magisk/native/src/external/zopfli/src/zopfli/blocksplitter.c
src/Magisk/native/src/external/zopfli/src/zopfli/cache.c
src/Magisk/native/src/external/zopfli/src/zopfli/deflate.c
src/Magisk/native/src/external/zopfli/src/zopfli/gzip_container.c
src/Magisk/native/src/external/zopfli/src/zopfli/hash.c
src/Magisk/native/src/external/zopfli/src/zopfli/katajainen.c
src/Magisk/native/src/external/zopfli/src/zopfli/lz77.c
src/Magisk/native/src/external/zopfli/src/zopfli/squeeze.c
src/Magisk/native/src/external/zopfli/src/zopfli/tree.c
src/Magisk/native/src/external/zopfli/src/zopfli/util.c
src/Magisk/native/src/external/zopfli/src/zopfli/zlib_container.c
src/Magisk/native/src/external/zopfli/src/zopfli/zopfli_lib.c)
target_include_directories(libzopfli PUBLIC
src/Magisk/native/src/external/zopfli/src)
target_compile_options(libzopfli PRIVATE
-Werror -Wno-unused -Wno-unused-parameter)
add_executable(magiskboot_exe
src/Magisk/native/src/boot/main.cpp
src/Magisk/native/src/boot/bootimg.cpp
src/Magisk/native/src/boot/compress.cpp
src/Magisk/native/src/boot/format.cpp
src/magiskboot-rs-wrapper.cc)
add_dependencies(magiskboot_exe magiskboot-static)
target_include_directories(magiskboot_exe PRIVATE
src/Magisk/native/src/external/cxx-rs/include)
target_link_libraries(magiskboot_exe
libbase
magiskboot-static
LibLZMA::LibLZMA
PkgConfig::liblz4
BZip2::BZip2
ZLIB::ZLIB
libzopfli
Threads::Threads)
include(GNUInstallDirs)
install(TARGETS magiskboot_exe DESTINATION ${CMAKE_INSTALL_BINDIR})