diff --git a/meson.build b/meson.build index 5fe4ffce..2afb9cfe 100644 --- a/meson.build +++ b/meson.build @@ -61,21 +61,12 @@ libui_mode = get_option('default_library') if libui_mode == 'both' error('sorry, but libui does not support building both shared and static libraries at the same time, because Windows resource file rules differ between the two') endif -if libui_OS == 'windows' and libui_mode == 'shared' and not libui_MSVC - error('sorry, but libui currently does not support building a shared library with MinGW; use --default_library=static instead') -endif # TODO there has to be a better way to specify this libui_buildtype = get_option('buildtype') libui_is_debug = libui_buildtype == 'debug' or libui_buildtype == 'debugoptimized' -libui_deps = [] -libui_soversion = '' -libui_rpath = '' -if libui_OS == 'windows' - # TODO c_winlibs and cpp_winlibs are the windows libraries - # user32 kernel32 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid windowscodecs -elif libui_OS == 'darwin' +if libui_OS == 'darwin' # TODO see if there's a more direct way to set this libui_macosx_version_min = '-mmacosx-version-min=10.8' add_project_arguments(libui_macosx_version_min, @@ -83,7 +74,6 @@ elif libui_OS == 'darwin' language: ['c', 'cpp', 'objc']) add_project_link_arguments(libui_macosx_version_min, language: ['c', 'cpp', 'objc']) -else endif # TODO see if there's a more direct way to set any of these @@ -131,9 +121,9 @@ endif libui_sources = [] libui_base_include_directories = [include_directories('.')] libui_include_directories = libui_base_include_directories -# TODO make this not += -libui_deps += [] -libui_extra_libs = [] +libui_deps = [] +libui_soversion = '' +libui_rpath = '' subdir('common') if libui_OS == 'windows' subdir('windows') diff --git a/test/meson.build b/test/meson.build index 455154be..30a994b0 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,10 +1,5 @@ # 23 march 2019 -# TODO -#if(WIN32) -# set(_TEST_RESOURCES_RC resources.rc) -#endif() - libui_test_sources = [ 'drawtests.c', 'images.c', @@ -31,6 +26,9 @@ libui_test_sources = [ 'page16.c', 'spaced.c', ] +if libui_OS == 'windows' and libui_mode == 'static' + libui_test_sources += ['resources.rc'] +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, diff --git a/windows/meson.build b/windows/meson.build new file mode 100644 index 00000000..5edfdb68 --- /dev/null +++ b/windows/meson.build @@ -0,0 +1,87 @@ +# 23 march 2019 + +libui_sources += [ + 'windows/alloc.cpp', + 'windows/area.cpp', + 'windows/areadraw.cpp', + 'windows/areaevents.cpp', + 'windows/areascroll.cpp', + 'windows/areautil.cpp', + 'windows/attrstr.cpp', + 'windows/box.cpp', + 'windows/button.cpp', + 'windows/checkbox.cpp', + 'windows/colorbutton.cpp', + 'windows/colordialog.cpp', + 'windows/combobox.cpp', + 'windows/container.cpp', + 'windows/control.cpp', + 'windows/d2dscratch.cpp', + 'windows/datetimepicker.cpp', + 'windows/debug.cpp', + 'windows/draw.cpp', + 'windows/drawmatrix.cpp', + 'windows/drawpath.cpp', + 'windows/drawtext.cpp', + 'windows/dwrite.cpp', + 'windows/editablecombo.cpp', + 'windows/entry.cpp', + 'windows/events.cpp', + 'windows/fontbutton.cpp', + 'windows/fontdialog.cpp', + 'windows/fontmatch.cpp', + 'windows/form.cpp', + 'windows/graphemes.cpp', + 'windows/grid.cpp', + 'windows/group.cpp', + 'windows/image.cpp', + 'windows/init.cpp', + 'windows/label.cpp', + 'windows/main.cpp', + 'windows/menu.cpp', + 'windows/multilineentry.cpp', + 'windows/opentype.cpp', + 'windows/parent.cpp', + 'windows/progressbar.cpp', + 'windows/radiobuttons.cpp', + 'windows/separator.cpp', + 'windows/sizing.cpp', + 'windows/slider.cpp', + 'windows/spinbox.cpp', + 'windows/stddialogs.cpp', + 'windows/tab.cpp', + 'windows/table.cpp', + 'windows/tabledispinfo.cpp', + 'windows/tabledraw.cpp', + 'windows/tableediting.cpp', + 'windows/tablemetrics.cpp', + 'windows/tabpage.cpp', + 'windows/text.cpp', + 'windows/utf16.cpp', + 'windows/utilwin.cpp', + 'windows/window.cpp', + 'windows/winpublic.cpp', + 'windows/winutil.cpp', +] +# resources.rc only contains the libui manifest. +# For a DLL, we have to include this directly, so we do so. +# Windows won't link resources in static libraries, so including this would have no effect. +# In those cases, we just need them to include the manifest with the executable (or link it directly into the output executable themselves); they can also customize the manifest as they see fit (assuming nothing breaks in the process). +# TODO make sure this gets added to both binary-only archives and install rules in this case +if libui_mode == 'shared' + libui_sources += ['windows/resources.rc'] +endif + +libui_include_directories += [include_directories('.')] + +libui_winlibs = 'user32 kernel32 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid windowscodecs'.split(' ') +for lib in libui_winlibs + libui_dep += [ + meson.get_compiler('cpp').find_library(lib, + required: true), + ] +endfor + +if libui_OS == 'windows' and libui_mode == 'shared' and not libui_MSVC + error('Sorry, but libui for Windows can currently only be built as a static library with MinGW. You will need to either build as a static library or switch to MSVC.') +endif