Files
flipper/xplat/CMakeLists.txt
Pascal Hartig da9511a5bf Fix CI build for Android (#2836)
Summary:
I've been really sweating about this one. It looks like Google now removed NDK 21 as it's too old. However, we've been struggling with the upgrade because OpenSSL was built against an old version of the NDK/glibc/LLVM/some other stuff.

I've now managed to create an OpenSSL distribution for 1.1.1k (we had 1.1.0h before) that seems to build with this after some small modifications.

This seems to do the trick, but I wouldn't be shocked if we found some more incompatibilities further down the line.

Pull Request resolved: https://github.com/facebook/flipper/pull/2836

Test Plan:
- Locally: `./gradlew :tutorial:installDebug`. Builds, starts up. Cool.
- Public GitHub CI: Happy.
- Circle CI: Only triggers post-land. We'll see. But the setup is simple, so hopefully it should work there, too.
- Internal CI: Waiting for signal.

Reviewed By: fabiomassimo

Differential Revision: D30839209

Pulled By: passy

fbshipit-source-id: efe599f28cc0edfdf2149f905c3483555239edc0
2021-09-09 08:46:59 -07:00

77 lines
2.6 KiB
CMake

# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required (VERSION 3.6.0)
project(flippercpp CXX)
set(CMAKE_VERBOSE_MAKEFILE on)
set(PACKAGE_NAME flippercpp)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
set(RSOCKET_VERSION 0.10.7)
set(external_DIR ${PROJECT_SOURCE_DIR}/../android/third-party/external)
set(libfolly_DIR ${external_DIR}/folly/)
set(rsocket_DIR ${external_DIR}/RSocket/)
set(glog_DIR ${external_DIR}/glog)
set(BOOST_DIR ${external_DIR}/boost/boost_1_63_0/)
set(LIBEVENT_DIR ${external_DIR}/LibEvent/libevent-2.1.11-stable/)
set(DOUBLECONVERSION_DIR ${external_DIR}/double-conversion/double-conversion-3.0.0/)
set(OPENSSL_DIR ${external_DIR}/OpenSSL/openssl-1.1.1k/)
list(APPEND dir_list ./)
list(APPEND dir_list ./Flipper)
include_directories(${dir_list})
add_compile_options(-DFOLLY_NO_CONFIG
-DFB_SONARKIT_ENABLED=1
-DFOLLY_HAVE_MEMRCHR
-DFOLLY_MOBILE=1
-DFOLLY_USE_LIBCPP=1
-DFOLLY_HAVE_LIBJEMALLOC=0
-DFOLLY_HAVE_PREADV=0
-frtti
-fexceptions
-Wno-error
-Wno-unused-local-typedefs
-Wno-unused-variable
-Wno-sign-compare
-Wno-comment
-Wno-return-type
-Wno-tautological-constant-compare
)
file(GLOB SOURCES Flipper/*.cpp)
add_library(${PACKAGE_NAME} STATIC ${SOURCES})
set(build_DIR ${CMAKE_SOURCE_DIR}/build)
set(libfolly_build_DIR ${build_DIR}/libfolly/${ANDROID_ABI})
set(rsocket_build_DIR ${build_DIR}/rsocket/${ANDROID_ABI})
file(MAKE_DIRECTORY ${build_DIR})
add_subdirectory(${rsocket_DIR} ${rsocket_build_DIR})
message(STATUS "RSocket DIR:- " ${rsocket_DIR})
target_include_directories(${PACKAGE_NAME} PRIVATE
${libfolly_DIR}
${BOOST_DIR}
${BOOST_DIR}/../
${LIBEVENT_DIR}/
${rsocket_DIR}/rsocket-cpp-${RSOCKET_VERSION}
${LIBEVENT_DIR}/include/
${LIBEVENT_DIR}/include/event2
${OPENSSL_DIR}/include
${glog_DIR}
${glog_DIR}/../
${glog_DIR}/glog-0.3.5/src/
)
set(OPENSSL_LINK_DIRECTORIES ${external_DIR}/OpenSSL/libs/${ANDROID_ABI}/)
find_path(OPENSSL_LIBRARY libssl.a HINTS ${OPENSSL_LINK_DIRECTORIES})
target_link_libraries(${PACKAGE_NAME} folly rsocket glog double-conversion log event ${OPENSSL_LINK_DIRECTORIES}/libssl.a ${OPENSSL_LINK_DIRECTORIES}/libcrypto.a)