Skip to content
Snippets Groups Projects
Forked from Game Development / Game Library
125 commits behind the upstream repository.
CMakeLists.txt 1.70 KiB
# bullet integration support
find_package( Bullet CONFIG )
if ( NOT Bullet_FOUND )
    message(WARNING "Bullet not found - disabling bullet physics integration")
else()
    message( STATUS "Bullet is poorly packaged, you might need to disable support for it" )

    add_library(fgglbt STATIC)

    if ( MSVC )
        # see https://github.com/microsoft/vcpkg/issues/7877
        target_link_libraries(fgglbt PUBLIC LinearMath Bullet3Common BulletDynamics BulletSoftBody BulletCollision BulletInverseDynamics)
    else()
        # FIXME: this shouldn't be necessary, for modern cmake, linking the libraries should be enough
        target_compile_definitions(fgglbt PUBLIC ${BULLET_DEFINITIONS})

        if ( BULLET_INCLUDE_DIRS STREQUAL "include/bullet" )
            message( STATUS "Bullet include path is relative - hard-coding" )
            # FIXME possible debian packing bug: path is relative in BulletConfig.cmake
            # FIXME debian packaging bug: BulletConfig.cmake lists BulletInverseDynamics, but that's packaged in bullet-extras
            target_include_directories(fgglbt PUBLIC ${BULLET_ROOT_DIR}/${BULLET_INCLUDE_DIRS})
        else()
            target_include_directories(fgglbt PUBLIC ${BULLET_INCLUDE_DIRS})
        endif()
        target_link_libraries(fgglbt PUBLIC ${BULLET_LIBRARIES})
    endif()

    target_link_libraries( fgglbt PUBLIC fggl )
    target_include_directories( fgglbt
        PUBLIC
            $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
            $<INSTALL_INTERFACE:include>
    )

    # bullet cpp files
    target_sources( fgglbt
        PRIVATE
            src/module.cpp
            src/simulation.cpp
            src/phys_draw.cpp
            src/service.cpp
    )
endif()