math/libfixmath: New port: Cross-platform fixed point math library

This commit is contained in:
Yuri Victorovich 2022-11-06 23:05:49 -08:00
parent 9b44be3b71
commit 683f6ce2cb
7 changed files with 81 additions and 0 deletions

View file

@ -433,6 +433,7 @@
SUBDIR += libbraiding
SUBDIR += libccd
SUBDIR += libdivide
SUBDIR += libfixmath
SUBDIR += libflame
SUBDIR += libhomfly
SUBDIR += libmesh

27
math/libfixmath/Makefile Normal file
View file

@ -0,0 +1,27 @@
PORTNAME= libfixmath
PORTVERSION= g20220915
CATEGORIES= math
MAINTAINER= yuri@FreeBSD.org
COMMENT= Cross-platform fixed point math library
WWW= https://github.com/PetteriAimonen/libfixmath
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= cmake:testing compiler:c++11-lang
USE_GITHUB= yes
GH_ACCOUNT= PetteriAimonen
GH_TAGNAME= 1416c99
CMAKE_ON= BUILD_SHARED_LIBS
do-install:
# headers
${MKDIR} ${STAGEDIR}${PREFIX}/include/${PORTNAME}
${INSTALL_DATA} ${WRKSRC}/libfixmath/*.h* ${STAGEDIR}${PREFIX}/include/${PORTNAME}
# library
${INSTALL_LIB} ${BUILD_WRKSRC}/libfixmath.so ${STAGEDIR}${PREFIX}/lib
.include <bsd.port.mk>

3
math/libfixmath/distinfo Normal file
View file

@ -0,0 +1,3 @@
TIMESTAMP = 1667802450
SHA256 (PetteriAimonen-libfixmath-g20220915-1416c99_GH0.tar.gz) = 3e9ee9cb4c6aa06763c5be01ae24486ebc888fd51f8412f33424154e78c6eca3
SIZE (PetteriAimonen-libfixmath-g20220915-1416c99_GH0.tar.gz) = 267430

View file

@ -0,0 +1,28 @@
--- CMakeLists.txt.orig 2022-09-15 10:24:31 UTC
+++ CMakeLists.txt
@@ -11,17 +11,23 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Werror=return-type")
include(libfixmath/libfixmath.cmake)
+if (BUILD_TESTING)
include(tests/tests.cmake)
+endif()
file(GLOB fixsingen-srcs fixsingen/*.c)
+if (BUILD_TESTING)
file(GLOB fixtest-srcs fixtest/*.c fixtest/*.h)
+endif()
+if (BUILD_TESTING)
add_executable(fixtest ${fixtest-srcs})
-target_link_libraries(fixtest PRIVATE libfixmath m)
+target_link_libraries(fixtest PRIVATE fixmath m)
target_include_directories(fixtest PRIVATE ${CMAKE_SOURCE_DIR})
+endif()
add_executable(fixsingen ${fixsingen-srcs})
-target_link_libraries(fixsingen PRIVATE libfixmath m)
+target_link_libraries(fixsingen PRIVATE fixmath m)
target_include_directories(fixsingen PRIVATE ${CMAKE_SOURCE_DIR})

View file

@ -0,0 +1,13 @@
--- libfixmath/libfixmath.cmake.orig 2022-09-15 10:24:31 UTC
+++ libfixmath/libfixmath.cmake
@@ -1,6 +1,6 @@
file(GLOB libfixmath-srcs libfixmath/*.c)
-add_library(libfixmath STATIC ${libfixmath-srcs})
+add_library(fixmath ${libfixmath-srcs})
-target_include_directories(libfixmath INTERFACE
- ${CMAKE_CURRENT_SOURCE_DIR})
\ No newline at end of file
+target_include_directories(fixmath INTERFACE
+ ${CMAKE_CURRENT_SOURCE_DIR})

View file

@ -0,0 +1 @@
Libfixmath implements Q16.16 format fixed point operations in C.

View file

@ -0,0 +1,8 @@
include/libfixmath/fix16.h
include/libfixmath/fix16.hpp
include/libfixmath/fix16_trig_sin_lut.h
include/libfixmath/fixmath.h
include/libfixmath/fract32.h
include/libfixmath/int64.h
include/libfixmath/uint32.h
lib/libfixmath.so