# A project header for using the DFPSR library.
#   Backends:
#     * Give the Graphics flag if the application should be able to create a window.
#     * Give the Sound flag if the application should be able to generate sounds.
#   Systems:
#     * Give the Linux flag when compiling on Linux or similar Posix systems having the same dependencies installed.
#     * Give the MacOS flag when compiling on MacOS.
#     * Give the Windows flag when compiling on Microsoft Windows.

if Linux
	Message "Building for Linux\n"
end if
if MacOS
	Message "Building for MacOS\n"
end if
if Windows
	Message "Building for Windows\n"
end if

# Standard math library
Link "m"

# Posix threading library on all platforms for consistent behavior
Link "pthread"
                                                                                                                                                                                                                                                   
# Paths are relative to the current script, even if imported somewhere else
#   so we use .. to leave the Source/DFPSR folder and then go into the windowManagers folder.
WindowManager = "../windowManagers/NoWindow.cpp"
if Graphics
	Message "Building with graphics enabled\n"
	if Linux
		Message "  Using X11\n"
		Link "X11"
		WindowManager = "../windowManagers/X11Window.cpp"
	end if
	if MacOS
		Message "  Using Cocoa\n"
		Framework "Cocoa"
		WindowManager = "../windowManagers/CocoaWindow.mm"
	end if
	if Windows
		Message "  Using Win32\n"
		Link "gdi32"
		Link "user32"
		Link "kernel32"
		Link "comctl32"
		WindowManager = "../windowManagers/Win32Window.cpp"
		# If the UNICODE macro is not set, SetWindowTextW will behave as SetWindowTextA and null terminate from the second byte in the first character.
		CompilerFlag "-DUNICODE"
	end if
end if
Crawl WindowManager

SoundManager = "../soundManagers/NoSound.cpp"
if Sound
	Message "Building with sound enabled\n"
	if Linux
		Message "  Using Alsa\n"
		Link "asound"
		SoundManager = "../soundManagers/AlsaSound.cpp"
	end if
	if MacOS
		Message "  Using CoreAudio\n"
		#Linking to AudioUnit, which is a part of CoreAudio.
		Framework "AudioUnit"
		SoundManager = "../soundManagers/CoreAudioSound.cpp"
	end if
	if Windows
		Message "  Using WinMM\n"
		Link "winmm"
		SoundManager = "../soundManagers/WinMMSound.cpp"
	end if
end if
Crawl SoundManager
