[cmake-developers] cmake xcode ios Build Phases > New Copy Files Phase?

Peter List pem.list at gmail.com
Thu Sep 10 15:00:27 EDT 2015


I added an extra line for Mac OS X.  So for iOS, the
MACOSX_PACKAGE_LOCATION line adds a "Copy Bundle Resource".  For OSX, the
"TARGET ALL" line copies the shader folder to the build folder.  Linux &
Windows will probably do the same thing as OSX, and probably Emscripten
too.  Android will probably need a separate conditional.

if(${IsIOS})
set_source_files_properties(shaders PROPERTIES MACOSX_PACKAGE_LOCATION
Resources)
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SRC_LIST} shaders)
else()
add_custom_target(TARGET ALL COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/shaders ${PROJECT_BINARY_DIR}/shaders)
add_executable(${PROJECT_NAME} ${SRC_LIST})
endif()




On Thu, Sep 10, 2015 at 1:45 AM, Peter List <pem.list at gmail.com> wrote:

> In case it helps someone else, here's what I have:
>
> # after link, add exe
> file(GLOB SRC_LIST shaders/* main.cpp)
> if(${IsIOS})
> set_source_files_properties(shaders PROPERTIES MACOSX_PACKAGE_LOCATION
> Resources)
> add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SRC_LIST} shaders)
> else()
> add_executable(${PROJECT_NAME} ${SRC_LIST})
> endif()
>
> It's a bit weird because I have both "shaders/*" and "shaders".  However,
> "shaders/*" is required for Qt Creator to see my GLSL shader files, while
> "shaders" is required for XCode iOS's Copy Bundle Resource.
>
> Oh I guess "Copy Bundle Resource" is not the same as "Copy Files"...  But
> I got something that works, and I'll have to look into the difference
> between those as a separate issue...
>
>
>
>
> On Thu, Sep 10, 2015 at 1:20 AM, Peter List <pem.list at gmail.com> wrote:
>
>> Actually I guess I found the answer here...
>>
>>
>> https://stackoverflow.com/questions/30430968/add-xcode-build-phase-via-cmake
>>
>>
>> On Thu, Sep 10, 2015 at 1:09 AM, Peter List <pem.list at gmail.com> wrote:
>>
>>> I use cmake to generate an iOS xcode project for "ios-cmake-master".
>>> Then I have to can manually add my "shaders" folder to xcode > cmd+4 >
>>> Build Phases > + New Copy Files Phase > Destination = Resources, + to add
>>> my "shaders" folder.  This allows me to have XCode copy my GLSL "shaders"
>>> folder (or other files) into the iOS simulator when I run my project.
>>>
>>> So my question is...  How do I tell CMake to generate my .xcodeproj file
>>> with this Build Phase?  I shouldn't need to manually edit my .xcodeproj
>>> file...
>>>
>>> thank you for any leads
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150910/1382629c/attachment.html>


More information about the cmake-developers mailing list