We've are developing our OSX project using cMake as a tool to create the Xcode project.
However, it turns out we now need some localization, for which we need both English and German .xib files (or .strings to generate them, that's not the important bit).
We have the files in the right place and correctly created, but when cMake generates the project, the files are inserted into the Xcode project as two completely separate and independent files, such as:
Foo.xib
Foo.xib
Instead of two "sub-files" under the same name:
Foo.xib
- Foo.xib (English)
- Foo.xib (German)
If i drag and drop the xib's that are in en.lproj and sv.lproj directly to the resources folder in the project explorer:
Xcode automatically detects that this is some different languages of the same UI, hence the languages are added in the project settings automatically.
Also the xibs get a MainMenu.xib group in the project explorer three, consisting of both the languages.
I try to add the localized xib's to the project through cmake. They get added to the resources folder but not as identified localizations, I only get two xibs in the project explorer three no localization no connection between them.
How can I make the localization work through cmake generation?
set(CEFCLIENT_RESOURCES_MAC_ENGLISH_LPROJ_SRCS_MACOSX
mac/en.lproj/MainMenu.xib
)
set(CEFCLIENT_RESOURCES_MAC_SWEDISH_LPROJ_SRCS_MACOSX
mac/sv.lproj/MainMenu.xib
)
set(CEFCLIENT_RESOURCES_SRCS
${CEFCLIENT_RESOURCES_MAC_SRCS}
${CEFCLIENT_RESOURCES_MAC_ENGLISH_LPROJ_SRCS}
${CEFCLIENT_RESOURCES_MAC_SWEDISH_LPROJ_SRCS}
${CEFCLIENT_RESOURCES_RES_SRCS}
)
Is there a way to generate the Xcode projects through cmake with the .lproj bundles working?
We just did this ourselves. Unfortunately the solution is not pretty. I ended up writing my own python script using mod_pbxproj to modify the xcode project after cmake generated it. If you can get away with using a regular xcode project instead of a cmake generated one, I think you are better off. What you have to do to make XCode recognize a set of files as localizations is pretty complex.
You can find an example of handling xib files for Xcode project here: https://github.com/open-eid/updater/blob/master/CMakeLists.txt.
Summary: one can use custom command + set MACOSX_PACKAGE_LOCATION property on resulting nib:
add_custom_command( OUTPUT MainMenu.nib
COMMAND ibtool --errors --warnings --notices --output-format human-readable-text
--compile MainMenu.nib ${CMAKE_CURRENT_SOURCE_DIR}/mac/en.lproj/MainMenu.xib
)
set_source_files_properties( MainMenu.nib
PROPERTIES MACOSX_PACKAGE_LOCATION Resources/en.lproj )
Related
I have a CMake project, and until now, I was using Visual C++ for developing.
Using CMake-gui to generate a solution for VC++, it generates more than one project in the same solution.
But when the script is loaded in qt-creator, only one project is defined, with all the code and folder tree inside, so I can not compile it (or I don't know how to do it).
How can I load the cmake file to load all the projects?
More info:
The first CMakeList.txt has some common configuration. Then, with 'add_subdirectory' function, I add a project to make a library, and another project to make a sample application to use this library.
You should add multiple projects to the root cmake file with help of "add_subdirectory()". Then in Qt Creator you should open the root cmake file. After that you could choose which project to run in the select a kit for running (3) or debugging (4) application pane (check the link).
It sad that you can't (or I don't know how) build only one project. You have to build all projects are added to the root cmake file and then choose which one of them you want to run.
I use Qt Creator 4.0 .
Here is the offical doc http://qt-project.org/doc/qtcreator-2.8/creator-project-cmake.html
My project have a similar structure, just open the top-most CMakeLists.txt file of the project, and qtcreator will import your project.
I'm trying to add the hypen library to my Xcode iOS project and it has 4 files: hyphen.c, hyphen.h, hnjalloc.c, hnjalloc.h. I dragged them to my project and hit build, but I'm getting undefined symbols for architecture i386 errors. Am I supposed to take any other steps besides dragging them to my project?
Make sure you've added them to the build target - including a file into the project without including in the build target can easily cause this error.
right click on the Source folder (top left where all the folder are) and check add. Then choose the files you wish to add. I tried drag&drop had problems with linker.
I have two projects that are build on 2 different compilers. I need to combine both into one single app. Found out from a source that it is possible to compile any one of the project into a library and add it into the other to use it.
I fairly new this concept. Has any one done anything like this? How do i convert one of the project into a library and how would i connect the two? Will i still able to call the views in that project(library) in my other project? I am using XCODE 4.2 and iOS 5.
Create a "Cocoa Touch Static Library" to build your "Project"/target, and include the then-built library (with its public headers) into the second one. Note that the details depend quite a bit on what you mean by "project" and by "call the views" (which looks a bit wrong).
If you have two existing projects (with .xcodeproj files), open the "app" project (guessing one is of such kind), and include the lib project inside it (by drag & drop, or by "Add Files..."). Not the opposite.
Then in the "Build Phases" of the app project, you can add your "lib" project as a target dependencies (making your lib to always build when building your app). Finally, add the lib project product (the .a) in the "Link" build phases of the "app" project.
I am trying to add a dependent project in XCode 4. The link to the project is this: https://github.com/jverkoey/ObjQREncoder
The author described a way to add this but it's for XCode 3. I am trying to add it to XCode 4.
I dragged the project inmy frameworks, then went to Targets and QREncoder in Target Dependencies. Then I added libQREncoder.a in "Link Binary with Libraries". Then I added this for header search path "src/Classes".
When I include "QREncoder/QREncoder.h", it gives me this error: file://somePath/FINALQRAppDelegate.m: error: Lexical or Preprocessor Issue: 'QREncoder/QREncoder.h' file not found
This is how my project is set up:
FINALQR is my project to which I am trying to add the dependency and the dependency project is in src.
Thanks.
The problem is it doesn't recognize the QREncoder class.
Only Xcode 4 workspaces benefit from shared build folders across multiple projects. From the main menu, select File > New > New Workspace... Save the workspace, then drag your subprojects into its Project navigator panel.
Be careful where you place them (make sure you're not making one project a subproject of another within the workspace) so that they're all top-level projects within your workspace. This will cause them to share the build folder and automatic dependency detection should work.
Unless, of course, you have custom search paths set in your targets' build settings. :-)
I think your problem is you need to set the following as your search path:
"$(SRCROOT)/src/Classes"
not
"src/Classes"
If you already have an Xcode4 project, you should be able to drag QREncoder into it as a subproject, as I think you have already done, and then add the .a file, also as you've done.
I have a project with two targets, one is a Cocoa Static Library, the other is the accompanying test project. Despite building the main project in different ways over and over again, I cannot find the .a file that I expect it to produce.
In fact, I cannot find the build folder associated with the project. I need to link to the library in an app, but cannot do so if I can't find the file to link to.
These properties are correctly set:
(Build Products Path) SYMROOT = build
(Intermediate Build Files Path) OBJROOT = $(SYMROOT)
All tests pass (which means the code MUST be building right?)
Breaking the code causes the build to break - again suggesting that it is building.
Also, the "Products > libproject.a" file is red in the xcode project navigation
I also checked the DerivedData directory, but all the seems to get created is the objects fot the OCunit stuff. Still no .a file against which I can link.
Where is my .a file?
Any help would be much appreciated.
It's probably in ~/Library/Developer/Xcode/DerivedData/ somewhere.