-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build Windows Release with CMake (part 2) #61880
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't seem able to finish configuring this with my setup. Besides the ninja requirement it seems like something else is wrong.
C:\src\Cataclysm-DDA> cmake --preset windows-tiles-sounds-x64-msvc
Preset CMake variables:
CMAKE_BUILD_TYPE="RelWithDebInfo"
CMAKE_INSTALL_PREFIX:PATH="C:/src/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc"
CMAKE_PROJECT_INCLUDE_BEFORE="C:/src/Cataclysm-DDA/build-scripts/windows-tiles-sounds-x64-msvc.cmake"
CMAKE_TOOLCHAIN_FILE:FILEPATH="C:/src/Cataclysm-DDA/build-scripts/MSVC.cmake"
CURSES="False"
DYNAMIC_LINKING="False"
LOCALIZE="True"
TILES="True"
VCPKG_OVERLAY_TRIPLETS="C:/src/Cataclysm-DDA/build-scripts"
VCPKG_TARGET_TRIPLET="x64-windows-static"
CMake Error at build-scripts/VsDevCmd.cmake:39 (cmake_path):
cmake_path undefined variable for input path.
Call Stack (most recent call first):
build-scripts/windows-tiles-sounds-x64-msvc.cmake:24 (include)
CMakeLists.txt:3 (project)
The system cannot find the path specified.
CMake Error at build-scripts/MSVC.cmake:86 (include):
include could not find requested file:
C:/vcpkg/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
out/build/windows-tiles-sounds-x64-msvc/CMakeFiles/3.25.0-rc2/CMakeSystem.cmake:6 (include)
CMakeLists.txt:3 (project)
CMake Error at CMakeLists.txt:3 (project):
Running
'/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe' '--version'
failed with:
The system cannot find the file specified
-- Configuring incomplete, errors occurred!
See also "C:/src/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/CMakeFiles/CMakeOutput.log".
I also suspect the x64-debug config is totally busted and should be deleted. It references a FindVCPKG file which doesn't seem to exist anymore.
Happy to iterate on figuring out what's different about my setup and how to handle it / document whats necessary. For example, it seems to assume vcpkg is at C:\vcpkg
which is not globally true and not true for me either.
It's still not resolving vcpkg correctly. I'm not sure if that's causing the downstream compiler errors or a separate issue.
|
I have moved it into |
Or set |
|
We use |
This env is set by env This logic is at begin of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it seems to build now after I set VCPKG_ROOT
in my env, but the output confuses me. It seems to build with optimizations disabled but with the release CRT. I would expect it to build with optimizations enabled and the release CRT. Is that because that's what RelWithDebInfo
maps to?
Sample build output
Lib:
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\Lib.exe /OUT:"cataclysm-tiles-common.dir\Debug\cataclysm-tiles-co
mmon.lib" /NOLOGO /MACHINE:X64 /machine:x64 "cataclysm-tiles-common.dir\Debug\cmake_pch.obj"
"cataclysm-tiles-common.dir\Debug\achievement.obj"
"cataclysm-tiles-common.dir\Debug\action.obj"
...
C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\CL.exe /c /I"O:\open\personal\Cataclysm-DDA\src" /Zi /nologo /W1
/WX- /diagnostics:column /sdl- /MP /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D _SCL_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_WARNINGS /D WIN32_LEAN_AND_MEAN /D LOCALIZ
E /D USE_VCPKG /D CMAKE /D GIT_VERSION /D RELEASE /D _AMD64_ /D TILES /D BACKTRACE /D USE_HOME_DIR /D CATCH_CONFIG_ENABLE_BENCHMARKING /D "CMAKE_INTDIR=\"Debug\"
" /GF /Gm- /EHsc /RTC1 /MT /GS- /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /std:c++14 /permissive- /Yu"O:/open/personal/Cataclysm-DDA/out/build/windows-
tiles-sounds-x64-msvc/tests/CMakeFiles/cata_test-tiles.dir/Debug/cmake_pch.hxx" /Fp"O:/open/personal/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/tests/
cata_test-tiles.dir/Debug/cmake_pch.pch" /Fo"cata_test-tiles.dir\Debug\\" /Fd"cata_test-tiles.dir\Debug\vc143.pdb" /external:W0 /Gd /TP /wd4068 /wd4146 /wd4819 /
wd6237 /wd6319 /wd26444 /wd26451 /wd26495 /FI"O:/open/personal/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/tests/CMakeFiles/cata_test-tiles.dir/Debug/c
make_pch.hxx" /FC /errorReport:queue /external:I "O:/open/personal/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/vcpkg_installed/x64-windows-static/incl
ude" /external:I "O:/open/personal/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/vcpkg_installed/x64-windows-static/include/SDL2" /external:I "O:/open/pe
rsonal/Cataclysm-DDA/src/third-party" /utf-8 /bigobj "O:\open\personal\Cataclysm-DDA\tests\act_build_test.cpp" "O:\open\personal\Cataclysm-DDA\tests\active_item_
cache_test.cpp" ...
The install step errors out though with
akrieger@d-sov5b34umi MINGW64 /o/open/personal/Cataclysm-DDA
$ cmake --install out/build/windows-tiles-sounds-x64-msvc
-- Install configuration: "Release"
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/de
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/de/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/de/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/es_AR
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/es_AR/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/es_AR/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/es_ES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/es_ES/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/es_ES/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/fr
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/fr/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/fr/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/it_IT
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/it_IT/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/it_IT/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ja
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ja/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ja/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ko
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ko/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ko/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/pt_BR
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/pt_BR/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/pt_BR/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ru
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ru/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/ru/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/zh_CN
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/zh_CN/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/zh_CN/LC_MESSAGES/cataclysm-dda.mo
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/zh_TW
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/zh_TW/LC_MESSAGES
-- Installing: O:/open/personal/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc/lang/mo/zh_TW/LC_MESSAGES/cataclysm-dda.mo
CMake Error at out/build/windows-tiles-sounds-x64-msvc/src/cmake_install.cmake:60 (file):
file INSTALL cannot find
"O:/open/personal/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/src/Release/cataclysm-tiles.exe":
File exists.
Call Stack (most recent call first):
out/build/windows-tiles-sounds-x64-msvc/cmake_install.cmake:42 (include)
'requesting changes' to add the vcpkg instructionss, clarification around expected build configuration, and to debug the install flow.
Edit: here the vimdiff between the the compiler and linker command lines from Release configuration in |
56b4da9
to
20094a2
Compare
It is a problem with the VS/MSBuild generator. It works using Ninja. I will check what can be done. |
I ran the generate and build steps exactly like specified in the doc, so maybe the ninja build does the right thing as far as compile flags, and it's the msbuild generator which mine defaulted to which uses |
If the selected CMake generator supports multi-configuration like Visual Studio, then |
c2980e4
to
996091f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the steps through visual studio but cmake configure didn't manage to finish correctly. I set VCPKG_ROOT correctly as an env var, which let vcpkg try to actually pass, but something isn't working right with the installed packages. Full output is at https://gist.github.com/akrieger/2b91997b4748fc822af742fb25ce3642
1> [CMake] -- Searching for SDL2 library --
1> [CMake] -- Searching for SDL deps libraries --
1> [CMake] -- Found Freetype: C:/code/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/vcpkg_installed/x64-windows-static/lib/freetype.lib (found version "2.11.1")
1> [CMake] -- Found PNG: C:/code/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/vcpkg_installed/x64-windows-static/lib/libpng16.lib (found version "1.6.37")
1> [CMake] -- Searching for SDL2_TTF library --
1> [CMake] CMake Warning at C:/code/vcpkg/scripts/buildsystems/vcpkg.cmake:824 (_find_package):
1> [CMake] By not providing "FindSDL2_ttf.cmake" in CMAKE_MODULE_PATH this project has
1> [CMake] asked CMake to find a package configuration file provided by "SDL2_ttf",
1> [CMake] but CMake did not find one.
1> [CMake]
1> [CMake] Could not find a package configuration file provided by "SDL2_ttf" with any
1> [CMake] of the following names:
1> [CMake]
1> [CMake] SDL2_ttfConfig.cmake
1> [CMake] sdl2_ttf-config.cmake
1> [CMake]
1> [CMake] Add the installation prefix of "SDL2_ttf" to CMAKE_PREFIX_PATH or set
1> [CMake] "SDL2_ttf_DIR" to a directory containing one of the above files. If
1> [CMake] "SDL2_ttf" provides a separate development package or SDK, be sure it has
1> [CMake] been installed.
1> [CMake] Call Stack (most recent call first):
1> [CMake] CMakeLists.txt:296 (find_package)
1> [CMake]
1> [CMake]
1> [CMake] CMake Error at C:\code\Cataclysm-DDA\CMakeLists.txt:298 (message):
1> [CMake] This project requires SDL2_ttf to be installed to compile in graphical
1> [CMake] mode. Please install the SDL2_ttf development libraries, or try compiling
1> [CMake] without -DTILES=1 for a text-only compilation. See
1> [CMake] doc/COMPILING/COMPILING-CMAKE.md for details and more info.
1> [CMake]
I followed the terminal instructions from my msys2 shell and got errors due to not having cl.exe on path.
Andrew@CRUSHER MINGW64 /c/code/Cataclysm-DDA
$ cmake --preset windows-tiles-sounds-x64-msvc
Preset CMake variables:
CMAKE_BUILD_TYPE="RelWithDebInfo"
CMAKE_INSTALL_PREFIX:PATH="C:/code/Cataclysm-DDA/out/install/windows-tiles-sounds-x64-msvc"
CMAKE_PROJECT_INCLUDE_BEFORE="C:/code/Cataclysm-DDA/build-scripts/windows-tiles-sounds-x64-msvc.cmake"
CMAKE_TOOLCHAIN_FILE:FILEPATH="C:/code/Cataclysm-DDA/build-scripts/MSVC.cmake"
CURSES="False"
DYNAMIC_LINKING="False"
LOCALIZE="True"
RELEASE="True"
TILES="True"
VCPKG_OVERLAY_TRIPLETS="C:/code/Cataclysm-DDA/build-scripts"
VCPKG_ROOT="C:/vcpkg"
VCPKG_TARGET_TRIPLET="x64-windows-static"
CMake Error at build-scripts/VsDevCmd.cmake:39 (cmake_path):
cmake_path undefined variable for input path.
Call Stack (most recent call first):
build-scripts/windows-tiles-sounds-x64-msvc.cmake:24 (include)
CMakeLists.txt:3 (project)
The system cannot find the path specified.
-- Running vcpkg install
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x64-windows-static...
All requested packages are currently installed.
Restored 0 packages from C:\Users\Andrew\AppData\Local\vcpkg\archives in 151.1 us. Use --debug to see more details.
Total elapsed time: 3.604 s
The package sdl2 provides CMake targets:
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(main PRIVATE SDL2::SDL2 SDL2::SDL2main SDL2::SDL2-static)
The package sdl2-image provides CMake targets:
find_package(sdl2-image CONFIG REQUIRED)
target_link_libraries(main PRIVATE SDL2::SDL2_image)
The package sdl2-mixer provides CMake targets:
find_package(sdl2-mixer CONFIG REQUIRED)
target_link_libraries(main PRIVATE SDL2::SDL2_mixer)
The package sdl2-ttf provides CMake targets:
find_package(sdl2-ttf CONFIG REQUIRED)
target_link_libraries(main PRIVATE SDL2::SDL2_ttf)
-- Running vcpkg install - done
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_C_COMPILER:
cl.exe
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_CXX_COMPILER:
cl.exe
is not a full path and was not found in the PATH.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/code/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/CMakeFiles/CMakeOutput.log".
See also "C:/code/Cataclysm-DDA/out/build/windows-tiles-sounds-x64-msvc/CMakeFiles/CMakeError.log".
I ran the terminal instructions from a VS developer command prompt which then encountered the same "Searching for SDL2_TTF library" error.
My vcpkg repo is at commit 659b6b5eeacb50ffe25856413960d231ce1a4b58
which is the same one specified in the cdda docs.
CMakeParseArguments.cmake since v3.4 CMakePushCheckState.cmake since v2.8.6 CheckLibraryExists since v2.8.2 FindCurses since v3.21.0 FindPackageHandleStandardArgs since v3.1.0 FindPackageMessage since v3.0.0
Co-authored-by: akrieger <[email protected]>
d7e9532
to
7bdd560
Compare
So I did a kind of
|
73893ed
to
8ccb212
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visual studio cmake flow seems to work. I can build, install, and launch. CI cmake flows don't seem broken. I think fixing install to include sound so at least the Basic soundpack is there would be good but functionally the build seems to be all there.
@alef I'll wait to see if you include sound in the install or tell me you'll pass, then I'll post this for ready-to-merge.
🎉 |
Summary
None
Purpose of change
Try to align CMake build to match the release.
Describe the solution
CMakeModules/
release.yml
names for presets and scriptsvswhere.exe
More details in commits comments.
Describe alternatives you've considered
Testing
It builds locally on VS 2022
Additional context
Part of discarded #60159