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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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
>>>
>>>
>>
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to