On 07-Aug-15 01:43, Ruslan Baratov via cmake-developers wrote:
Hi,
I'm thinking about fixing bug
http://public.kitware.com/Bug/view.php?id=12506 and before I go deeper
in CMake internals just want to ask is there any work-in-progress
attempts already or hints/directions of how it can be done?
Thanks, Ruslo
Hi,
Sending patches with fix. Now it's possible to install simulator
libraries by:
> cmake --build _builds --config Release --target install -- -sdk
iphonesimulator
and device libraries by:
> cmake --build _builds --config Release --target install -- -sdk iphoneos
or from Xcode IDE (build target install).
However this commands will install both libraries to the same location.
This behaviour can be improved by adding some code that will do lipo of
all libraries before install (i.e. universal libraries will be
installed). This can be achieved by using ONLY_ACTIVE_ARCHS=NO while
running Xcode build. The only question is about making install target
depends on two type of builds (-sdk iphonesimulator and -sdk iphoneos).
Ruslo
>From 17aec9b5ff32f6dcbaced4b38ceeb6ccbe3a8c66 Mon Sep 17 00:00:00 2001
From: Ruslan Baratov <ruslan_bara...@yahoo.com>
Date: Thu, 13 Aug 2015 02:03:35 +0300
Subject: [PATCH 1/2] Fix EFFECTIVE_PLATFORM_NAME in cmake_install.cmake
$(EFFECTIVE_PLATFORM_NAME) in Xcode will be substituted with
`-iphoneos`/`-iphonesimulator` depending on the currently enabled SDK,
however for cmake_install.cmake script this will not happen and
explicit environment variable should be used.
Working on bug: http://public.kitware.com/Bug/view.php?id=12506
---
Source/cmInstallTargetGenerator.cxx | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 30cf175..6b6808d 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -84,6 +84,30 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
{
fromDirConfig =
this->Target->Target->GetDirectory(config, this->ImportLibrary);
+ const char *platforms = this->Target->Target->GetMakefile()->GetDefinition(
+ "CMAKE_XCODE_EFFECTIVE_PLATFORMS");
+
+ // Replace $(EFFECTIVE_PLATFORM_NAME) at the end with
+ // $ENV{EFFECTIVE_PLATFORM_NAME}.
+ //
+ // $(EFFECTIVE_PLATFORM_NAME) in Xcode will be substituted with
+ // `-iphoneos`/`-iphonesimulator` depending on the currently enabled SDK,
+ // however for cmake_install.cmake script this will not happen and
+ // explicit environment variable should be used.
+ if (platforms)
+ {
+ const std::string oldStr = "$(EFFECTIVE_PLATFORM_NAME)";
+ const std::string newStr = "$ENV{EFFECTIVE_PLATFORM_NAME}";
+
+ if (oldStr.size() <= fromDirConfig.size())
+ {
+ const size_t subBegin = fromDirConfig.size() - oldStr.size();
+ if (fromDirConfig.compare(subBegin, oldStr.size(), oldStr) == 0)
+ {
+ fromDirConfig.replace(subBegin, oldStr.size(), newStr);
+ }
+ }
+ }
fromDirConfig += "/";
}
std::string toDir =
--
1.9.3 (Apple Git-50)
>From 3c031415a3a9d58b7fcb8db7866da96f3c7a534c Mon Sep 17 00:00:00 2001
From: Ruslan Baratov <ruslan_bara...@yahoo.com>
Date: Thu, 13 Aug 2015 02:06:52 +0300
Subject: [PATCH 2/2] Fix install arguments for iOS
CMAKE_CFG_INTDIR can't be used for the BUILD_TYPE for iOS since it equals
to `Debug-iphoneos`,`Debug-iphonesimulator` etc.
Working on bug: http://public.kitware.com/Bug/view.php?id=12506
---
Source/cmGlobalGenerator.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cda26cd..fb93f5c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2471,8 +2471,11 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
singleLine.push_back(cmd);
if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' )
{
+ const char *platforms = mf->GetDefinition(
+ "CMAKE_XCODE_EFFECTIVE_PLATFORMS");
std::string cfgArg = "-DBUILD_TYPE=";
- cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
+ cfgArg += platforms ? "$(CONFIGURATION)" :
+ mf->GetDefinition("CMAKE_CFG_INTDIR");
singleLine.push_back(cfgArg);
}
singleLine.push_back("-P");
--
1.9.3 (Apple Git-50)
--
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