增加libccd源代码
This commit is contained in:
parent
8d7d02fb57
commit
09ab26efaa
75
libccd-2.1-ctest.patch
Normal file
75
libccd-2.1-ctest.patch
Normal file
@ -0,0 +1,75 @@
|
||||
diff -up ./CMakeLists.txt.ctest ./CMakeLists.txt
|
||||
--- ./CMakeLists.txt.ctest 2018-12-22 07:13:45.000000000 -0500
|
||||
+++ ./CMakeLists.txt 2020-04-18 14:10:30.394989892 -0400
|
||||
@@ -9,7 +9,7 @@ endif()
|
||||
project(libccd)
|
||||
|
||||
set(CCD_VERSION_MAJOR 2)
|
||||
-set(CCD_VERSION_MINOR 0)
|
||||
+set(CCD_VERSION_MINOR 1)
|
||||
set(CCD_VERSION ${CCD_VERSION_MAJOR}.${CCD_VERSION_MINOR})
|
||||
|
||||
set(CCD_SOVERSION 2)
|
||||
@@ -25,6 +25,8 @@ option(BUILD_SHARED_LIBS "Build libccd a
|
||||
option(ENABLE_DOUBLE_PRECISION
|
||||
"Enable double precision computations instead of single precision" OFF)
|
||||
|
||||
+option(BUILD_TESTING "Build the test suite" OFF)
|
||||
+
|
||||
# Option for some bundle-like build system in order not to expose
|
||||
# any FCL binary symbols in their public ABI
|
||||
option(CCD_HIDE_ALL_SYMBOLS "Hide all binary symbols" OFF)
|
||||
@@ -73,3 +75,8 @@ install(FILES "${CMAKE_BINARY_DIR}/ccd.p
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
install(FILES BSD-LICENSE DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/doc/ccd")
|
||||
+
|
||||
+if (BUILD_TESTING)
|
||||
+ enable_testing()
|
||||
+endif (BUILD_TESTING)
|
||||
+
|
||||
diff -up ./src/testsuites/CMakeLists.txt.ctest ./src/testsuites/CMakeLists.txt
|
||||
--- ./src/testsuites/CMakeLists.txt.ctest 2018-12-22 07:13:45.000000000 -0500
|
||||
+++ ./src/testsuites/CMakeLists.txt 2020-04-18 14:07:25.369371109 -0400
|
||||
@@ -1,3 +1,41 @@
|
||||
+set(CCDTEST_ARGS "" CACHE STRING "Argments to pass to ccdtest executable")
|
||||
+
|
||||
+set(TEST_SOURCES
|
||||
+ common.c
|
||||
+ support.c
|
||||
+ vec3.c
|
||||
+ polytope.c
|
||||
+ boxbox.c
|
||||
+ spheresphere.c
|
||||
+ cylcyl.c
|
||||
+ boxcyl.c
|
||||
+ mpr_boxbox.c
|
||||
+ mpr_cylcyl.c
|
||||
+ mpr_boxcyl.c)
|
||||
+
|
||||
+add_executable(ccdtest ${TEST_SOURCES} main.c)
|
||||
+target_link_libraries(ccdtest ccd cu rt)
|
||||
+add_definitions(-DCU_ENABLE_TIMER)
|
||||
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
+add_test(NAME ccdtest
|
||||
+ COMMAND ccdtest ${CCDTEST_ARGS}
|
||||
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
+
|
||||
+add_test(NAME ccdtest-valgrind
|
||||
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
+ COMMAND valgrind -q --leak-check=full --show-reachable=yes --trace-children=yes
|
||||
+ --error-limit=no
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/ccdtest ${CCDTEST_ARGS})
|
||||
+
|
||||
+add_test(NAME ccdtest-valgrind-gen-suppressions
|
||||
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
+ COMMAND valgrind -q --leak-check=full --show-reachable=yes --trace-children=yes
|
||||
+ --gen-suppressions=all --log-file=out --error-limit=no
|
||||
+ ${CMAKE_CURRENT_BINARY_DIR}/ccdtest ${CCDTEST_ARGS})
|
||||
+
|
||||
+add_test(NAME check-regressions
|
||||
+ COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/cu/check-regressions regressions
|
||||
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_subdirectory(cu)
|
||||
|
||||
set(MAIN_SOURCES
|
||||
12
libccd-2.1-pkgconfig.patch
Normal file
12
libccd-2.1-pkgconfig.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -up ./ccd.pc.in.pkgconfig ./ccd.pc.in
|
||||
--- ./ccd.pc.in.pkgconfig 2020-04-18 13:59:50.548416479 -0400
|
||||
+++ ./ccd.pc.in 2020-04-18 14:00:11.487751430 -0400
|
||||
@@ -3,7 +3,7 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/ccd
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: @CCD_PKGCONFIG_DESCRIPTION@
|
||||
158
libccd-2.1-py3.patch
Normal file
158
libccd-2.1-py3.patch
Normal file
@ -0,0 +1,158 @@
|
||||
diff -up ./src/testsuites/cu/check-regressions.py3 ./src/testsuites/cu/check-regressions
|
||||
--- ./src/testsuites/cu/check-regressions.py3 2020-04-18 14:23:18.757771743 -0400
|
||||
+++ ./src/testsuites/cu/check-regressions 2020-04-18 14:23:56.070249408 -0400
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/python3
|
||||
##
|
||||
# CU - C unit testing framework
|
||||
# ---------------------------------
|
||||
@@ -88,7 +88,7 @@ class Hunk:
|
||||
if self.numLinesAdded() != self.numLinesDeleted():
|
||||
return False
|
||||
|
||||
- for i in xrange(0, self.numLinesAdded()):
|
||||
+ for i in range(0, self.numLinesAdded()):
|
||||
# if any line does not contain number - return False because
|
||||
# there must be more differences than in numbers
|
||||
if not self.re_is_num.match(self.added[i]) \
|
||||
@@ -102,8 +102,8 @@ class Hunk:
|
||||
nums1 = self.re_num.findall(line1)
|
||||
nums2 = self.re_num.findall(line2)
|
||||
# and remove all empty strings
|
||||
- nums1 = filter(lambda x: len(x) > 0, nums1)
|
||||
- nums2 = filter(lambda x: len(x) > 0, nums2)
|
||||
+ nums1 = [x for x in nums1 if len(x) > 0]
|
||||
+ nums2 = [x for x in nums2 if len(x) > 0]
|
||||
|
||||
# if length of list nums1 does not equal to length of nums2
|
||||
# return False
|
||||
@@ -111,7 +111,7 @@ class Hunk:
|
||||
return False
|
||||
|
||||
# iterate trough all numbers
|
||||
- for j in xrange(0, len(nums1)):
|
||||
+ for j in range(0, len(nums1)):
|
||||
# if numbers do not equal to each other return False
|
||||
if not self.__eq(float(nums1[j]), float(nums2[j])):
|
||||
return False
|
||||
@@ -177,7 +177,7 @@ class Parser:
|
||||
self.re_deleted = re.compile(r"^< (.*)$")
|
||||
|
||||
def __readNextLine(self):
|
||||
- self.line = self.fin.readline()
|
||||
+ self.line = self.fin.readline().decode('utf-8')
|
||||
if len(self.line) == 0:
|
||||
return False
|
||||
return True
|
||||
@@ -210,7 +210,7 @@ class Parser:
|
||||
num_lines += 1
|
||||
|
||||
if PROGRESS_ON and num_lines % 50 == 0:
|
||||
- print MSG_BASE, "[ %08d ]" % num_lines, "\r",
|
||||
+ print(MSG_BASE, "[ %08d ]" % num_lines, "\r", end=' ')
|
||||
sys.stdout.flush()
|
||||
|
||||
# last push to list of hunks
|
||||
@@ -218,7 +218,7 @@ class Parser:
|
||||
self.diff.addHunk(self.cur_hunk)
|
||||
|
||||
if PROGRESS_ON:
|
||||
- print MSG_BASE, " ", "\r",
|
||||
+ print(MSG_BASE, " ", "\r", end=' ')
|
||||
sys.stdout.flush()
|
||||
|
||||
def getDiff(self):
|
||||
@@ -262,26 +262,26 @@ def regressionFilesInDir():
|
||||
|
||||
def MSG(str = "", wait = False):
|
||||
if wait:
|
||||
- print str,
|
||||
+ print(str, end=' ')
|
||||
else:
|
||||
- print str
|
||||
+ print(str)
|
||||
def MSGOK(prestr = "", str = "", poststr = ""):
|
||||
- print prestr, "\033[0;32m" + str + "\033[0;0m", poststr
|
||||
+ print(prestr, "\033[0;32m" + str + "\033[0;0m", poststr)
|
||||
def MSGFAIL(prestr = "", str = "", poststr = ""):
|
||||
- print prestr, "\033[0;31m" + str + "\033[0;0m", poststr
|
||||
+ print(prestr, "\033[0;31m" + str + "\033[0;0m", poststr)
|
||||
def MSGINFO(prestr = "", str = "", poststr = ""):
|
||||
- print prestr, "\033[0;33m" + str + "\033[0;0m", poststr
|
||||
+ print(prestr, "\033[0;33m" + str + "\033[0;0m", poststr)
|
||||
def dumpLines(lines, prefix = "", wait = False, max_lines = -1):
|
||||
line_num = 0
|
||||
if wait:
|
||||
for line in lines:
|
||||
- print prefix, line,
|
||||
+ print(prefix, line, end=' ')
|
||||
line_num += 1
|
||||
if max_lines >= 0 and line_num > max_lines:
|
||||
break
|
||||
else:
|
||||
for line in lines:
|
||||
- print prefix, line
|
||||
+ print(prefix, line)
|
||||
line_num += 1
|
||||
if max_lines >= 0 and line_num > max_lines:
|
||||
break
|
||||
@@ -308,7 +308,7 @@ def main(files):
|
||||
MSG_BASE = "Comparing %s and %s" % \
|
||||
(filenames[0].ljust(len1) ,filenames[1].ljust(len2))
|
||||
if not PROGRESS_ON:
|
||||
- print MSG_BASE,
|
||||
+ print(MSG_BASE, end=' ')
|
||||
sys.stdout.flush()
|
||||
|
||||
pipe = Popen(cmd, stdout=PIPE)
|
||||
@@ -319,7 +319,7 @@ def main(files):
|
||||
diff.checkFloats()
|
||||
|
||||
if PROGRESS_ON:
|
||||
- print MSG_BASE,
|
||||
+ print(MSG_BASE, end=' ')
|
||||
|
||||
if diff.numHunks() == 0:
|
||||
MSGOK(" [", "OK", "]")
|
||||
@@ -345,23 +345,23 @@ def main(files):
|
||||
dumpLines(lines, " |", True, MAX_DIFF_LINES)
|
||||
|
||||
def usage():
|
||||
- print "Usage: " + sys.argv[0] + " [ OPTIONS ] [ directory, [ directory, [ ... ] ] ]"
|
||||
- print ""
|
||||
- print " OPTIONS:"
|
||||
- print " --help / -h none Print this help"
|
||||
- print " --exact / -e none Switch do exact comparasion of files"
|
||||
- print " --not-exact / -n none Switch do non exact comparasion of files (default behaviour)"
|
||||
- print " --max-diff-lines int Maximum of lines of diff which can be printed (default " + str(MAX_DIFF_LINES) + ")"
|
||||
- print " --eps float Precision of floating point numbers (epsilon) (default " + str(EPS) + ")"
|
||||
- print " --no-progress none Turn off progress bar"
|
||||
- print " --progress none Turn on progress bar (default)"
|
||||
- print ""
|
||||
- print " This program is able to compare files with regressions generated by CU testsuites."
|
||||
- print " You can specify directories which are to be searched for regression files."
|
||||
- print " In non exact copmarasion mode (which is default), this program tries to compare"
|
||||
- print " floating point numbers in files with respect to specified precision (see --eps) and"
|
||||
- print " those lines which differ only in precission of floating point numbers are omitted."
|
||||
- print ""
|
||||
+ print("Usage: " + sys.argv[0] + " [ OPTIONS ] [ directory, [ directory, [ ... ] ] ]")
|
||||
+ print("")
|
||||
+ print(" OPTIONS:")
|
||||
+ print(" --help / -h none Print this help")
|
||||
+ print(" --exact / -e none Switch do exact comparasion of files")
|
||||
+ print(" --not-exact / -n none Switch do non exact comparasion of files (default behaviour)")
|
||||
+ print(" --max-diff-lines int Maximum of lines of diff which can be printed (default " + str(MAX_DIFF_LINES) + ")")
|
||||
+ print(" --eps float Precision of floating point numbers (epsilon) (default " + str(EPS) + ")")
|
||||
+ print(" --no-progress none Turn off progress bar")
|
||||
+ print(" --progress none Turn on progress bar (default)")
|
||||
+ print("")
|
||||
+ print(" This program is able to compare files with regressions generated by CU testsuites.")
|
||||
+ print(" You can specify directories which are to be searched for regression files.")
|
||||
+ print(" In non exact copmarasion mode (which is default), this program tries to compare")
|
||||
+ print(" floating point numbers in files with respect to specified precision (see --eps) and")
|
||||
+ print(" those lines which differ only in precission of floating point numbers are omitted.")
|
||||
+ print("")
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
91
libccd.spec
Normal file
91
libccd.spec
Normal file
@ -0,0 +1,91 @@
|
||||
%ifarch %{valgrind_arches}
|
||||
%global with_valgrind 1
|
||||
%endif
|
||||
%global soversion 2
|
||||
|
||||
Name: libccd
|
||||
Version: 2.1
|
||||
Release: 1
|
||||
Summary: Library for collision detection between convex shapes
|
||||
|
||||
License: BSD
|
||||
URL: http://libccd.danfis.cz
|
||||
Source0: https://github.com/danfis/%{name}/archive/refs/tags/v%{version}.tar.gz
|
||||
# This patch integrates additional programs that are present in
|
||||
# the testsuites folder into CMake, via CTest.
|
||||
# It also increments the version number to match the release.
|
||||
# Not yet submitted upstream
|
||||
Patch0: %{name}-2.1-ctest.patch
|
||||
# This patch changes the ccd.pc file to point to the correct include
|
||||
# directory. Not yet submitted upstream
|
||||
Patch1: %{name}-2.1-pkgconfig.patch
|
||||
# Convert check_regressions to python3
|
||||
# Not submitted upstream
|
||||
Patch2: %{name}-2.1-py3.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: cmake
|
||||
# These are required for executing the test suite
|
||||
BuildRequires: python3
|
||||
%if 0%{?with_valgrind}
|
||||
BuildRequires: valgrind
|
||||
%endif
|
||||
|
||||
%description
|
||||
libccd implements variation on Gilbert-Johnson-Keerthi (GJK) algorithm +
|
||||
Expand Polytope Algorithm (EPA). It also implements Minkowski Portal
|
||||
Refinement (MPR, a.k.a. XenoCollide) algorithm as published in Game
|
||||
Programming Gems 7.
|
||||
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
The %{name}-devel package contains libraries and header files for
|
||||
developing applications that use %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p0 -b .ctest
|
||||
%patch1 -p0 -b .pkgconfig
|
||||
%patch2 -p0 -b .py3
|
||||
|
||||
%build
|
||||
mkdir build && cd build
|
||||
%cmake \
|
||||
-DBUILD_TESTS=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
..
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install -C build
|
||||
find %{buildroot} -name '*.la' -exec rm -f {} ';'
|
||||
rm -f %{buildroot}%{_libdir}/*.a
|
||||
rm -rf %{buildroot}%{_docdir}/ccd
|
||||
|
||||
|
||||
%check
|
||||
%if 0%{?with_valgrind}
|
||||
make -C build test ||exit 0
|
||||
%endif
|
||||
|
||||
|
||||
%files
|
||||
%doc BSD-LICENSE README.md
|
||||
%{_libdir}/*.so.%{version}
|
||||
%{_libdir}/*.so.%{soversion}
|
||||
|
||||
%files devel
|
||||
%{_includedir}/*
|
||||
%{_libdir}/*.so
|
||||
%{_libdir}/pkgconfig/*.pc
|
||||
%{_libdir}/ccd
|
||||
|
||||
%changelog
|
||||
* Sun May 7 2023 will_niutao <niutao2@huawei.com> - 2.1-1
|
||||
- Init for openEuler
|
||||
|
||||
BIN
v2.1.tar.gz
Normal file
BIN
v2.1.tar.gz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user