SDKBOX Firebase with CMake on iOS

SDKBOX Firebase with CMake on iOS
0

Hey,

has anyone successfully integrated the sdkbox Firebase plugin with CMake for ios?
1/2 year ago I struggled adding the sdkbox & IAP for ios for CMake

Where at the end it seems like find_library worked.
But somehow this isn’t the case for Firebase.

It works for android:

#==================================================
#SDKBOX
# add plugin lib
if(ANDROID)
    add_definitions(-DSDKBOX_ENABLED)
    add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/PluginIAP/)
    target_link_libraries(${APP_NAME} ext_pluginiap)
	
	add_definitions(-DSDKBOX_ENABLED)
    add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/PluginFirebase/)
    target_link_libraries(${APP_NAME} ext_PluginFirebase)
	
    include_directories(
        #${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/PluginIAP
        #${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/sdkbox
            ${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/
   )

# add sdkbox lib
    add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/jni/sdkbox/)
    target_link_libraries(${APP_NAME} ext_sdkbox
    )
endif()

but I have no idea whats wrong with ios again…

find_library(F_FIREBASE PluginFirebase)
target_link_libraries(${APP_NAME} ${F_SYSCONF} ${F_STOREKIT} ${F_SDKBOX} ${F_IAP} ${F_FIREBASE})

linking “${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac/PluginFirebase.framework/PluginFirebase”
directly might work here again, but then a bunch of other stuff doesn’t work at all, since the plugin shipps with an additional Firebase folder besides the PluginFirebase.framework

let me know if anyone has successfully integrated it and can help me out here ._.

I did not test cmake with ios, only android.
i’ll try to fix this issue.

Thanks for your report.

1 Like

maybe I’m just doing something wrong again with cmake ._.

how do you compile iOS, plz show steps .

nothing special

for ios i used the sdkbox GUI to apply the plugin, which generatse me an Firebase folder including multiple .framework files
and a normal Firebase.framework file.

I’m using the cocos ios toolchain to generate cmake
and add:

find_library(F_FIREBASE PluginFirebase)
#same for <sdkbox> and <iap>

target_link_libraries(${APP_NAME} ${F_SYSCONF} ${F_STOREKIT} ${F_SDKBOX} ${F_IAP} ${F_FIREBASE})

at the end of my cmakefile, since this works for the IAP plugin.
for Firebase it says NOTFOUND for F_FIREBASE, so find_library doesn’t work as it should (like for PluginIAP) and therefore can’t even generated a xcode project…

I’ve tried once to directly use target_link_libraries on the PluginFirebase.framework/PluginFirebase file, but then i get a bunch of linker errors. when trying to build.

I’m not 100% sure what to do with the Firebase folder that get generated.
Do I have to add all the *.framework files in CMake myself?

btw: im on 3.17.1

my steps:
0. create a cocos2d-x cpp 3.17.1 project

  1. sdkbox import iap and firebase
  2. run command cocos compile -p ios

.

have you generated another xcode project to test ? If yes, why ?

But did you run it with CMake?

as far as i know sdkbox doesn’t add anything automatically to the CMakeLists.txt
I only know that some cmake stuf gets generated for Android but I still had to add it to the projeckt cmake file.

I’ll try it with a new project later today.

sorry i do not know how to run it with CMake for iOS .

if(IOS)
add_definitions(-DSDKBOX_ENABLED)
message(${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac)
find_host_library(F_IAP
    NAMES PluginIAP
    PATHS ${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac
    )
message(STATUS "F_IAP: ${F_IAP}") # print find libs result
find_host_library(F_SDKBOX
    NAMES sdkbox
    PATHS ${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac
    )
message(STATUS "F_SDKBOX: ${F_SDKBOX}") # print find libs result

target_link_libraries(${APP_NAME} ${F_SDKBOX} ${F_IAP})
endif()

answer from https://github.com/cocos2d/cocos2d-x/pull/19230

IAP example:

yeah IAP is working for me as well, I only had issues with Firebase, I’ll give it a shot again.

plz ref to [the IAP CMake example] http://docs.sdkbox.com/en/qa/sdkbox-cmake/#iap-example to write your own firebase configure.
I’ll update our CMake patch.