Skip to content
4 changes: 4 additions & 0 deletions system/lib/pkgconfig/glfw3.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Name: GLFW
Description: A multi-platform library for OpenGL, window and input
Version: 3.2.1
Libs: -sUSE_GLFW=3
3 changes: 2 additions & 1 deletion tests/cmake/find_pkg_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ endif()
message(STATUS "Check that all .pc files shipped with Emscripten can be located correctly")
pkg_check_modules(EGL REQUIRED egl)
pkg_check_modules(GLESV2 REQUIRED glesv2)
pkg_check_modules(SDL2 REQUIRED sdl)
pkg_check_modules(GLFW3 REQUIRED glfw3)
pkg_check_modules(SDL REQUIRED sdl)
27 changes: 25 additions & 2 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ def metafunc(self, backend):
return metafunc


def requires_pkg_config(func):
assert callable(func)

@wraps(func)
def decorated(self, *args, **kwargs):
if not utils.which('pkg-config'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a EMTEST_SKIP_PKG_CONFIG setting (see the existing EMTEST_SKIP_V8) so that we can disable these tests in certain environments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done in 211f806

self.fail('pkg-config is required to run this test')
return func(self, *args, **kwargs)

return decorated


class other(RunnerCore):
def assertIsObjectFile(self, filename):
self.assertTrue(building.is_wasm(filename))
Expand Down Expand Up @@ -805,14 +817,25 @@ def test_cmake_find_modules(self):
self.assertContained('AL_VERSION: 1.1', output)
self.assertContained('SDL version: 2.0.', output)

@requires_pkg_config
def test_cmake_find_pkg_config(self):
if not utils.which('pkg-config'):
self.fail('pkg-config is required to run this test')
out = self.run_process([EMCMAKE, 'cmake', test_file('cmake/find_pkg_config')], stdout=PIPE).stdout
libdir = shared.Cache.get_sysroot_dir('local', 'lib', 'pkgconfig')
libdir += os.path.pathsep + shared.Cache.get_sysroot_dir('lib', 'pkgconfig')
self.assertContained('PKG_CONFIG_LIBDIR: ' + libdir, out)

@requires_pkg_config
def test_pkg_config_packages(self):
packages = [
('egl', '10.2.2'),
('glesv2', '10.2.2'),
('glfw3', '3.2.1'),
('sdl', '1.2.15'),
]
for package, version in packages:
out = self.run_process([emmake, 'pkg-config', '--modversion', package], stdout=PIPE).stdout
self.assertContained(version, out)

def test_system_include_paths(self):
# Verify that all default include paths are within `emscripten/system`

Expand Down