Skip to content

Commit 9cd6aa9

Browse files
Merge branch 'master' of github.com:highperformancecoder/ecolab
2 parents 2186bca + 1145505 commit 9cd6aa9

File tree

14 files changed

+407
-548
lines changed

14 files changed

+407
-548
lines changed

Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ endif
5858
endif
5959

6060
ifeq ($(OS),Darwin)
61-
CXXFLAGS+=-std=c++11
61+
CXXFLAGS+=-std=c++20
6262
endif
6363

6464
VPATH+=src
@@ -119,7 +119,13 @@ endif
119119
all: all-without-models
120120
$(MAKE) models
121121

122-
all-without-models: ecolab-libs lib/libecolab$(ECOLIBS_EXT).a bin/ecolab$(ECOLIBS_EXT)
122+
ifeq ($(OS),Linux)
123+
ifndef MXE
124+
ECOLAB_INTERPRETER=bin/ecolab$(ECOLIBS_EXT)
125+
endif
126+
endif
127+
128+
all-without-models: ecolab-libs lib/libecolab$(ECOLIBS_EXT).a $(ECOLAB_INTERPRETER)
123129
-$(CHMOD) a+x $(SCRIPTS)
124130
# copy in the system built TCL library
125131
ifdef MXE
@@ -173,10 +179,13 @@ lib/libecolab$(ECOLIBS_EXT).a: $(OBJS) $(LIBMODS) graphcode
173179
ar r $@ $(OBJS) $(LIBMODS) graphcode/*.o
174180
ifeq ($(OS),Darwin)
175181
ranlib $@
176-
endif
182+
else
183+
ifndef MXE
177184
$(CPLUSPLUS) -shared -Wl,-soname,libecolab$(ECOLIBS_EXT).so.$(SOVERSION) $(OBJS) $(LIBMODS) graphcode/*.o $(LIBS) -o lib/libecolab$(ECOLIBS_EXT).so.$(SOVERSION)
178185
cd lib; ln -sf libecolab$(ECOLIBS_EXT).so.$(SOVERSION) libecolab$(ECOLIBS_EXT).so
179186
cd lib; ln -sf libecolab$(ECOLIBS_EXT).so.$(SOVERSION) ecolab.so
187+
endif
188+
endif
180189

181190
$(MODS:%=lib/%): lib/%: src/%
182191
cp $< $@
@@ -236,8 +245,8 @@ latex-docs:
236245
if which latex; then cd doc; rm -f *.aux *.dvi *.log *.blg *.toc *.lof *.out; latex -interaction=batchmode ecolab; fi
237246

238247
#bin/ecolab is a python interpreter supporting MPI
239-
bin/ecolab$(ECOLIBS_EXT): src/pythonMain.o lib/libecolab$(ECOLIBS_EXT).so
240-
$(LINK) $(FLAGS) src/pythonMain.o -Wl,-rpath $(ECOLAB_HOME)/lib $(LIBS) -lboost_system -o $@
248+
bin/ecolab$(ECOLIBS_EXT): src/pythonMain.o lib/libecolab$(ECOLIBS_EXT).a
249+
$(LINK) $(FLAGS) src/pythonMain.o -Wl,-rpath $(ECOLAB_HOME)/lib $(LIBS) -lboost_system$(BOOST_EXT) -o $@
241250
-find . \( -name "*.cc" -o -name "*.h" \) -print |etags -
242251

243252
.PHONY: install
@@ -269,11 +278,13 @@ UNURAN_LIB=$(firstword $(call search,lib*/libunuran.a))
269278

270279
$(ECOLAB_HOME)/$(MCFG):
271280
@rm -f $(MCFG)
281+
ifndef MXE
272282
# absolute dependencies
273283
@if ! $(PKG_CONFIG) --exists python3; then \
274284
echo "Error: Cannot find Python libs - please install python3-dev"; \
275285
exit 1; \
276286
fi
287+
endif
277288
# optional dependecies
278289
@if [ -n "$(call search,lib*/tclConfig.sh)" ]; then echo TCL=1>>$(MCFG); fi
279290
@if [ -n "$(call search,lib*/tkConfig.sh)" ]; then echo TK=1>>$(MCFG); fi

classdesc

include/Makefile

Lines changed: 127 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,32 @@ DPCPP=
2626
# enables ecolab for the MXE environment
2727
MXE=
2828

29+
# choose 32 bits by preference
30+
ifdef MXE
31+
MXE_32bit=$(shell if which i686-w64-mingw32.shared-g++>&/dev/null; then echo 1; fi)
32+
MXE_64bit=$(shell if which x86_64-w64-mingw32.shared-g++>&/dev/null; then echo 1; fi)
33+
ifeq ($(MXE_32bit),1)
34+
MXE_PREFIX=i686-w64-mingw32.shared
35+
else
36+
ifeq ($(MXE_64bit),1)
37+
MXE_PREFIX=x86_64-w64-mingw32.shared
38+
else
39+
$(error "MXE compiler not found")
40+
endif
41+
BOOST_EXT=-mt-x64
42+
endif
43+
44+
# force 64 bit build
45+
ifdef MXE64
46+
MXE_64bit=$(shell if which x86_64-w64-mingw32.shared-g++>&/dev/null; then echo 1; fi)
47+
ifeq ($(MXE_64bit),1)
48+
MXE_PREFIX=x86_64-w64-mingw32.shared
49+
else
50+
$(error "MXE compiler not found")
51+
endif
52+
endif
53+
endif
54+
2955
FLAGS+=-DECOLAB_HOME=\"$(ECOLAB_HOME)\"
3056

3157
ifdef MPI_DEBUG
@@ -49,127 +75,123 @@ ICC=
4975
AQUA=
5076

5177
ifneq ($(MAKECMDGOALS),clean)
52-
# configuration variables generated by make configure
53-
include $(ECOLAB_HOME)/include/Makefile.config
78+
# configuration variables generated by make configure
79+
include $(ECOLAB_HOME)/include/Makefile.config
5480
endif
5581

5682
.SUFFIXES: .cd .d .rc $(SUFFIXES)
5783
VPATH=$(ECOLAB_HOME)/classdesc $(ECOLAB_HOME)/classdesc/json5_parser/json5_parser $(ECOLAB_HOME)/graphcode $(ECOLAB_HOME)/include
5884
PATH:=$(ECOLAB_HOME)/bin:$(PATH):$(HOME)/usr/bin
5985
CLASSDESC=$(ECOLAB_HOME)/bin/classdesc
60-
PKG_CONFIG_PATH:=$(HOME)/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig:$(PKG_CONFIG_PATH)
61-
PKG_CONFIG=env PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config
62-
63-
# where to look for installed software (prefix values)
64-
# nb Cygwin does not like /usr put here. Add it to the search command
65-
DIRS=$(ECOLAB_HOME) $(HOME)/usr /usr/local /opt/local /usr/X11R6
66-
# a search mechanism to find a particular file
67-
# use as $(call search,name)
86+
6887
ifdef MXE
69-
search=$(firstword $(foreach dir,$(DIRS),$(wildcard $(dir)/$(1))))
88+
# rewrite ecolab home to be the mxe one
89+
ifeq ($(ECOLAB_HOME),$(HOME)/usr/ecolab)
90+
ECOLAB_HOME=$(HOME)/usr/mxe/ecolab
91+
endif
92+
# where to look for installed software (prefix values)
93+
DIRS=$(ECOLAB_HOME) $(HOME)/usr/mxe $(subst bin/$(CPLUSPLUS),$(MXE_PREFIX),$(shell which $(CPLUSPLUS)))
94+
95+
# a search mechanism to find a particular file
96+
# use as $(call search,name)
97+
search=$(firstword $(foreach dir,$(DIRS),$(wildcard $(dir)/$(1))))
98+
99+
# xdr on MXE is positively ancient, so just disable it here
100+
XDR=
101+
PKG_CONFIG_PATH:=$(HOME)/usr/mxe/lib/pkgconfig:$(PKG_CONFIG_PATH)
102+
PKG_CONFIG=env PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(MXE_PREFIX)-pkg-config
103+
LIBS+=-lgdiplus
104+
70105
else
71-
search=$(firstword $(foreach dir,$(DIRS) /usr,$(wildcard $(dir)/$(1))))
106+
# where to look for installed software (prefix values)
107+
# nb Cygwin does not like /usr put here. Add it to the search command
108+
DIRS=$(ECOLAB_HOME) $(HOME)/usr /usr/local /opt/local /usr/X11R6
109+
# a search mechanism to find a particular file
110+
# use as $(call search,name)
111+
search=$(firstword $(foreach dir,$(DIRS) /usr,$(wildcard $(dir)/$(1))))
112+
113+
PKG_CONFIG_PATH:=$(HOME)/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig:$(PKG_CONFIG_PATH)
114+
PKG_CONFIG=env PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config
72115
endif
73116

117+
# add standard list of search paths, -L/usr/lib32 must be before this statement
118+
LIBS+= $(DIRS:%=-L%/lib)
119+
FLAGS+=$(DIRS:%=-I%/include)
120+
74121
# where to find classdesc header files (eg pack_base.h)
75122
CDINCLUDE=$(ECOLAB_HOME)/include
76123

77124
ifdef AEGIS
78-
# unused-variable warnings fail certain RAII usages in C++
79-
FLAGS+=-Werror -Wall -Wno-unused-variable -Wno-unused-function
80-
# for now, we maintain the code for C++98 standard
81-
# noexcept-type is a warning about ABI changes coming in C++17
82-
# Travis complains about unused-local-typedefs, so shut it up.
83-
CXXFLAGS+=-Wno-noexcept-type -Wno-unused-local-typedefs -std=c++20
125+
# unused-variable warnings fail certain RAII usages in C++
126+
FLAGS+=-Werror -Wall -Wno-unused-variable -Wno-unused-function
127+
# for now, we maintain the code for C++98 standard
128+
# noexcept-type is a warning about ABI changes coming in C++17
129+
# Travis complains about unused-local-typedefs, so shut it up.
130+
CXXFLAGS+=-Wno-noexcept-type -Wno-unused-local-typedefs -std=c++20
84131
endif
85132

86-
# needed for generating .so files
87133
ifndef MXE
88-
FLAGS+=-fPIC
89-
endif
90-
91-
# use mpicc etc by default if MPI set
92-
ifdef MPI
93-
HAVE_mpiCC=$(shell if which mpiCC>&/dev/null; then echo 1; fi)
94-
CC=mpicc
95-
ifeq ($(HAVE_mpiCC),1)
96-
CPLUSPLUS=mpiCC
97-
else
98-
# newer versions of mpich use this name!!
99-
CPLUSPLUS=mpicxx
100-
endif
101-
LINK=$(CPLUSPLUS)
102-
CPP=$(CPLUSPLUS) -E
103-
104-
# disable inclusion of mpi++.h in the MPICH case (don't know what the problem is here)
105-
FLAGS+=-UHAVE_MPI_CPP
106-
else
107-
# Engage Intel OneAPI compiler
108-
ifdef DPCPP
109-
CPLUSPLUS=icpx
110-
SYCL+=-fsycl
111-
# -std=c++20 used to suppress warning messages
112-
FLAGS+=-std=c++20 -Wno-vla-cxx-extension
113-
else
114-
CPLUSPLUS=g++
115-
endif
116-
CC=gcc
117-
LINK=$(CPLUSPLUS) $(SYCL)
118-
CPP=g++ -E
119-
endif
120-
121-
ifdef CCACHE
122-
CC:=ccache $(CC)
123-
CPLUSPLUS:=ccache $(CPLUSPLUS)
124-
endif
125-
126-
# choose 32 bits by preference
127-
ifdef MXE
128-
MXE_32bit=$(shell if which i686-w64-mingw32.shared-g++>&/dev/null; then echo 1; fi)
129-
MXE_64bit=$(shell if which x86_64-w64-mingw32.shared-g++>&/dev/null; then echo 1; fi)
130-
ifeq ($(MXE_32bit),1)
131-
MXE_PREFIX=i686-w64-mingw32.shared
132-
else
133-
ifeq ($(MXE_64bit),1)
134-
MXE_PREFIX=x86_64-w64-mingw32.shared
135-
else
136-
$(error "MXE compiler not found")
137-
endif
138-
endif
139-
140-
# force 64 bit build
141-
ifdef MXE64
142-
MXE_64bit=$(shell if which x86_64-w64-mingw32.shared-g++>&/dev/null; then echo 1; fi)
143-
ifeq ($(MXE_64bit),1)
144-
MXE_PREFIX=x86_64-w64-mingw32.shared
145-
else
146-
$(error "MXE compiler not found")
147-
endif
148-
endif
149-
150-
GCC=1
151-
FLAGS+= -DNO_FWD_DECLARE_STL -DMXE -DSTATIC_BUILD
152-
CC=$(MXE_PREFIX)-gcc
153-
CPLUSPLUS=$(MXE_PREFIX)-g++
154-
LINK=$(CPLUSPLUS)
155-
CPP=$(CPLUSPLUS) -E
156-
# rewrite ecolab home to be the mxe one
157-
ifeq ($(ECOLAB_HOME),$(HOME)/usr/ecolab)
158-
ECOLAB_HOME=$(HOME)/usr/mxe/ecolab
159-
endif
160-
DIRS=$(ECOLAB_HOME) $(HOME)/usr/mxe $(subst bin/$(CPLUSPLUS),$(MXE_PREFIX),$(shell which $(CPLUSPLUS)))
161-
PKG_CONFIG_PATH:=$(HOME)/usr/mxe/lib/pkgconfig:$(PKG_CONFIG_PATH)
162-
PKG_CONFIG=env PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(MXE_PREFIX)-pkg-config
163-
LIBS+=-lgdiplus
164-
165-
# xdr on MXE is positively ancient, so just disable it here
166-
XDR=
167-
168-
# rule for running the resource compiler
169-
.rc.o:
134+
# needed for generating .so files
135+
FLAGS+=-fPIC
136+
137+
# use mpicc etc by default if MPI set
138+
ifdef MPI
139+
HAVE_mpiCC=$(shell if which mpiCC>&/dev/null; then echo 1; fi)
140+
CC=mpicc
141+
ifeq ($(HAVE_mpiCC),1)
142+
CPLUSPLUS=mpiCC
143+
else
144+
# newer versions of mpich use this name!!
145+
CPLUSPLUS=mpicxx
146+
endif
147+
LINK=$(CPLUSPLUS)
148+
CPP=$(CPLUSPLUS) -E
149+
150+
# disable inclusion of mpi++.h in the MPICH case (don't know what the problem is here)
151+
FLAGS+=-UHAVE_MPI_CPP
152+
else
153+
# Engage Intel OneAPI compiler
154+
ifdef DPCPP
155+
CPLUSPLUS=icpx
156+
SYCL+=-fsycl
157+
# -std=c++20 used to suppress warning messages
158+
FLAGS+=-std=c++20 -Wno-vla-cxx-extension
159+
else
160+
CPLUSPLUS=g++
161+
endif
162+
CC=gcc
163+
LINK=$(CPLUSPLUS) $(SYCL)
164+
CPP=g++ -E
165+
endif
166+
167+
ifdef CCACHE
168+
CC:=ccache $(CC)
169+
CPLUSPLUS:=ccache $(CPLUSPLUS)
170+
endif
171+
172+
BOOST_EXT=
173+
# try to autonomously figure out which boost extension we should be using
174+
ifeq ($(shell if $(CPLUSPLUS) test/testmain.cc $(LIBS) -lboost_system>&/dev/null; then echo 1; else echo 0; fi),0)
175+
ifeq ($(shell if $(CPLUSPLUS) test/testmain.cc $(LIBS) -lboost_system-mt>&/dev/null; then echo 1; else echo 0; fi),1)
176+
BOOST_EXT=-mt
177+
else
178+
$(warning cannot figure out boost extension)
179+
endif
180+
endif
181+
$(warning Boost extension=$(BOOST_EXT))
182+
else # MXE
183+
GCC=1
184+
FLAGS+= -DNO_FWD_DECLARE_STL -DMXE -DSTATIC_BUILD
185+
CC=$(MXE_PREFIX)-gcc
186+
CPLUSPLUS=$(MXE_PREFIX)-g++
187+
LINK=$(CPLUSPLUS)
188+
CPP=$(CPLUSPLUS) -E
189+
190+
# rule for running the resource compiler
191+
.rc.o:
170192
$(MXE_PREFIX)-windres -O coff -i $< -o $@
171193

172-
.rc.d:
194+
.rc.d:
173195
touch $@
174196
endif
175197

@@ -196,7 +218,7 @@ endif
196218
ECOLIBS=$(ECOLAB_HOME)/lib/libecolab$(ECOLIBS_EXT).a
197219

198220
# why is boost_thread required here?
199-
LIBS+=-L$(ECOLAB_HOME)/lib -lecolab$(ECOLIBS_EXT) -lboost_thread
221+
LIBS+=-L$(ECOLAB_HOME)/lib -lecolab$(ECOLIBS_EXT) -lboost_thread$(BOOST_EXT)
200222
FLAGS+=-I. -I$(ECOLAB_HOME)/classdesc -I$(ECOLAB_HOME)/classdesc/json5_parser/json5_parser -I$(ECOLAB_HOME)/graphcode -I$(ECOLAB_HOME)/include -I$(ECOLAB_HOME)/Ouroboros-SYCL/include -DHASH_TCL_hash
201223

202224
# The following section uses GNU Make specific syntax. If not using
@@ -284,10 +306,6 @@ FLAGS+=-DTR1
284306
endif
285307
endif
286308

287-
# add standard list of search paths, -L/usr/lib32 must be before this statement
288-
LIBS+= $(DIRS:%=-L%/lib)
289-
FLAGS+=$(DIRS:%=-I%/include)
290-
291309
# canonicalise CYGWIN's OS name
292310
ifeq ($(findstring CYGWIN,$(OS)),CYGWIN)
293311
OS=CYGWIN
@@ -590,7 +608,8 @@ LINK+=$(OPT)
590608
LIBMODS=
591609

592610
# modules to include on the MODLINK command line
593-
ALWAYSLINK=tcl_arrays tclgraph analysis random cairo_types plot
611+
#ALWAYSLINK=analysis random cairo_types plot
612+
ALWAYSLINK=
594613

595614
# for some reason, the -u option doesn't work with MXE
596615
ifdef MXE

0 commit comments

Comments
 (0)