Skip to content

Commit 0138013

Browse files
authored
Add pkgconfig file for GLFW (#17100)
Addresses #2387 for GLFW.
1 parent 092eb52 commit 0138013

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ jobs:
496496
other.test_libc_progname
497497
other.test_realpath
498498
other.test_embed_file_dup
499-
other.test_dot_a_all_contents_invalid"
499+
other.test_dot_a_all_contents_invalid
500+
other.test_pkg_config*"
500501
# Run a single websockify-based test to ensure it works on windows.
501502
- run-tests:
502503
test_targets: "sockets.test_nodejs_sockets_echo*"

system/lib/pkgconfig/glfw3.pc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Name: GLFW
2+
Description: A multi-platform library for OpenGL, window and input
3+
Version: 3.2.1
4+
Libs: -sUSE_GLFW=3

tests/cmake/find_pkg_config/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ endif()
1111
message(STATUS "Check that all .pc files shipped with Emscripten can be located correctly")
1212
pkg_check_modules(EGL REQUIRED egl)
1313
pkg_check_modules(GLESV2 REQUIRED glesv2)
14-
pkg_check_modules(SDL2 REQUIRED sdl)
14+
pkg_check_modules(GLFW3 REQUIRED glfw3)
15+
pkg_check_modules(SDL REQUIRED sdl)

tests/test_other.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,21 @@ def decorated(self, *args, **kwargs):
147147
return decorated
148148

149149

150+
def requires_pkg_config(func):
151+
assert callable(func)
152+
153+
@wraps(func)
154+
def decorated(self, *args, **kwargs):
155+
if not utils.which('pkg-config'):
156+
if 'EMTEST_SKIP_PKG_CONFIG' in os.environ:
157+
self.skipTest('test requires pkg-config and EMTEST_SKIP_PKG_CONFIG is set')
158+
else:
159+
self.fail('pkg-config is required to run this test')
160+
return func(self, *args, **kwargs)
161+
162+
return decorated
163+
164+
150165
class other(RunnerCore):
151166
def assertIsObjectFile(self, filename):
152167
self.assertTrue(building.is_wasm(filename))
@@ -816,14 +831,25 @@ def test_cmake_find_modules(self):
816831
self.assertContained('AL_VERSION: 1.1', output)
817832
self.assertContained('SDL version: 2.0.', output)
818833

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

841+
@requires_pkg_config
842+
def test_pkg_config_packages(self):
843+
packages = [
844+
('egl', '10.2.2'),
845+
('glesv2', '10.2.2'),
846+
('glfw3', '3.2.1'),
847+
('sdl', '1.2.15'),
848+
]
849+
for package, version in packages:
850+
out = self.run_process([emmake, 'pkg-config', '--modversion', package], stdout=PIPE).stdout
851+
self.assertContained(version, out)
852+
827853
def test_system_include_paths(self):
828854
# Verify that all default include paths are within `emscripten/system`
829855

0 commit comments

Comments
 (0)