How can I change my BB10 project to use a makefile? - makefile

I recently created a new Blackberry project Momentics, and it runs fine from the IDE, but I need to be able to build it from the command line using a Makefile. I ran make in Terminal, but received an error because the makefile does not exist.
I checked the sample apps that I've been looking at, and they all have makefiles. I found some sources that say you can pick whether you use a managed build or a makefile when you create the project, but I found no such option in the latest version of Momentics (2.1). I tried changing this setting in the project properties, but the Builder Settings under C/C++ Build are all greyed out.
How can I change my BB10 project to use a makefile? If that isn't possible, how can I require a new project to use a makefile instead of a managed build?

It turns out that the option to use a makefile is unintentionally hidden in OSX. When you create a Blackberry Core Native project, the Build Settings screen will look like this:
I viewed the same screen on Windows, and the option that I wanted was right below language. I then tried again in OSX, and found out that you can scroll this screen to show the "Build" option.
I also discovered that creating the project as a Blackberry Cascades project doesn't give you this option at all, but will always use a makefile to build.
I also tried converting my original project from using managed build to using makefile. This appeared to be possible from the File > Import option. I tried importing my project as BlackBerry > Existing Code as BlackBerry C/C++ Makefile Project and as C/C++ > Existing Code as Makefile Project, but neither option actually converted my project to a makefile project. Unfortunately, because of this, the best solution to convert the project seems to be starting a new project with the desired setting and copying the files and settings from the old project.

Related

Xcode 13 and Linux Makefile

I searched and it seems all the answers are from are from many years ago. I'm working on a command line tool for linux/Mac that currently uses a Makefile. I wanted to use the Xcode debugger, so I tried to build an Xcode project, but I'm having some final difficulties.
I created a new project of type command line tool with external build target in the project directory. The default was to use /usr/bin/make. It ended up in a subdirectory, and based on several older web resources, I moved the project file up to the folder with the makefile. I added the source files in the folder to the project and right now I can edit and build from Xcode without difficulty.
The issue is that the final executable ends up in a subfolder called bin, and I can't seem to discover how to tell Xcode that that is the final executable. All of the resources I've found talk about adding a custom executable to the target from the project menu, but that menu no longer exists. Searching project help doesn't seem to point to any setting for the executable produced by an external build process. The closest build setting I could find was PROJECT_NAME, but changing that didn't seem to help.
Thanks.
Found an answer on another site. Edit the info tab in the scheme to identify the binary.

Importing very large C projects in CLion. (200k+ headers)

I want to start using CLion at work instead of Eclipse (Eclipse needs 4h+ to index my project and use 9GB RAM).
As I mentioned in the title the project is very large and has two subprojects. So what I have done was put all projects in the same folder and done an "Import project from source". The CMakeLists.txt is made automatically by CLion and has a size of 44MB.
Now my problem is that CLion does not find any definition of anything in the project. (Need to mention that the project use a private toolchain).
Can anyone help me set the CLion environment?
Seems that you need at least one standard toolchain to extract the compiler options from CMake project. It can be a fake target, but it need to exist for right source parsing procedure.

Managing Static Library project as a module like Framework on iOS project in Xcode4

Many people including me trying to make a kind of Static Library framework for iOS to archive some kind of modularity. Framework is best way to do this, but it doesn't provided by Apple, and workarounds don't work well.
https://github.com/kstenerud/iOS-Universal-Framework/tree/master/Fake%20Framework/Templates
Fake framework cannot be referenced from linking tab in Build Phases.
Real framework needs modification of system setting. And still not work smoothly on every parts.
Problem is static library need header files, and it's impossible to reference header files on project at another location on different project without some script. And script breaks IDE's file management abstraction.
How can I use static library project like a convenient module manner? (just dragging project into another project to complete embedding)
I've since updated the template to do away with the script target. It now builds the universal framework from your regular target, so you can include it in workspaces or as a project dependency.
With a real framework target, you can just add it to "Link Binary With Libraries", and it will show up fine.
With a fake framework, Xcode doesn't recognize the target type, so you need to add the link command manually. For example, assuming your framework is called Foo:
Expand the "Products" group of your framework project, then drag "Foo.framework" into the "Link Binary With Libraries" build phase of your app target.
In your app target, edit "Other Linker Flags" in the build settings and add: "-framework Foo"
Framework template link for anyone not sure what we're talking about: https://github.com/kstenerud/iOS-Universal-Framework
Solution.
Goto Project or Target's Build Settings.
Find Public Headers Folder Path. (definition name = PUBLIC_HEADERS_FOLDER_PATH)
Set it as YourLibrary.framework/Headers. I have used ${PRODUCT_NAME}.framework/Headers for automatic syncing with project name.
Goto Build Phases and find Copy Headers step.
Move all required headers to Public pane.
Now all header files will be formed like Framework and copied with product binary. IDE will copy all of them as a unit into some temporary folder like app's build folder. So referencing app project can use the headers automatically.
This is a trick. The created directory structure is not real framework. Because it doesn't contain any binary. However we don't need real framework to archive just this functionality. IDE works with frameworks without any binary. And I don't want to hack IDE without documentation about internal structure.
This works well, however you'll experience some problem when you Archive. This happens because Xcode4 behaves specially when Archiving. Here's workaround.
For each embedded library project, SKIP_INSTALL = YES in target build settings.
For final product project, FRAMEWORK_SEARCH_PATHS = "${OBJROOT}/UninstalledProducts". Take care about this setting should be set only for Release build mode.
Now it'll be archived well.
At the case of cross platform library, there can be many projects for many platforms. But sometime Xcode will show some product as red color even it compiled successfully.
This is a bug of Xcode. IDE display depends SDKROOT of Project build setting. So if you set the SDKROOT differently on Target, it won't work. You can check the the product will become black color after changing the SDKROOT of the Project build setting. See this Open Radar entry for details.
http://openradar.appspot.com/9636211
If you wish to fix this bug, please report this to Apple's Radar. Duplicated bugs will make attention of Apple. Just copy & paste my report :)
I found this : http://db-in.com/blog/2011/05/creating-universal-framework-to-iphone-ios/
It seems to work.

