Skip to content

Commit

Permalink
Added MacOSX build support.
Browse files Browse the repository at this point in the history
Fixed a memory error in ibisami_api.cpp.
  • Loading branch information
capn-freako committed May 19, 2015
1 parent d0f6863 commit 667b582
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*.la
*.a
*.lib
*.exp

# Executables
*.exe
Expand Down
57 changes: 31 additions & 26 deletions defs.mak
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ all:

clean:
@echo "Cleaning up previous build..."
-rm *.o *.obj *.exp *.lib *.manifest *.dll *.so *.exe 2>/dev/null
-rm *.o *.obj *.lib *.manifest *.so *.exe 2>/dev/null

rebuild:
@$(MAKE) clean
Expand Down Expand Up @@ -58,34 +58,39 @@ ifeq ($(OS), Windows_NT)
oleaut32.lib uuid.lib odbc32.lib dbccp32.lib
IBISAMI_LIB := ibisami_$(SUFFIX).lib
else
ifeq ($(OS), Linux)
OBJS = $(MODS:%=%_$(SUFFIX).o)
RUN_CMD =
BIN := /usr/bin
CC := gcc
CXX := g++
LIB := $(CXX)
LD := $(CXX)
CFLAGS := -c -fPIC -std=gnu++11 -I. -I"$(IBISAMI_ROOT)"
LDFLAGS = -o $@ -shared
ifeq ($(MACHINE), X86)
LDFLAGS += -m32
CFLAGS += -m32
else
LDFLAGS += -m64
CFLAGS += -m64
endif
ifdef DEBUG
CFLAGS += -g
LDFLAGS += -g
else
OBJS = $(MODS:%=%_$(SUFFIX).o)
RUN_CMD =
BIN := /usr/bin
CC := gcc
CXX := g++
LIB := $(CXX)
LD := $(CXX)
CFLAGS := -c -fPIC -std=gnu++11 -I. -I"$(IBISAMI_ROOT)" -I"$(BOOST_ROOT)"
LDFLAGS = -o $@ -shared
ifeq ($(MACHINE), X86)
LDFLAGS += -m32
CFLAGS += -m32
else
LDFLAGS += -m64
CFLAGS += -m64
endif
ifdef DEBUG
CFLAGS += -g
LDFLAGS += -g
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
LDFLAGS += -s -static-libgcc -static-libstdc++ $(@:%_$(SUFFIX).so=%.exp)
else
ifeq ($(UNAME_S), Darwin)
LDFLAGS += -static-libstdc++ $(@:%_$(SUFFIX).so=%.exp)
else
$(error Unsupported OS: $(UNAME_S))
endif
endif
CXXFLAGS := $(CFLAGS)
IBISAMI_LIB := libibisami_$(SUFFIX).a
else
$(error Unsupported OS: $(OS))
endif
CXXFLAGS := $(CFLAGS)
IBISAMI_LIB := libibisami_$(SUFFIX).a
endif

# Default rules
Expand Down
6 changes: 3 additions & 3 deletions example/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ifeq ($(OS), Windows_NT)
LIB_OBJS = $(LIB_MODS:%="$(IBISAMI_ROOT_DOS)\\%_$(SUFFIX).obj")
else
TARGS := $(MODS:%=%_$(SUFFIX).so)
LIB_OBJS = $(LIB_MODS:%="$(IBISAMI_ROOT)/%_$(SUFFIX).o")
LIB_OBJS = $(LIB_MODS:%=$(IBISAMI_ROOT)/%_$(SUFFIX).o)
endif

# Targets
Expand All @@ -41,8 +41,8 @@ tx64:

targs: $(TARGS)

$(TARGS): $(OBJS)
$(TARGS): $(OBJS) $(LIB_OBJS)
@echo "Building $@..."
# $(RUN_CMD) $(LD) $(LDFLAGS) "$(IBISAMI_ROOT_DOS)\$(IBISAMI_LIB)" "$(IBISAMI_ROOT_DOS)\$(IBISAMI_LIB:%.lib=%.exp)" $^
$(RUN_CMD) $(LD) $(LDFLAGS) $(LIB_OBJS) $^
$(RUN_CMD) $(LD) $(LDFLAGS) $^

1 change: 0 additions & 1 deletion src/ibisami_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ DLL_EXPORT long AMI_Close(
void * AMI_memory
) {
AmiPointers *self = (AmiPointers *)AMI_memory;
delete self->model;
delete self->msg;
delete self->params;
delete self;
Expand Down

0 comments on commit 667b582

Please sign in to comment.