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

MinGW and MacOS Fixes #25

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jhannemann
Copy link

The demos now compile with CodeBlocks/MinGW using the regular CMake process.

For now, I've omitted OpenMP-dependent executables, but that can easily be fixed using CMake's
FindOpenMP module.

Had to make some minor tweaks because Sleep() would result in unresolved symbols.

Also added compile instructions to set MinGW to C++11 and how to properly enable the M_PI macro.

I've added GLFW3 3.2.1 as an external dependency as that seems to fix a lot of problems on MacOS.

I've also added appropriate gitattributes and gitignore files to ensure proper line ending
conversions.

`glext.h` does not need to be included on MacOS, so it is only included
if the OS is not Apple.

The Cocoa, IOkit, CoreFoundation, and CoreVideo frameworks are needed
in order to compile and link glfw3. This has been added to the
`CMakeLists.txt` file if configuring on Apple.
The code and CMake setup for GLFW 3.2 has big improvements over 3.0,
so it is added as an additional external dependency.
MinGW does not come with OpenMP, so those examples are commented out
for the time being.

When using MinGW, the `Sleep()` function results in an unresolved
symbol when linking. These function calls are skipped when the
`__MINGW32__` symbol is defined.

Add instructions how to properly request C++11 and use of the
`M_PI` macro when using MinGW.
`sin()` by default operates on double in C. The original code casts the
result to `float`. This is slow and loses precision unnecessarily.

Rather than use `sinf()`, since the code is C++, it is better to cast
`currentTime` to `float` (using a `static_cast`) once and then use
std::sin(), which is overloaded for `float`.
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 this pull request may close these issues.

1 participant