Saturday, August 6, 2022
HomeGame DevelopmentEasy methods to copy file in native/engine/ios to construct/ios/proj ? cc 3.5.2...

Easy methods to copy file in native/engine/ios to construct/ios/proj ? cc 3.5.2 – Cocos Creator


I’ve a Podfile in folder native/ios . Easy methods to robotically copy it to folder construct/ios/proj after click on construct in cocos creator ?


There’s a downside with utilizing CocoaPods with CMake. Each time you regenerate the Xcode undertaking file with cmake, the earlier CocoaPods settings can be reset.

So you have to allow the choice to skip Xcode undertaking updates, after which copy the Podfile.

Copying information will be performed with add_custom_commands or utilizing the construct plugin.



2 Likes

Thanks for reply. The place to place add_custom_commands code ? is it in native/engine/ios/CMakeLists.txt ? @PatriceJiang

Are you able to write instance for me when use add_custom_commands ? @PatriceJiang

add_custom_command(TARGET ${target_name} POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E copy_if_different ${file_path} ${CMAKE_BINARY_DIR}/${filename}
            )

Do you imply like this ? @PatriceJiang . It’s not working

The motion will be set off after construct the goal with Xcode.

The copy vacation spot is wrong

add_custom_command(TARGET ${EXECUTABLE_NAME} POST_BUILD
                COMMAND ${CMAKE_COMMAND} -E copy_if_different  ${CMAKE_CURRENT_LIST_DIR}/Podfile ${CMAKE_BINARY_DIR}/Podfile
            )

If you have to copy file throughout producing the Xcode undertaking, you should use file(COPY)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/Podfile ${CMAKE_BINARY_DIR}/Podfile)

Oh. I assumed it’s going to copy podfile after i click on construct in cocos creator
image

it’s didn’t construct. Do you imply ${CMAKE_BINARY_DIR) on this folder ?
image

@PatriceJiang I’ve construction undertaking like this

MyProject
→ native → ios → CMakeLists.txt
→ build->ios->proj

I need to copy file in native/ios to construct/ios/proj after i click on construct in cocos creator construct device

Do that command and ignore add_custom_command, it’s extra complicate

file(COPY ${CMAKE_CURRENT_LIST_DIR}/Podfile DESTINATION ${CMAKE_BINARY_DIR})



1 Like

Sure, ${CMAKE_BINARY_DIR} is the construct folder



1 Like

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments