diff --git a/CMakeLists.txt b/CMakeLists.txt index b3d5f6159..1ca68f89e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ endif(APPLE) #### we need the boost library from boost.org set(BOOST_ROOT CACHE PATH "root of Boost") -find_package(Boost 1.36.0 COMPONENTS system filesystem thread date_time chrono REQUIRED) +find_package(Boost 1.36.0 COMPONENTS system filesystem REQUIRED) # For Visual Studio we have to disable the auto-linking feature of boost # where just including a boost file automatically adds it to the linker path. # Although this sounds great, it sadly breaks because of conflicting file-paths when linking etc etc. diff --git a/src/xGadgetron/cGadgetron/CMakeLists.txt b/src/xGadgetron/cGadgetron/CMakeLists.txt index 60ab00f06..59ade5222 100644 --- a/src/xGadgetron/cGadgetron/CMakeLists.txt +++ b/src/xGadgetron/cGadgetron/CMakeLists.txt @@ -17,7 +17,7 @@ # #========================================================================= # Commented out, as this is now done at the top-level -#find_package(Boost COMPONENTS system filesystem thread date_time chrono REQUIRED) +#find_package(Boost COMPONENTS system filesystem REQUIRED) # For Visual Studio we have to disable the auto-linking feature of boost # where just including a boost file automatically adds it to the linker path. # Although this sounds great, it sadly breaks because of conflicting file-paths when linking etc etc. @@ -28,7 +28,7 @@ if (SIRF_INSTALL_DEPENDENCIES AND WIN32) set(Boost_DLL_DIR ${Boost_LIBRARY_DIR_RELEASE}) message(STATUS "Install boost shared libraries from ${Boost_DLL_DIR} ") - foreach (__boost_lib system filesystem thread date_time chrono) + foreach (__boost_lib system filesystem) file(GLOB Boost_DLL "${Boost_DLL_DIR}/boost_${__boost_lib}*.dll") install( FILES ${Boost_DLL} DESTINATION bin ) endforeach() @@ -50,13 +50,13 @@ target_link_libraries(cgadgetron iutilities csirf) if((CMAKE_VERSION VERSION_LESS 3.5.0) OR (NOT _Boost_IMPORTED_TARGETS)) # This is harder than it should be on older CMake versions to be able to cope with # spaces in filenames. - foreach(C SYSTEM FILESYSTEM THREAD DATE_TIME CHRONO) + foreach(C SYSTEM FILESYSTEM) target_link_libraries(cgadgetron optimized "${Boost_${C}_LIBRARY_RELEASE}") target_link_libraries(cgadgetron debug "${Boost_${C}_LIBRARY_DEBUG}") endforeach() else() # Nice and simple for recent CMake (which knows about your Boost version) - target_link_libraries(cgadgetron Boost::system Boost::filesystem Boost::thread Boost::date_time Boost::chrono) + target_link_libraries(cgadgetron Boost::system Boost::filesystem) endif() # Note: cannot use ISMRMRD_LIBRARIES on Windows as it generally contains diff --git a/src/xGadgetron/cGadgetron/cgadgetron.cpp b/src/xGadgetron/cGadgetron/cgadgetron.cpp index 0dc5226ef..3143e1446 100644 --- a/src/xGadgetron/cGadgetron/cgadgetron.cpp +++ b/src/xGadgetron/cGadgetron/cgadgetron.cpp @@ -47,7 +47,7 @@ return NEW_OBJECT_HANDLE(G) #define NEW_GADGET_CHAIN(C) if (boost::iequals(name, C::class_name())) \ return NEW_OBJECT_HANDLE(C) -shared_ptr Mutex::sptr_mutex_; +shared_ptr Mutex::sptr_mutex_; static void* unknownObject(const char* obj, const char* name, const char* file, int line) @@ -1237,7 +1237,7 @@ cGT_sendAcquisitions(void* ptr_con, void* ptr_dat) GTConnector& conn = objectFromHandle(h_con); GadgetronClientConnector& con = conn(); Mutex mutex; - boost::mutex& mtx = mutex(); + std::mutex& mtx = mutex(); ISMRMRD::Dataset& ismrmrd_dataset = objectFromHandle(h_dat); @@ -1253,7 +1253,7 @@ cGT_sendAcquisitions(void* ptr_con, void* ptr_dat) ISMRMRD::Acquisition acq_tmp; for (uint32_t i = 0; i < acquisitions; i++) { { - boost::mutex::scoped_lock scoped_lock(mtx); + std::unique_lock scoped_lock(mtx); ismrmrd_dataset.readAcquisition(i, acq_tmp); } con.send_ismrmrd_acquisition(acq_tmp); diff --git a/src/xGadgetron/cGadgetron/gadgetron_client.cpp b/src/xGadgetron/cGadgetron/gadgetron_client.cpp index 59ac7b451..42b798d5b 100644 --- a/src/xGadgetron/cGadgetron/gadgetron_client.cpp +++ b/src/xGadgetron/cGadgetron/gadgetron_client.cpp @@ -160,7 +160,7 @@ GadgetronClientConnector::connect(std::string hostname, std::string port) throw GadgetronClientException("Error connecting using socket."); reader_thread_ = - boost::thread(boost::bind(&GadgetronClientConnector::read_task, this)); + std::thread(&GadgetronClientConnector::read_task, this); } void diff --git a/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/gadgetron_client.h b/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/gadgetron_client.h index a8ee5fa14..a1ab39c92 100644 --- a/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/gadgetron_client.h +++ b/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/gadgetron_client.h @@ -39,7 +39,6 @@ limitations under the License. #include #include -#include #include #include @@ -260,7 +259,7 @@ namespace sirf { boost::asio::io_service io_service; boost::asio::ip::tcp::socket* socket_; - boost::thread reader_thread_; + std::thread reader_thread_; maptype readers_; unsigned int timeout_ms_; }; diff --git a/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/xgadgetron_utilities.h b/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/xgadgetron_utilities.h index 452a86d6c..4c8295791 100644 --- a/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/xgadgetron_utilities.h +++ b/src/xGadgetron/cGadgetron/include/sirf/Gadgetron/xgadgetron_utilities.h @@ -33,7 +33,7 @@ limitations under the License. #include #include -#include +#include #include "sirf/Gadgetron/cgadgetron_shared_ptr.h" @@ -106,11 +106,11 @@ namespace sirf { { init_(); } - boost::mutex& operator()() + std::mutex& operator()() { return *sptr_mutex_.get(); } - gadgetron::shared_ptr sptr() + gadgetron::shared_ptr sptr() { return sptr_mutex_; } @@ -123,12 +123,12 @@ namespace sirf { sptr_mutex_->unlock(); } private: - static gadgetron::shared_ptr sptr_mutex_; + static gadgetron::shared_ptr sptr_mutex_; static void init_() { static bool initialized = false; if (!initialized) { - sptr_mutex_ = gadgetron::shared_ptr(new boost::mutex); + sptr_mutex_ = gadgetron::shared_ptr(new std::mutex); initialized = true; } } @@ -136,4 +136,4 @@ namespace sirf { } -#endif \ No newline at end of file +#endif diff --git a/src/xGadgetron/mGadgetron/CMakeLists.txt b/src/xGadgetron/mGadgetron/CMakeLists.txt index d9de37e11..7bbf67670 100644 --- a/src/xGadgetron/mGadgetron/CMakeLists.txt +++ b/src/xGadgetron/mGadgetron/CMakeLists.txt @@ -18,7 +18,7 @@ if(BUILD_MATLAB) #commented out as done at top-level - #find_package(Boost COMPONENTS system thread filesystem REQUIRED) + #find_package(Boost COMPONENTS system filesystem REQUIRED) set(CMAKE_POSITION_INDEPENDENT_CODE True) diff --git a/src/xSTIR/cSTIR/CMakeLists.txt b/src/xSTIR/cSTIR/CMakeLists.txt index c28d17afd..89dad0090 100644 --- a/src/xSTIR/cSTIR/CMakeLists.txt +++ b/src/xSTIR/cSTIR/CMakeLists.txt @@ -29,17 +29,5 @@ target_include_directories(cstir PUBLIC "${STIR_INCLUDE_DIRS}") target_link_libraries(cstir csirf iutilities) target_link_libraries(cstir "${STIR_LIBRARIES}") -# Add boost library dependencies -if((CMAKE_VERSION VERSION_LESS 3.5.0) OR (NOT _Boost_IMPORTED_TARGETS)) - # This is harder than it should be on older CMake versions to be able to cope with - # spaces in filenames. - foreach(C SYSTEM FILESYSTEM THREAD DATE_TIME CHRONO) - target_link_libraries(cstir optimized "${Boost_${C}_LIBRARY_RELEASE}") - target_link_libraries(cstir debug "${Boost_${C}_LIBRARY_DEBUG}") - endforeach() -else() - # Nice and simple for recent CMake (which knows about your Boost version) - target_link_libraries(cstir Boost::system Boost::filesystem Boost::thread Boost::date_time Boost::chrono) -endif() ADD_SUBDIRECTORY(tests)