Skip to content

Commit

Permalink
Add a CMake option that turns on/off _XACC_MUTEX
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Hayashi <[email protected]>
  • Loading branch information
ahayashi committed Jun 23, 2021
1 parent af0b924 commit 2e77ec2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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" "")

Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion xacc/xacc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <sys/stat.h>
#include <fstream>

#undef _XACC_MUTEX
#ifdef _XACC_MUTEX
#include <mutex>
#endif
Expand Down

0 comments on commit 2e77ec2

Please sign in to comment.