DirectX-Headers
DirectX-Headers copied to clipboard
issues with cmake build system
I have two big issues with the cmake build for DirectX-Headers when building for mingw-w64 in MSYS2 (a CygWin derivative).
-
The CMakeLists.txt file needs to be updated to fix that rpc number issue so libraries such as DirectXTex can be built in mingw. DirectXTex uses CMake's "find_package" and that fails if only Meson was used to build the DirectX-Headers. I have created a patch to fix that issue for CMakeLists.txt and it's simply a line such as "elseif((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))" in the "if (NOT WIN32)" block.
-
The CMakeLists.txt needs to generate a "DirectX-Headers.pc" pkg-config file just like the building with Meson does. That is how Mesa's build script can detect the presence of the DirectX-Headers. and I suspect that other build systems such as Autoconf do something similar with package config files.
Incidentally, I noticed an inconsistency between what is done with Meson and CMake. If you build with mesa, one of the two static libraries is "ibd3dx12-format-properties.a" but if you build with CMake, that file is "libDirectX-Headers.a".
If you build with mesa, one of the two static libraries is "ibd3dx12-format-properties.a" but if you build with CMake, that file is "libDirectX-Headers.a".
Right, CMake's concept of a static library with header dependencies isn't something that meson really has. So for CMake, we just say that the DirectX-Headers
static library is the dependency that's exported, and the additional includes are a PUBLIC
property of that, but for meson, a dependency object is needed. The dependency object is named DirectX-Headers
and includes the include paths and references to the relevant C++ files as static libraries.
The introduction of DirectX-Headers.pc
breaks VCPKG:
warning: There should be no absolute paths, such as the following, in an installed package:
D:\vcpkg\packages\directx-headers_x64-windows
D:\vcpkg\installed
D:\vcpkg\buildtrees\directx-headers
D:\vcpkg\downloads
Absolute paths were found in the following files:
D:\vcpkg\packages\directx-headers_x64-windows\debug\lib\pkgconfig\DirectX-Headers.pc
D:\vcpkg\packages\directx-headers_x64-windows\lib\pkgconfig\DirectX-Headers.pc
error: Found 1 post-build check problem(s). To submit these ports to curated catalogs, please first correct the portfile: D:\vcpkg\ports\directx-headers\portfile.cmake