Skip to content

Commit 1145505

Browse files
MacOSX fixes
1 parent b0ac96a commit 1145505

File tree

5 files changed

+124
-126
lines changed

5 files changed

+124
-126
lines changed

Makefile

Lines changed: 9 additions & 8 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,8 +119,10 @@ endif
119119
all: all-without-models
120120
$(MAKE) models
121121

122-
ifndef MXE
123-
ECOLAB_INTERPRETER=bin/ecolab$(ECOLIBS_EXT)
122+
ifeq ($(OS),Linux)
123+
ifndef MXE
124+
ECOLAB_INTERPRETER=bin/ecolab$(ECOLIBS_EXT)
125+
endif
124126
endif
125127

126128
all-without-models: ecolab-libs lib/libecolab$(ECOLIBS_EXT).a $(ECOLAB_INTERPRETER)
@@ -177,13 +179,12 @@ lib/libecolab$(ECOLIBS_EXT).a: $(OBJS) $(LIBMODS) graphcode
177179
ar r $@ $(OBJS) $(LIBMODS) graphcode/*.o
178180
ifeq ($(OS),Darwin)
179181
ranlib $@
180-
endif
181-
ifeq ($(OS),Linux)
182-
ifndef MXE
182+
else
183+
ifndef MXE
183184
$(CPLUSPLUS) -shared -Wl,-soname,libecolab$(ECOLIBS_EXT).so.$(SOVERSION) $(OBJS) $(LIBMODS) graphcode/*.o $(LIBS) -o lib/libecolab$(ECOLIBS_EXT).so.$(SOVERSION)
184185
cd lib; ln -sf libecolab$(ECOLIBS_EXT).so.$(SOVERSION) libecolab$(ECOLIBS_EXT).so
185186
cd lib; ln -sf libecolab$(ECOLIBS_EXT).so.$(SOVERSION) ecolab.so
186-
endif
187+
endif
187188
endif
188189

189190
$(MODS:%=lib/%): lib/%: src/%
@@ -245,7 +246,7 @@ latex-docs:
245246

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

251252
.PHONY: install

include/Makefile

Lines changed: 111 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,30 @@ MXE=
2828

2929
# choose 32 bits by preference
3030
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
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
4343

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
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
5253
endif
5354

54-
5555
FLAGS+=-DECOLAB_HOME=\"$(ECOLAB_HOME)\"
5656

5757
ifdef MPI_DEBUG
@@ -75,115 +75,123 @@ ICC=
7575
AQUA=
7676

7777
ifneq ($(MAKECMDGOALS),clean)
78-
# configuration variables generated by make configure
79-
include $(ECOLAB_HOME)/include/Makefile.config
78+
# configuration variables generated by make configure
79+
include $(ECOLAB_HOME)/include/Makefile.config
8080
endif
8181

8282
.SUFFIXES: .cd .d .rc $(SUFFIXES)
8383
VPATH=$(ECOLAB_HOME)/classdesc $(ECOLAB_HOME)/classdesc/json5_parser/json5_parser $(ECOLAB_HOME)/graphcode $(ECOLAB_HOME)/include
8484
PATH:=$(ECOLAB_HOME)/bin:$(PATH):$(HOME)/usr/bin
8585
CLASSDESC=$(ECOLAB_HOME)/bin/classdesc
86-
PKG_CONFIG_PATH:=$(HOME)/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig:$(PKG_CONFIG_PATH)
87-
PKG_CONFIG=env PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config
88-
89-
# where to look for installed software (prefix values)
90-
# nb Cygwin does not like /usr put here. Add it to the search command
91-
DIRS=$(ECOLAB_HOME) $(HOME)/usr /usr/local /opt/local /usr/X11R6
92-
# a search mechanism to find a particular file
93-
# use as $(call search,name)
86+
9487
ifdef MXE
95-
DIRS+=$(dir `which $(MXE_PREFIX)-g++`)
96-
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+
97105
else
98-
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
99115
endif
100116

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+
101121
# where to find classdesc header files (eg pack_base.h)
102122
CDINCLUDE=$(ECOLAB_HOME)/include
103123

104124
ifdef AEGIS
105-
# unused-variable warnings fail certain RAII usages in C++
106-
FLAGS+=-Werror -Wall -Wno-unused-variable -Wno-unused-function
107-
# for now, we maintain the code for C++98 standard
108-
# noexcept-type is a warning about ABI changes coming in C++17
109-
# Travis complains about unused-local-typedefs, so shut it up.
110-
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
111131
endif
112132

113-
# needed for generating .so files
114133
ifndef MXE
115-
FLAGS+=-fPIC
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
116171

117-
BOOST_EXT=
118-
# try to autonomously figure out which boost extension we should be using
172+
BOOST_EXT=
173+
# try to autonomously figure out which boost extension we should be using
119174
ifeq ($(shell if $(CPLUSPLUS) test/testmain.cc $(LIBS) -lboost_system>&/dev/null; then echo 1; else echo 0; fi),0)
120175
ifeq ($(shell if $(CPLUSPLUS) test/testmain.cc $(LIBS) -lboost_system-mt>&/dev/null; then echo 1; else echo 0; fi),1)
121176
BOOST_EXT=-mt
122177
else
123178
$(warning cannot figure out boost extension)
124179
endif
125180
endif
126-
$(warning Boost extension=$(BOOST_EXT))
127-
endif
128-
129-
# use mpicc etc by default if MPI set
130-
ifdef MPI
131-
HAVE_mpiCC=$(shell if which mpiCC>&/dev/null; then echo 1; fi)
132-
CC=mpicc
133-
ifeq ($(HAVE_mpiCC),1)
134-
CPLUSPLUS=mpiCC
135-
else
136-
# newer versions of mpich use this name!!
137-
CPLUSPLUS=mpicxx
138-
endif
139-
LINK=$(CPLUSPLUS)
140-
CPP=$(CPLUSPLUS) -E
141-
142-
# disable inclusion of mpi++.h in the MPICH case (don't know what the problem is here)
143-
FLAGS+=-UHAVE_MPI_CPP
144-
else
145-
# Engage Intel OneAPI compiler
146-
ifdef DPCPP
147-
CPLUSPLUS=icpx
148-
SYCL+=-fsycl
149-
# -std=c++20 used to suppress warning messages
150-
FLAGS+=-std=c++20 -Wno-vla-cxx-extension
151-
else
152-
CPLUSPLUS=g++
153-
endif
154-
CC=gcc
155-
LINK=$(CPLUSPLUS) $(SYCL)
156-
CPP=g++ -E
157-
endif
158-
159-
ifdef CCACHE
160-
CC:=ccache $(CC)
161-
CPLUSPLUS:=ccache $(CPLUSPLUS)
162-
endif
163-
164-
GCC=1
165-
FLAGS+= -DNO_FWD_DECLARE_STL -DMXE -DSTATIC_BUILD
166-
CC=$(MXE_PREFIX)-gcc
167-
CPLUSPLUS=$(MXE_PREFIX)-g++
168-
LINK=$(CPLUSPLUS)
169-
CPP=$(CPLUSPLUS) -E
170-
# rewrite ecolab home to be the mxe one
171-
ifeq ($(ECOLAB_HOME),$(HOME)/usr/ecolab)
172-
ECOLAB_HOME=$(HOME)/usr/mxe/ecolab
173-
endif
174-
DIRS=$(ECOLAB_HOME) $(HOME)/usr/mxe $(subst bin/$(CPLUSPLUS),$(MXE_PREFIX),$(shell which $(CPLUSPLUS)))
175-
PKG_CONFIG_PATH:=$(HOME)/usr/mxe/lib/pkgconfig:$(PKG_CONFIG_PATH)
176-
PKG_CONFIG=env PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(MXE_PREFIX)-pkg-config
177-
LIBS+=-lgdiplus
178-
179-
# xdr on MXE is positively ancient, so just disable it here
180-
XDR=
181-
182-
# rule for running the resource compiler
183-
.rc.o:
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:
184192
$(MXE_PREFIX)-windres -O coff -i $< -o $@
185193

186-
.rc.d:
194+
.rc.d:
187195
touch $@
188196
endif
189197

@@ -298,10 +306,6 @@ FLAGS+=-DTR1
298306
endif
299307
endif
300308

301-
# add standard list of search paths, -L/usr/lib32 must be before this statement
302-
LIBS+= $(DIRS:%=-L%/lib)
303-
FLAGS+=$(DIRS:%=-I%/include)
304-
305309
# canonicalise CYGWIN's OS name
306310
ifeq ($(findstring CYGWIN,$(OS)),CYGWIN)
307311
OS=CYGWIN

include/graph.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,9 @@ class DiGraph: private std::set<Edge>
277277
using Evec::value_type;
278278
using Evec::size_type;
279279
using Evec::difference_type;
280-
//using Evec::const_iterator;
280+
using Evec::const_iterator;
281281
using Evec::const_reference;
282282

283-
struct const_iterator: public Evec::const_iterator
284-
{
285-
const_iterator() {}
286-
const_iterator(const Evec::const_iterator& x): Evec::const_iterator(x) {}
287-
#ifdef __APPLE_CC__
288-
// bizarrely iterator equality is missing on Apple's compiler!
289-
bool operator==(const const_iterator& x) const {return &**this==&*x;}
290-
#endif
291-
};
292-
293283
using iterator=const_iterator; //disallow modification of edges
294284

295285
unsigned nodes() const {return num_nodes;}

src/cairoSurfaceImage.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ using namespace ecolab;
4848
#define CONST86
4949
#endif
5050

51+
#ifdef _WIN32
5152
// undocumented internal function for extracting the HDC from a Drawable
5253
extern "C" HDC TkWinGetDrawableDC(Display*, Drawable, void*);
5354
extern "C" HDC TkWinReleaseDrawableDC(Drawable, HDC, void*);
55+
#endif
5456

5557

5658
namespace

test/testmain.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int main() {return 0;}

0 commit comments

Comments
 (0)