How to build NodeJS in XCode IDE? - xcode

How can I build NodeJS within the XCode IDE as a project? NodeJS build instructions say that it should be built with:
./configure
make
make install
However I wish to build within the XCode IDE.
What I really want to do is embed NodeJS within my application, so I think if I can build NodeJS within XCode then I can just adjust it to add my application once I have NodeJS building and running.
I made some progress I think by getting V8 to compile in XCode, now I am trying to add NodeJS to the V8 project.

Run ./configure --xcode in node repository root and you will get node.xcodeproj file you want.

As of this commit in Node.js - https://github.com/nodejs/node/pull/20328 one must do -
./configure -- -f xcode

Related

Electron: Sharing the same project folder between macOS and Windows

Goal
I've read many Electron tutorials about app bootstrapping and build pipeline and had assumed that you could have a single project to handle a cross-platform action.
But after numerous failures in the packaging and build process, I finally realized that maybe my assumption is wrong.
Problem
Here is my desired workflow based on electron-forge:
1. Create app skeleton on Windows
yarn create electron-app my-app
cd my-app
yarn add my-dependency
yarn start
yarn make
This all went well. Now onto macOS
2. Transfer project to macOS for a ride
On macOS, running the app will lead to an error
cd my-app
yarn start
The error looks like this
$ yarn start
yarn run v1.22.4
$ electron-forge start
✔ Checking your system
✔ Locating Application
✔ Preparing native dependencies: 1 / 1
✔ Launching Application
/path/to/my-app/node_modules/electron/dist/electron.exe: /path/to/my-app/node_modules/electron/dist/electron.exe: cannot execute binary file
error Command failed with exit code 126.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
So I blindly reinstall electron on macOS
yarn add electron
yarn start
yarn make
Things work fine on macOS.
Now back to Windows.
3. Travel back to Windows to double-check
This time. I got the similar problem as in Step #2. The Windows distribution now has the wrong Electron binary.
Findings
I found this file constantly getting overwritten even if I merge carefully when transferring project files between Windows and macOS.
my-app/node_modules/electron/path.txt
It contains a hardcoded path to Electron executable:
macOS
Electron.app/Contents/MacOS/Electron
Windows:
electron.exe
Workarounds
I could add pre-build steps against this by copying predefined metadata to the project folder depending on the current platform. But a hack like this sounds lame for a framework like Electron.
Question
So to me this metadata arrangement makes it difficult to share the same project between Windows and macOS. I can't imagine Electron developers working like this.
So What am I missing?
Basically, you shouldn't commit node_modules at all. Some post installation scripts may compile packages for a specific OS and the folder is usually huge.
Also, you shouldn't commit any result of a build, package or compile command. Typically, dist folders should be ignored.
Your repository should only contains code and configuration files.
The idea is that it makes no sense to commit these files and folders as you have all the required steps in order to reproduce the result on any machine: your windows computer, your macOS computer, your CI environment, etc. For example (these are pseudo-commands):
npm i or npm ci
npm run build
electron package
etc
So you should add all these folders to you .gitignore file:
# compiled output
/dist
/tmp
/out-tsc
/packages
# dependencies
/node_modules

How to build .px4

i want to build .px4 file
so i trying build with Qt Creator in ubuntu 14
but did not work
how to fix this problem...
If you have cloned into the native git px4 repo (https://github.com/PX4/Firmware) I would suggest you to go for a suitable tagged release branch (other than beta-unless you think of developing the firmware) depending on your board version instead of master as it is most probably tbd..
Open the terminal, manual build is mostly recommended. cd to go to your cloned/source directory of px4 firmware with:
cd <fmu_source_directory>/
and just use
make build px4fmu-v**x**_default upload
(x can be any version you like to build for your board [1-4])
this way you would be able to bypass the config errors of qt and easily manually deploy your px4 firmware (assuming that you have a gnu compiler and all other dependencies built and ready to use on your computer)..

How CocoaPods' install command works behind the scene to add files to my Xcode project?

I've started using CocoaPods. I like the way it adds files to my Xcode project but I'm curious about writing my own AppleScript to be able to add files to my Xcode project. How I can do that? Any reference would be appreciated?
The Xcode project file format is tough. There are 2 tools that CocoaPods can use to edit them. The Xcodeproj Ruby gem is the first. A lot of other projects such as slather also depend on this gem to deal with the project files. If you have it installed CocoaPods can also use xcproj to add things to your project. This can be installed with Homebrew with
brew install xcproj
It has to be recompiled each time you update Xcode. If you'd like to make a tool that manipulates your project I'd recommend these as your starting point.

Grunt, Cordova & Windows Phone

I am developing an app for multiple platforms using Cordova. Grunt is used as a build tool. I use it to copy my source code to the right folder for each platform so I can develop them independently.
This works fine with Android using the scripts that are provided by Cordova. However, I have no idea if or how it is possible to automate the WP build process. I'm looking for two things:
Add all files in the www directory to the VS project (it does not include files that are not added to the project, which is sad).
Build, install and run the app in the emulator. I used adb & Grunt's exec for Android which was really simple, is there something similar for WP?
If you look in a cordova windows phone project there is a directory called 'cordova' which contains scripts to do all of this.
There should be scripts to build and run your project.
The run script can pretty much do it all. You can call it like :
run --device --release
or
run --emulator --debug
or just
run
A recent commit now makes it possible to use www\** in the .csproj file, which solved my first issue.

How to run Grunt tasks during Xcode build phase?

I am developing a web application, which includes GruntJS build tasks. I deploy it using Phonegap/Cordova in the Xcode IDE.
I would like to integrate the grunt build process into my Xcode project to simplify running the project. Ideally Xcode should run all the processes that I manually invoke using the Grunt CLI beforehand.
My Gruntfile.js lies within the root Xcode project directory. I have a local grunt install (0.4.0rc4) in node_modules and grunt-cli installed globally.
project
- multiple project dirs ...
- node_modules
- www-src
- www
project.xcodeproj
Gruntfile.js
I have tried adding a custom Run script - build phase to my Xcode project with a command as simple as "grunt" which returns "grunt: command not found" during build. Clearly more effort is needed to reference grunt and/or the proper target directory.
Nice setup Gregor :-) I had exact same setup for my previous project. Here is how I setup my custom script in Xcode Build Phases:
cd "${PROJECT_DIR}"
PATH=${PATH}:/usr/local/bin
grunt
Hope this helps you :-)

Resources