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

Define constants for the target platform #28517

Closed
woubuc opened this issue Apr 29, 2019 · 5 comments · Fixed by #28786
Closed

Define constants for the target platform #28517

woubuc opened this issue Apr 29, 2019 · 5 comments · Fixed by #28786

Comments

@woubuc
Copy link

woubuc commented Apr 29, 2019

In C# attributes (e.g. [DllImport]), you can only use const values, so it's not possible to use the OS singleton to check which platform you're using. So it would be very useful if a platform constant was available in the builds, so we can do something like #if WINDOWS with preprocessor directives.

@exts
Copy link
Contributor

exts commented Apr 29, 2019

If this does get added wouldn't it be useful to be precise on OS and bit info eg.:

  • OS_WINDOWS (either 32/64)
  • OS_WINDOWS_32
  • OS_WINDOWS_64
  • OS_LINUX
  • OS_LINUX_32
  • OS_LINUX_64
  • OS_MAC
  • OS_MAC_32
  • OS_MAC_64
  • OS_ANDROID
  • OS_IOS
  • OS_UWP

@Calinou
Copy link
Member

Calinou commented Apr 29, 2019

@exts 32-bit macOS isn't supported anymore, so OS_OSX would be enough 🙂 (the platform is called OSX in the engine code).

@aaronfranke
Copy link
Member

aaronfranke commented Apr 30, 2019

This should also apply to REAL_T_IS_DOUBLE (if it's not already being passed).

Mac should probably be changed to OS_MAC since it's just called "macOS" now. But OS_MAC_64 is still relevant because there might be non-x64 Macs one day (ARM? 128-bit?).

Also, OS_UWP should probably exist too.

@ShyRed
Copy link
Contributor

ShyRed commented May 8, 2019

Maybe we could use the existing OS names? This way we would not have to maintain separate lists of OS names and new OS targets get added in automatically.

Something like "OS_" + uppercase(OS::get_singleton()->get_name()) + "_" + Bits maybe?

The OS singleton does not provide the number for Bits, it seems. Might want to add that in, too...

@ShyRed
Copy link
Contributor

ShyRed commented May 8, 2019

Not to forget a general "GODOT" define like suggested in #27227

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

Successfully merging a pull request may close this issue.

6 participants