Go to file
Sylvain PILLOT 843ed3a3f2 update README.md 2023-12-10 13:10:50 +01:00
cmake initial commit 2023-12-10 13:08:21 +01:00
include/box2d initial commit 2023-12-10 13:08:21 +01:00
src initial commit 2023-12-10 13:08:21 +01:00
.gitignore initial commit 2023-12-10 13:08:21 +01:00
CMakeLists.txt initial commit 2023-12-10 13:08:21 +01:00
README.md update README.md 2023-12-10 13:10:50 +01:00
giteapc.make initial commit 2023-12-10 13:08:21 +01:00

README.md

Box2D rigid body physics simulation libraty sources for Casio Graph 90+E and Prizm CG10/20

Need to have a fully working gcc toolchain for SH3/SH4 architecture.

You can use the giteapc install Slyvtt/cBox2D command to get an automatic install

Using in a program

With CMake

find_package(cBox2D 2.4.1 REQUIRED)
target_link_libraries(<TARGET> PRIVATE cBox2D::cBox2D)

With make, the following steps are not automatically done, so please proceed with the following manipulations :

  • copy the library libcBox2D.a into your SH3/SH4 compiler lib folder
  • copy all header files *.h in the include folder include/box2d of the SH3/SH4 compiler
  • link with -lcBox2D

In the C/C++ sources #include <box2d/box2d.h>

Typical CMakeLists.txt

Below is the typical minimum CMakeLists.txt file to be used for a fxSDK project aiming at using the cBox2D library :

cmake_minimum_required(VERSION 3.15)
project(MyAddin)


project(cBox2DApp VERSION 2.4.1 LANGUAGES CXX)

#needed to get the find_package working well
list(APPEND CMAKE_MODULE_PATH "$ENV{HOME}/.local/lib/cmake")
if(DEFINED "$ENV{FXSDK_PATH}")
  list(APPEND CMAKE_MODULE_PATH "$ENV{FXSDK_PATH}/lib/cmake")
endif()

include(GenerateG3A)
include(Fxconv)

find_package(Gint 2.9.0 REQUIRED)
find_package(LibProf 2.4 REQUIRED)
find_package(cBox2D 2.4.1 REQUIRED)


set(SOURCES
  src/main.cpp
  src/primitives.cpp
  src/extrakeyboard.cpp
  # ...
)

# Shared assets, fx-9860G-only assets and fx-CG-50-only assets
set(ASSETS
  # ...
)

set(ASSETS_cg
  # ...
)

fxconv_declare_assets(${ASSETS} ${ASSETS_cg} WITH_METADATA)


add_executable(myaddin ${SOURCES} ${ASSETS} ${ASSETS_${FXSDK_PLATFORM}})
target_compile_options(myaddin PRIVATE -Wall -Wextra -Os -std=c++20)
target_link_options(myaddin PRIVATE -Wl,-Map=Build_Addin.map -Wl,--print-memory-usage -fno-use-cxa-atexit -fpermissive)
target_link_libraries(myaddin LibProf::LibProf Gint::Gint -lstdc++ cBox2D::cBox2D)


if("${FXSDK_PLATFORM_LONG}" STREQUAL fxCG50)
  generate_g3a(TARGET myaddin OUTPUT "Box2DApp.g3a"
    NAME "Box2D App" ICONS assets-cg/icon-uns.png assets-cg/icon-sel.png)
endif()