Skip to content

Commit

Permalink
reviews updating
Browse files Browse the repository at this point in the history
  • Loading branch information
yhmtsai committed Oct 17, 2019
1 parent d012d50 commit 6527420
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ configure_file(${Ginkgo_SOURCE_DIR}/include/ginkgo/config.hpp.in
# This is modified from https://gitlab.kitware.com/cmake/community/wikis/FAQ#dynamic-replace
if(MSVC)
if(BUILD_SHARED_LIBS)
ginkgo_turn_to_windows_dynamic("CXX")
ginkgo_turn_to_windows_dynamic("C")
ginkgo_switch_to_windows_dynamic("CXX")
ginkgo_switch_to_windows_dynamic("C")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
else()
ginkgo_turn_to_windows_static("CXX")
ginkgo_turn_to_windows_static("C")
ginkgo_switch_to_windows_static("CXX")
ginkgo_switch_to_windows_static("C")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS FALSE)
endif()
endif()
Expand All @@ -128,6 +128,7 @@ ginkgo_find_package(GTest "GTest::GTest;GTest::Main" FALSE 1.8.1)
ginkgo_find_package(gflags gflags FALSE 2.2.2)
ginkgo_find_package(RapidJSON rapidjson TRUE 1.1.0)
add_subdirectory(third_party) # Third-party tools and libraries

# Needs to be first in order for `CMAKE_CUDA_DEVICE_LINK_EXECUTABLE` to be
# propagated to the other parts of Ginkgo in case of building as static libraries
if(GINKGO_BUILD_CUDA)
Expand Down
10 changes: 7 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Use the standard cmake build procedure:
mkdir build; cd build
cmake -G "Unix Makefiles" [OPTIONS] .. && make
```
Use `cmake --build .` in some systems like MinGW or Microsoft Visual Studio which do not use `make`.

For Microsoft Visual Studio, use `cmake --build . --config <build_type>` to decide the build type. The possible options are `Debug`, `Release`, `RelWithDebInfo` and `MinSizeRel`.

Replace `[OPTIONS]` with desired cmake options for your build.
Ginkgo adds the following additional switches to control what is being built:

Expand Down Expand Up @@ -82,12 +86,12 @@ Ginkgo adds the following additional switches to control what is being built:
[`ARCHITECTURES` specification list](https://github.com/ginkgo-project/CudaArchitectureSelector/blob/master/CudaArchitectureSelector.cmake#L58)
section in the documentation of the CudaArchitectureSelector CMake module.
* `-DGINKGO_WINDOWS_SHARED_LIBRARY_RELPATH=<path>` where <path> is a relative
path with `PROJECT_BINARY_DIR`. Users must to add the absoulte path
path built with `PROJECT_BINARY_DIR`. Users must add the absolute path
(`PROJECT_BINARY_DIR`/`GINKGO_WINDOWS_SHARED_LIBRARY_RELPATH`) into the
environment variable PATH when building shared libraries and executable
program, default is `windows_shared_library`.
* `-DGINKGO_CHECK_PATH={ON, OFF}` checks the environment variable PATH is valid.
It is valid only when building shared libraries and executable program,
* `-DGINKGO_CHECK_PATH={ON, OFF}` checks if the environment variable PATH is valid.
It is checked only when building shared libraries and executable program,
default is `ON`

For example, to build everything (in debug mode), use:
Expand Down
10 changes: 5 additions & 5 deletions cmake/build_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function(ginkgo_check_shared_library name)
endif()
endfunction()

function(ginkgo_turn_windows_link lang from to)
function(ginkgo_switch_windows_link lang from to)
foreach(flag_var
"CMAKE_${lang}_FLAGS" "CMAKE_${lang}_FLAGS_DEBUG" "CMAKE_${lang}_FLAGS_RELEASE"
"CMAKE_${lang}_FLAGS_MINSIZEREL" "CMAKE_${lang}_FLAGS_RELWITHDEBINFO"
Expand All @@ -88,10 +88,10 @@ function(ginkgo_turn_windows_link lang from to)
endforeach()
endfunction()

macro(ginkgo_turn_to_windows_static lang)
ginkgo_turn_windows_link(${lang} "MD" "MT")
macro(ginkgo_switch_to_windows_static lang)
ginkgo_switch_windows_link(${lang} "MD" "MT")
endmacro()

macro(ginkgo_turn_to_windows_dynamic lang)
ginkgo_turn_windows_link(${lang} "MT" "MD")
macro(ginkgo_switch_to_windows_dynamic lang)
ginkgo_switch_windows_link(${lang} "MT" "MD")
endmacro()
4 changes: 1 addition & 3 deletions cmake/package_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ macro(ginkgo_add_external_target new_target external_name includedir libdir buil
# Since we do not really manage other build types, let's globally use the DEBUG symbols
if(MSVC)
# Only Debug build uses MDd or MTd, and others use MD or MT.
# MSVC would like to use same runtime library, so we use Debug third-party in Debug and Release third-party in Release.
set_target_properties(${new_target} PROPERTIES IMPORTED_LOCATION_DEBUG
${${external_name}_LIBRARY_DEBUG})
# MSVC would like to use same runtime library, so we use Debug third-party in Debug and Release third-party in others.
set_target_properties(${new_target} PROPERTIES IMPORTED_LOCATION
${${external_name}_LIBRARY_RELEASE})
else()
Expand Down
4 changes: 2 additions & 2 deletions cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ endif()
# This is modified from https://gitlab.kitware.com/cmake/community/wikis/FAQ#dynamic-replace
if(MSVC)
if(BUILD_SHARED_LIBS)
ginkgo_turn_to_windows_dynamic("CUDA")
ginkgo_switch_to_windows_dynamic("CUDA")
else()
ginkgo_turn_to_windows_static("CUDA")
ginkgo_switch_to_windows_static("CUDA")
endif()
endif()

Expand Down

0 comments on commit 6527420

Please sign in to comment.