Fixed static builds on all platforms. So close to getting all this set up!

This commit is contained in:
Pietro Gagliardi 2019-03-24 14:11:02 -04:00
parent c1dfc0ab5d
commit 467a9102ec
3 changed files with 25 additions and 4 deletions

View File

@ -53,7 +53,7 @@ libui_forced_options = {
}
foreach name, value : libui_forced_options
# TODO why does meson need this guard? why aren't all options defined regardless of target?!
if not (name == 'cpp_eh' and not libui_MSVC) and not (name == 'c_std' and libui_MSVC)
if not ((name == 'c_winlibs' or name == 'cpp_eh' or name == 'cpp_winlibs') and not libui_MSVC) and not (name == 'c_std' and libui_MSVC)
actual = '@0@'.format(get_option(name))
if actual != value
error('sorry, but libui requires that option ' + name + ' has the default value ' + value)
@ -122,6 +122,13 @@ else
endif
endif
libui_manifest_args = []
if libui_mode == 'static'
add_project_arguments('-D_UI_STATIC',
language: ['c', 'cpp', 'objc'])
libui_manifest_args = ['-D_UI_STATIC']
endif
libui_sources = []
libui_base_include_directories = [include_directories('.')]
libui_include_directories = libui_base_include_directories
@ -139,6 +146,7 @@ else
subdir('unix')
install_headers('ui_unix.h')
endif
# TODO make sure the name is always libui.(something) regardless of the OS or build type
libui_libui = library('ui', libui_sources,
include_directories: libui_include_directories,
dependencies: libui_deps,

View File

@ -26,13 +26,25 @@ libui_test_sources = [
'page16.c',
'spaced.c',
]
if libui_OS == 'windows' and libui_mode == 'static'
libui_test_sources += ['resources.rc']
libui_test_include_directories = libui_base_include_directories + [include_directories('.')]
if libui_OS == 'windows'
libui_test_manifest = 'test.manifest'
if libui_mode == 'static'
libui_test_manifest = 'test.static.manifest'
endif
libui_test_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: [libui_test_manifest],
include_directories: libui_test_include_directories),
]
endif
# TODO meson doesn't let us name this target test, but also doesn't seem to provide a way to override the executable name????
executable('tester', libui_test_sources,
include_directories: libui_base_include_directories + [include_directories('.')],
include_directories: libui_test_include_directories,
dependencies: libui_binary_deps,
link_with: libui_libui,
build_by_default: false,

View File

@ -77,6 +77,7 @@ if libui_mode == 'shared'
libui_sources += [
# TODO settle the path thing once and for all
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: ['libui.manifest'],
include_directories: libui_include_directories),
]