Skip to content

Commit

Permalink
resolve conflits and merge PR 196
Browse files Browse the repository at this point in the history
  • Loading branch information
zeyiwen committed Feb 5, 2020
1 parent f1d5b92 commit 85bc165
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ if (OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif ()

if (USE_CUDA AND USE_EIGEN)
message (FATAL_ERROR "CUDA and Eigen are mutually exclusive. Please specify either USE_CUDA or USE_EIGEN, not both.")
endif ()

if (USE_CUDA)
message("Compile with CUDA")
find_package(CUDA REQUIRED QUIET)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -std=c++11 -Wno-deprecated-gpu-targets)
set(LINK_LIBRARY ${CUDA_cusparse_LIBRARY})
list(APPEND LINK_LIBRARY ${CUDA_cusparse_LIBRARY})

# Correct error for GCC 5 and CUDA 7.5
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_MWAITXINTRIN_H_INCLUDED -D_FORCE_INLINES")
Expand All @@ -47,8 +51,15 @@ else ()
endif ()

if (USE_EIGEN)
message("using Eigen for acceleration")
include_directories(${PROJECT_SOURCE_DIR}/eigen)
find_package (Eigen3 3.3 NO_MODULE)
if (Eigen3_FOUND)
message("using external Eigen3 for acceleration")
include_directories(${EIGEN3_INCLUDE_DIR})
list(APPEND LINK_LIBRARY Eigen3::Eigen)
else ()
message("using internal Eigen3 for acceleration")
include_directories(${PROJECT_SOURCE_DIR}/eigen)
endif ()
add_compile_options("-march=native")
endif ()

Expand Down
6 changes: 6 additions & 0 deletions cmake/thundersvmConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
@PACKAGE_INIT@

if (@USE_EIGEN@)
if (@Eigen3_FOUND@)
find_dependency(Eigen3)
endif ()
endif()

include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components("@PROJECT_NAME@")

0 comments on commit 85bc165

Please sign in to comment.