##
|
|
## Compilation
|
|
##
|
|
|
|
C++ = clang++ ;
|
|
LINK = clang++ ;
|
|
# C++ = g++ ;
|
|
# LINK = g++ ;
|
|
|
|
if $(UNIX) { SUFSHR = .so ; }
|
|
else if $(NT) { SUFSHR = .dll ; }
|
|
|
|
if $(CROSS_COMPILE_WINDOWS)
|
|
{
|
|
C++ = x86_64-w64-mingw32-g++ ;
|
|
LINK = x86_64-w64-mingw32-g++ ;
|
|
AR = x86_64-w64-mingw32-ar ;
|
|
SUFEXE = .exe ;
|
|
|
|
OS_DEPENDENT_C++FLAGS = -DWINDOWS ;
|
|
OS_DEPENDENT_LINKLIBS = ;
|
|
OS_DEPENDENT_LINKFLAGS = --export-all-symbols ;
|
|
|
|
MINGW_LIB_PATH = /usr/lib/gcc/x86_64-w64-mingw32/7.3-win32 ;
|
|
OS_DEPENDENT_DLLS =
|
|
$(MINGW_LIB_PATH)/libgcc_s_seh-1.dll
|
|
$(MINGW_LIB_PATH)/libstdc++-6.dll ;
|
|
}
|
|
else if $(UNIX)
|
|
{
|
|
OS_DEPENDENT_C++FLAGS = -DUNIX ;
|
|
# For dynamic loading: ldl loads, export-dynamic lets the loaded code resolve its symbols to the loader's code
|
|
OS_DEPENDENT_LINKLIBS = -ldl ;
|
|
OS_DEPENDENT_LINKFLAGS = --export-dynamic ;
|
|
OS_DEPENDENT_DLLS = ;
|
|
}
|
|
else if $(NT)
|
|
{
|
|
OS_DEPENDENT_C++FLAGS = -DWINDOWS ;
|
|
# TODO: Windows support
|
|
OS_DEPENDENT_LINKLIBS = ;
|
|
OS_DEPENDENT_LINKFLAGS = ;
|
|
OS_DEPENDENT_DLLS = ;
|
|
}
|
|
|
|
# Arguments used on all projects, regardless of any variables
|
|
C++FLAGS = -std=c++11 -Wall -Wextra -Wno-unused-parameter
|
|
# Only for profiling, i.e. not release builds
|
|
# -DTRACY_ENABLE
|
|
-g
|
|
# Needed for dynamic linking
|
|
-fPIC
|
|
|
|
$(OS_DEPENDENT_C++FLAGS)
|
|
;
|
|
|
|
# TODO: Make base hold all this weirdness?
|
|
# if $(DEBUG_BUILD)
|
|
# {
|
|
# SFML_LINKLIBS = -lsfml-audio-d -lsfml-graphics-d -lsfml-window-d -lsfml-system-d ;
|
|
# }
|
|
# else
|
|
# {
|
|
# SFML_LINKLIBS = -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system ;
|
|
# }
|
|
|
|
OPTIM = -O0 ;
|
|
|
|
##
|
|
## Linking
|
|
##
|
|
|
|
LINKLIBS =
|
|
# Standard (e.g. for Tracy)
|
|
-lpthread
|
|
# Functions for dynamically loading libraries (UNIX)
|
|
$(OS_DEPENDENT_LINKLIBS)
|
|
;
|
|
|
|
LINKFLAGS = -g
|
|
# -Wl = pass to linker
|
|
# --export-dynamic = Export all symbols so dynamically loaded code can resolve their symbols to ours
|
|
-Wl,-rpath,.,$(OS_DEPENDENT_LINKFLAGS)
|
|
;
|
|
##
|
|
## Jam stuff
|
|
##
|
|
|
|
# Fix for unnecessary rebuilding any Jam project
|
|
KEEPOBJS = true ; # This doesn't actually fix anything, though it seems like it should
|
|
NOARSCAN = true ; # This actually fixes the problem
|
|
#AR = ar rUu ; # I was thinking maybe the AR command was wrong (always outputting deterministically)
|
|
# It doesn't seem like this is the problem though
|
|
AR = ar cr ;
|
|
|
|
# Some helpful Jam commands
|
|
# -q : stop on failed target
|
|
# -jN : use N cores
|
|
# -sVAR=VAL : Set VAR to VAL. Note that setting WINDOWS=false is the same as setting WINDOWS=true,
|
|
# frustratingly (as if it's an ifdef not an if x = y
|
|
# -dx : print commands being used
|
|
# -n : don't actually run commands
|