Commit e6e310e4 authored by Andreas Tille's avatar Andreas Tille
Browse files

Lots of changes in cmake config need to be done - this is just a very rough...

Lots of changes in cmake config need to be done - this is just a very rough start which is not working at all
parent 6642d296
Loading
Loading
Loading
Loading

debian/patches/pthreads.patch

deleted100644 → 0
+0 −44
Original line number Diff line number Diff line
--- a/SofaKernel/cmake/Modules/FindThreads.cmake
+++ b/SofaKernel/cmake/Modules/FindThreads.cmake
@@ -125,36 +125,12 @@ ELSE()
         # We have pthread.h
         # Let's check for the library now.
         #
-        SET(CMAKE_HAVE_THREADS_LIBRARY)
-        IF(NOT THREADS_HAVE_PTHREAD_ARG)
-
-            # Do we have -lpthreads
-            CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
-            IF(CMAKE_HAVE_PTHREADS_CREATE)
-                SET(CMAKE_THREAD_LIBS_INIT "-lpthreads")
-                SET(CMAKE_HAVE_THREADS_LIBRARY 1)
-                SET(Threads_FOUND TRUE)
-            ENDIF()
-
-            # Ok, how about -lpthread
-            CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
-            IF(CMAKE_HAVE_PTHREAD_CREATE)
-                SET(CMAKE_THREAD_LIBS_INIT "-lpthread")
-                SET(Threads_FOUND TRUE)
-                SET(CMAKE_HAVE_THREADS_LIBRARY 1)
-            ENDIF()
+	# --> https://stackoverflow.com/questions/1620918/cmake-and-libpthread
+	set(THREADS_PREFER_PTHREAD_FLAG ON)
+	find_package(Threads REQUIRED)
+	# target_link_libraries(my_app Threads::Threads)
 
-            IF(CMAKE_SYSTEM MATCHES "SunOS.*")
-                # On sun also check for -lthread
-                CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
-                IF(CMAKE_HAVE_THR_CREATE)
-                    SET(CMAKE_THREAD_LIBS_INIT "-lthread")
-                    SET(CMAKE_HAVE_THREADS_LIBRARY 1)
-                    SET(Threads_FOUND TRUE)
-                ENDIF()
-            ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
-
-        ENDIF(NOT THREADS_HAVE_PTHREAD_ARG)
+        SET(CMAKE_HAVE_THREADS_LIBRARY)
 
         IF(NOT CMAKE_HAVE_THREADS_LIBRARY)
             # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
+0 −1
Original line number Diff line number Diff line
pthreads.patch
use_debian_packaged_libs.patch
+25 −16
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ Description: Use Debian packaged libs

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,7 +138,6 @@ option(SOFA_BUILD_TESTS "Compile the aut
@@ -158,7 +158,6 @@ option(SOFA_BUILD_TESTS "Compile the aut
 if(SOFA_BUILD_TESTS)
     # Enable testing features of cmake, like the add_test() command.
     enable_testing()
@@ -14,7 +14,7 @@ Description: Use Debian packaged libs
 ## Active or not the use of ccache
--- a/extlibs/CMakeLists.txt
+++ b/extlibs/CMakeLists.txt
@@ -1,24 +1,10 @@
@@ -1,33 +1,5 @@
 cmake_minimum_required(VERSION 3.1)
 
-set(EXTLIBS_TARGETS
@@ -23,19 +23,28 @@ Description: Use Debian packaged libs
-    tinyxml
-)
-
 ## Necessary ones
-add_subdirectory(SuiteSparse)
-add_subdirectory(csparse)
-add_subdirectory(${SOFA_KERNEL_SOURCE_DIR}/extlibs/eigen-3.2.7 eigen)
-######## SofaKernel/extlibs ########
-
-# Eigen (header-only): see SofaKernel/cmake/Modules/FindEigen3.cmake
-set(EIGEN_ROOT "${SOFA_KERNEL_SOURCE_DIR}/extlibs/eigen-3.2.7" CACHE PATH "Eigen directory (containing Eigen/src/...)")
-mark_as_advanced(EIGEN_ROOT)
-
-# Nlohmann JSON (header-only): see SofaKernel/cmake/Modules/FindJson.cmake
-set(JSON_ROOT "${SOFA_KERNEL_SOURCE_DIR}/extlibs/json" CACHE PATH "Nlohmann JSON directory")
-mark_as_advanced(JSON_ROOT)
-
-# Newmat
-find_package(Newmat QUIET)
-if(NOT Newmat_FOUND)
-    add_subdirectory(${SOFA_KERNEL_SOURCE_DIR}/extlibs/newmat newmat)
-endif()
-
-# TinyXML
-find_package(TinyXML QUIET)
-if(NOT TinyXML_FOUND)
-    add_subdirectory(${SOFA_KERNEL_SOURCE_DIR}/extlibs/tinyxml tinyxml)
-add_subdirectory(${SOFA_KERNEL_SOURCE_DIR}/extlibs/json json)
-endif()
-
 ####################################
 
 ## Optional ones
 if (SOFAGUI_ENABLE_QWT)
     message("Qwt activated")
-    add_subdirectory(qwt-6.1.2/src qwt)
 endif()
 
 option(SOFA_BUILD_MINIFLOWVR "Build the miniFlowVR library distributed in the extlibs/ directory." OFF)
 ## Necessary ones