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

Box2D: Support for July 2020 version #90

Closed
wants to merge 2 commits into from
Closed

Conversation

alanjfs
Copy link
Contributor

@alanjfs alanjfs commented Jul 8, 2020

The latest release (as of this writing) of Box2D is from 2014 and uses mixed-case Box2D.h whereas the newer one is all lowercase box2d.h. This change adds support for the newer version, without breaking compatibility with the older one.

Box2D also no longer provides a CMake install() directive, which can be gotten around like this.

From..

# Version 2014
git clone https://github.com/erincatto/box2d --branch v2.3.1
cd box2d
mkdir build && cd build
cmake ..
cmake --build . --target install

To..

# Version 2020
git clone https://github.com/erincatto/box2d
cd box2d
git checkout 1025f9a
mkdir build && cd build
cmake ..
cmake --build .
cp src/box2d.bc <your-prefix>/lib/
cp -R ../include/box2d <your-prefix>/include/box2d

The latest release is from 2014 and uses mixed-case for file/folder names
@mosra mosra added this to the 2020.0b milestone Jul 8, 2020
@mosra mosra added this to TODO in Project management via automation Jul 8, 2020
@mosra
Copy link
Owner

mosra commented Jul 8, 2020

Thanks! Doesn't this need a similar update for the Box2D include? I assume you didn't run into this one because of case-insensitive filesystems, but then I wonder why CMake needed the change.

Something like this could work I think:

/* Latest Box2D release from 2014 uses mixed case, current master (2020) uses
   lowercase */
#ifdef __has_include
#if __has_include(<box2d/box2d.h>)
#include <box2d/box2d.h>
#else
#include <Box2D/Box2D.h>
#endif
/* If the compiler doesn't have __has_include, assume it's extremely old, and 
   thus an extremely old Box2D is more likely as well */
#else
#include <Box2D/Box2D.h>
#endif

@alanjfs
Copy link
Contributor Author

alanjfs commented Jul 8, 2020

You're right! I actually only tested this on my own code (on a Linux-box), but I should have also built the examples.

@mosra
Copy link
Owner

mosra commented Jul 8, 2020

I see, that explains everything :)

@mosra
Copy link
Owner

mosra commented Nov 3, 2020

Merged in 8ed6f5e, together with fixing Yet Another Fun But Unnecessary Breakage in 5eb6fca.

Severe apologies for taking three centuries to merge PRs nowadays.

@mosra mosra closed this Nov 3, 2020
Project management automation moved this from TODO to Done Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants