From b67f66ad7e2544e3e4c5a415ac992816cc452203 Mon Sep 17 00:00:00 2001
From: "Kirill A. Korinsky" <kirill@korins.ky>
Date: Tue, 13 Jun 2023 11:50:41 +0200
Subject: [PATCH] patch for lrslib-7.2 compatibility

---
 CMakeLists.txt               | 1 -
 sympol/CMakeLists.txt        | 7 ++++---
 sympol/raycomputationlrs.cpp | 5 +++--
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git CMakeLists.txt CMakeLists.txt
index ec3db33..0c1bc57 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -22,7 +22,6 @@ enable_testing()
 add_test(NAME perltest WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/contrib COMMAND perl test-sympol.pl ${PROJECT_BINARY_DIR})
 
 add_subdirectory(sympol)
-add_subdirectory(external/lrslib-042c)
 add_subdirectory(test)
 
 exec_program( ${CMAKE_COMMAND} ARGS -E copy_directory ${PROJECT_SOURCE_DIR}/data ${PROJECT_BINARY_DIR}/data )
diff --git sympol/CMakeLists.txt sympol/CMakeLists.txt
index df6fd6f..a19bb16 100644
--- sympol/CMakeLists.txt
+++ sympol/CMakeLists.txt
@@ -40,10 +40,10 @@ SET (Boost_USE_MULTITHREADED TRUE)
 find_package(Boost 1.34.1 COMPONENTS program_options REQUIRED)
 include_directories(${Boost_INCLUDE_DIRS})
 
-include_directories(../external/boost ../external/permlib ../external/cddlib-094f ${CMAKE_CURRENT_BINARY_DIR})
+include_directories(../external/boost ../external/permlib ${CMAKE_CURRENT_BINARY_DIR})
 add_definitions(-Woverloaded-virtual)
 # lrs flags
-add_definitions(-DGMP -DLRS_QUIET)
+add_definitions(-DGMP -DMA -DLRS_QUIET)
 # cdd flags
 add_definitions(-DGMPRATIONAL)
 
@@ -75,9 +75,10 @@ set_target_properties(sympol PROPERTIES VERSION ${SYMPOL_MAJOR}.${SYMPOL_MINOR}.
 add_executable(sympolbin sympol.cpp)
 set_target_properties(sympolbin PROPERTIES OUTPUT_NAME sympol)
 
+find_library(LRS lrs REQUIRED)
 find_library(CDDGMP cddgmp REQUIRED)
 
-set(TARGET_LIBS ${TARGET_LIBS} lrsgmp ${CDDGMP} ${GMP_LIBRARIES} ${Boost_LIBRARIES})
+set(TARGET_LIBS ${TARGET_LIBS} ${LRS} ${CDDGMP} ${GMP_LIBRARIES} ${Boost_LIBRARIES})
 target_link_libraries(sympol ${TARGET_LIBS})
 target_link_libraries(sympolbin sympol)
 
diff --git sympol/raycomputationlrs.cpp sympol/raycomputationlrs.cpp
index c599548..fd4519a 100644
--- sympol/raycomputationlrs.cpp
+++ sympol/raycomputationlrs.cpp
@@ -25,7 +25,9 @@
 #include "polyhedron.h"
 
 extern "C" {
-  #include <lrslib.h>
+  #define MA
+  #include <lrslib/lrsrestart.h>
+  #include <lrslib/lrslib.h>
 }
 
 #include <ctime>
@@ -66,7 +68,6 @@ bool RayComputationLRS::finish() {
         return true;
     }
 
-    lrs_mp_close();
     
     if (RayComputationLRS::ms_fIn != NULL) {
         if (std::fclose(RayComputationLRS::ms_fIn)) {
-- 
2.41.0

