Skip to content

Commit

Permalink
Add build definitions for sfml.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed May 26, 2021
1 parent 09b5b60 commit 6ca92d3
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 0 deletions.
34 changes: 34 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
project('sfml', 'cpp',
version: '2.5.1',
default_options: ['cpp_std=c++17',
'wrap_mode=forcefallback',
])

cpp = meson.get_compiler('cpp')

stb_dep = dependency('stb')
openal_dep = dependency('openal')
thread_dep = dependency('threads')
gl_dep = dependency('gl')
winmm_dep = cpp.find_library('winmm', required: false)
w32_dep = cpp.find_library('ws2_32', required: false)
freetype_dep = dependency('freetype2')
flac_dep = dependency('flac')
ogg_dep = dependency('ogg')
vorbis_dep = dependency('vorbis')
vorbisenc_dep = dependency('vorbisenc')
vorbisfile_dep = dependency('vorbisfile')

pub_inc = include_directories('include')
priv_inc = include_directories('src')

subdir('src/SFML')

sfml_dep = declare_dependency(include_directories: 'include',
link_with: [audio_lib,
graphics_lib,
network_lib,
window_lib,
system_lib] + (host_machine.system() == 'windows' ? [main_lib] : []),
compile_args: get_option('default_library') == 'shared' ? [] : ['-DSFML_STATIC'],
)
35 changes: 35 additions & 0 deletions src/SFML/Audio/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
audio_sources = files(
'ALCheck.cpp',
'AlResource.cpp',
'AudioDevice.cpp',
'Listener.cpp',
'Music.cpp',
'Sound.cpp',
'SoundBuffer.cpp',
'SoundBufferRecorder.cpp',
'InputSoundFile.cpp',
'OutputSoundFile.cpp',
'SoundRecorder.cpp',
'SoundSource.cpp',
'SoundStream.cpp',

'SoundFileFactory.cpp',
'SoundFileReaderFlac.cpp',
'SoundFileReaderOgg.cpp',
'SoundFileReaderWav.cpp',
'SoundFileWriterFlac.cpp',
'SoundFileWriterOgg.cpp',
'SoundFileWriterWav.cpp',
)

audio_lib = library('sfml-audio',
audio_sources,
cpp_args: get_option('default_library') == 'shared' ? ['-DSFML_AUDIO_EXPORTS'] : ['-DSFML_STATIC'],
link_with: [system_lib],
include_directories: [pub_inc, priv_inc],
dependencies: [openal_dep,
flac_dep,
vorbis_dep,
vorbisenc_dep,
vorbisfile_dep,
ogg_dep])
49 changes: 49 additions & 0 deletions src/SFML/Graphics/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
graphics_sources = files(
'BlendMode.cpp',
'Color.cpp',
'Font.cpp',
'Glsl.cpp',
'GLCheck.cpp',
'GLExtensions.cpp',
'Image.cpp',
'ImageLoader.cpp',
'RenderStates.cpp',
'RenderTexture.cpp',
'RenderTarget.cpp',
'RenderWindow.cpp',
'Shader.cpp',
'Texture.cpp',
'TextureSaver.cpp',
'Transform.cpp',
'Transformable.cpp',
'View.cpp',
'Vertex.cpp',
)

# GLES not supported yet, so add always.
graphics_sources += files('GLLoader.cpp')

graphics_sources += files(
'Shape.cpp',
'CircleShape.cpp',
'RectangleShape.cpp',
'ConvexShape.cpp',
'Sprite.cpp',
'Text.cpp',
'VertexArray.cpp',
'VertexBuffer.cpp',
)

graphics_sources += files(
'RenderTextureImpl.cpp',
'RenderTextureImplFBO.cpp',
'RenderTextureImplDefault.cpp',
)

graphics_lib = library('sfml-graphics',
graphics_sources,
cpp_args: get_option('default_library') == 'shared' ? ['-DSFML_GRAPHICS_EXPORTS'] : ['-DSFML_STATIC'],
include_directories: [pub_inc, priv_inc],
link_with: [window_lib, system_lib],
dependencies: [gl_dep, stb_dep, freetype_dep],
)
4 changes: 4 additions & 0 deletions src/SFML/Main/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if host_machine.system() == 'windows'
main_lib = static_library('sfml-main', 'MainWin32.cpp',
include_directories: [pub_inc])
endif
25 changes: 25 additions & 0 deletions src/SFML/Network/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
network_sources = files(
'Ftp.cpp',
'Http.cpp',
'IpAddress.cpp',
'Packet.cpp',
'Socket.cpp',
'SocketSelector.cpp',
'TcpListener.cpp',
'TcpSocket.cpp',
'UdpSocket.cpp',
)

