Tuesday, August 9, 2022
HomeGame DevelopmentEasy methods to robotically add library to undertaking xcode in cc 3.5.2?...

Easy methods to robotically add library to undertaking xcode in cc 3.5.2? – Cocos Creator



After i add some libs in construct phases->hyperlink binary with libraries . I attempt to construct undertaking once more through the use of cocos creator construct instrument. I opened undertaking xcode once more. In construct phases->hyperlink binary with libraries , it was empty.
Is there any solution to repair this drawback?


It’s worthwhile to edit:
native/engine/ios/CMakeLists.txt

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AppTrackingTransparency")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Safety")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework StoreKit")

Hope this may clear up your concern.



1 Like

I attempted it. it didn’t work @stark2022
image

I already know the issue why each time I rebuild, this area is empty. That’s as a result of I selected the choice skip xcode replace . However I nonetheless need to understand how if I construct a brand new xcode undertaking it could actually robotically add the library

The reply from @stark2022 ought to work.

And right here a modernized is manner

#...
cc_ios_after_target(${EXECUTABLE_NAME})

target_link_libraries(${EXECUTABLE_NAME} # PUBLIC
  "-framework AppTrackingTransparency"
  "-framework Safety"
  "-framework StoreKit"
)

If the skip choice is checked and must override the Xcode undertaking, you possibly can take away the construct/ios folder or the only file construct/ios/proj/CMakeCache.txt, to set off regenerate.



1 Like

@PatriceJiang , will the library be added after constructing in cocos creator instrument with the above command? .
I attempted your code however it construct failed . Are you positive the next is syntactically right ?

target_link_libraries(${EXECUTABLE_NAME} PUBLIC
  "-framework AppTrackingTransparency"
  "-framework Safety"
  "-framework StoreKit"
)

will the library be added after constructing in cocos creator instrument with the above command?

Sure

Are you positive the next is syntactically right ?

What sort of error report do you meet? target_link_libraries.

Pls, strive whether or not you possibly can appropriately embrace the corresponding header file. I’m unsure whether or not your verification technique is dependable

Attempt to take away the key phrase PUBLIC to see for those who can clear up the error reported



1 Like

Sorry, i don’t have expertise for ios improvement :frowning: . i believed that I needed to verify right here @PatriceJiang .
image

If I’ve some library recordsdata which is downloaded . Easy methods to robotically add them to undertaking xcode after construct @PatriceJiang ?

You need to use add_library and target_link_libraries

For instance:

# import 
add_library(freetype STATIC IMPORTED GLOBAL)
set_target_properties(freetype PROPERTIES
  IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libs/libfreetype.a
  INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/embrace/freetype
)
# hyperlink
target_link_libraries(${EXECUTABLE_NAME} PUBLIC
freetype 
)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments