How to link Photon lib with Android project use Cmake?

I just upgrade cocos2dx to version 3.17.1 and use Cmake build game.
All is ok, except Photon lib.
I'm a newbie in cmake's world.

A part of CMakeLists.txt:
project(${APP_NAME})
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs/cocos)
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
include(CocosBuildSet)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core)
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
add_library(${APP_NAME} SHARED ${all_code_files})
target_include_directories(${APP_NAME} PRIVATE ${GAME_INC})
link_directories(LIB_LINK)
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
target_link_libraries(${APP_NAME} cocos2d)
setup_cocos_app_config(${APP_NAME})

When I try "target_link_libraries" to photon, I get error: undefined reference to 'std::ios_base::Init::Init()'

Can anyone help me?
Sorry for my English. Thanks!

Comments

  • Sorry. My mistake
  • Hi,
    Can you please help me,
    how to link Photon lib with Android project use Cmake.
  • Hi @Gammer.

    We use ndk-build and not cmake for building the Android libraries and demo projects.
    It should be possible to use cmake instead, but we don't have experience with doing so.
    Please see the demo projects for how to link the Photon libs with your Android project using ndk-build.
    Googles Android NDK documentation at https://developer.android.com/ndk/guides/build should explain the differences between ndk-build and cmake and with the information you should be able to figure out how to translate a ndk-build makefile into a cmake makefile and vice versa.