Mercurial > hg > orthanc-stone
changeset 548:d10a295b607a ct-pet-dose-struct
Added /MP option to cmakefile and improved readme with Windows command lines for configure/build
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 02 Apr 2019 13:27:51 +0200 |
parents | 0f43e479b49c |
children | 1d9deb4ee84c |
files | Applications/Samples/CMakeLists.txt README.md |
diffstat | 2 files changed, 40 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Applications/Samples/CMakeLists.txt Tue Apr 02 11:54:28 2019 +0200 +++ b/Applications/Samples/CMakeLists.txt Tue Apr 02 13:27:51 2019 +0200 @@ -12,6 +12,20 @@ add_definitions(-DOPENSSL_NO_CAPIENG=1) endif() + +# the following block has been borrowed from orthanc/**/Compiler.cmake +if (MSVC_MULTIPLE_PROCESSES) +# "If you omit the processMax argument in the /MP option, the +# compiler obtains the number of effective processors from the +# operating system, and then creates one process per effective +# processor" +# https://blog.kitware.com/cmake-building-with-all-your-cores/ +# https://docs.microsoft.com/en-us/cpp/build/reference/mp-build-with-multiple-processes +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") +endif() + + #set(ENABLE_DCMTK ON) set(ENABLE_SDL OFF CACHE BOOL "Target SDL Native application")
--- a/README.md Tue Apr 02 11:54:28 2019 +0200 +++ b/README.md Tue Apr 02 13:27:51 2019 +0200 @@ -137,15 +137,27 @@ ~/orthanc-stone/Applications/Samples/ ``` -**Ninja generator with static build (typical under Windows)** +**Ninja generator with static SDL build (pwsh script)** ``` # Please yourself one level above the orthanc-stone and orthanc folders -mkdir -p stone_build_sdl +if( -not (test-path stone_build_sdl)) { mkdir stone_build_sdl } cd stone_build_sdl cmake -G Ninja -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT="$($pwd)\..\orthanc" -DALLOW_DOWNLOADS=ON -DENABLE_SDL=ON ../orthanc-stone/Applications/Samples/ ``` +**Visual Studio 2017 generator with static SDL build (pwsh script)** + +``` +# The following will use Visual Studio 2017 to build the SDL samples +# in debug mode (with multiple compilers in parallel). NOTE: place +# yourself one level above the `orthanc-stone` and `orthanc` folders + +if( -not (test-path stone_build_sdl)) { mkdir stone_build_sdl } +cd stone_build_sdl +cmake -G "Visual Studio 15 2017 Win64" -DMSVC_MULTIPLE_PROCESSES=ON -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT="$($pwd)\..\orthanc" -DALLOW_DOWNLOADS=ON -DENABLE_SDL=ON ../orthanc-stone/Applications/Samples/ +cmake --build . --config Debug +``` If you are working on Windows, add the correct generator option to cmake to, for instance, generate msbuild files for Visual Studio. @@ -160,18 +172,28 @@ Building the Qt native samples (SimpleViewer only) under Windows: ------------------------------------------------------------------ -**MSVC 2017 generator with static build (typical under Windows)** +**Visual Studio 2017 generator with static Qt build (pwsh script)** For instance, if Qt is installed in `C:\Qt\5.12.0\msvc2017_64` ``` -cmake -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DCMAKE_PREFIX_PATH=C:\Qt\5.12.0\msvc2017_64 -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT="$($pwd)\..\orthanc" -DALLOW_DOWNLOADS=ON -DENABLE_QT=ON -G "Visual Studio 15 2017 Win64" ../orthanc-stone/Applications/Samples/ +# The following will use Visual Studio 2017 to build the SDL samples +# in debug mode (with multiple compilers in parallel). NOTE: place +# yourself one level above the `orthanc-stone` and `orthanc` folders + +if( -not (test-path stone_build_qt)) { mkdir stone_build_qt } +cd stone_build_qt +cmake -G "Visual Studio 15 2017 Win64" -DMSVC_MULTIPLE_PROCESSES=ON -DSTATIC_BUILD=ON -DOPENSSL_NO_CAPIENG=ON -DCMAKE_PREFIX_PATH=C:\Qt\5.12.0\msvc2017_64 -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT="$($pwd)\..\orthanc" -DALLOW_DOWNLOADS=ON -DENABLE_QT=ON ../orthanc-stone/Applications/Samples/ +cmake --build . --config Debug ``` Note: replace `$($pwd)` with the current directory when not using Powershell + + + Building the SDL native samples (SimpleViewer only) under Windows: ------------------------------------------------------------------ `cmake -DSTATIC_BUILD=ON -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT="$($pwd)\..\orthanc" -DALLOW_DOWNLOADS=ON -DENABLE_SDL=ON -G "Visual Studio 15 2017 Win64" ../orthanc-stone/Applications/Samples/`