mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-24 11:39:46 -05:00
gnu: Add FXDiv.
* gnu/packages/maths.scm (fxdiv): New variable. * gnu/packages/patches/fxdiv-system-libraries.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it.
This commit is contained in:
parent
ffb381856d
commit
a9bc8a25eb
3 changed files with 76 additions and 0 deletions
|
@ -1032,6 +1032,7 @@ dist_patch_DATA = \
|
|||
%D%/packages/patches/freedink-engine-fix-sdl-hints.patch \
|
||||
%D%/packages/patches/freeimage-unbundle.patch \
|
||||
%D%/packages/patches/fuse-overlapping-headers.patch \
|
||||
%D%/packages/patches/fxdiv-system-libraries.patch \
|
||||
%D%/packages/patches/gajim-honour-GAJIM_PLUGIN_PATH.patch \
|
||||
%D%/packages/patches/ganeti-deterministic-manual.patch \
|
||||
%D%/packages/patches/ganeti-disable-version-symlinks.patch \
|
||||
|
|
|
@ -127,6 +127,7 @@ (define-module (gnu packages maths)
|
|||
#:use-module (gnu packages netpbm)
|
||||
#:use-module (gnu packages ocaml)
|
||||
#:use-module (gnu packages onc-rpc)
|
||||
#:use-module (gnu packages parallel)
|
||||
#:use-module (gnu packages pcre)
|
||||
#:use-module (gnu packages popt)
|
||||
#:use-module (gnu packages perl)
|
||||
|
@ -6657,3 +6658,33 @@ (define-public blitz
|
|||
(license (list license:artistic2.0
|
||||
license:bsd-3
|
||||
license:lgpl3+))))
|
||||
|
||||
(define-public fxdiv
|
||||
;; There is currently no tag in this repo.
|
||||
(let ((commit "63058eff77e11aa15bf531df5dd34395ec3017c8")
|
||||
(version "0.0")
|
||||
(revision "1"))
|
||||
(package
|
||||
(name "fxdiv")
|
||||
(version (git-version version revision commit))
|
||||
(home-page "https://github.com/Maratyszcza/FXdiv")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference (url home-page) (commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0zwzh8gmbx4m6b18s5nf13b0dk5yjkd1fs8f421bl7fz5f9gjd9f"))
|
||||
(patches (search-patches "fxdiv-system-libraries.patch"))))
|
||||
(build-system cmake-build-system)
|
||||
(inputs
|
||||
`(("googletest" ,googletest)
|
||||
("googlebenchmark" ,googlebenchmark)))
|
||||
(synopsis
|
||||
"C++ library for division via fixed-point multiplication by inverse")
|
||||
(description
|
||||
"On modern CPUs and GPUs, integer division is several times slower than
|
||||
multiplication. FXdiv implements an algorithm to replace an integer division
|
||||
with a multiplication and two shifts. This algorithm improves performance
|
||||
when an application performs repeated divisions by the same divisor.")
|
||||
(license license:expat))))
|
||||
|
|
44
gnu/packages/patches/fxdiv-system-libraries.patch
Normal file
44
gnu/packages/patches/fxdiv-system-libraries.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
This patch allows the build process to use the provided dependencies instead
|
||||
of adding their source as CMake sub-directories (in which case "make install"
|
||||
would install googletest's and googlebenchmark's libraries and headers).
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index bcae6b5..ff6710d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -21,7 +21,7 @@ IF(FXDIV_BUILD_TESTS)
|
||||
ENDIF()
|
||||
|
||||
# ---[ Download deps
|
||||
-IF(FXDIV_BUILD_TESTS AND NOT DEFINED GOOGLETEST_SOURCE_DIR)
|
||||
+IF(FALSE)
|
||||
MESSAGE(STATUS "Downloading Google Test to ${CMAKE_BINARY_DIR}/googletest-source (define GOOGLETEST_SOURCE_DIR to avoid it)")
|
||||
CONFIGURE_FILE(cmake/DownloadGoogleTest.cmake "${CMAKE_BINARY_DIR}/googletest-download/CMakeLists.txt")
|
||||
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
@@ -31,7 +31,7 @@ IF(FXDIV_BUILD_TESTS AND NOT DEFINED GOOGLETEST_SOURCE_DIR)
|
||||
SET(GOOGLETEST_SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-source" CACHE STRING "Google Test source directory")
|
||||
ENDIF()
|
||||
|
||||
-IF(FXDIV_BUILD_BENCHMARKS AND NOT DEFINED GOOGLEBENCHMARK_SOURCE_DIR)
|
||||
+IF(FALSE)
|
||||
MESSAGE(STATUS "Downloading Google Benchmark to ${CMAKE_BINARY_DIR}/googlebenchmark-source (define GOOGLEBENCHMARK_SOURCE_DIR to avoid it)")
|
||||
CONFIGURE_FILE(cmake/DownloadGoogleBenchmark.cmake "${CMAKE_BINARY_DIR}/googlebenchmark-download/CMakeLists.txt")
|
||||
EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
@@ -54,7 +54,7 @@ INSTALL(FILES include/fxdiv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
IF(FXDIV_BUILD_TESTS)
|
||||
# ---[ Build google test
|
||||
- IF(NOT TARGET gtest)
|
||||
+ IF(FALSE)
|
||||
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
ADD_SUBDIRECTORY(
|
||||
"${GOOGLETEST_SOURCE_DIR}"
|
||||
@@ -78,7 +78,7 @@ ENDIF()
|
||||
|
||||
IF(FXDIV_BUILD_BENCHMARKS)
|
||||
# ---[ Build google benchmark
|
||||
- IF(NOT TARGET benchmark)
|
||||
+ IF(FALSE)
|
||||
SET(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
|
||||
ADD_SUBDIRECTORY(
|
||||
"${GOOGLEBENCHMARK_SOURCE_DIR}"
|
Loading…
Reference in a new issue