diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..07a9dc9 --- /dev/null +++ b/meson.build @@ -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'], +) diff --git a/src/SFML/Audio/meson.build b/src/SFML/Audio/meson.build new file mode 100644 index 0000000..765f592 --- /dev/null +++ b/src/SFML/Audio/meson.build @@ -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]) diff --git a/src/SFML/Graphics/meson.build b/src/SFML/Graphics/meson.build new file mode 100644 index 0000000..2361718 --- /dev/null +++ b/src/SFML/Graphics/meson.build @@ -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], +) diff --git a/src/SFML/Main/meson.build b/src/SFML/Main/meson.build new file mode 100644 index 0000000..499fd12 --- /dev/null +++ b/src/SFML/Main/meson.build @@ -0,0 +1,4 @@ +if host_machine.system() == 'windows' + main_lib = static_library('sfml-main', 'MainWin32.cpp', + include_directories: [pub_inc]) +endif diff --git a/src/SFML/Network/meson.build b/src/SFML/Network/meson.build new file mode 100644 index 0000000..748d41d --- /dev/null +++ b/src/SFML/Network/meson.build @@ -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], +) diff --git a/src/SFML/System/meson.build b/src/SFML/System/meson.build new file mode 100644 index 0000000..d8fdbee --- /dev/null +++ b/src/SFML/System/meson.build @@ -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]) diff --git a/src/SFML/Window/meson.build b/src/SFML/Window/meson.build new file mode 100644 index 0000000..ce262a9 --- /dev/null +++ b/src/SFML/Window/meson.build @@ -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, +) diff --git a/src/SFML/meson.build b/src/SFML/meson.build new file mode 100644 index 0000000..4f7a772 --- /dev/null +++ b/src/SFML/meson.build @@ -0,0 +1,6 @@ +subdir('System') +subdir('Main') +subdir('Window') +subdir('Network') +subdir('Graphics') +subdir('Audio') diff --git a/upstream.wrap b/upstream.wrap new file mode 100644 index 0000000..1bc1d94 --- /dev/null +++ b/upstream.wrap @@ -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