meson.build 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. project('msvc dll versioning', 'c')
  2. cc = meson.get_compiler('c')
  3. if cc.get_id() != 'msvc'
  4. error('MESON_SKIP_TEST: test is only for msvc')
  5. endif
  6. # Test that MSVC creates correctly-named dll files and .lib files,
  7. # and also installs them in the right place
  8. some = shared_library('some', 'lib.c',
  9. version : '1.2.3',
  10. soversion : '0',
  11. install : true)
  12. noversion = shared_library('noversion', 'lib.c',
  13. install : true)
  14. onlyversion = shared_library('onlyversion', 'lib.c',
  15. version : '1.4.5',
  16. install : true)
  17. onlysoversion = shared_library('onlysoversion', 'lib.c',
  18. # Also test that int soversion is acceptable
  19. soversion : 5,
  20. install : true)
  21. # Hack to make the executables below depend on the shared libraries above
  22. # without actually adding them as `link_with` dependencies since we want to try
  23. # linking to them with -lfoo linker arguments.
  24. cp = find_program('copyfile.py')
  25. out = custom_target('library-dependency-hack',
  26. input : 'exe.orig.c',
  27. output : 'exe.c',
  28. depends : [some, noversion, onlyversion, onlysoversion],
  29. command : [cp, '@INPUT@', '@OUTPUT@'])
  30. # Manually test if the linker can find the above libraries
  31. # i.e., whether they were generated with the right naming scheme
  32. test('manually linked 1', executable('manuallink1', out,
  33. link_args : ['-L.', '-lsome']))
  34. test('manually linked 2', executable('manuallink2', out,
  35. link_args : ['-L.', '-lnoversion']))
  36. test('manually linked 3', executable('manuallink3', out,
  37. link_args : ['-L.', '-lonlyversion']))
  38. test('manually linked 4', executable('manuallink4', out,
  39. link_args : ['-L.', '-lonlysoversion']))
  40. shared_library('customdir', 'lib.c',
  41. install : true,
  42. install_dir : get_option('libexecdir'))
  43. shared_module('module', 'lib.c', install : true)