On 13-Aug-15 08:46, Gregor Jasny wrote:
Hi,
On 13/08/15 01:44, Ruslan Baratov via cmake-developers wrote:
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).
This was my preliminary work:
https://github.com/gjasny/CMake/commit/978dca25ac387bdec894a1ba2c934317f5f6169f
This looks great! I've spent several hours trying to figure out how
'$(EFFECTIVE_PLATFORM_NAME)' can be set to Xcode and some CMake friendly
string to cmake_install.cmake script. I didn't know Xcode understand
`${VAR}` syntax (probably it didn't, it's just expanded as an
environment variable). I've tested your fix and it works fine for me.
Since we don't need to replace string with path manually I think your
solution is neater. I've added description to commit and rebased it, see
attachment.
Thanks, Ruslo
>From a85eaddb5d1df693606a3c86b754d01a0efcb4e7 Mon Sep 17 00:00:00 2001
From: Gregor Jasny <gja...@googlemail.com>
Date: Thu, 13 Aug 2015 13:03:02 +0300
Subject: [PATCH] Fix installation of iOS targets
Since cmTarget::ComputeOutputDir results can be used in CMake code of script
cmake_install.cmake and in Xcode internals, string ${EFFECTIVE_PLATFORM_NAME}
should be used instead of $(EFFECTIVE_PLATFORM_NAME) because it works for both.
Value of CMAKE_CFG_INTDIR can't be used in BUILD_TYPE argument of install
command since it contains $(EFFECTIVE_PLATFORM_NAME) (e.g. equals to
`Release-iphoneos`, `Debug-iphoneos`, etc.).
Fix bug: http://public.kitware.com/Bug/view.php?id=12506
---
Source/cmGlobalGenerator.cxx | 13 ++++++++++++-
Source/cmTarget.cxx | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cda26cd..933839c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2472,7 +2472,18 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' )
{
std::string cfgArg = "-DBUILD_TYPE=";
- cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
+ const char *platforms =
+ mf->GetDefinition("CMAKE_XCODE_EFFECTIVE_PLATFORMS");
+ if(platforms)
+ {
+ cfgArg += "$(CONFIGURATION)";
+ singleLine.push_back(cfgArg);
+ cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)";
+ }
+ else
+ {
+ cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
+ }
singleLine.push_back(cfgArg);
}
singleLine.push_back("-P");
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 316d85c..3ac9e8e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -3536,7 +3536,7 @@ bool cmTarget::ComputeOutputDir(const std::string& config,
const char *platforms = this->Makefile->GetDefinition(
"CMAKE_XCODE_EFFECTIVE_PLATFORMS");
std::string suffix =
- usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : "";
+ usesDefaultOutputDir && platforms ? "${EFFECTIVE_PLATFORM_NAME}" : "";
this->Makefile->GetGlobalGenerator()->
AppendDirectoryForConfig("/", conf, suffix, out);
}
--
2.4.5
--
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