if host_machine.system() == 'windows'
network_sources += files('Win32/SocketImpl.cpp')
else
network_sources += files('Unix/SocketImpl.cpp')
endif

network_lib = library('sfml-network',
network_sources,
cpp_args: get_option('default_library') == 'shared' ? ['-DSFML_NETWORK_EXPORTS'] : ['-DSFML_STATIC'],
include_directories: [pub_inc, priv_inc],
link_with: [system_lib],
dependencies: [w32_dep],
)
38 changes: 38 additions & 0 deletions src/SFML/System/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
system_sources = files(
'Clock.cpp',
'Err.cpp',
'Lock.cpp',
'Mutex.cpp',
'Sleep.cpp',
'String.cpp',
'Thread.cpp',
'ThreadLocal.cpp',
'Time.cpp',
'FileInputStream.cpp',
'MemoryInputStream.cpp',
)

if host_machine.system() == 'windows'
system_sources += files(
'Win32/ClockImpl.cpp',
'Win32/MutexImpl.cpp',
'Win32/SleepImpl.cpp',
'Win32/SleepImpl.hpp',
'Win32/ThreadImpl.cpp',
'Win32/ThreadLocalImpl.cpp',
)
else
system_sources += files(
'Unix/ClockImpl.cpp',
'Unix/MutexImpl.cpp',
'Unix/SleepImpl.cpp',
'Unix/ThreadImpl.cpp',
'Unix/ThreadLocalImpl.cpp'
)
endif

system_lib = library('sfml-system',
system_sources,
cpp_args: get_option('default_library') == 'shared' ? ['-DSFML_SYSTEM_EXPORTS'] : ['-DSFML_STATIC'],
include_directories: [pub_inc, priv_inc],
dependencies: [thread_dep, winmm_dep])
58 changes: 58 additions & 0 deletions src/SFML/Window/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
window_sources = files(
'Clipboard.cpp',
'Context.cpp',
'Cursor.cpp',
'GlContext.cpp',
'GlResource.cpp',
'Joystick.cpp',
'JoystickManager.cpp',
'Keyboard.cpp',
'Mouse.cpp',
'Touch.cpp',
'Sensor.cpp',
'SensorManager.cpp',
'VideoMode.cpp',
'Window.cpp',
'WindowImpl.cpp',
)

if host_machine.system() == 'windows'
window_sources += files(
'Win32/CursorImpl.cpp',
'Win32/ClipboardImpl.cpp',
'Win32/WglContext.cpp',
'Win32/WglExtensions.cpp',
'Win32/InputImpl.cpp',
'Win32/JoystickImpl.cpp',
'Win32/SensorImpl.cpp',
'Win32/VideoModeImpl.cpp',
'Win32/WindowImplWin32.cpp',
)
window_deps = []
elif host_machine.system() == 'linux'
window_sources += files(
'Unix/CursorImpl.cpp',
'Unix/ClipboardImpl.cpp',
'Unix/Display.cpp',
'Unix/InputImpl.cpp',
'Unix/SensorImpl.cpp',
'Unix/VideoModeImpl.cpp',
'Unix/WindowImplX11.cpp',
'Unix/JoystickImpl.cpp',
'Unix/GlxContext.cpp',
'Unix/GlxExtensions.cpp',
)
window_deps = [dependency('xrandr'), dependency('x11'), dependency('libudev')]
else
error('Not yet implemented.')
endif

symbol_args = get_option('default_library') == 'shared' ? ['-DSFML_WINDOW_EXPORTS'] : ['-DSFML_STATIC']

window_lib = library('sfml-window',
window_sources,
cpp_args: symbol_args + ['-DUNICODE'],
link_with: [system_lib],
include_directories: [pub_inc, priv_inc],
dependencies: [gl_dep, winmm_dep] + window_deps,
)
6 changes: 6 additions & 0 deletions src/SFML/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
subdir('System')
subdir('Main')
subdir('Window')
subdir('Network')
subdir('Graphics')
subdir('Audio')
9 changes: 9 additions & 0 deletions upstream.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[wrap-file]
directory = SFML-2.5.1

source_url = https://github.com/SFML/SFML/archive/refs/tags/2.5.1.tar.gz
source_filename = 2.5.1.tar.gz
source_hash = 438c91a917cc8aa19e82c6f59f8714da353c488584a007d401efac8368e1c785

[provide]
sfml = sfml_dep

0 comments on commit 6ca92d3

Please sign in to comment.