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

Add CMake Support #61

Merged
merged 5 commits into from
Feb 16, 2024
Merged

Add CMake Support #61

merged 5 commits into from
Feb 16, 2024

Conversation

RedSkittleFox
Copy link
Contributor

Added basic CMake support

  • interface (header only) library for atomic_queue
  • option to build samples
  • option to build tests + CTest support
  • gcc/clang linux cmake build

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
Copy link
Contributor Author

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
Copy link
Owner

max0x7ba commented Feb 15, 2024

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
Copy link
Contributor Author

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
Copy link
Owner

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.

@max0x7ba max0x7ba merged commit bc9400c into max0x7ba:master Feb 16, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants