Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update custom icon path info in Project.xcconfig #430

Closed
danomatika opened this issue Oct 30, 2023 · 10 comments · Fixed by #431
Closed

update custom icon path info in Project.xcconfig #430

danomatika opened this issue Oct 30, 2023 · 10 comments · Fixed by #431

Comments

@danomatika
Copy link
Contributor

The info on setting a custom icon path is out of date in Project.xcconfig: https://github.com/openframeworks/projectGenerator/blob/master/commandLine/Project.xcconfig#L29

I believe it should be:

//IF YOU WANT AN APP TO HAVE A CUSTOM ICON - PUT THEM IN YOUR DATA FOLDER AND CHANGE ICON_FILE_PATH to:
//ICON_FILE = bin/data/$(ICON_NAME)

This works fine on a project that used to set a custom icon using the original ICON_FILE_PATH variable.

@dimitre
Copy link
Member

dimitre commented Oct 30, 2023

Maybe we should remove ICON_FILE_PATH variable entirely?

@dimitre
Copy link
Member

dimitre commented Oct 30, 2023

You can create a file named App.xcconfig, it is an optional include, so settings like icon survive projectGenerator rewrites.
it is useful for app version / icon and other configurations

//CLANG_CXX_LANGUAGE_STANDARD = c++20
//MACOSX_DEPLOYMENT_TARGET = 12.0

PRODUCT_BUNDLE_IDENTIFIER = org.dmtr.xp
VERSION = 0.0.7

ICON_NAME = xp.icns
ICON_FILE = $(ICON_NAME)

CODE_SIGN_IDENTITY = -;
CODE_SIGN_STYLE = Automatic;

//OF_NO_FMOD = 1
//OF_CORE_LIBS = $(LIB_GLEW) $(LIB_PUGIXML)
//OF_CORE_HEADERS = $(HEADER_OF) $(HEADER_GLEW) $(HEADER_TESS2) $(HEADER_GLFW) $(HEADER_UTF8) $(HEADER_JSON) $(HEADER_GLM) $(HEADER_PUGIXML)
//OF_CORE_FRAMEWORKS = -framework Accelerate -framework Cocoa -framework CoreFoundation -framework CoreServices -framework CoreVideo -framework IOKit -framework OpenGL -framework QuartzCore -framework Security

@danomatika
Copy link
Contributor Author

Yes, I do this now, however my point is that the reference in the comment is wrong and ICON_FILE_PATH does not appear to be used anymore, so this note should be updated.

@dimitre
Copy link
Member

dimitre commented Oct 30, 2023

Agreed! lets remove it. I was just confused because ICON_FILE_PATH is mentioned in your suggestion

@danomatika
Copy link
Contributor Author

danomatika commented Oct 30, 2023

Also, this is important since the change to oF 0.12 broke the icon on projects I originally set up with the oF 0.10-0.11 ICON_FILE_PATH. I think people should at least get a hint on how to fix it...

@dimitre
Copy link
Member

dimitre commented Oct 30, 2023

how about this?

//IF YOU WANT AN APP TO HAVE A CUSTOM ICON EDIT ICON_FILE VARIABLE:
//ICON_FILE = bin/data/custom.icns

@danomatika
Copy link
Contributor Author

danomatika commented Oct 30, 2023

I think it is also important that the note should match how the default ICON_FILE is set and support both debug and release iconsets:

ICON_FILE = bin/data/$(ICON_NAME)

For instance, in my old Project.xcconfig used with oF 0.11:

//ICONS - NEW IN 0072
ICON_NAME_DEBUG = icon-debug.icns
ICON_NAME_RELEASE = icon.icns
//ICON_FILE_PATH = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/
ICON_FILE_PATH = bin/data/

The equivalent override in App.xcconfig for oF 0.12 is now:

// icon
ICON_NAME = icon.icns
ICON_NAME[config=Debug] = icon-debug.icns
ICON_FILE = bin/data/$(ICON_NAME)

I think a full note about how to transition from the old way to the new way would be helpful, ala:

// to reenable custom icon loading using ICON_FILE_PATH as used in oF 0.7.2 - 0.11:
// ICON_NAME = icon.icns
// ICON_NAME[config=Debug] = icon-debug.icns
// ICON_FILE = bin/data/$(ICON_NAME)
// if you use a custom openFrameworks.plist, set CFBundleIconFile to ICON_FILE

@danomatika
Copy link
Contributor Author

danomatika commented Oct 30, 2023

That whole section in Project.xcconfig could be overhauled a bit. For example:

// default oF app icon
ICON_NAME = of.icns
ICON_NAME[config=Debug] = of_debug.icns
ICON_FILE = $(OF_PATH)/libs/openFrameworksCompiled/project/osx/$(ICON_NAME)

// custom app icon
//ICON_NAME = MyApp.icns
//ICON_FILE = $(ICON_NAME)

// custom app icon with separate Release and Debug versions placed in bin/data
//ICON_NAME = icon.icns
//ICON_NAME[config=Debug] = icon-debug.icns
//ICON_FILE = bin/data/$(ICON_NAME)

// note: oF 0.7.2 - 0.11 used ICON_FILE_PATH which is no longer used in oF 0.12+
// ex. change ICON_FILE_PATH = bin/data/ -> ICON_FILE = bin/data/$(ICON_NAME)
// if you use a custom openFrameworks.plist, set CFBundleIconFile to ICON_FILE

@dimitre
Copy link
Member

dimitre commented Oct 30, 2023

Great! +1 for this change. it is much better without all caps.
@ofTheo any opinion on this?

@ofTheo
Copy link
Member

ofTheo commented Oct 30, 2023

@dimitre @danomatika - this all looks great!
Happy for these changes as long as CI still passes :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants