Skip to content

Commit

Permalink
Ensure static libraries are included when compiling with MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Nov 30, 2023
1 parent 4027092 commit 89efdb8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
6 changes: 4 additions & 2 deletions native/HBV/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ CC_SERIAL = g++
C_FLAGS = -O3 -DOUT_TO_SCREEN -DHBVMOD -DRANGER_MEMORY_TRICK -DSERIAL -lm
C_FLAGS_DEBUG = -g -O0 -DOUT_TO_SCREEN -DHBVMOD -DRANGER_MEMORY_TRICK -DSERIAL -lm

PLATFORM := $(shell uname)
ifeq ($(PLATFORM),Linux)
ifeq ($(OS),Windows_NT)
C_FLAGS += -static-libgcc -static-libstdc++
C_FLAGS_DEBUG += -static-libgcc -static-libstdc++
else
C_FLAGS += -DLINUX
C_FLAGS_DEBUG += -DLINUX
endif
Expand Down
5 changes: 3 additions & 2 deletions native/LRGV/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ SRC_DIR = src
SHARED_DIR = ../shared
C_FLAGS=-O3 -I$(SRC_DIR) -I$(SHARED_DIR)

PLATFORM := $(shell uname)
ifeq ($(PLATFORM),Linux)
ifeq ($(OS),Windows_NT)
C_FLAGS += -static-libgcc -static-libstdc++
else
C_FLAGS += -DLINUX
endif

Expand Down
6 changes: 5 additions & 1 deletion native/LakeProblem/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ CC = g++
SRC_DIR = src
SHARED_DIR = ../shared
TARGET = lake
C_FLAGS = -O3 -Wno-unused-local-typedefs -I$(SRC_DIR) -I$(SHARED_DIR) -I$(SRC_DIR)/boost_1_56_0
C_FLAGS = -O3 -Wno-unused-local-typedefs -I$(SRC_DIR) -I$(SHARED_DIR) -I$(SRC_DIR)/boost_1_56_0
SOURCE = $(SRC_DIR)/main-lake.cpp $(SHARED_DIR)/moeaframework.c

ifeq ($(OS),Windows_NT)
C_FLAGS += -static-libgcc -static-libstdc++
endif

all:
mkdir -p bin
$(CC) $(C_FLAGS) -o bin/$(TARGET) $(SOURCE)
Expand Down
4 changes: 4 additions & 0 deletions native/WDS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ SHARED_DIR = ../shared
SOURCE = $(SRC_DIR)/main.c $(SRC_DIR)/models.c $(SHARED_DIR)/moeaframework.c
C_FLAGS = -I$(SRC_DIR)/epanet2 -I$(SHARED_DIR) -Lbin -lm -lepanet2 -Wl,-R,\.

ifeq ($(OS),Windows_NT)
C_FLAGS += -static-libgcc -static-libstdc++
endif

all:
$(MAKE) -C $(SRC_DIR)/epanet2
$(CC) -o bin/TRN -DTRN $(SOURCE) $(C_FLAGS)
Expand Down

0 comments on commit 89efdb8

Please sign in to comment.