1
+ #
2
+ # Copyright © 2022 Github Lzhiyong
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
cmake_minimum_required (VERSION 3.14.2)
2
18
project (sdk-tools)
3
19
4
- if (ANDROID_ABI STREQUAL "arm64-v8a" OR ANDROID_ABI STREQUAL "armeabi-v7a" )
5
- enable_language (ASM)
6
- elseif (ANDROID_ABI STREQUAL "x86_64" OR ANDROID_ABI STREQUAL "x86" )
7
- enable_language (ASM_NASM)
8
- else ()
9
- message (FATAL_ERROR "Unsupported architecture: ${ANDROID_ABI} " )
10
- endif ()
20
+ set (CMAKE_C_STANDARD 11)
21
+ set (CMAKE_CXX_STANDARD 20)
22
+ enable_language (ASM)
11
23
12
24
# set global cflags and cxxflags
13
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes -std=gnu11 " )
14
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes -std=gnu++2a " )
25
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes" )
26
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics -fPIC -Wno-attributes" )
15
27
# static link
16
28
set (CMAKE_EXE_LINKER_FLAGS "-static" )
17
29
18
30
# platform tools version
19
31
# see the patches/other/platform_tools_version.h
20
- set (TOOLS_VERSION 33 .0.1)
32
+ set (TOOLS_VERSION 35 .0.1)
21
33
set (SRC ${PROJECT_SOURCE_DIR} /src)
22
34
23
35
# 64-bit off_t for lseek.
24
36
add_definitions (-D_FILE_OFFSET_BITS=64)
25
37
26
- if (NOT DEFINED PROTOC_PATH)
27
- message (FATAL_ERROR "PROTOC_PATH undefined, please make sure to build and install protoc from the cloned submodule." )
28
- endif ()
38
+ set (PROTOC_COMPILER)
39
+
40
+ if (DEFINED PROTOC_PATH)
41
+ set (PROTOC_COMPILER ${PROTOC_PATH} )
29
42
30
- set (PROTOC_COMPILER ${PROTOC_PATH} )
31
-
32
- if (NOT EXISTS ${PROTOC_COMPILER} )
33
- unset (PROTOC_PATH CACHE )
34
- message (FATAL_ERROR "Invalid protoc: ${PROTOC_COMPILER} , please check if the path is correct" )
43
+ if (NOT EXISTS ${PROTOC_COMPILER} )
44
+ unset (PROTOC_PATH CACHE )
45
+ message (FATAL_ERROR "Invalid protoc: ${PROTOC_COMPILER} , please check if the path is correct" )
46
+ endif ()
47
+
48
+ # check protoc version
49
+ execute_process (
50
+ COMMAND ${PROTOC_COMPILER} --version
51
+ OUTPUT_VARIABLE PTOTOBUF_VERSION
52
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
53
+ )
54
+
55
+ if (NOT PTOTOBUF_VERSION MATCHES "^libprotoc*" )
56
+ unset (PROTOC_PATH CACHE )
57
+ message (FATAL_ERROR "Invalid protoc: ${PROTOC_COMPILER} , this may not be an executable" )
58
+ endif ()
59
+
60
+ string (REGEX MATCH "([0-9]+)\\ .([0-9]+)\\ .([0-9]+)" VERSIONS ${PTOTOBUF_VERSION} )
61
+ # please note that if the protobuf version is too high, you may encounter the following error
62
+ # error: This file was generated by a newer version of protoc
63
+ if (VERSIONS VERSION_GREATER "3.21.12" )
64
+ message (WARNING "${PTOTOBUF_VERSION} , the protobuf version is too high, may be incompatible!!" )
65
+ endif ()
35
66
endif ()
36
67
37
68
# thrid-party libraries
38
69
add_subdirectory (src/boringssl EXCLUDE_FROM_ALL )
39
70
add_subdirectory (src/fmtlib EXCLUDE_FROM_ALL )
40
71
add_subdirectory (src/pcre EXCLUDE_FROM_ALL )
41
- add_subdirectory (src/expat EXCLUDE_FROM_ALL )
42
- add_subdirectory (src/zopfli EXCLUDE_FROM_ALL )
43
- add_subdirectory (src/protobuf/cmake EXCLUDE_FROM_ALL )
72
+ add_subdirectory (src/libpng EXCLUDE_FROM_ALL )
73
+ add_subdirectory (src/jsoncpp EXCLUDE_FROM_ALL )
74
+ add_subdirectory (src/expat/expat EXCLUDE_FROM_ALL )
75
+ add_subdirectory (src/protobuf EXCLUDE_FROM_ALL )
76
+ add_subdirectory (src/googletest EXCLUDE_FROM_ALL )
44
77
45
78
# building sdk-tools
46
- add_subdirectory (cmake)
79
+ add_subdirectory (lib)
80
+ add_subdirectory (build -tools)
81
+
0 commit comments