KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
887 stars 232 forks source link

Missing version.h #550

Closed ilyachastikov closed 2 years ago

ilyachastikov commented 2 years ago

I try to build KTX-Software with Visual Studio and get error "No sush file or directory version.h"

MarkCallow commented 2 years ago

The version.h files are created at build time by mkversion from the output of git describe. If you open the solution file you will see various *_version projects such as ktx_version which create the files and are dependencies of the target for which they are creating a version.h. Did you perhaps pick "Project Only->Build Only" to build a project? If not, were there any errors before the "No such file or directory" error?

Our CI builds with VS 2015, VS 2017 and VS 2019 are all working. Which version of VS are you using? What are you trying to build?

ilyachastikov commented 2 years ago

I use VS 2022. I try to build 'ALL_BUILD'. There are some errors before:
Error MSB8066 Custom build for 'D:\libBin\KTX-Software-4.0.0\build\CMakeFiles\8732717486b7215cf74288d800338a7f\version.h.rule;D:\libBin\KTX-Software-4.0.0\build\CMakeFiles\b6b2e403e0e2c13cae2822dc517ae659\toktx_version.rule;D:\libBin\KTX-Software-4.0.0\tools\toktx\CMakeLists.txt' exited with code 1. toktx_version

Error MSB6006 "CL.exe" exited with code 2. ktxsc C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets 700

Error MSB6006 "link.exe" exited with code 1104. transcodetests C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets 1092

Error LNK1104 cannot open file '....\Debug\ktx.lib' transcodetests D:\libBin\KTX-Software-4.0.0\build\tests\transcodetests\LINK 1

MarkCallow commented 2 years ago

The ALL_BUILD project doesn't work in VS. Unfortunately I am not well enough versed in CMake to know how to fix it.

Set your default project to one of the others, e.g. ktx2check and do a build (^B). It will build all the projects.

ilyachastikov commented 2 years ago

I tried to build any other project - the same fail result. *_version projects failed to build with error like this: 'D:\libBin\KTX-Software-4.0.0\build\CMakeFiles\8533b9eb68d09c03937384399dc59902\version.h.rule;D:\libBin\KTX-Software-4.0.0\build\CMakeFiles\c1666dd797410166ce6d55e0451f2c1c\ktx_version.rule;D:\libBin\KTX-Software-4.0.0\CMakeLists.txt' exited with code 1.
I think this means that it can't to generate version.h file.

ilyachastikov commented 2 years ago

I found cause of the problem. I have not install linux distro to WSL. Now all compile fine. Thank you.

MarkCallow commented 2 years ago

I found cause of the problem. I have not install linux distro to WSL. Now all compile fine. Thank you.

Great. Sorry for the hassle. mkversion is a bash script. Many Windows users obtain their git via Git for Windows which includes bash. WSL+linux is another way to get it as is cygwin. I will add a note to BUILDING.md about this.