Skip to content

Commit

Permalink
Merge pull request #185 from ankane/mac_install
Browse files Browse the repository at this point in the history
Added support for clang on Mac
  • Loading branch information
zeyiwen committed Nov 25, 2019
2 parents a94f7b2 + 29f6e23 commit c9fc01b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
19 changes: 13 additions & 6 deletions docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,27 @@ If ```make -j``` doesn't work, please use ```make``` instead.
#### Installation for MacOS
* Clone ThunderSVM repository
```bash
git clone https://github.com/zeyiwen/thundersvm.git
git clone --recursive https://github.com/zeyiwen/thundersvm.git
```
You need to Install ```CMake``` and ```gcc``` for MacOS. If you don't have Homebrew, [here](https://brew.sh/) is its website.
You need to Install ```CMake``` and ```libomp``` for MacOS. If you don't have Homebrew, [here](https://brew.sh/) is its website.
```bash
brew install gcc
brew install cmake
brew install cmake libomp
```

* Build ThunderSVM. You can specify gcc as the compiler of cmake. ([path_to_g++] and [path_to_gcc] typically look like ```/usr/local/bin/g++-7``` and ```/usr/local/bin/gcc-7```, respectively.).
* Build ThunderSVM
```
# in thundersvm root directory
mkdir build
cd build
cmake -DCMAKE_CXX_COMPILER=[path_to_g++] -DCMAKE_C_COMPILER=[path_to_gcc] -DUSE_CUDA=OFF -DUSE_EIGEN=ON ..
cmake \
-DUSE_CUDA=OFF \
-DUSE_EIGEN=ON \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" \
-DOpenMP_C_LIB_NAMES=omp \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" \
-DOpenMP_CXX_LIB_NAMES=omp \
-DOpenMP_omp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib \
..
make -j
```

Expand Down
3 changes: 3 additions & 0 deletions src/thundersvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ else ()
file(GLOB SRC_KERNEL kernel/*.cpp)
list(APPEND SRC ${SRC_KERNEL})
add_library(${PROJECT_LIB_NAME} SHARED ${SRC})
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_link_libraries(${PROJECT_LIB_NAME} OpenMP::OpenMP_CXX)
endif()
add_executable(${PROJECT_NAME}-train thundersvm-train.cpp ${COMMON_INCLUDES})
add_executable(${PROJECT_NAME}-predict thundersvm-predict.cpp ${COMMON_INCLUDES})
endif ()
Expand Down

0 comments on commit c9fc01b

Please sign in to comment.