Skip to content
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

Using the library from Visual Studio implies manually adding the include folder #55

Open
cosmin42 opened this issue Oct 2, 2023 · 3 comments

Comments

@cosmin42
Copy link

cosmin42 commented Oct 2, 2023

When using the library from vcpkg along with VIsual Studio, the include path has to be added manually which should not be necessary.
Most of the vcpkg libraries have their include files directly under the include folder, while dp-thread pool have them under include\thread-pool-0.6.2 .

The solution is suggested here: microsoft/vcpkg#34140

Here https://github.com/DeveloperPaul123/thread-pool/blob/079c447bbc011038705383f30acf83e011f407e4/CMakeLists.txt#L131C21-L131C83

DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}-${PROJECT_VERSION}/thread_pool
should be
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/thread_pool

The same for the other install command.

I can attempt a pull request if agreed.

Thank you.

@DeveloperPaul123
Copy link
Owner

Interesting, thanks for reporting this.

Are you not using CMake or the CMake target? I'm curious as to how thread-pool is being included.

@cosmin42
Copy link
Author

cosmin42 commented Oct 2, 2023

The easiest way to notice the problem is to install other vcpkg packages. We can notice that all the .h files and subdirectories (thread-pool folder is the equivalent here) are found directly under vcpkg\installed\x64-windows\include. The thread-pool library is found under vcpkg\installed\x64-windows\include\vcpkg\installed\x64-windows\include\thread-pool-0.6.2.
This can be noticed by simply installing the package.

Here is how I'm using the library:

I'm installing the threadpool from vcpkg, then I'm including it in a library this way: https://github.com/cosmin42/cpp-photobook/blob/main/PB/CMakeLists.txt .

That library is then referenced in a visual studio project after it is built with -DCMAKE_TOOLCHAIN_FILE=${PATH_TO}/vcpkg/scripts/buildsystems/vcpkg.cmake

At this point we should be able to build the Visual Studio project, however, for thread-pool, an additional step is needed in order to build: Adding the include folder manually to Visual Studio.

If this is still not clear I think I can do a sample example.

@DeveloperPaul123
Copy link
Owner

Hmm, this should work since you are linking to dp::thread-pool. This should automatically pull in the include directory without the need to add it specifically to visual studio.

I'll have to investigate a bit further.

I guess a simple solution would be to do what you propose since having multiple versions of the thread pool side by side is likely not to happen.

I'd be open to a PR if you're willing to file it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants