wx257osn2 / qoixx

Single Header Quite Fast QOI(Quite OK Image Format) Implementation written in C++20
MIT License
36 stars 6 forks source link

Add Basic CMake Support, Fix Conversion Test Compilation #28

Open cullvox opened 5 months ago

cullvox commented 5 months ago

In one of my projects I'm working on it's useful to have support for CMake. I am using CPM, and to easily add a small library like this I think it might be useful to have some CMake support. What I added is just an interface library for the header and also compiling the test cases.

Usage of the overload template helper in the conversion test, was causing a compiler error when using AppleClang.

wx257osn2 commented 4 months ago

@cullvox

cullvox commented 4 months ago
cmake_minimum_required(VERSION 3.14)
project(qoixx_sample LANGUAGES CXX)

include(CMake/CPM.cmake) # CPM module

CPMAddPackage("gh:wx257osn2/qoixx@0.1.7")

add_executable(qoixx_sample "main.cpp")
target_link_libraries(qoixx_sample PUBLIC qoixx::qoixx)

Here's an example CMake for this.

wx257osn2 commented 2 months ago

@cullvox Sorry to late for reply, I tried to check the behavior. It seems that it works well for CPM (without above issue), but when we build qoixx with CMake, 3 binaries (qoibench , qoiconv , and qoitest) are generated on the build directory. Currently Makefile generates binaries on bin/ directory, so we can copy it to our own $PATH , but it is hard to understand to what binaries to copy to where with current CMakeLists.txt . Would you support installing (make install) for qoiconv and qoibench ? (qoitest is not needed to support this)

cullvox commented 2 months ago

@wx257osn2 Hi, I'm providing a late reply too. I added an install for the qoiconv and qoibench targets. I tested this on Windows and Ubuntu. Using cmake --install {build folder} will install the files to the bin folder, or you could go into the CMake build folder and call make install and it works the same way. I think this is what you were asking for — if not I'll gladly add/change anything!

wx257osn2 commented 2 months ago

@cullvox Thank you for working it!