Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Improvements to config.cmake (#17639)
Browse files Browse the repository at this point in the history
- Set Ninja build generator in config.cmake instead of commmand line
- Load config.cmake by default if present
  • Loading branch information
leezu authored Feb 22, 2020
1 parent cc78b68 commit d2be9a6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ endif()

project(mxnet C CXX)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.cmake)
# Load config.cmake only if mxnet is not compiled as a dependency of another project
include(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake)
endif()

if(__CMAKE_CROSSCOMPILING_OVERRIDE)
set(CMAKE_CROSSCOMPILING ${__CMAKE_CROSSCOMPILING})
endif()
Expand Down
10 changes: 6 additions & 4 deletions config/darwin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
# Next modify the according entries, and then compile by
#
# $ mkdir build; cd build
# $ cmake -C ../config.cmake ..
# $ cmake --build . --parallel 8
# $ cmake ..
# $ cmake --build .
#
# You can increase the --parallel 8 argument to match the number of processor
# cores of your computer.
# Specify `cmake --build . --parallel N` to set the number of parallel compilation jobs.
# Default is derived from CPUs available.
#
#-------------------------------------------------------------------------------

Expand All @@ -55,6 +55,8 @@ set(USE_TVM_OP OFF CACHE BOOL "Enable use of TVM operator build system.")
#---------------------
# Compilers
#--------------------
set(CMAKE_GENERATOR "Ninja" CACHE STRING "Build Tool Generator used by CMake")

# Compilers are usually autodetected. Uncomment and modify the next 3 lines to
# choose manually:

Expand Down
10 changes: 6 additions & 4 deletions config/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
# Next modify the according entries, and then compile by
#
# $ mkdir build; cd build
# $ cmake -C ../config.cmake ..
# $ cmake --build . --parallel 8
# $ cmake ..
# $ cmake --build .
#
# You can increase the --parallel 8 argument to match the number of processor
# cores of your computer.
# Specify `cmake --build . --parallel N` to set the number of parallel compilation jobs.
# Default is derived from CPUs available.
#
#-------------------------------------------------------------------------------

Expand Down Expand Up @@ -73,6 +73,8 @@ set(USE_TVM_OP OFF CACHE BOOL "Enable use of TVM operator build system.")
#---------------------
# Compilers
#--------------------
set(CMAKE_GENERATOR "Ninja" CACHE STRING "Build Tool Generator used by CMake")

# Compilers are usually autodetected. Uncomment and modify the next 3 lines to
# choose manually:

Expand Down
10 changes: 6 additions & 4 deletions config/linux_gpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
# Next modify the according entries, and then compile by
#
# $ mkdir build; cd build
# $ cmake -C ../config.cmake ..
# $ cmake --build . --parallel 8
# $ cmake ..
# $ cmake --build .
#
# You can increase the --parallel 8 argument to match the number of processor
# cores of your computer.
# Specify `cmake --build . --parallel N` to set the number of parallel compilation jobs.
# Default is derived from CPUs available.
#
#-------------------------------------------------------------------------------

Expand Down Expand Up @@ -73,6 +73,8 @@ set(USE_TVM_OP OFF CACHE BOOL "Enable use of TVM operator build system.")
#---------------------
# Compilers
#--------------------
set(CMAKE_GENERATOR "Ninja" CACHE STRING "Build Tool Generator used by CMake")

# Compilers are usually autodetected. Uncomment and modify the next 3 lines to
# choose manually:

Expand Down
8 changes: 4 additions & 4 deletions docs/static_site/src/pages/get_started/osx_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ the guide in [Math Library Selection](build_from_source#math-library-selection).
```bash
rm -rf build
mkdir -p build && cd build
cmake -GNinja -C ../config.cmake ..
cmake --build . --parallel 8
cmake ..
cmake --build .
```

You can increase the `--parallel 8` argument to match the number of processor
cores of your computer.
Specify `cmake --build . --parallel N` to set the number of parallel compilation
jobs. Default is derived from CPUs available.

After a successful build, you will find the `libmxnet.dylib` in the `build`
folder in your MXNet project root. `libmxnet.dylib` is required to install
Expand Down
8 changes: 4 additions & 4 deletions docs/static_site/src/pages/get_started/ubuntu_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ the guide in [Math Library Selection](build_from_source#math-library-selection).
```bash
rm -rf build
mkdir -p build && cd build
cmake -GNinja -C ../config.cmake ..
cmake --build . --parallel 8
cmake ..
cmake --build .
```

You can increase the `--parallel 8` argument to match the number of processor
cores of your computer.
Specify `cmake --build . --parallel N` to set the number of parallel compilation
jobs. Default is derived from CPUs available.

After a successful build, you will find the `libmxnet.so` in the `build` folder
in your MXNet project root. `libmxnet.so` is required to install language
Expand Down

0 comments on commit d2be9a6

Please sign in to comment.