build.bat
:
@echo off
setlocal
if not exist build (
mkdir build
)
pushd build
conan install .. --output-folder=. --build=missing
cmake .. -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build .
copy compile_commands.json ..
template.exe
popd
endlocal
conanfile.txt
:
[requires]
glfw/3.4
glew/2.2.0
[generators]
CMakeDeps
CMakeToolchain
command ran
:
$ ./build.bat
log
:
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
conanfile.txt: C:/Development/C++/Graphics/GLFW/Template/conanfile.txt
Requirements
glew/2.2.0#162c9c4b82b196eed6de22764f658d87 - Cache
glfw/3.4#41cc24c744dc4c80571f5dd10dcd9cda - Cache
glu/system#a5189f60c8270ac97ed29d7f36fffe39 - Cache
opengl/system#7c02ea6ef926fd04844af53622a30541 - Cache
======== Computing necessary packages ========
glfw/3.4: Main binary package 'f4d6c37328d2efda18b0804ee64fe81ef802cc45' missing
glfw/3.4: Checking 1 compatible configurations
glfw/3.4: Found compatible package '5d7bb7439775dff9366a392feeb8baeb292a334c': compiler.version=193
glew/2.2.0: Main binary package 'f11bd165005b7981a60f77e1c132942d5ee0d2e1' missing
glew/2.2.0: Checking 1 compatible configurations
glew/2.2.0: Found compatible package '0e5e5c22ac81ba92a302488392437424e738e2e0': compiler.version=193
Requirements
glew/2.2.0#162c9c4b82b196eed6de22764f658d87:0e5e5c22ac81ba92a302488392437424e738e2e0#298f7914ca2070a14a20936e0c7ca46a - Cache
glfw/3.4#41cc24c744dc4c80571f5dd10dcd9cda:5d7bb7439775dff9366a392feeb8baeb292a334c#d9ef14f70af6c5758e682c60edf04983 - Cache
glu/system#a5189f60c8270ac97ed29d7f36fffe39:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
opengl/system#7c02ea6ef926fd04844af53622a30541:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
======== Installing packages ========
opengl/system: Already installed! (1 of 4)
glfw/3.4: Already installed! (2 of 4)
glu/system: Already installed! (3 of 4)
glew/2.2.0: Already installed! (4 of 4)
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated: 'cpp_info.filenames' used in: opengl/system
======== Finalizing install (deploy, generators) ========
conanfile.txt: Writing generators to C:/Development/C++/Graphics/GLFW/Template/build
conanfile.txt: Generator 'CMakeDeps' calling 'generate()'
conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt
find_package(glfw3)
find_package(glew)
target_link_libraries(... glfw GLEW::GLEW)
conanfile.txt: Generator 'CMakeToolchain' calling 'generate()'
conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake
conanfile.txt: CMakeToolchain: Preset 'conan-default' added to CMakePresets.json.
(cmake>=3.23) cmake --preset conan-default
(cmake<3.23) cmake <path> -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW
conanfile.txt: CMakeToolchain generated: C:/Development/C++/Graphics/GLFW/Template/build/CMakePresets.json
conanfile.txt: CMakeToolchain generated: C:/Development/C++/Graphics/GLFW/Template/CMakeUserPresets.json
conanfile.txt: Generating aggregated env files
conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully
-- Using Conan toolchain: C:/Development/C++/Graphics/GLFW/Template/build/conan_toolchain.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: Setting CMAKE_MSVC_RUNTIME_LIBRARY=$<$<CONFIG:Release>:MultiThreadedDLL>
-- Conan toolchain: C++ Standard 14 with extensions OFF
CMake Error at CMakeLists.txt:2 (project):
Generator
MinGW Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
CMake Error:
Generator
MinGW Makefiles
does not support platform specification, but platform
x64
was specified.
The system cannot find the file specified.
'template.exe' is not recognized as an internal or external command,
operable program or batch file.
The Conan profile is not aligned with your current compiler or generator. To use MinGW, the Conan profile should be something like:
[settings]
os=Windows
arch=x86_64
compiler=gcc
compiler.version=11
compiler.libcxx=libstdc++11
...
Depending of what you have in the PATH, you might need to add the compiler path, etc, to the environment:
[buildenv]
PATH=+(path)C:/path/to/my/mingw/bin
For further details, including how MinGW from a Conan package with a tool_requires
can be done see this page