Skip to content
This repository was archived by the owner on Mar 10, 2025. It is now read-only.

Commit 6ca92d3

Browse files
committed
Add build definitions for sfml.
1 parent 09b5b60 commit 6ca92d3

File tree

9 files changed

+258
-0
lines changed

9 files changed

+258
-0
lines changed

meson.build

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
project('sfml', 'cpp',
2+
version: '2.5.1',
3+
default_options: ['cpp_std=c++17',
4+
'wrap_mode=forcefallback',
5+
])
6+
7+
cpp = meson.get_compiler('cpp')
8+
9+
stb_dep = dependency('stb')
10+
openal_dep = dependency('openal')
11+
thread_dep = dependency('threads')
12+
gl_dep = dependency('gl')
13+
winmm_dep = cpp.find_library('winmm', required: false)
14+
w32_dep = cpp.find_library('ws2_32', required: false)
15+
freetype_dep = dependency('freetype2')
16+
flac_dep = dependency('flac')
17+
ogg_dep = dependency('ogg')
18+
vorbis_dep = dependency('vorbis')
19+
vorbisenc_dep = dependency('vorbisenc')
20+
vorbisfile_dep = dependency('vorbisfile')
21+
22+
pub_inc = include_directories('include')
23+
priv_inc = include_directories('src')
24+
25+
subdir('src/SFML')
26+
27+
sfml_dep = declare_dependency(include_directories: 'include',
28+
link_with: [audio_lib,
29+
graphics_lib,
30+
network_lib,
31+
window_lib,
32+
system_lib] + (host_machine.system() == 'windows' ? [main_lib] : []),
33+
compile_args: get_option('default_library') == 'shared' ? [] : ['-DSFML_STATIC'],
34+
)

src/SFML/Audio/meson.build

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
audio_sources = files(
2+
'ALCheck.cpp',
3+
'AlResource.cpp',
4+
'AudioDevice.cpp',
5+
'Listener.cpp',
6+
'Music.cpp',
7+
'Sound.cpp',
8+
'SoundBuffer.cpp',
9+
'SoundBufferRecorder.cpp',
10+
'InputSoundFile.cpp',
11+
'OutputSoundFile.cpp',
12+
'SoundRecorder.cpp',
13+
'SoundSource.cpp',
14+
'SoundStream.cpp',
15+
16+
'SoundFileFactory.cpp',
17+
'SoundFileReaderFlac.cpp',
18+
'SoundFileReaderOgg.cpp',
19+
'SoundFileReaderWav.cpp',
20+
'SoundFileWriterFlac.cpp',
21+
'SoundFileWriterOgg.cpp',
22+
'SoundFileWriterWav.cpp',
23+
)
24+
25+
audio_lib = library('sfml-audio',
26+
audio_sources,
27+
cpp_args: get_option('default_library') == 'shared' ? ['-DSFML_AUDIO_EXPORTS'] : ['-DSFML_STATIC'],
28+
link_with: [system_lib],
29+
include_directories: [pub_inc, priv_inc],
30+
dependencies: [openal_dep,
31+
flac_dep,
32+
vorbis_dep,
33+
vorbisenc_dep,
34+
vorbisfile_dep,
35+
ogg_dep])

src/SFML/Graphics/meson.build

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
graphics_sources = files(
2+
'BlendMode.cpp',
3+
'Color.cpp',
4+
'Font.cpp',
5+
'Glsl.cpp',
6+
'GLCheck.cpp',
7+
'GLExtensions.cpp',
8+
'Image.cpp',
9+
'ImageLoader.cpp',
10+
'RenderStates.cpp',
11+
'RenderTexture.cpp',
12+
'RenderTarget.cpp',
13+
'RenderWindow.cpp',
14+
'Shader.cpp',
15+
'Texture.cpp',
16+
'TextureSaver.cpp',
17+
'Transform.cpp',
18+
'Transformable.cpp',
19+
'View.cpp',
20+
'Vertex.cpp',
21+
)
22+
23+
# GLES not supported yet, so add always.
24+
graphics_sources += files('GLLoader.cpp')
25+
26+
graphics_sources += files(
27+
'Shape.cpp',
28+
'CircleShape.cpp',
29+
'RectangleShape.cpp',
30+
'ConvexShape.cpp',
31+
'Sprite.cpp',
32+
'Text.cpp',
33+
'VertexArray.cpp',
34+
'VertexBuffer.cpp',
35+
)
36+
37+
graphics_sources += files(
38+
'RenderTextureImpl.cpp',
39+
'RenderTextureImplFBO.cpp',
40+
'RenderTextureImplDefault.cpp',
41+
)
42+
43+
graphics_lib = library('sfml-graphics',
44+
graphics_sources,
45+
cpp_args: get_option('default_library') == 'shared' ? ['-DSFML_GRAPHICS_EXPORTS'] : ['-DSFML_STATIC'],
46+
include_directories: [pub_inc, priv_inc],
47+
link_with: [window_lib, system_lib],
48+
dependencies: [gl_dep, stb_dep, freetype_dep],
49+
)

src/SFML/Main/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if host_machine.system() == 'windows'
2+
main_lib = static_library('sfml-main', 'MainWin32.cpp',
3+
include_directories: [pub_inc])
4+
endif

