Conan ํ๋ก์ ํธ ๋น๋ ๋ช
๋ น
Windows : Visual Studio (2022 or higher) , cmake , ninja
Linux : gcc (g++) , cmake , ninja
conanfile.txt ํ์ผ ์์ฑ
[requires]
boost/1.84.0
[options]
boost/*:shared =False
[generators]
CMakeToolchain
CMakeDeps
์์ ๊ฒฝ์ฐ boost ๋ฒ์ 1.84.0 ์ ์ฌ์ฉ
์ฝ๋ ํ๋กํ ํ์ผ์ ์ฌ์ ์ ์์ฑํ๋ค.
๋ฆด๋ฆฌ์ฆ ๋น๋๋ฅผ ์ํ ์ค์ ํ์ผ ์์ฑ: C:\Users\<user>\.conan2\profiles\msvc_release (<user>๋ ๊ฐ์ธ ๊ณ์ )
[settings]
os =Windows
arch =x86_64
build_type =Release
compiler =msvc
compiler.version =194
compiler.runtime =dynamic
compiler.runtime_type =Release
compiler.cppstd =17
[conf]
tools.cmake.cmaketoolchain:generator =Ninja
compiler.version
Visual Studio ๋ฒ์ + ์ ํ ๋ฒ์ (MSVC Toolset), Conan compiler.version
Visual Studio 2026, 195
Visual Studio 2022 17.10~, 194
Visual Studio 2022 17.0~17.9, 193
Visual Studio 2019, 192
Visual Studio 2017, 191
Visual Studio 2015, 190
cl ๋ช
๋ น์ ์
๋ ฅํ๋ฉด ํ์๋๋ ๋ฒ์ ์ ์์ 3์๋ฆฌ ๊ฐ: ์> 19.50.35725 ์ด๋ฉด 195 ๋ฅผ ์ฌ์ฉ
๋๋ฒ๊น
๋น๋๋ฅผ ์ํ ์ค์ ํ์ผ ์์ฑ: C:\Users\<user>\.conan2\profiles\msvc_debug
[settings]
os =Windows
arch =x86_64
build_type =Debug
compiler =msvc
compiler.version =194
compiler.runtime =dynamic
compiler.runtime_type =Debug
compiler.cppstd =17
[conf]
tools.cmake.cmaketoolchain:generator =Ninja
Visual Studio์ธ ๊ฒฝ์ฐ Release ๋น๋ ์ ์ฐจ
# msvc cmd ์์ ๋ค์๊ณผ ๊ฐ์ ๋ช
๋ น๋ค์ ์คํํ๋ค.
cmake -E rm -rf build-msvc-release
# build-msvc ๋๋ ํฐ๋ฆฌ๋ฅผ ์กด์ฌ ์ฌ๋ถ์ ๊ด๊ณ์์ด, ํ์ ๋ด์ฉ๊น์ง ์ ๋ถ ์ญ์
conan install . ^
-pr:h %USERPROFILE%\. conan2\p rofiles\m svc_release ^
-pr:b default ^
-of build-msvc-release ^
--build=missing
# conan install . : ํ์ฌ ๋๋ ํฐ๋ฆฌ(.)์ ์๋ conanfile.txt ๋๋ conanfile.py๋ฅผ ๊ธฐ์ค
# -pr:h %USERPROFILE%\.conan2\profiles\msvc_release : host profile ์ง์
# -pr:b default : ๋ณดํต host์ ๋์ผํ๋ฉด default๋ฅผ ์ฌ์ฉ
# -of build-msvc-release : Conan์ด ์์ฑํ๋ ํ์ผ๋ค์ build-msvc-release ๋๋ ํฐ๋ฆฌ์ ์ถ๋ ฅ
# --build=missing : ๋ก์ปฌ ์บ์์ ์๋ ํจํค์ง๋ ์์ค์์ ๋น๋. ์ด๋ฏธ ์บ์์ ์์ผ๋ฉด ๋น๋ํ์ง ์์.
cmake -S . ^
-B build-msvc-release ^
-DCMAKE_TOOLCHAIN_FILE=build-msvc\c onan_toolchain.cmake ^
-G " Visual Studio 17 2022"
# -S . : ํ์ฌ ๋๋ ํฐ๋ฆฌ(.)์ CMakeLists.txt๊ฐ ์์
# -B build-msvc : CMake ๊ฒฐ๊ณผ๋ฌผ์ build-msvc์ ์์ฑ
# -DCMAKE_TOOLCHAIN_FILE=build-msvc\conan_toolchain.cmake :
cmake --build build-msvc-release --config Release
# --build build-msvc-release : build-msvc-release ๊ฒฝ๋ก ๋น๋
# --config Release : ํ๋กํ ํ์ผ(msvc_release)์ Release๋ก ์ค์ ๋ ๊ฒฝ์ฐ, ๋ฆด๋ฆฌ์ฆ๋ก ๋น๋ํ์ฌ์ผ ํจ.
Visual Studio์ธ ๊ฒฝ์ฐ Debug ๋น๋ ์ ์ฐจ
cmake -E rm -rf build-msvc-debug
conan install . ^
-pr:h %USERPROFILE%\. conan2\p rofiles\m svc_debug ^
-pr:b default ^
-of build-msvc-debug ^
--build=missing
cmake -S . -B build-msvc-debug ^
-DCMAKE_TOOLCHAIN_FILE=build-msvc-debug\c onan_toolchain.cmake ^
-G " Visual Studio 17 2022"
cmake --build build-msvc-debug --config Debug
๋ฆด๋ฆฌ์ฆ ๋น๋๋ฅผ ์ํ ์ค์ ํ์ผ ์์ฑ: /home/<user>/.conan2/profiles/linux_gcc_release
[settings]
os =Linux
arch =x86_64
compiler =gcc
compiler.version =8
compiler.libcxx =libstdc++11
build_type =Release
[conf]
tools.cmake.cmaketoolchain:generator =Ninja
gcc/linux ์์ Release ๋น๋
cmake -E rm -rf build-linux-gcc-release
conan install . \
-pr:h ~ /.conan2/profiles/linux_gcc_release \
-pr:b default \
-of build-linux-gcc-release \
--build=b2* \
--build=missing
# b2์ ์ข
์์ฑ ๋ฌธ์ ๊ฐ ์์ ๊ฒฝ์ฐ๋ฅผ ๋๋นํ์ฌ b2๋ ๋น๋ํจ
cmake -S . \
-B build-linux-gcc-release \
-DCMAKE_TOOLCHAIN_FILE=build-linux-gcc/conan_toolchain.cmake \
-G " Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release
cmake --build build-linux-gcc-release --config Release