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

Allow platform-dependence in targets? #68

Closed
GPMueller opened this issue Sep 24, 2018 · 2 comments
Closed

Allow platform-dependence in targets? #68

GPMueller opened this issue Sep 24, 2018 · 2 comments
Labels
discussion Something that might end up being labled enhancement or wontfix enhancement New feature or request

Comments

@GPMueller
Copy link
Contributor

This would allow a lot of abstraction layers, such as GLFW, where the platform-dependence cannot be avoided, to be built quite naturally with clang-build. The goal should again be that the easiest solution is to have no platform-dependence, but to allow it if actually necessary.
Aside from abstraction layers, one sometimes has to apply platform-specific linkage, e.g. to the pthreads library on unix systems.

The following would allow it to be composable and non-intrusive:

[mytarget]
target_type = "shared library"

sources = ["src/common.cpp"]
[mytarget.flags]
compile = ["-DSOMETHING"]

[mytarget.osx]
sources = ["src/osx/platform_specific.cpp"]
[mytarget.osx.flags]
link = ['-lpthread']

[mytarget.linux]
sources = ["src/linux/platform_specific.cpp"]
[mytarget.linux.flags]
link = ['-lpthread']

[mytarget.windows]
sources = ["src/windows/platform_specific.cpp"]

The corresponding osx, linux and windows subdicts would be merged into the main one if the corresponding platform is detected. This of course only makes sense for lists, i.e. include_directories, sources and flags (what about dependencies?).

@GPMueller GPMueller added enhancement New feature or request discussion Something that might end up being labled enhancement or wontfix labels Sep 24, 2018
@GPMueller
Copy link
Contributor Author

Added platform-dependent flags with 3e75731 on branch feature-improved-config. The approach there should be rewritten to take mytarget.osx.flags instead of mytarget.flags.osx, what I wrote above seems more general and therefore better.

@GPMueller
Copy link
Contributor Author

Implemented correctly with 2d54e0a on feature-improved-config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Something that might end up being labled enhancement or wontfix enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant