wg_engineL fix test build scripts and ambiguous declarations

Issue https://github.com/thorvg/thorvg/issues/2938
This commit is contained in:
SergeyLebedkin 2024-11-08 14:00:45 +02:00 committed by Jinny You
parent c49cb49e5c
commit 4b6f2172be
2 changed files with 17 additions and 7 deletions

View file

@ -1,9 +1,11 @@
examples_compiler_flags = compiler_flags
if lib_type == 'static' if lib_type == 'static'
compiler_flags += ['-DTVG_STATIC'] examples_compiler_flags += ['-DTVG_STATIC']
endif endif
if target_opengles if target_opengles
compiler_flags += '-DTHORVG_GL_TARGET_GLES=1' examples_compiler_flags += '-DTHORVG_GL_TARGET_GLES=1'
endif endif
examples_dep = [dependency('sdl2')] examples_dep = [dependency('sdl2')]
@ -13,7 +15,7 @@ if all_engines or get_option('engines').contains('wg')
if host_machine.system() == 'darwin' if host_machine.system() == 'darwin'
add_languages('objcpp') add_languages('objcpp')
examples_dep += declare_dependency(link_args: ['-lobjc', '-framework', 'Cocoa', '-framework', 'CoreVideo', '-framework', 'IOKit', '-framework', 'QuartzCore']) examples_dep += declare_dependency(link_args: ['-lobjc', '-framework', 'Cocoa', '-framework', 'CoreVideo', '-framework', 'IOKit', '-framework', 'QuartzCore'])
compiler_flags += ['-x', 'objective-c++'] examples_compiler_flags += ['-x', 'objective-c++']
endif endif
endif endif
@ -86,7 +88,7 @@ foreach current_file : source_file
executable(name, current_file, executable(name, current_file,
include_directories : headers, include_directories : headers,
link_with : thorvg_lib, link_with : thorvg_lib,
cpp_args : compiler_flags, cpp_args : examples_compiler_flags,
dependencies : examples_dep) dependencies : examples_dep)
endforeach endforeach
@ -101,7 +103,7 @@ if get_option('bindings').contains('capi')
executable(name, current_file, executable(name, current_file,
include_directories : headers, include_directories : headers,
link_with : thorvg_lib, link_with : thorvg_lib,
cpp_args : compiler_flags, cpp_args : examples_compiler_flags,
dependencies : examples_dep) dependencies : examples_dep)
endforeach endforeach
endif endif

View file

@ -1,5 +1,12 @@
test_compiler_flags = compiler_flags
if lib_type == 'static' if lib_type == 'static'
compiler_flags += ['-DTVG_STATIC'] test_compiler_flags += ['-DTVG_STATIC']
endif
test_dep = []
if host_machine.system() == 'darwin'
test_dep += declare_dependency(link_args: ['-framework', 'Cocoa', '-framework', 'IOKit'])
endif endif
test_file = [ test_file = [
@ -23,7 +30,8 @@ tests = executable('tvgUnitTests',
test_file, test_file,
include_directories : headers, include_directories : headers,
link_with : thorvg_lib, link_with : thorvg_lib,
cpp_args : compiler_flags) cpp_args : test_compiler_flags,
dependencies : test_dep)
test('Unit Tests', tests, args : ['--success']) test('Unit Tests', tests, args : ['--success'])