src/SFML/Network/meson.build

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
network_sources = files(
2+
'Ftp.cpp',
3+
'Http.cpp',
4+
'IpAddress.cpp',
5+
'Packet.cpp',
6+
'Socket.cpp',
7+
'SocketSelector.cpp',
8+
'TcpListener.cpp',
9+
'TcpSocket.cpp',
10+
'UdpSocket.cpp',
11+
)
12+
13+
if host_machine.system() == 'windows'
14+
network_sources += files('Win32/SocketImpl.cpp')
15+
else
16+
network_sources += files('Unix/SocketImpl.cpp')
17+
endif
18+
19+
network_lib = library('sfml-network',
20+
network_sources,
21+
cpp_args: get_option('default_library') == 'shared' ? ['-DSFML_NETWORK_EXPORTS'] : ['-DSFML_STATIC'],
22+
include_directories: [pub_inc, priv_inc],
23+
link_with: [system_lib],
24+
dependencies: [w32_dep],
25+
)

src/SFML/System/meson.build

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
system_sources = files(
2+
'Clock.cpp',
3+
'Err.cpp',
4+
'Lock.cpp',
5+
'Mutex.cpp',
6+
'Sleep.cpp',
7+
'String.cpp',
8+
'Thread.cpp',
9+
'ThreadLocal.cpp',
10+
'Time.cpp',
11+
'FileInputStream.cpp',
12+
'MemoryInputStream.cpp',
13+
)
14+
15+
if host_machine.system() == 'windows'
16+
system_sources += files(
17+
'Win32/ClockImpl.cpp',
18+
'Win32/MutexImpl.cpp',
19+
'Win32/SleepImpl.cpp',
20+
'Win32/SleepImpl.hpp',
21+
'Win32/ThreadImpl.cpp',
22+
'Win32/ThreadLocalImpl.cpp',
23+
)
24+
else
25+
system_sources += files(
26+
'Unix/ClockImpl.cpp',
27+
'Unix/MutexImpl.cpp',
28+
'Unix/SleepImpl.cpp',
29+
'Unix/ThreadImpl.cpp',
30+
'Unix/ThreadLocalImpl.cpp'
31+
)
32+
endif
33+
34+
system_lib = library('sfml-system',
35+
system_sources,
36+
cpp_args: get_option('default_library') == 'shared' ? ['-DSFML_SYSTEM_EXPORTS'] : ['-DSFML_STATIC'],
37+
include_directories: [pub_inc, priv_inc],
38+
dependencies: [thread_dep, winmm_dep])

src/SFML/Window/meson.build

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
window_sources = files(
2+
'Clipboard.cpp',
3+
'Context.cpp',
4+
'Cursor.cpp',
5+
'GlContext.cpp',
6+
'GlResource.cpp',
7+
'Joystick.cpp',
8+
'JoystickManager.cpp',
9+
'Keyboard.cpp',
10+
'Mouse.cpp',
11+
'Touch.cpp',
12+
'Sensor.cpp',
13+
'SensorManager.cpp',
14+
'VideoMode.cpp',
15+
'Window.cpp',
16+
'WindowImpl.cpp',
17+
)
18+
19+
if host_machine.system() == 'windows'
20+
window_sources += files(
21+
'Win32/CursorImpl.cpp',
22+
'Win32/ClipboardImpl.cpp',
23+
'Win32/WglContext.cpp',
24+
'Win32/WglExtensions.cpp',
25+
'Win32/InputImpl.cpp',
26+
'Win32/JoystickImpl.cpp',
27+
'Win32/SensorImpl.cpp',
28+
'Win32/VideoModeImpl.cpp',
29+
'Win32/WindowImplWin32.cpp',
30+
)
31+
window_deps = []
32+
elif host_machine.system() == 'linux'
33+
window_sources += files(
34+
'Unix/CursorImpl.cpp',
35+
'Unix/ClipboardImpl.cpp',
36+
'Unix/Display.cpp',
37+
'Unix/InputImpl.cpp',
38+
'Unix/SensorImpl.cpp',
39+
'Unix/VideoModeImpl.cpp',
40+
'Unix/WindowImplX11.cpp',
41+
'Unix/JoystickImpl.cpp',
42+
'Unix/GlxContext.cpp',
43+
'Unix/GlxExtensions.cpp',
44+
)
45+
window_deps = [dependency('xrandr'), dependency('x11'), dependency('libudev')]
46+
else
47+
error('Not yet implemented.')
48+
endif
49+
50+
symbol_args = get_option('default_library') == 'shared' ? ['-DSFML_WINDOW_EXPORTS'] : ['-DSFML_STATIC']
51+
52+
window_lib = library('sfml-window',
53+
window_sources,
54+
cpp_args: symbol_args + ['-DUNICODE'],
55+
link_with: [system_lib],
56+
include_directories: [pub_inc, priv_inc],
57+
dependencies: [gl_dep, winmm_dep] + window_deps,
58+
)

src/SFML/meson.build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
subdir('System')
2+
subdir('Main')
3+
subdir('Window')
4+
subdir('Network')
5+
subdir('Graphics')
6+
subdir('Audio')

upstream.wrap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[wrap-file]
2+
directory = SFML-2.5.1
3+
4+
source_url = https://github.com/SFML/SFML/archive/refs/tags/2.5.1.tar.gz
5+
source_filename = 2.5.1.tar.gz
6+
source_hash = 438c91a917cc8aa19e82c6f59f8714da353c488584a007d401efac8368e1c785
7+
8+
[provide]
9+
sfml = sfml_dep

0 commit comments

Comments
 (0)