creating an XCode project with existing code

I'm in the process of porting a Linux application to Mac. I have different files with the source code that can get compiled and linked using the standard Makefile.
I'm going to be porting that code to Mac and continue writing code in C (sorry, no obj-c). Is there a way to create a project on XCode, add the existing code so I can use XCode and the IDE, compile and debug the code and generate Mac Makefiles?
Thanks for the help
New Project -> Other -> External Build System
(in new project)
Expand "Targets"
select the target the template created
press return
edit the target settings:
by default, it uses /usr/bin/make for invocation. if you want to use some other build system, then you'll have more to configure.
for a Makefile, you will need to set the 'Directory' field of the build settings window to the directory which contains the appropriate makefile to build.
note that you'll lose some integration when using a makefile.
you can regain some of that by adding the sources to the project (drag and drop), and not associating them with a target.
to improve navigation and code completion, you may want to create a second (dummy) target (such as a static library) so the ide parses your programs. you would then add the sources to the dummy static library, and set the makefile as a 'dependency' of the static library (so it gets built, and so it gets built first).
The Apple Developer docs have a section on porting makefile based projects into XCode.
"Porting UNIX/Linux Applications to OS X"
This subsection is most relevant: "Building makefile projects with XCode"
https://developer.apple.com/library/content/documentation/Porting/Conceptual/PortingUnix/preparing/preparing.html#//apple_ref/doc/uid/TP40002849-BBCJABGC
You can build using your existing makefiles and create a wrapper project with a custom target with a 'Run Script' build phase that just calls down to your makefile. This means that you'll also be able to use the debugger, but you probably won't get the full benefit of the editor with autocompletion etc.
To import C code into Xcode:
start xcode
new project
pick something like Standard Tool. Should read c command line tool.
drag you file or files onto main project window. This is the first window that comes up when you create a new project. My project name is xaBitHoist. I dropped the files on xaBitHoist > src.
just build. Seems to default to main.c
to change start program or add argues Project > New Project Executable.
the online help for xcode is good.
Good luck.
Robert

Why compile button is disabled in VisualStudio?

For some reason when I open my project Compile button is disabled. I'm in C++ file and Ctrl+F7 doesn't work, Menu/Build/Compile is disabled and Compile in context menu in SolutionExplorer is disabled too. I can build project with F7, but I can't compile single file. It used to work just fine.
Any ideas why?
Had the same problem just because my project wasn't set as startup Project in my solution. Setting it solve the issue.
It seems that problem is on my side: someone in my team introduced some build scripts, which apparently work only for building whole project.
It might also be that a referenced property sheet could not be found. You can check this by attempting to view the properties of the project (Alt-Enter). A warning will be shown then when the property sheet cannot be found. Fix the property sheet reference, and probably you can compile again.
Note: question was asked/answered a while ago, but maybe it is useful for other persons.
My project was using an intermediate version of a unity build (sometimes called blob build) where groups of ~10 cpp files are put in the same compilation unit by being included in some blob_xxx.cpp. The project only considers the blob_xxx.cpp as source files, so technically the .cpp I was working on was not a source file for the project, so the Compile command was disabled (this is similar to what Paulius experienced).
In this case, you need to either select the blob_xxx.cpp file and Compile this single file, or switch to a non-blob build.
If your objective is to quickly test for compilation errors, you can comment out the includes for all the files you are not working on.
Alternatively, you may setup your project generation script to isolate the files you are working on in a separate blob (it's up to you to define what "working on" means; it may be a manual list or the list of cpp files that are checked out in Perforce if using it).

Resources