Skip to content

JayTwoLab/conan-msvc-linux_gcc-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

์ฝ”๋‚œ ํ”„๋กœ์ ํŠธ ๋นŒ๋“œ ๋ช…๋ น

์‚ฌ์ „ ์„ค์น˜

  • Windows : Visual Studio (2022), cmake, ninja
  • Linux : gcc, cmake, ninja

ํ”„๋กœ์ ํŠธ ์„ค์ •

  • conanfile.txt
[requires]
boost/1.84.0

[options]
boost/*:shared=False

[generators]
CMakeToolchain
CMakeDeps

Visual Studio 2022

์ฝ”๋‚œ ํ”„๋กœํ•„ ํŒŒ์ผ์„ ์‚ฌ์ „์— ์ƒ์„ฑํ•œ๋‹ค.

  • 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
  • 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

  • Release ๋นŒ๋“œ
# msvc cmd ์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ช…๋ น๋“ค์„ ์‹คํ–‰ํ•œ๋‹ค. 

cmake -E rm -rf build-msvc-release
# build-msvc ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ์กด์žฌ ์—ฌ๋ถ€์™€ ๊ด€๊ณ„์—†์ด, ํ•˜์œ„ ๋‚ด์šฉ๊นŒ์ง€ ์ „๋ถ€ ์‚ญ์ œ

conan install . ^
 -pr:h %USERPROFILE%\.conan2\profiles\msvc_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\conan_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๋กœ ์„ค์ •๋œ ๊ฒฝ์šฐ, ๋ฆด๋ฆฌ์ฆˆ๋กœ ๋นŒ๋“œํ•˜์—ฌ์•ผ ํ•จ.
  • Debug ๋นŒ๋“œ
cmake -E rm -rf build-msvc-debug

conan install . ^
  -pr:h %USERPROFILE%\.conan2\profiles\msvc_debug ^
  -pr:b default ^
  -of build-msvc-debug ^
  --build=missing

cmake -S . -B build-msvc-debug ^
  -DCMAKE_TOOLCHAIN_FILE=build-msvc-debug\conan_toolchain.cmake ^
  -G "Visual Studio 17 2022"

cmake --build build-msvc-debug --config Debug


Rocky Linux 8 x86_64

  • /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
  • 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

About

๐Ÿ“ฆ conan ๋นŒ๋“œ (Visual Studio 2022, Rocky Linux 8)

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published