Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build on FreeBSD #113

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/AnalyseAllPlaysBin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/AnalyseAllPlaysPBN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/AnalysePlayBin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/AnalysePlayPBN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/CalcAllTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/CalcAllTablesPBN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/CalcDDtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/CalcDDtablePBN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/DealerPar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
117 changes: 117 additions & 0 deletions examples/Makefiles/Makefile_freebsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# This is a Makefile for the examples,
# for FreeBSD and the clang c++ compiler.

# It does assume a Unix-like setup for some commands,
# but if you only want to call "make" with the default target,
# you should be OK.

# If your compiler name is not given here, change it.
CC = c++

CC_FLAGS = -O3 -flto -fopenmp

# These flags are not turned on by default, but DDS should pass them.
# Turn them on below.
WARN_FLAGS = \
-Wshadow \
-Wsign-conversion \
-pedantic -Wall -Wextra \
-Wcast-align -Wcast-qual \
-Wctor-dtor-privacy \
-Wdisabled-optimization \
-Winit-self \
-Wmissing-declarations \
-Wmissing-include-dirs \
-Wold-style-cast \
-Woverloaded-virtual \
-Wredundant-decls \
-Wsign-promo \
-Wstrict-overflow=1 \
-Wswitch-default -Wundef \
-Werror \
-Wno-unused \
-Wno-unknown-pragmas \
-Wno-long-long \
-Wno-format

# Here you can turn on warnings.
# CC_FULL_FLAGS = $(CC_FLAGS)
CC_FULL_FLAGS = $(CC_FLAGS) $(WARN_FLAGS)

DLLBASE = dds
STATIC_LIB = lib$(DLLBASE).a

COMMON_SOURCE_FILES = \
hands.cpp

ALL_EXAMPLE_FILES = \
AnalysePlayBin \
AnalysePlayPBN \
AnalyseAllPlaysBin \
AnalyseAllPlaysPBN \
CalcDDtable.cpp \
CalcDDtablePBN.cpp \
CalcAllTables.cpp \
CalcAllTablesPBN.cpp \
DealerPar.cpp \
Par.cpp \
SolveBoard.cpp \
SolveBoardPBN.cpp \
SolveAllBoards.cpp

LIB_FLAGS = -L. -l$(DLLBASE)

LD_FLAGS =

OBJ_FILES = $(COMMON_SOURCE_FILES:S/.cpp/.o/)
EX_OBJ_FILES = $(ALL_EXAMPLE_FILES:S/.cpp/.o/)
EX_EXE_FILES = $(ALL_EXAMPLE_FILES:S/.cpp//)

AnalysePlayBin: $(OBJ_FILES) AnalysePlayBin.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) AnalysePlayBin.o $(LIB_FLAGS) -o AnalysePlayBin

AnalysePlayPBN: $(OBJ_FILES) AnalysePlayPBN.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) AnalysePlayPBN.o $(LIB_FLAGS) -o AnalysePlayPBN

AnalyseAllPlaysBin: $(OBJ_FILES) AnalyseAllPlaysBin.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) AnalyseAllPlaysBin.o $(LIB_FLAGS) -o AnalyseAllPlaysBin

AnalyseAllPlaysPBN: $(OBJ_FILES) AnalyseAllPlaysPBN.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) AnalyseAllPlaysPBN.o $(LIB_FLAGS) -o AnalyseAllPlaysPBN

CalcDDtable: $(OBJ_FILES) CalcDDtable.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) CalcDDtable.o $(LIB_FLAGS) -o CalcDDtable

CalcDDtablePBN: $(OBJ_FILES) CalcDDtablePBN.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) CalcDDtablePBN.o $(LIB_FLAGS) -o CalcDDtablePBN

CalcAllTables: $(OBJ_FILES) CalcAllTables.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) CalcAllTables.o $(LIB_FLAGS) -o CalcAllTables

CalcAllTablesPBN: $(OBJ_FILES) CalcAllTablesPBN.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) CalcAllTablesPBN.o $(LIB_FLAGS) -o CalcAllTablesPBN

DealerPar: $(OBJ_FILES) DealerPar.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) DealerPar.o $(LIB_FLAGS) -o DealerPar

Par: $(OBJ_FILES) Par.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) Par.o $(LIB_FLAGS) -o Par

SolveBoard: $(OBJ_FILES) SolveBoard.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) SolveBoard.o $(LIB_FLAGS) -o SolveBoard

SolveBoardPBN: $(OBJ_FILES) SolveBoardPBN.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) SolveBoardPBN.o $(LIB_FLAGS) -o SolveBoardPBN

SolveAllBoards: $(OBJ_FILES) SolveAllBoards.o
$(CC) $(CC_FULL_FLAGS) $(LD_FLAGS) $(OBJ_FILES) SolveAllBoards.o $(LIB_FLAGS) -o SolveAllBoards

.cpp.o:
$(CC) $(CC_FULL_FLAGS) -c $< -o $@

