microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++
https://walbourn.github.io/directxtk/
MIT License
2.57k stars 511 forks source link

Add vcpkg installation instructions #212

Closed NancyLi1013 closed 3 years ago

NancyLi1013 commented 4 years ago

directxtkis available as a port in vcpkg, a C++ library manager that simplifies installation for directxtkand other project dependencies. Documenting the install process here will help users get started by providing a single set of commands to build directxtk, ready to be included in their projects.

We also test whether our library ports build in various configurations (dynamic, static) on various platforms (Windows: x86, x64, arm, uwp) to keep a wide coverage for users. Note: Currently it only supports dynamic build on Windows.

I'm a maintainer for vcpkg, and here is what the port script looks like. We try to keep the library maintained as close as possible to the original library.

I'm trying to add vcpkg installation instructions but I couldn't find the related docs in code item except for on Wikipage.

Could you please help add the following contents to this port?

Installing and building directxtk via vcpkg

You can download and install directxtk using the vcpkg dependency manager:

  git clone https://github.com/Microsoft/vcpkg.git
  cd vcpkg
  ./bootstrap-vcpkg.sh
  ./vcpkg integrate install
  vcpkg install directxtk 

The directxtk port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.

Thanks, Nancy

walbourn commented 4 years ago

The general issue here is that my library is STATIC only. DYNAMIC doesn't make sense at all for this particular library. When will vcpkg support STATIC only libraries?

NancyLi1013 commented 4 years ago

Hi @walbourn Thanks for posting this issue. DirectXTK currently only supports dynamic CRT linkage in vcpkg. As for the support static library, we will consider to add it in the near future but I'm not sure the specific time.

AraHaan commented 4 years ago

I would love for dxtk to support the static crt as well. Static libraries are the best because then I do not have to distribute like 10k+ dlls with my program if it could be cut down to 10 dlls or less😄.

Sadly wish the same could be said for the direct x dlls themselves and being able to static link to the old d3dx libs instead of depending on an dll for them as well.

But then again if the code that generated the old d3dx.lib files from the old legacy dxsdk was open source I would be happy on that one and make my own copy of those libs that static links inside of my programs 🤣.

walbourn commented 3 years ago

This seems to have been addressed already:

https://github.com/microsoft/vcpkg/pull/14539/files/34d427842e6b20978e3bc31f5e28dd61f8ee75fd#diff-7d7290a71bd89ed078331ab71242db298ae7af430cb3b0c4b2a5c4e016be668f

NancyLi1013 commented 3 years ago

@walbourn

The above link is about the new version update for directxtk. But this issue is aimed to add vcpkg installation instructions for directxtk. I think this is not done yet.

walbourn commented 3 years ago

I'm looking at those instructions now... It looks like the main problem is after installing it, I'm not sure how you "find" the library. Looks like I need to author a FindDirectXTK.cmake or a DirectXTK-config.cmake, but I've not really done that before. The internet is of course rife with overly complex examples :(

NancyLi1013 commented 3 years ago

@walbourn

Thanks for your focus on this issue. Factually, this is just instructions that can help you users know about how to install DirectXTK via vcpkg. We need your help to add this instructions to a document for DirectXTK.

For the usage of DirectXTK, it seems like a feature for DirectXTK, which can be implemented in the near future.

Thanks for your support and help.

walbourn commented 3 years ago

OK. I've added this section to each of my wiki pages for directxtk, directxtk12, directxmesh, and directxtex.

Opened this issue for the find_package issue.

walbourn commented 3 years ago

@NancyLi1013

Can you take a look at these PRs where I add support for find_package to my GitHub projects that are in vcpkg?

https://github.com/microsoft/DirectXMesh/pull/51

https://github.com/microsoft/DirectXTex/pull/205

https://github.com/microsoft/DirectXTK/pull/248

https://github.com/microsoft/DirectXTK12/pull/85

NancyLi1013 commented 3 years ago

@walbourn

Thanks for your fast action. It's so awesome.

Factually, how to use these ports via find_package() is not a required thing in vcpkg, but it is quite great for users.

We will update these changes to vcpkg if these PRs are merged to your project. The usage will be included to vcpkg automatically. So it's unnecessary to add it to your Github projects in vcpkg.

But you can add this to a document on Wiki or readme if you like.

walbourn commented 3 years ago

@NancyLi1013 as far as I can tell, if the vcpkg versions of my libs are going to be easily consumable from cmake, this work is really needed. If you or someone else on your team is a cmake expert, I'd appreciate any feedback you can on these four PRs.

I was going to see about updating the vcpkg directly so I can try to verify this actually works in practice. Is there something that needs to be done to the vcpkg ports to pick up the new 'cmake' files?

walbourn commented 3 years ago

@NancyLi1013

https://github.com/microsoft/vcpkg/pull/15210

https://github.com/microsoft/DirectXTK/wiki/DirectXTK#using-the-vcpkg-c-library-manager

https://github.com/microsoft/DirectXTK/wiki/Adding-the-DirectX-Tool-Kit#cmake-projects

https://github.com/microsoft/DirectXTK12/wiki/DirectXTK#using-the-vcpkg-c-library-manager

https://github.com/microsoft/DirectXTK12/wiki/Adding-the-DirectX-Tool-Kit#cmake-projects

https://github.com/microsoft/DirectXTex/wiki/DirectXTex#using-the-vcpkg-c-library-manager

https://github.com/microsoft/DirectXMesh/wiki/DirectXMesh#using-the-vcpkg-c-library-manager

https://github.com/microsoft/UVAtlas/wiki/UVAtlas#using-the-vcpkg-c-library-manager

NancyLi1013 commented 3 years ago

@walbourn

Thanks for your these work. It looks great.

These four PRs look good for us now. We will ask for help from you to update or change if there is something that needs to be done in the future.

I noticed that my colleague @ JackBoosY has helped you to reviewed this PR microsoft/vcpkg#15210. He has more experience than I. So you can ask for help from him if you have any concerns.