Skip to content

Commit

Permalink
Find OpenMP in CMake (dmlc#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
BarclayII authored Feb 20, 2019
1 parent bd9171d commit 6e7f3f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ else(MSVC)
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11)
set(CMAKE_C_FLAGS "-O2 -Wall -fPIC ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-O2 -Wall -fPIC -std=c++11 ${CMAKE_CXX_FLAGS}")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_C_FLAGS "-fopenmp ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-fopenmp ${CMAKE_CXX_FLAGS}")
endif()

include(FindOpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${OpenMP_C_FLAGS} ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${OpenMP_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
endif(OPENMP_FOUND)
endif(MSVC)

# Source file lists
Expand Down
2 changes: 1 addition & 1 deletion src/graph/sampler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <omp.h>
#include <dmlc/omp.h>

#ifdef _MSC_VER
// rand in MS compiler works well in multi-threading.
Expand Down

0 comments on commit 6e7f3f3

Please sign in to comment.