Makefile 4.14 KB
Newer Older
1
SRCSFULL = $(wildcard tb2*.cpp applis/*.cpp core/*.cpp globals/*.cpp incop/*.cpp search/*.cpp utils/*.cpp vns/*.cpp ToulbarVersion.cpp)
2

3
4
# Comment the following line if BOOST Graph library uninstalled
BOOST = -DBOOST
Simon de Givry's avatar
Simon de Givry committed
5
6
7

# Same thing for XML
#XML = XMLFLAG
8
9
#XMLI = -I/usr/include/libxml2 -DXMLFLAG
# -DXMLFLAG -DMAXCSP
10
11
12
13

ifeq ($(BOOST),-DBOOST)
SRCS = $(SRCSFULL)
else
14
SRCS = $(SRCSFULL:utils/tb2boostgraph.cpp=)
15
endif
Simon de Givry's avatar
Simon de Givry committed
16

17
ifeq ($(XML),XMLFLAG)
18
19
OBJS = $(SRCS:.cpp=.o) -lxml2 -lboost_graph -lboost_iostreams -lgmp -lz -llzma
# -lxml2 -lz -llzma -lm -lpthread
20
else
21
OBJS = $(SRCS:.cpp=.o) -lboost_graph -lboost_iostreams -lgmp -lz -llzma
22
endif
Simon de Givry's avatar
Simon de Givry committed
23

24
LIBSRCS = $(SRCS:tb2main.cpp=)
25
26
LIBOBJS = $(LIBSRCS:.cpp=.o)

Simon de Givry's avatar
Simon de Givry committed
27
28
CC = g++

29
# Library compatible with Ilog Solver:
30
# In order to link ToulBar2 with Ilog Solver, uncomment the following two lines starting with ILOGFLAGS and ILOGLIBS, and uncomment #define INT_COST (also adding comment to #define LONGLONG_COST) in tb2types.hpp
31
# Then recompile libtb2.so (make clean;make libtb2.so) and finaly compile iloglue (make iloglue)
32
33
# Usage: iloglue 16wqueens.wcsp [verbosity level]
# Ilog Solver 6.0
34
35
#ILOGFLAGS = -DILOGLUE -DIL_STD -I/usr/local/Ilog/solver60/include -I/usr/local/Ilog/concert20/include
#ILOGLIBS = -L/usr/local/Ilog/solver60/lib/i86_linux2_glibc2.3_gcc3.2/static_pic -L/usr/local/Ilog/concert20/lib/i86_linux2_glibc2.3_gcc3.2/static_pic -lsolverfloat -lsolver -lconcert
36
37
38
39
# Ilog Solver 6.5
# (warning: compile libtb2.so and iloglue with -O optimization and not -O3)
#ILOGFLAGS = -DILOGLUE -DIL_STD -I/usr/local/ILOG/solver65/include -I/usr/local/ILOG/concert25/include
#ILOGLIBS = -L/usr/local/ILOG/solver65/lib/x86-64_rhel4.0_3.4/static_pic -L/usr/local/ILOG/concert25/lib/x86-64_rhel4.0_3.4/static_pic -lsolverfloat -lsolver -lconcert
40

41
42
43
44
## PLPS cost functions needs CPLEX installed (update the following path depending on your configuration and uncomment the following three lines) *** Warning! Beta untested version for PLPS ***
##CPLEX_LOCATION = /opt/ibm/ILOG/CPLEX_Studio126
##CPLEXFLAGS = -DILOGCPLEX -DIL_STD -fPIC -fexceptions -fno-strict-aliasing -pthread -I$(CPLEX_LOCATION)/cplex/include/ilcplex -I$(CPLEX_LOCATION)/cplex/include -I$(CPLEX_LOCATION)/concert/include
##CPLEXLIB =  -L$(CPLEX_LOCATION)/cplex/lib/x86-64_linux/static_pic -L$(CPLEX_LOCATION)/concert/lib/x86-64_linux/static_pic -lilocplex -lcplex -lconcert -pthread -rdynamic 
45

46
CFLAGS = -g -Wall -I. $(ILOGFLAGS) $(BOOST) $(XMLI) -DLINUX -DLONGLONG_COST -DWIDE_STRING -DLONGDOUBLE_PROB -DNARYCHAR -DWCSPFORMATONLY
47
# -DLINUX # compile on linux computers
48
49
50
# -DLONGLONG_COST # uses type long long for encoding costs, to be replaced by -DINT_COST if memory is an issue (but costs are limited to 119304647)
# -DWIDE_STRING # uses wide strings (2 bytes per char instead of one) for encoding value tuples (including separators)
# -DLONGDOUBLE_PROB # uses type long double for encoding (log) probabilities instead of type double if using -DDOUBLE_PROB
51
52
53
# -DNARYCHAR # pretty prints of nary constraints (including separators)
# -DWCSPFORMATONLY # assumes positive domains starting at value 0 (as in the wcsp format file) *** Incompatible with Numberjack ***
# -DNUMBERJACK # 
54
# -DOPENMPI # enables variable neighborhood search
55
# -fsanitize=signed-integer-overflow -fsanitize=float-cast-overflow -g3 # catches numerical integer overflows
56
57

OFLAGS = -O3 -DNDEBUG
58
# -O3 -DNDEBUG
Simon de Givry's avatar
Simon de Givry committed
59

60
PFLAGS =
61
# -pg -g3
62
63

BUILD = $(CC) -shared
Simon de Givry's avatar
Simon de Givry committed
64

Simon de Givry's avatar
Simon de Givry committed
65
66
67
%.o : %.cpp
	$(CC) $(OFLAGS) $(CFLAGS) $(LIBFLAGS) -c -o $@  $< $(PFLAGS)

68
%.o : %.cpp %.hpp
69
	$(CC) $(OFLAGS) $(CFLAGS) $(LIBFLAGS) -c -o $@  $< $(PFLAGS)
Simon de Givry's avatar
Simon de Givry committed
70

71
72
%.o : %.cpp %.h
	$(CC) $(OFLAGS) $(CFLAGS) $(LIBFLAGS) -c -o $@  $< $(PFLAGS)
Simon de Givry's avatar
Simon de Givry committed
73

74
75
toulbar2: $(OBJS)
	$(CC) $(OBJS) -o $@ $(PFLAGS) -static -static-libgcc
Simon de Givry's avatar
Simon de Givry committed
76

77
libtb2.so: LIBFLAGS = -fPIC
78
libtb2.so: $(LIBOBJS)
79
	$(BUILD) $(LIBFLAGS) $(LIBOBJS) -o $@
80

81
toulbar2test: toulbar2test.cpp libtb2.so
82
	$(CC) $(OFLAGS) $(CFLAGS) -o $@ $< ./libtb2.so -lboost_graph -lboost_iostreams -lgmp -lz -llzma
83

84
iloglue: iloglue.cpp libtb2.so
85
	$(CC) $(OFLAGS) $(CFLAGS) -o $@ $< $(ILOGLIBS) -L. -ltb2 -lboost_graph -lboost_iostreams -lgmp -lz -llzma
Simon de Givry's avatar
Simon de Givry committed
86
87

clean:
88
	-rm -f *.o applis/*.o core/*.o globals/*.o incop/*.o search/*.o utils/*.o vns/*.o toulbar2 libtb2.so iloglue toulbar2test
Simon de Givry's avatar
Simon de Givry committed
89

90
all: toulbar2