Skip to content

Provides cmake-based building, testing#83

Open
shakfu wants to merge 23 commits intomjwybrow:masterfrom
shakfu:master
Open

Provides cmake-based building, testing#83
shakfu wants to merge 23 commits intomjwybrow:masterfrom
shakfu:master

Conversation

@shakfu
Copy link

@shakfu shakfu commented Jul 25, 2025

This PR enables out-of-source cmake-based builds, tests and installation of artifacts. It can also build the python swig extension without using a setup.py file.

A simple Makefile is included as frontend for the cmake command:

PREFIX ?= $(CURDIR)/build/install

.PHONY: all build python test clean install

all: build

build:
	@mkdir -p build \
	&& cd build \
	&& cmake .. \
	&& cmake --build . --config Release

python:
	@mkdir -p build && cd build \
	&& cmake .. -DBUILD_SWIG_PYTHON=ON \
	&& cmake --build . --config Release \
	&& cmake --install . --prefix $(PREFIX)

test:
	@mkdir -p build && cd build \
	&& cmake .. -DBUILD_TESTS=ON \
	&& cmake --build . --config Debug \
	&& ctest

install: build
	@cd build \
	&& cmake --install . --prefix $(PREFIX)

clean:
	@rm -rf build

Also please note that this PR also includes a fix for cola/swig-python3-setup.py to work with setuptools rather than the obsolete distutils.

It has been tested against macOS and Ubuntu linux. Windows support needs some further guidance.

@shakfu
Copy link
Author

shakfu commented Jul 25, 2025

I have also added a github workflow, build-cmake.yml, which builds the libraries, the swig python extension, and uploads the build artifacts for both macOS and Linux.

@starseeker
Copy link

@shakfu I suppose it's a bit orthogonal to this PR, but can you tell us what issues you're seeing on Windows? If I want to enable a feature by default in our code I'll need a cross platform build (and the CMake build will also make my life way simpler..)

@shakfu
Copy link
Author

shakfu commented Nov 20, 2025

Hi @starseeker

I haven't really tried to build on Windows, simply because I don't really use it as a platform, but also because the build guide specifies: "[w]e use GNU automake to build. We've tried to make the contents of the repository as platform agnostic as possible, so you'll need to call aclocal, autoconf, and automake before configure."

I may be completely wrong here, but that doesn't sound like MSVC is supported. Of course, one could try to build on windows using the cmake build system in this PR, and see what happens.

I've created a GitHub workflow that builds the macOS and linux version. So If you do manage to get this fix, please feel free to post in this PR or in the fork itself, so I can incorporate the changes. This would be a welcome addition, no doubt.

@shakfu
Copy link
Author

shakfu commented Nov 20, 2025

@starseeker

I briefly looked into this again, if one can download and install cairomm on windows, it should be theoretically possible to build adaptagrams on windows. However, winget doesn't have it, but conan does, and it explicitly supports windows.

If the relevant conanfile.txt is included and one follows the method outlined here, it may work using cmake.

@shakfu
Copy link
Author

shakfu commented Nov 20, 2025

@starseeker I've done a bit of work on this in the win64 branch of my fork just by running it in a GitHub workflow, but it needs a bit more iteration on an actual machine. So feel free to try to get it to build on windows.

@starseeker
Copy link

@shakfu I've done some CMake work, but haven't been able to get to Windows yet - still getting things on my end set for testing. Hopefully in a week or two - in the meantime, I targeted a couple of PRs at your fork to get things started.

@shakfu
Copy link
Author

shakfu commented Nov 23, 2025

HI @starseeker

I merged your PR into the win64 branch, but I'm struggling with conan2 not doing what it'supposed to (generate the cmake build code for caromm). It's simply not working on a windows machine using GitHub actions.

If you have a Windows machine, can you try to build using the same sequence in the .github/workflows/build-windows.yaml workflow?

@starseeker
Copy link

@shakfu I took a brief try at a Windows build, but there's a couple things I'll need to fix just to build even the base libs. I'm afraid I'm not familiar with conan2, so I don't know how helpful I'll be there, but I'll try to take a look in the next couple weeks once I get a functional Windows setup going with my code.

@shakfu
Copy link
Author

shakfu commented Dec 29, 2025

@starseeker

I have released the hola-graph project to pypi (formerly called pyhola), and during the process kept some notes on the challenges of building adaptagrams on windows using cmake

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