depend:
makedepend -Y -- $(cOMMON_SOURCE_FILES) $(ALL_EXAMPLE_FILES)

clean:
rm -f $(OBJ_FILES) $(EX_OBJ_FILES) $(EX_EXE_FILES) $(STATIC_LIB)

2 changes: 1 addition & 1 deletion examples/Par.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/SolveAllBoards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main()
char line[80];
bool match;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/SolveBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main()
bool match2;
bool match3;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion examples/SolveBoardPBN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main()
bool match2,
match3;

#if defined(__linux) || defined(__APPLE__)
#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
SetMaxThreads(0);
#endif

Expand Down
2 changes: 1 addition & 1 deletion include/portab.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define USES_DLLMAIN

#elif defined (__linux)
#elif defined (__linux) || defined(__FreeBSD__)
#include <unistd.h>
#if !defined(DDS_NO_STATIC_INIT)
#define USES_CONSTRUCTOR
Expand Down
125 changes: 125 additions & 0 deletions src/Makefiles/Makefile_freebsd_shared
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# --------------------- INFORMATION --------------------------------

# This the DDS Makefile for FreeBSD and the clang c++ compiler.
# It creates a dynamically linked (shared) library, libdds.so.

# --------------------- CONFIGURATION ------------------------------

# You can configure the following:

# 1. The threading systems that you want in the library.
# You will always get single-threading. If you have multiple
# threading systems, the default will be the multi-threading one
# with the lowest number (see System.cpp). All that matters is
# CC_THREADING.

# GCD and WINAPI don't work on Windows.
THR_BOOST = -DDDS_THREADS_BOOST
THR_GCD = -DDDS_THREADS_GCD
THR_OPENMP = -DDDS_THREADS_OPENMP
THR_WINAPI = -DDDS_THREADS_WINAPI
THR_STL = -DDDS_THREADS_STL

THREADING = $(THR_BOOST) $(THR_OPENMP) $(THR_STL)

# If you need to add something for a threading system, this is
# the place.

CC_BOOST_LINK = -lboost_system -lboost_thread

THREAD_COMPILE = -fopenmp
THREAD_LINK = -fopenmp $(CC_BOOST_LINK)

# 2. Debugging options. (There are more granular options in debug.h.)

DEBUG_ALL = -DDDS_DEBUG_ALL
TIMING = -DDDS_TIMING
SCHEDULER = -DDDS_SCHEDULER

# All that matters from no. 2 and no. 3 is the following. Here you
# can add $(SMALL_MEMORY) etc.

DDS_BEHAVIOR =

# ----------------------- OFTEN OK ------------------------------

# From here on you you don't have to change anything to CONFIGURE
# the compilation. But you may well have to change something to
# get it to compile.

INCL_SOURCE = Makefiles/sources.txt
INCL_DEPENDS = Makefiles/depends_o.txt

# If your compiler name is not given here, change it.
CC = c++

# We compile with aggressive warnings, but we have to turn off some
# of them as they appear in libraries in great numbers...

WARN_FLAGS = \
-Wshadow \
-Wsign-conversion \
-pedantic -Wall -Wextra \
-Wcast-align -Wcast-qual \
-Wctor-dtor-privacy \
-Wdisabled-optimization \
-Winit-self \
-Wmissing-declarations \
-Wmissing-include-dirs \
-Wold-style-cast \
-Woverloaded-virtual \
-Wredundant-decls \
-Wsign-promo \
-Wstrict-overflow=1 \
-Wswitch-default -Wundef \
-Werror \
-Wno-unused \
-Wno-unknown-pragmas \
-Wno-long-long \
-Wno-format

IFLAGS = -I/usr/local/include
COMPILE_FLAGS = -fPIC -O3 -flto -fopenmp -std=c++11 \
$(WARN_FLAGS) $(IFLAGS) \
$(DDS_BEHAVIOR) $(THREAD_COMPILE) $(THREADING)

DLLBASE = dds
SHARED_LIB = lib$(DLLBASE).so

include $(INCL_SOURCE)

O_FILES = $(SOURCE_FILES:S/cpp/o/)

LINK_FLAGS = \
-shared \
${COMPILE_FLAGS} \
-Wl,--sort-common \
-Wl,--as-needed \
-Wl,-z \
-Wl,relro \
$(THREAD_LINK) \
-L/usr/local/lib \
-fPIC


linux: $(O_FILES)
$(CC) \
-o $(SHARED_LIB) $(O_FILES) $(LINK_FLAGS)

.cpp.o:
$(CC) $(COMPILE_FLAGS) -c $< -o $@

depend:
makedepend -Y -- $(SOURCE_FILES)

clean:
rm -f $(O_FILES) $(SHARED_LIB)

install:
test -d ../test || mkdir ../test
test -d ../examples || mkdir ../examples
cp $(SHARED_LIB) ../test
cp $(SHARED_LIB) ../examples

include $(INCL_DEPENDS)

Loading