parnoldx / nasc

Do maths like a normal person
http://parnoldx.github.io/nasc/
GNU General Public License v3.0
560 stars 37 forks source link

Build libqalculatenasc with CMake #85

Closed valpackett closed 6 years ago

valpackett commented 6 years ago

The current libqualculatenasc build is incompatible with CMake's Ninja backend:

ninja: error: 'libqalculatenasc.so', needed by 'nasc', missing and no known rule to make it

Plus, it uses a libtool generated for Linux, does not use pkg-config to find libqualculate itself, does not use the same compiler as CMake…

I just wrote a FreeBSD port that installs NaSC, and I had to include this patch:

--- libqalculatenasc/Makefile.in.orig   2017-09-28 09:09:25 UTC
+++ libqalculatenasc/Makefile.in
@@ -1,8 +1,6 @@
-CC = g++
-LIBTOOL = ./libtool
+CC? = c++
 DEBUG = -g
 CFLAGS = -std=c++11 -fPIC -O3 -c $(DEBUG)
-LFLAGS = --tag=CXX --mode=link g++ -shared

 BINDIR=@exedir@
 MANDIR=@mandir@
@@ -10,16 +8,16 @@ LIBDIR=@libdir@
 INCDIR=@prefix@/include/

 libqalculatenasc.so : QalculateNasc.o
-       $(LIBTOOL) $(LFLAGS) QalculateNasc.o -o libqalculatenasc.so -lqalculate
+       $(CC) -shared QalculateNasc.o -o libqalculatenasc.so `pkg-config --libs libqalculate`

 QalculateNasc.o : QalculateNasc.h QalculateNasc.cc
-       $(CC) $(CFLAGS) QalculateNasc.cc
+       $(CC) $(CFLAGS) QalculateNasc.cc `pkg-config --cflags libqalculate`

 all: libqalculatenasc.so

 clean:
        \rm -f QalculateNasc.o libqalculatenasc.so

-install:
+install: libqalculatenasc.so
        install libqalculatenasc.so $(LIBDIR)
        install QalculateNasc.h $(LIBDIR)

Everything works fine without libtool! So I don't see a reason why this thing is not just built inside CMake.

parnoldx commented 6 years ago

Mostly because i have not really a clue about CMake.

parnoldx commented 6 years ago

@myfreeweb It seems that libqualcuatenasc.so is not installed anymore. You know how to fix this? https://github.com/parnold-x/nasc/issues/81