max0x7ba / atomic_queue

C++ lockless queue.
MIT License
1.47k stars 176 forks source link

Add CMake Support #61

Closed RedSkittleFox closed 6 months ago

RedSkittleFox commented 7 months ago

Added basic CMake support

Because of the way dependencies are set up in benchmarking I did not implement benchmark target. Those could be implemented with either cmake's install + find_package or with FetchContent if respective libraries use CMake and are small enough.

Boost, which is used by the test target, is found using find_opackage. This causes some issues on Windows - the easiest way to get it to work on windows is by using vcpkg. To mitigate it, it would be the best to replace boost-test with google-test, which can be easily downloaded and installed per-repo with fetch_content.

RedSkittleFox commented 7 months ago

I will create Windows fix (conditional pthreads) once this is accepted, there is currently no way to build this on Windows (unless we use MinGW or something to build from make files). pthreads are only included by test target or manually if someone wants to use spinlock.

max0x7ba commented 6 months ago

What problem does your CMake support tries to solve?

You can run Ubuntu natively in Windows and build Linux projects without having to write or change a line of code. https://ubuntu.com/desktop/wsl

Boost is a number one dependency in all C++ projects I worked on since year 2004. Asking to ditch Boost and change code is an absurd request, in my opinion.

CMake was created with a goal of being able to build C++ projects on different platforms. CMake support would need to be able to build tests and benchmarks on Windows to fulfil its purpose. Conan package manager solves the problem of acquiring libraries and making them available in CMake.

RedSkittleFox commented 6 months ago

What problem does your CMake support tries to solve?

The goal is to build natively on Windows and support CMake build systems without requiring 3rd party package managers or manual CMake configurations, even if this is just a header-only library.

You can run Ubuntu natively in Windows and build Linux projects without having to write or change a line of code.

Yes, that doesn't however solve the problem of targeting Windows natively.

Boost is a number one dependency in all C++ projects I worked on since year 2004. Asking to ditch Boost and change code is an absurd request, in my opinion.

That's fair. I proposed it as a way of getting around having to install 3rd party dependencies manually or using external package managers.

CMake was created with a goal of being able to build C++ projects on different platforms. CMake support would need to be able to build tests and benchmarks on Windows to fulfil its purpose. Conan package manager solves the problem of acquiring libraries and making them available in CMake.

I can work on bringing the benchmark target to CMake and making it work on Windows. The main goal for me was to port the library and test targets to CMake.

max0x7ba commented 6 months ago

What problem does your CMake support tries to solve?

The goal is to build natively on Windows and support CMake build systems without requiring 3rd party package managers or manual CMake configurations, even if this is just a header-only library.

Ah, I see now.

You can run Ubuntu natively in Windows and build Linux projects without having to write or change a line of code.

Yes, that doesn't however solve the problem of targeting Windows natively.

Fair enough.

Boost is a number one dependency in all C++ projects I worked on since year 2004. Asking to ditch Boost and change code is an absurd request, in my opinion.

That's fair. I proposed it as a way of getting around having to install 3rd party dependencies manually or using external package managers.

Fine, amputate boost.

CMake was created with a goal of being able to build C++ projects on different platforms. CMake support would need to be able to build tests and benchmarks on Windows to fulfil its purpose. Conan package manager solves the problem of acquiring libraries and making them available in CMake.

I can work on bringing the benchmark target to CMake and making it work on Windows. The main goal for me was to port the library and test targets to CMake.

Okay, benchmarks can be a tall order.