Re: [cmake-developers] [PATCH 2/9] Xcode: Sort Xcode objects by Id
Xcode keeps the objects ordered by the object id. Because cmake stores them into an unordered container at creation time they must be sorted before writing the pbxproj file. out of curiosity: what exactly is the id? the uuid identifier or the target name? when ordering targets in the project, it would make sense to order them by target name, as that's what users are used to (iirc the cmake-generated msvc projects are order their targets by target name) -- 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
Re: [cmake-developers] [PATCH 2/9] Xcode: Sort Xcode objects by Id
On 04/14/2015 04:15 AM, Tim Blechmann wrote: out of curiosity: what exactly is the id? the uuid identifier or the target name? when ordering targets in the project, it would make sense to order them by target name, as that's what users are used to (iirc the cmake-generated msvc projects are order their targets by target name) We don't know exactly what it is because the Xcode format is not documented publicly. I suspect Xcode uses some form of serialization tool to store its internal data structures to the .pbxproj file, and these are the ids it generates. Effectively it is a UUID for our purposes. The ordering Gregor proposes is to match what Xcode writes when it generates the .pbxproj file, and we can't choose that. -Brad -- 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
Re: [cmake-developers] [PATCH 2/9] Xcode: Sort Xcode objects by Id
On 04/14/2015 10:17 AM, Tim Blechmann wrote: Effectively it is a UUID for our purposes. The ordering Gregor proposes is to match what Xcode writes when it generates the .pbxproj file, and we can't choose that. i see ... is it (easily) possible to lexicographically sort he user-visible appearance? this is something that can be changed in native xcode projects (by dragging) If Xcode can save and load projects with user-specified ordering then CMake may be able to generate things accordingly. Try creating a project with the IDE, saving it, copying it, and then updating the order in the IDE and saving again. Compare the saved project files. Where is the order stored? -Brad -- 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
Re: [cmake-developers] [PATCH 2/9] Xcode: Sort Xcode objects by Id
Effectively it is a UUID for our purposes. The ordering Gregor proposes is to match what Xcode writes when it generates the .pbxproj file, and we can't choose that. i see ... is it (easily) possible to lexicographically sort he user-visible appearance? this is something that can be changed in native xcode projects (by dragging) If Xcode can save and load projects with user-specified ordering then CMake may be able to generate things accordingly. Try creating a project with the IDE, saving it, copying it, and then updating the order in the IDE and saving again. Compare the saved project files. Where is the order stored? seems to be the children property: --- tset/test.xcodeproj/project.pbxproj 2015-04-14 16:33:49.0 +0200 +++ test/test.xcodeproj/project.pbxproj 2015-04-14 16:34:08.0 +0200 @@ -61,8 +61,8 @@ 22AA72931ADD5C9900988B41 = { isa = PBXGroup; children = ( - 22AA729E1ADD5C9900988B41 /* test */, 22AA72B51ADD5C9900988B41 /* testTests */, + 22AA729E1ADD5C9900988B41 /* test */, 22AA729D1ADD5C9900988B41 /* Products */, ); sourceTree = group; -- 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
Re: [cmake-developers] [PATCH 2/9] Xcode: Sort Xcode objects by Id
On 04/14/2015 10:36 AM, Tim Blechmann wrote: Where is the order stored? seems to be the children property: 22AA72931ADD5C9900988B41 = { isa = PBXGroup; children = ( -22AA729E1ADD5C9900988B41 /* test */, 22AA72B51ADD5C9900988B41 /* testTests */, +22AA729E1ADD5C9900988B41 /* test */, 22AA729D1ADD5C9900988B41 /* Products */, ); Take a look at the end of the CreateXCodeObjects method below the now add all targets to the root object comment. One may be able to sort the target traversal order in that loop. -Brad -- 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
Re: [cmake-developers] [PATCH 2/9] Xcode: Sort Xcode objects by Id
out of curiosity: what exactly is the id? the uuid identifier or the target name? when ordering targets in the project, it would make sense to order them by target name, as that's what users are used to (iirc the cmake-generated msvc projects are order their targets by target name) We don't know exactly what it is because the Xcode format is not documented publicly. I suspect Xcode uses some form of serialization tool to store its internal data structures to the .pbxproj file, and these are the ids it generates. Effectively it is a UUID for our purposes. The ordering Gregor proposes is to match what Xcode writes when it generates the .pbxproj file, and we can't choose that. i see ... is it (easily) possible to lexicographically sort he user-visible appearance? this is something that can be changed in native xcode projects (by dragging) -- 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
[cmake-developers] [PATCH 2/9] Xcode: Sort Xcode objects by Id
Xcode keeps the objects ordered by the object id. Because cmake stores them into an unordered container at creation time they must be sorted before writing the pbxproj file. --- Source/cmGlobalXCodeGenerator.cxx | 16 Source/cmGlobalXCodeGenerator.h | 1 + 2 files changed, 17 insertions(+) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0561a05..be40c66 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -592,6 +592,20 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( } // + +static bool objectIdLessThan(cmXCodeObject* l, cmXCodeObject* r) +{ + return l-GetId() r-GetId(); +} + +// +void cmGlobalXCodeGenerator::SortXCodeObjects() +{ + std::sort(this-XCodeObjects.begin(), this-XCodeObjects.end(), +objectIdLessThan); +} + +// void cmGlobalXCodeGenerator::ClearXCodeObjects() { this-TargetDoneSet.clear(); @@ -3713,6 +3727,8 @@ cmGlobalXCodeGenerator::WriteXCodePBXProj(std::ostream fout, cmLocalGenerator* , std::vectorcmLocalGenerator* ) { + SortXCodeObjects(); + fout // !$*UTF8*$!\n; fout {\n; cmXCodeObject::Indent(1, fout); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index b272f6a..1a69fce 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -150,6 +150,7 @@ private: cmXCodeObject* buildSettings, const std::string buildType); std::string ExtractFlag(const char* flag, std::string flags); + void SortXCodeObjects(); // delete all objects in the this-XCodeObjects vector. void ClearXCodeObjects(); bool CreateXCodeObjects(cmLocalGenerator* root, -- 2.3.3 -- 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