diff --git a/CMakeLists.txt b/CMakeLists.txt index 46f9a83de..289e72952 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ message(STATUS "C++ version ${CXX_STANDARD} configured.") option(XACC_BUILD_TESTS "Build test programs" OFF) option(XACC_BUILD_EXAMPLES "Build example programs" OFF) +option(XACC_MULTI_THREADED "Enable multi-thread support" OFF) option(XACC_ENSMALLEN_INCLUDE_DIR "Path to ensmallen.hpp for mlpack optimizer" "") option(XACC_ARMADILLO_INCLUDE_DIR "Path to armadillo header for mlpack optimizer" "") @@ -101,6 +102,13 @@ endif() message(STATUS "${BoldGreen}Installing XACC to ${CMAKE_INSTALL_PREFIX}. Override with -DCMAKE_INSTALL_PREFIX=...${ColorReset}") +if (XACC_MULTI_THREADED) + message(STATUS "${BoldGreen}Multi-thread support is enabled ${ColorReset}") + add_compile_definitions(_XACC_MUTEX) +else() + message(STATUS "${BoldGreen}Multi-thread support is disabled (default)${ColorReset}") +endif() + if (XACC_BUILD_TESTS) enable_testing() macro(add_xacc_test _TEST_NAME) diff --git a/xacc/xacc.hpp b/xacc/xacc.hpp index 88b480b8f..9953f6880 100644 --- a/xacc/xacc.hpp +++ b/xacc/xacc.hpp @@ -28,7 +28,6 @@ #include #include -#undef _XACC_MUTEX #ifdef _XACC_MUTEX #include #endif