Add a test for generated header deps of generated sources

pull/803/head
Nirbheek Chauhan 8 years ago
parent d3e73e0dbc
commit 3be01a7e7b
  1. 6
      test cases/common/95 dep fallback/gensrc.py
  2. 11
      test cases/common/95 dep fallback/meson.build
  3. 3
      test cases/common/95 dep fallback/subprojects/boblib/bob.c
  4. 3
      test cases/common/95 dep fallback/subprojects/boblib/bob.h
  5. 7
      test cases/common/95 dep fallback/subprojects/boblib/genbob.py
  6. 11
      test cases/common/95 dep fallback/subprojects/boblib/meson.build
  7. 1
      test cases/common/95 dep fallback/tester.c

@ -0,0 +1,6 @@
#!/usr/bin/env python
import sys
import shutil
shutil.copyfile(sys.argv[1], sys.argv[2])

@ -6,5 +6,14 @@ if not bob.found()
endif
jimmy = dependency('jimmylib', fallback : ['jimmylib', 'jimmy_dep'], required: false)
exe = executable('bobtester', 'tester.c', dependencies : bob)
gensrc_py = find_program('gensrc.py')
gensrc = custom_target('gensrc.c',
input : 'tester.c',
output : 'gensrc.c',
command : [gensrc_py, '@INPUT@', '@OUTPUT@'])
exe = executable('bobtester',
[gensrc],
dependencies : bob)
test('bobtester', exe)

@ -1,5 +1,8 @@
#include"bob.h"
#ifdef _MSC_VER
__declspec(dllexport)
#endif
const char* get_bob() {
return "bob";
}

@ -1,3 +1,6 @@
#pragma once
#ifdef _MSC_VER
__declspec(dllimport)
#endif
const char* get_bob();

@ -0,0 +1,7 @@
#!/usr/bin/env python
import os
import sys
with open(sys.argv[1], 'w') as f:
f.write('')

@ -1,7 +1,16 @@
project('bob', 'c')
boblib = static_library('bob', 'bob.c')
gensrc_py = find_program('genbob.py')
genbob_h = custom_target('genbob.h',
output : 'genbob.h',
command : [gensrc_py, '@OUTPUT@'])
genbob_c = custom_target('genbob.c',
output : 'genbob.c',
command : [gensrc_py, '@OUTPUT@'])
boblib = library('bob', ['bob.c', genbob_c])
bobinc = include_directories('.')
bob_dep = declare_dependency(link_with : boblib,
sources : [genbob_h],
include_directories : bobinc)

@ -1,4 +1,5 @@
#include"bob.h"
#include"genbob.h"
#include<string.h>
#include<stdio.h>

Loading…
Cancel
Save