openframeworks / openframeworks/projectGenerator

Revisiting absolute path in macOS and Xcode. Fs and machine agnostic project generation.

Open
#174 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CSS
Stars
90
Forks
79
Avg merge
2d 9h
Merged PRs (30d)
5

Description

Hi,

macOS, Xcode

Through years I have avoided projectGenerator both as it did not handle absolute paths as well as everybody has (don't we 😄 ) clean project templates ready. Revisited it yesterday (used projectGenerator of_v0.9.8_osx_release against current oF master branch) to see how it handles absolute paths. It still generates relative paths in some places, but is easily find-replace correctable now.

To correct it:

  • Let us assume situation where absolute OF_PATH is /symlinks/oF/openFrameworks. In my case it is actually symlink to /abs/path/to/openFrameworks (this is the way I manage working on same project on different machines (project is synced via cloud services), all machines have same symlinks, although /abs/path/to/openFrameworks differ among them).
  • In projectGenerator settings openFrameworks path is set to /symlinks/oF/openFrameworks before generating project (or real absolute path)
  • Project mySketch is generated wherever on filesystem.
  • After project mySketch is generated following changes (change relative paths to absolute) have to be made manually so that mySketch can be freely moved across file system (or in my case across machines). 4 changes across 2 files for project with no addons.

mySketch/Project.xconfig

// ...
OF_PATH = /symlinks/oF/openFrameworks
// ...
#include " /symlinks/oF/openFrameworks/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig"
// ...

mySketch/mySketch.xcodeproj/project.pbxproj

// ...
<string>/symlinks/oF/openFrameworks/libs/openFrameworksCompiled/project/osx/openFrameworksLib.xcodeproj</string>
// ...
<string>/symlinks/oF/openFrameworks/libs/openFrameworksCompiled/project/osx/CoreOF.xcconfig</string>
// ...

mySketch/mySketch.xcodeproj/project.pbxproj
When addons are chosen to be included in the project they also get relative paths in mySketch/mySketch.xcodeproj/project.pbxproj for links to sources (code and header files) as well as OTHER_LDFLAGS and HEADER_SEARCH_PATHS. For example <string>../../../../symlinks/oF/openFrameworks/addons/ofxGui/src</string>. (Checkbox to enable copying addons to mySketch/addons and link against them, not linking against global oF addons dir, is yet another topic).

(mySketch/config.make and mySketch/makefile also have relative paths there, but it is not applicable to Xcode).

I quickly looked at projectGenerator source, but it is not so easy to follow.
Maybe somebody currently working in it (@arturoc seems active lately 😄 ) can point where to look
https://github.com/openframeworks/projectGenerator/blob/master/ofxProjectGenerator/src/projects/xcodeProject.cpp#L378 ?
https://github.com/openframeworks/projectGenerator/blob/master/frontend/index.js#L113 ?
/ or solve it in the 2 files (mySketch/Project.xconfig and mySketch/mySketch.xcodeproj/project.pbxproj) mentioned ? Note that I am using v0.9.8 which is the suggested way.

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ofxProjectGenerator/src/projects/xcodeProject.cpp around line 378 and frontend/index.js around line 113, then inspect how Project.xconfig and mySketch.xcodeproj/project.pbxproj are generated. Reproduce a project using an absolute openFrameworks path, including addons, and trace the relative path generation. Done means generated Xcode projects use absolute paths consistently for the framework, configuration, addon sources, linker flags, and header search paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, macos
Domain
build-system, desktop, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.