openframeworks / openframeworks/openFrameworks

Proposal: Different #define handling in ofMain.h

Open
#6,948 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

What I'm proposing here is having certain defines to see if some functionality is included or not, which can be based on platform as it is now, but can be used independent of platform too.
#undef is very useful here because we can make the exceptions independent of the previously set #defines.

I mean previously set because we can make this defines in the project itself using GCC preprocessor (tested here and working)
and it can be easily set per project.

Ideas? suggestions?

#define OF_LIB_USE_THREAD
#define OF_LIB_USE_CAIRO
#define OF_LIB_USE_SERIAL
#define OF_LIB_USE_SOUND

#ifdef TARGET_NO_SOUND
	#undef OF_LIB_USE_SOUND
#endif

#if defined(TARGET_EMSCRIPTEN)
	#undef OF_LIB_USE_THREAD
#endif 

#if defined( TARGET_OF_IOS ) | defined(TARGET_ANDROID) | defined(TARGET_EMSCRIPTEN)
	#undef OF_LIB_USE_SERIAL
	#undef OF_LIB_USE_CAIRO
#endif

Contributor guide

Open the contributing guide

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 by reviewing the existing platform-dependent defines in ofMain.h and compare them with the proposed OF_LIB_USE_* and TARGET_* conditions. Determine the intended independent configuration and platform exceptions before making changes; done requires an agreed behavior for enabling or excluding each listed functionality across the mentioned platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.