The whole requirements are described on the F.A.Q.:
Add the
-DSFML_STATIC
preprocessor flag,Use the library files suffixed with
-s
:-lsfml-graphics-s
instead of-lsfml-graphics
,Add every needed static library:
-lopengl32 -lwinmm -lgdi32
is a minimum when using the Graphics, Window and System modules.
A simple Makefile would looks like this:
EXE := static.exe
SRC := $(wildcard *.cpp)
OBJ := $(SRC:.cpp=.o)
DEP := $(OBJ:.o=.d)
CPPFLAGS := -Ipath/to/SFML/include -MMD -MP -DSFML_STATIC
CXXFLAGS := -std=c++11 -Wall -W -pedantic
LDFLAGS := -Lpath/to/SFML/lib
LDLIBS := -lsfml-graphics-s -lsfml-window-s -lsfml-system-s
LDLIBS += -lopengl32 -lwinmm -lgdi32
.PHONY: all clean
all: $(EXE)
$(EXE): $(OBJ)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@
clean:
$(RM) $(EXE) $(OBJ) $(DEP)
ifeq "$(MAKECMDGOALS)" ""
-include $(DEP)
endif
To remove the console, add the -mwindows
linker flag to LDFLAGS
.