tket icon indicating copy to clipboard operation
tket copied to clipboard

How to build tket and install into $PREFIX?

Open yurivict opened this issue 2 years ago • 3 comments

I am trying to create the FreeBSD port for tket. README has a lot of custom conan-based commands. It looks like this is to integrate it with conan.

But how to just build binaries and install them into $PREFIX?

yurivict avatar Jul 30 '22 02:07 yurivict

Good question! It's true that the build system currently assumes and depends on conan. If you want to build in a more conventional way, you will have to make a few modifications.

First, note that as well as a few external dependencies (symengine, eigen, boost), tket depends on a few extra libraries, which must be built first; the source for these is in the libs directory. For example, to build tklog (without using conan), you'd have to first remove the two lines referencing conan in tklog/src/CMakeLists.txt and then do a standard cmake build there. Similarly for the other libraries in that directory (note that some also depend on boost, and on each other: the dependencies are given in the conanfiles).

Once you've built these, and installed them in an appropriate place, you should be able to build tket: again just remove the lines referencing conan from tket/src/CMakeLists.txt, and then do a cmake build. You may have to do some tweaks to ensure the compiler knows where to find the dependent libraries, and you would probably also need to add an "install" step to the cmake script.

In short, it should not be too hard to adapt the build system -- indeed, this is more or less how it used to work -- but as we have been using conan for some time now, it isn't entirely trivial. If you feel like making whatever changes are needed to make it easier (without breaking the current build process), and submitting a PR, that would be great.

cqc-alec avatar Jul 30 '22 07:07 cqc-alec

Every porting/packaging system will have a problem with this.

Maybe it would be a good idea to add a cmake variable "CONAN_BUILD" that would turn on conan build vs. traditional build.

This variable can speed up adoption of tket a great deal.

yurivict avatar Jul 30 '22 07:07 yurivict

Ideally the tket part should install C++ libraries with its own cmake file, and the pytket part should install the python part.

yurivict avatar Jul 30 '22 15:07 yurivict