BuildProtobuf VS 2017 설정
CNTK 컴파일된 Protobuf 3.1.0 만들기
CNTK 위해 Protobuf 3.1.0을 직접 빌드하려면 다음 지침을 따르세요. 컴파일된 Protobuf 버전은 에 있습니다. c:\local\protobuf-3.1.0-vs17
- cmake.org CMake를 설치합니다.
- 에서 protobuf 원본을 다운로드하고 압축을 풉니다 https://github.com/google/protobuf/archive/v3.1.0.zip.
다음 단계에서는 Protobuf 원본이 디렉터리 c:\local\src\protobuf-3.1.0
로 압축을 풉니다. 아래 지침은 디렉터리에 Protobuf 라이브러리 및 헤더 파일을 만듭니다 c:\local\protobuf-3.1.0-vs17
. 이 위치가 다른 경우 아래 단계를 디렉터리 구조와 일치하도록 조정하세요.
배치 파일을 통해 또는 수동으로 CNTK Protobuf 라이브러리를 빌드하는 방법에는 두 가지가 있습니다.
일괄 처리 파일을 통해 빌드
디렉터리 Tools\devInstall\Windows
에서 일괄 처리 파일을 buildProtoVS17.bat
찾습니다. 이 일괄 처리 파일은 CNTK Protobuf 라이브러리를 빌드하는 데 두 개의 매개 변수를 사용합니다. 첫 번째 매개 변수는 위에서 압축을 풉진 Protobuf 원본 파일의 디렉터리이고, 두 번째 매개 변수는 생성된 Protobuf 라이브러리의 대상 디렉터리입니다. 이 경우 표준 Windows 명령 프롬프트에서 다음 단계를 수행합니다.
c:
cd \repos\cntk\Tools\devInstall\Windows
buildProtoVS17 C:\local\src\protobuf-3.1.0 C:\local\protobuf-3.1.0-vs17
환경 변수 PROTOBUF_PATH
를 Protobuf 위치로 설정합니다(원본 위치가 아니라 위의 명령 호출에서 두 번째 매개 변수입니다.)
setx PROTOBUF_PATH c:\local\protobuf-3.1.0-vs17
CNTK Protobuf 라이브러리에 대한 수동 빌드 단계
참고
Visual Studio 설치 관리자가 환경 변수를 설정하지 않은 경우 VS2017INSTALLDIR
수동으로 설정합니다. 정확한 설치 디렉터리 버전은 다음 패턴C:\Program Files (x86)\Microsoft Visual Studio\<version>\<offering>
에 따라 Visual Studio 버전(이 경우 2017) 및 제품(Community, Enterprise 등)에 따라 달라집니다.
Visual Studio 2017 Enterprise 버전의 경우 다음을 실행합니다.
setx VS2017INSTALLDIR "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise"
Visual Studio 2017 Community 버전의 경우 다음을 실행합니다.
setx VS2017INSTALLDIR "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
- 64비트 Visual Studio 2017 개발 환경을 시작합니다. 가장 편리한 방법은 표준 Windows 명령 셸에서 필요한 매개 변수를 사용하여 Visual Studio 디렉터리에서 일괄 처리 파일을
vcvarsall.bat
실행하는 것입니다.
"%VS2017INSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" amd64 --vcvars_ver=14.11
시스템에서 이 일괄 처리 파일을 찾을 수 없는 경우 VS2017 설치를 다시 검토하고 'VC++ 버전 15.4 v14.11 도구 집합' 옵션이 선택되어 있는지 확인하세요. 2. 빌드 디렉터리 만들기:
cd C:\local\src\protobuf-3.1.0\cmake
mkdir build && cd build
- 디버그 빌드를 만듭니다.
mkdir debug && cd debug
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DCMAKE_INSTALL_PREFIX="c:\local\protobuf-3.1.0-vs17" ..\..
nmake && nmake install
cd ..
- 릴리스 빌드를 만듭니다.
mkdir release && cd release
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DCMAKE_INSTALL_PREFIX="c:\local\protobuf-3.1.0-vs17" ..\..
nmake && nmake install
cd ..
- 환경 변수
PROTOBUF_PATH
를 Protobuf 위치로 설정합니다(참고: 원본 위치가 아니라 위의 cmake 명령에 사용되는 설치 위치입니다.)
setx PROTOBUF_PATH c:\local\protobuf-3.1.0-vs17