Closed kattjevfel closed 2 years ago
You should also open an issue about GLFW while you're at it 😛
Oh, I didn't see that since it wasn't a submodule.
For whatever reason this does not work on arch:
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Box2D (missing: BOX2D_LIBRARY) (Required is at least version
"2.4.0")
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
cmake/FindBox2D.cmake:10 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
cmake/Carnage3D.cmake:25 (find_package)
CMakeLists.txt:8 (include)
-- Configuring incomplete, errors occurred!
See also "/home/katt/build/carnage3d/build/CMakeFiles/CMakeOutput.log".
And yet here it is:
katt@main build/carnage3d (master) » pacman -Qlq box2d 1 ↵
/usr/
/usr/include/
/usr/include/box2d/
/usr/include/box2d/b2_api.h
/usr/include/box2d/b2_block_allocator.h
/usr/include/box2d/b2_body.h
/usr/include/box2d/b2_broad_phase.h
/usr/include/box2d/b2_chain_shape.h
/usr/include/box2d/b2_circle_shape.h
/usr/include/box2d/b2_collision.h
/usr/include/box2d/b2_common.h
/usr/include/box2d/b2_contact.h
/usr/include/box2d/b2_contact_manager.h
/usr/include/box2d/b2_distance.h
/usr/include/box2d/b2_distance_joint.h
/usr/include/box2d/b2_draw.h
/usr/include/box2d/b2_dynamic_tree.h
/usr/include/box2d/b2_edge_shape.h
/usr/include/box2d/b2_fixture.h
/usr/include/box2d/b2_friction_joint.h
/usr/include/box2d/b2_gear_joint.h
/usr/include/box2d/b2_growable_stack.h
/usr/include/box2d/b2_joint.h
/usr/include/box2d/b2_math.h
/usr/include/box2d/b2_motor_joint.h
/usr/include/box2d/b2_mouse_joint.h
/usr/include/box2d/b2_polygon_shape.h
/usr/include/box2d/b2_prismatic_joint.h
/usr/include/box2d/b2_pulley_joint.h
/usr/include/box2d/b2_revolute_joint.h
/usr/include/box2d/b2_rope.h
/usr/include/box2d/b2_settings.h
/usr/include/box2d/b2_shape.h
/usr/include/box2d/b2_stack_allocator.h
/usr/include/box2d/b2_time_of_impact.h
/usr/include/box2d/b2_time_step.h
/usr/include/box2d/b2_timer.h
/usr/include/box2d/b2_types.h
/usr/include/box2d/b2_weld_joint.h
/usr/include/box2d/b2_wheel_joint.h
/usr/include/box2d/b2_world.h
/usr/include/box2d/b2_world_callbacks.h
/usr/include/box2d/box2d.h
/usr/lib/
/usr/lib/cmake/
/usr/lib/cmake/box2d/
/usr/lib/cmake/box2d/box2dConfig-noconfig.cmake
/usr/lib/cmake/box2d/box2dConfig.cmake
/usr/lib/cmake/box2d/box2dConfigVersion.cmake
/usr/lib/libbox2d.so
/usr/lib/libbox2d.so.2
/usr/lib/libbox2d.so.2.4.1
Hey, it looks like arch is missing a static library (libbox2d.a). FindBox2D looks only for that one. The fix is quite simple, just add the dynamic lib (libbox2d.so) in https://github.com/codenamecpp/carnage3d/blob/master/cmake/FindBox2D.cmake#L7.
Would you mind to open a PR after verification?
That seems to have worked, however I cannot test if I am able to run the game just yet, I'll have to do that after work today. After that I'll send a PR (unless you're quicker)
I've built the dynamic lib, linked against it and it seems to work:
$ ldd carnage3d
linux-vdso.so.1 (0x00007ffd80dca000)
libbox2d.so.2 => /home/marmichalski/Projects/github/carnage3d/build/third_party/Box2D/bin/libbox2d.so.2 (0x00007f5de59e2000)
Currently Box2D is pulled in as a submodule (which complicates packaging), but from what I can see there's no reason we couldn't just use Box2D installed system-wide. This would also mean less things to compile since some distros provide it as an official package.