Merge branch 'meson'

This switches the build system from CMake to Meson. This also switches from Travis CI to Azure Pipelines.

Fixes #450.
Fixes #449.
This commit is contained in:
Pietro Gagliardi 2019-04-07 23:24:01 -04:00
commit 88a3267cdd
40 changed files with 1959 additions and 804 deletions

View File

@ -2,66 +2,80 @@ version: 'build #{build}'
environment:
matrix:
- linking: shared
- arch: 386
libtype: shared
libfiles: libui.dll libui.lib
compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- linking: static
- arch: 386
libtype: static
libfiles: libui.lib
compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- linking: shared
compiler: msvc2015
- arch: amd64
libtype: shared
libfiles: libui.dll libui.lib
compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- arch: amd64
libtype: static
libfiles: libui.lib
compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- arch: 386
libtype: static
libfiles: libui.lib
compiler: mingw
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- linking: static
compiler: msvc2015
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- linking: shared
compiler: msvc2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- linking: static
compiler: msvc2017
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- linking: static
- arch: amd64
libtype: static
libfiles: libui.lib
compiler: mingw
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
platform:
- Win32
- x64
before_build:
- if %compiler%==msvc2013 ( set "CMAKE_GENERATOR=Visual Studio 12 2013" )
else if %compiler%==msvc2015 ( set "CMAKE_GENERATOR=Visual Studio 14 2015" )
else if %compiler%==msvc2017 ( set "CMAKE_GENERATOR=Visual Studio 15 2017" )
else if %compiler%==mingw ( set "CMAKE_GENERATOR=MinGW Makefiles" )
- if %compiler%-%platform%==mingw-Win32 ( set "PATH=C:\msys64\mingw32\bin;%PATH%" )
else if %compiler%-%platform%==mingw-x64 ( set "PATH=C:\msys64\mingw64\bin;%PATH%" )
else if %platform%==x64 ( set "CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64" )
- if %linking%==static ( set CMAKE_FLAGS=-DBUILD_SHARED_LIBS=OFF )
- if %compiler%==mingw ( set "outdir=build\out" ) else ( set "outdir=build\out\Release" )
- ren "C:\Program Files\Git\usr\bin\sh.exe" _sh.exe
- set "simultaneous=3"
# Note: AppVeyor tries to be "helpful" and splits cmd.exe scripts into their constitutent lines to check their error codes. There is no way to switch this off; for true multi-line scripts we have to use PowerShell. But we need to use vcvarsall.bat, so that's out of the question.
install:
# Set Python Version
- set "PYTHON_ROOT=C:\python37-x64"
- if %arch%==386 ( set "PYTHON_ROOT=C:\python37" )
- set "PATH=%PYTHON_ROOT%;%PYTHON_ROOT%\Scripts;%PATH%"
# Install Latest Meson
- pip install meson
# Install Ninja
- powershell -Command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -OutFile C:\ninja-win.zip"
- mkdir C:\ninja
- powershell -Command "Expand-Archive -LiteralPath C:\ninja-win.zip -DestinationPath C:\ninja"
- set "PATH=C:\ninja;%PATH%"
# Parameters for the build_script phase, to reduce their noise.
- set "mingwPath=C:\msys64\mingw64\bin"
- set vcvarsallArch=x86
- if %arch%==386 ( set "mingwPath=C:\msys64\mingw32\bin" )
- if %arch%==386 ( set vcvarsallArch=amd64 )
build_script:
- md build && cd build
- if not %compiler%==mingw ( set "CFLAGS=/MP%simultaneous% %CFLAGS%" )
- if not %compiler%==mingw ( set "CPPFLAGS=/MP%simultaneous% %CPPFLAGS%" )
- if not %compiler%==mingw ( set "CXXFLAGS=/MP%simultaneous% %CXXFLAGS%" )
- cmake -G "%CMAKE_GENERATOR%" %CMAKE_FLAGS% ..
- if %compiler%==mingw ( mingw32-make -j%simultaneous% tester examples )
else ( msbuild libui.sln /t:Build /p:Configuration=Release /p:Platform=%platform% )
- cd %APPVEYOR_BUILD_FOLDER%
- if %compiler%==mingw ( set "PATH=%mingwPath%;%PATH%" )
- if not %compiler%==mingw ( call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %vcvarsallArch% )
- meson setup build --buildtype=release --default-library=%libtype%
- ninja -C build
after_build:
- if %platform%==x64 ( set "arch=amd64" ) else ( set "arch=386" )
- set "version=%APPVEYOR_REPO_BRANCH%"
- if %APPVEYOR_REPO_TAG%==true ( set "version=%APPVEYOR_REPO_TAG_NAME%" )
else ( set "version=%APPVEYOR_REPO_BRANCH%" )
- if %linking%==shared ( set "artifact=shared" ) else ( set "artifact=%compiler%-static" )
- set "artifact=%version%-windows-%arch%-%artifact%"
- del .\%outdir%\libui.exp # remove unnecessary files
- 7z a libui-%artifact%.zip .\%outdir%\libui.* ui.h ui_windows.h
- 7z l libui-%artifact%.zip
- 7z a examples-%artifact%.zip .\%outdir%\*.exe
- 7z l examples-%artifact%.zip
- set "artifact=%version%-windows-%arch%-%compiler%-%libtype%"
- cd build\meson-out
# TODO msvc only?
- if %libtype%==static ( ren libui.a libui.lib )
- copy ..\..\ui.h .
- copy ..\..\ui_windows.h .
# remove unnecessary files
# TODO should we do this on Azure too?
- del libui.exp
- 7z a "%APPVEYOR_BUILD_FOLDER%\libui-%artifact%.zip" %libfiles% ui.h ui_windows.h
- 7z a "%APPVEYOR_BUILD_FOLDER%\examples-%artifact%.zip" controlgallery.exe cpp-multithread.exe datetime.exe drawtext.exe histogram.exe tester.exe timer.exe
- del ui.h ui_windows.h
artifacts:
- path: libui-*.zip

View File

@ -1,97 +0,0 @@
language: c
include: &toolchain_linux_amd64
os: linux
dist: trusty
addons:
apt:
update: true
packages:
- libgtk-3-dev
include: &toolchain_linux_386
os: linux
dist: trusty
addons:
apt:
packages:
- gcc-multilib
- g++-multilib
- libgtk-3-dev:i386
# the rest fixes broken dependencies of libgtk:i386
- libgirepository-1.0-1:i386
- libglib2.0-dev:i386
- gir1.2-glib-2.0:i386
- gir1.2-atk-1.0:i386
- libatk1.0-dev:i386
- libfreetype6-dev:i386
- libfontconfig1-dev:i386
- libcairo2-dev:i386
- libgdk-pixbuf2.0-dev:i386
- libpango1.0-dev:i386
- libxft-dev:i386
- libpng12-dev:i386
include: &toolchain_osx_amd64
os: osx
osx_image: xcode8
# Travis CI build matrix.
# Each entry below will trigger an extra, parallel build on Travis.
matrix:
include:
- env: linking=shared arch=amd64
<<: *toolchain_linux_amd64
- env: linking=static arch=amd64
<<: *toolchain_linux_amd64
- env: linking=shared arch=386
<<: *toolchain_linux_386
- env: linking=static arch=386
<<: *toolchain_linux_386
- env: linking=shared arch=amd64
<<: *toolchain_osx_amd64
- env: linking=static arch=amd64
<<: *toolchain_osx_amd64
install:
- if [[ "${arch}" == "386" ]]; then
export CFLAGS=-m32;
export CXXFLAGS=-m32;
export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig;
fi
- if [[ "${linking}" == "static" ]]; then
export CMAKE_FLAGS=-DBUILD_SHARED_LIBS=OFF;
fi
script:
- cmake --version
- mkdir build
- pushd build
- cmake -G "Unix Makefiles" ${CMAKE_FLAGS} ..
- make tester examples
- popd
after_success:
- ls -lR build/out
- file build/out/test
- export platform="$TRAVIS_OS_NAME"
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp ui.h ui_darwin.h build/out/; export platform=darwin; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ui.h ui_unix.h build/out/; fi
- if [[ "x${TRAVIS_TAG}" != "x" ]]; then export version=${TRAVIS_TAG}; else export version=${TRAVIS_BRANCH}; fi
- export artifact=${version}-${platform}-${arch}-${linking}
- echo ${artifact}
- pushd build/out
- # TODO do not include symlinks in the archive
- tar -czvf libui-${artifact}.tgz libui.* *.h
- tar -czvf examples-${artifact}.tgz `find . -type f ! -name "*.*"`
- popd
deploy:
provider: releases
api_key:
secure: "fmgC97mlXQY/ASWAL/GyTJfiJIo/hsVFf6bP3Zz8odv259PJUFGgnZ9kNIgJcFQ5961lXDFi7pBMMSetm1GZ2EBZxIXnUfe1kfIhw62ybJHIwB2+g2tc8A4zzfkWJVY4xVYpitOU3iMuu5Z8U2n+68RYWKpcxhbkVw5v8Zu2Rms="
file: build/out/*.tgz
file_glob: true
skip_cleanup: true
on:
tags: true

View File

@ -1,238 +0,0 @@
# 3 june 2016
# see https://cmake.org/gitweb?p=cmake.git;a=commit;h=95cdf132489c79e88a10fdf7a7566fa002c7680b (thanks ngladitz in irc.freenode.net/#cmake)
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# TODOs
# - silence entering/leaving messages?
# - uname -s for more refined OS control
# - Haiku for haiku
# - debian DESTDIR? https://github.com/andlabs/libui/pull/10
# - libui-combined* needs to be deleted so that custom command can run every time
# - add notelemetry.obj to *ALL TARGETS* on VS2015 and up - https://www.infoq.com/news/2016/06/visual-cpp-telemetry
# - switch to 3.1.0 features
# the docs say we need to set this up prior to project()
# the docs don't say this, but the CACHE part is important; see https://stackoverflow.com/questions/34208360/cmake-seems-to-ignore-cmake-osx-deployment-target
# TODO figure out what other variables must be set with CACHE
# TODO figure out if FORCE is needed here
# TODO figure out whether STRING "" is best or if something else is better; also what FORCE does because I forget and later I say it's needed
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "" FORCE)
# we want to disable incremental linking
# see also:
# - https://github.com/bulletphysics/bullet3/blob/master/CMakeLists.txt#L43
# - https://cmake.org/pipermail/cmake/2010-February/035174.html
# this must also go before project()
set(MSVC_INCREMENTAL_DEFAULT ON)
# default to debug builds
# do this before project() just to be safe
# either DEBUG or Debug will work; we use DEBUG as that's what cmake does internally (https://cmake.org/pipermail/cmake/2013-June/055177.html)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "" FORCE)
endif()
project(libui)
option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static library" ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
set(CMAKE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
if(APPLE)
set(_OSNAME darwin)
set(_HASVERSION TRUE)
set(_VERSION "A")
# always use our rpath
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# the / is required by some older versions of OS X
set(CMAKE_INSTALL_RPATH "@executable_path/")
set(CMAKE_MACOSX_RPATH TRUE)
elseif(WIN32)
set(_OSNAME windows)
# and don't include the default libraries with ANY of the builds
# note the CACHE FORCE stuff is required here
set(CMAKE_C_STANDARD_LIBRARIES CACHE STRING "" FORCE)
set(CMAKE_CXX_STANDARD_LIBRARIES CACHE STRING "" FORCE)
else()
set(_OSNAME unix)
set(_HASVERSION TRUE)
set(_VERSION "0")
# always use our rpath
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
endif()
# common flags
if(MSVC)
# TODO subsystem version
# TODO /Wall does too much
# TODO -Wno-switch equivalent
# TODO /sdl turns C4996 into an ERROR
# don't use /analyze; that requires us to write annotations everywhere
# TODO undecided flags from qo?
# the RTC flags are only supplied in debug builds because they are only supposed to be used by debug builds (see "This is because run-time error checks are not valid in a release (optimized) build." in https://docs.microsoft.com/cpp/build/reference/rtc-run-time-error-checks)
# /RTCc is not supplied because it's discouraged as of VS2015; see https://www.reddit.com/r/cpp/comments/46mhne/rtcc_rejects_conformant_code_with_visual_c_2015/d06auq5
# /EHsc is to shut the compiler up in some cases
# TODO make /EHsc C++-only
set(_COMMON_CFLAGS
/W4 /wd4100
/bigobj /nologo
$<$<CONFIG:Debug>:/RTC1 /RTCs /RTCu>
/EHsc
)
# note the /MANIFEST:NO (which must be / and uppercase); thanks FraGag (https://github.com/andlabs/libui/issues/93#issuecomment-223183436)
# TODO warnings on undefined symbols
set(_COMMON_LDFLAGS
/LARGEADDRESSAWARE
/NOLOGO
/INCREMENTAL:NO
/MANIFEST:NO
)
# TODO autogenerate a .def file?
# more incremental linking fixes
# TODO actually get rid of incremental linking here
else()
set(_COMMON_CFLAGS
-Wall -Wextra -pedantic
-Wno-unused-parameter
-Wno-switch
-fvisibility=hidden
)
# don't use C_VERSION or CXX_VERSION because they use GNU standards
# TODO we can actually do this; set both C_EXTENSIONS and CXX_EXTENSIONS to OFF
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
set(_COMMON_LDFLAGS
-fvisibility=hidden
)
# don't require shipping the MinGW-w64 DLLs
if(WIN32)
list(APPEND _COMMON_LDFLAGS
-static
-static-libgcc
-static-libstdc++
)
endif()
# TODO document this
if(ADDRESS_SANITIZER)
set(_COMMON_CFLAGS ${_COMMON_CFLAGS}
-fsanitize=address
-fno-omit-frame-pointer
)
set(_COMMON_LDFLAGS ${_COMMON_LDFLAGS}
-fsanitize=address
-fno-omit-frame-pointer
)
endif()
endif()
# problem:
# - target_link_libraries() only supports - for flags
# - but cmake only doesn't generate the manifest if the flag has a /
macro(_target_link_options_private _target)
foreach(_opt IN LISTS ${ARGN})
set_property(TARGET ${_target} APPEND_STRING PROPERTY
LINK_FLAGS " ${_opt}")
endforeach()
endmacro()
add_subdirectory("common")
add_subdirectory("${_OSNAME}")
add_library(libui ${_LIBUI_SOURCES})
target_include_directories(libui
PUBLIC .
PRIVATE ${_LIBUI_INCLUEDIRS})
target_compile_definitions(libui
PRIVATE ${_LIBUI_DEFS})
# cmake produces this for us by default but only for shared libraries
target_compile_definitions(libui
PRIVATE libui_EXPORTS)
target_compile_options(libui
PUBLIC ${_COMMON_CFLAGS}
PRIVATE ${_LIBUI_CFLAGS})
# TODO link directories?
if(BUILD_SHARED_LIBS)
target_link_libraries(libui
PRIVATE ${_LIBUI_LIBS})
endif()
# TODO INTERFACE libs don't inherit to grandhcildren?
# on Windows the linker for static libraries is different; don't give it the flags
if(BUILD_SHARED_LIBS)
_target_link_options_private(libui
_COMMON_LDFLAGS
_LIBUI_LDFLAGS)
endif()
if(NOT BUILD_SHARED_LIBS)
# TODO figure out a way to tell libui that it's static
target_compile_definitions(libui
PUBLIC _UI_STATIC)
endif()
if(NOT MSVC)
# on non-MSVC compilers cmake adds an extra lib-
# note that we apply this to libui, not to any intermediates
set_target_properties(libui PROPERTIES
OUTPUT_NAME ui)
# flags for warning on undefined symbols
# TODO figure out why FreeBSD follows linked libraries here
# TODO figure out MSVC equivalents
if(BUILD_SHARED_LIBS)
if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD))
# on OS X we don't need to do this; Apple's linker warns about undefined symbols in -shared builds!
if(NOT APPLE)
target_link_libraries(libui
PRIVATE -Wl,--no-undefined -Wl,--no-allow-shlib-undefined
)
endif()
endif()
endif()
endif()
if(BUILD_SHARED_LIBS)
if(_HASVERSION)
set_target_properties(libui PROPERTIES
SOVERSION "${_VERSION}")
endif()
endif()
# TODO why is this not a default?!
set_property(TARGET libui PROPERTY
POSITION_INDEPENDENT_CODE True)
macro(_add_exec _name)
# TODOTODO re-add WIN32 when merging back
add_executable(${_name}
EXCLUDE_FROM_ALL
${ARGN})
target_link_libraries(${_name} libui)
_target_link_options_private(${_name}
_COMMON_LDFLAGS)
# TODO does this propagate?
set_property(TARGET ${_name} PROPERTY
POSITION_INDEPENDENT_CODE True)
# TODO see above about INTERFACE
if(NOT BUILD_SHARED_LIBS)
target_link_libraries(${_name}
${_LIBUI_LIBS})
endif()
# TODOfor some reason these don't propagate
if(NOT WIN32)
target_include_directories(${_name}
PUBLIC .)
target_compile_options(${_name}
PUBLIC ${_COMMON_CFLAGS})
endif()
endmacro()
add_subdirectory("test")
add_subdirectory("examples")

View File

@ -1,8 +1,8 @@
# libui: a portable GUI library for C
This README is being written.<br>
[![Build Status, Linux and macOS](https://travis-ci.org/andlabs/libui.svg?branch=master)](https://travis-ci.org/andlabs/libui)<br>
[![Build Status, Windows](https://ci.appveyor.com/api/projects/status/ouyk78c52mmisa31?svg=true)](https://ci.appveyor.com/project/andlabs/libui)
[![Build Status, Azure Pipelines](https://dev.azure.com/andlabs/libui/_apis/build/status/andlabs.libui?branchName=master)](https://dev.azure.com/andlabs/libui/_build/latest?definitionId=1&branchName=master)<br>
[![Build Status, AppVeyor](https://ci.appveyor.com/api/projects/status/ouyk78c52mmisa31?svg=true)](https://ci.appveyor.com/project/andlabs/libui)
## Status
@ -30,6 +30,10 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
*Note that today's entry (Eastern Time) may be updated later today.*
* **7 April 2019**
* **The build system has been switched to Meson.** See below for instructions. This change was made because the previous build system, CMake, caused countless headaches over trivial issues. Meson was chosen due to how unproblematic setting up libui's build just right was, as well as having design goals that are by coincidence closely aligned with what libui wants.
* Travis CI has been replaced with Azure Pipelines and much of the AppVeyor CI configuration was integrated into the Azure Pipelines configuration. This shouldn't affect most developers.
* **1 September 2018**
* **Alpha 4.1 is here.** This is an emergency fix to Alpha 4 to fix `uiImageAppend()` not working as documented. It now works properly, with one important difference you'll need to care about: **it now requires image data to be alpha-premultiplied**. In addition, `uiImage` also is implemented slightly more nicely now, and `ui.h` has minor documentation typo fixes.
* Alpha 4.1 also tries to make everything properly PIC-enabled.
@ -82,7 +86,8 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
## Build Requirements
* All platforms:
* CMake 3.1.0 or newer
* [Meson](https://mesonbuild.com/) 0.48.0 or newer
* Any of Meson's backends; this section assumes you are using [Ninja](https://ninja-build.org/), but there is no reason the other backends shouldn't work.
* Windows: either
* Microsoft Visual Studio 2013 or newer (2013 is needed for `va_copy()`) — you can build either a static or a shared library
* MinGW-w64 (other flavors of MinGW may not work) — **you can only build a static library**; shared library support will be re-added once the following features come in:
@ -92,33 +97,41 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
## Building
Out-of-tree builds typical of cmake are preferred:
libui uses only [the standard Meson build options](https://mesonbuild.com/Builtin-options.html), so a libui build can be set up just like any other:
```
$ # you must be in the top-level libui directory, otherwise this won't work
$ mkdir build
$ cd build
$ cmake ..
$ meson setup build [options]
$ ninja -C build
```
Pass `-DBUILD_SHARED_LIBS=OFF` to `cmake` to build a static library. The standard cmake build configurations are provided; if none is specified, `Debug` is used.
Once this completes, everything will be under `build/meson-out/`. (Note that unlike the previous build processes, everything is built by default, including tests and examples.)
If you use a makefile generator with cmake, then
The most important options are:
```
$ make
$ make tester # for the test program
$ make examples # for examples
```
* `--buildtype=(debug|release|...)` controls the type of build made; the default is `debug`. For a full list of valid values, consult [the Meson documentation](https://mesonbuild.com/Running-Meson.html).
* `--default-library=(shared|static)` controls whether libui is built as a shared library or a static library; the default is `shared`. You currently cannot specify `both`, as the build process changes depending on the target type (though I am willing to look into changing things if at all possible).
* `-Db_sanitize=which` allows enabling the chosen [sanitizer](https://github.com/google/sanitizers) on a system that supports sanitizers. The list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#base-options).
* `--backend=backend` allows using the specified `backend` for builds instead of `ninja` (the default). A list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options).
and pass `VERBOSE=1` to see build commands. Build targets will be in the `build/out` folder.
Most other built-in options will work, though keep in mind there are a handful of options that cannot be overridden because libui depends on them holding a specific value; if you do override these, though, libui will warn you when you run `meson`.
Project file generators should work, but are untested by me.
The Meson website and documentation has more in-depth usage instructions.
On Windows, I use the `Unix Makefiles` generator and GNU make (built using the `build_w32.bat` script included in the source and run in the Visual Studio command line). In this state, if MinGW-w64 (either 32-bit or 64-bit) is not in your `%PATH%`, cmake will use MSVC by default; otherwise, cmake will use with whatever MinGW-w64 is in your path. `set PATH=%PATH%;c:\msys2\mingw(32/64)\bin` should be enough to temporarily change to a MinGW-w64 build for the current command line session only if you installed MinGW-w64 through [MSYS2](https://msys2.github.io/); no need to change global environment variables constantly.
For the sake of completeness, I should note that the default value of `--layout` is `flat`, not the usual `mirror`. This is done both to make creating the release archives easier as well as to reduce the chance that shared library builds will fail to start on Windows because the DLL is in another directory. You can always specify this manually if you want.
Backends other than `ninja` should work, but are untested by me.
## Installation
Meson also supports installing from source; if you use Ninja, just do
```
$ ninja -C build install
```
When running `meson`, the `--prefix` option will set the installation prefix. [The Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options) has more information, and even lists more fine-grained options that you can use to control the installation.
#### Arch Linux
Can be built from AUR: https://aur.archlinux.org/packages/libui-git/

76
_notes/azure-pipelines Normal file
View File

@ -0,0 +1,76 @@
multi-platform {
https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started-multiplatform?view=azure-devops
}
microsoft-hosted agents {
https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#use-a-microsoft-hosted-agent
https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md
https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2015-Server2012R2-Readme.md
}
maximum number of processors (for ninja -j) {
msbuild supports this with the -m option natively; meanwhile:
https://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html
}
potentially useful tasks {
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/visual-studio-build?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/xcode?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/github-release?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
}
meson CI reference {
https://github.com/mesonbuild/meson/blob/master/docs/markdown/Continuous-Integration.md
}
job templates, which will clean up our pipelines {
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops
}
migrating from travis {
https://docs.microsoft.com/en-us/azure/devops/pipelines/migrate/from-travis?view=azure-devops
}
32-bit {
https://github.com/numpy/numpy/issues/12856
https://github.com/numpy/numpy/pull/12863/files
https://github.com/numpy/numpy/blob/master/azure-pipelines.yml (also explains what the @s mean; thanks guys)
}
using visual studio tools {
https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs
https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=vs-2019#developer_command_file_locations
}
OLD using visual studio tools; also some docker {
https://github.com/mesonbuild/meson/blob/master/ci/azure-steps.yml
https://github.com/reactiveui/Akavache/blob/master/azure-pipelines.yml
https://github.com/vector-of-bool/CMakeCM/blob/master/azure-pipelines.yml
https://docs.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container?view=vs-2019
https://docs.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2019
https://devblogs.microsoft.com/cppblog/using-msvc-in-a-docker-container-for-your-c-projects/
https://devblogs.microsoft.com/cppblog/finding-the-visual-c-compiler-tools-in-visual-studio-2017/
}
reference {
https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#task
https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/windows/cpp?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=azure-devops
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml
}
C++ binary compatibility and shared libraries (TODO split into its own notes file) {
https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2017
}
others I forgot why I had them open {
https://github.com/Microsoft/cpprestsdk/blob/master/azure-pipelines.yml (32-bit?)
https://docs.microsoft.com/en-us/azure/devops/release-notes/2018/sprint-142-update (I forget, maybe also 32-bit?)
}
others that might not be relevant {
https://github.com/Microsoft/azure-pipelines-agent/blob/master/docs/start/envubuntu.md has instructions on how to build the agent tool itself
}

6
_notes/winflags Normal file
View File

@ -0,0 +1,6 @@
# TODO is there a -Wno-switch equivalent?
# TODO /sdl turns C4996 into an ERROR
# don't use /analyze; that requires us to write annotations everywhere
# TODO undecided flags from qo?
# the RTC flags are only supplied in debug builds because they are only supposed to be used by debug builds (see "This is because run-time error checks are not valid in a release (optimized) build." in https://docs.microsoft.com/cpp/build/reference/rtc-run-time-error-checks)
# /RTCc is not supplied because it's discouraged as of VS2015; see https://www.reddit.com/r/cpp/comments/46mhne/rtcc_rejects_conformant_code_with_visual_c_2015/d06auq5

View File

@ -1,36 +1,5 @@
# 3 june 2016
if(WIN32)
set(_EXAMPLE_RESOURCES_RC resources.rc)
endif()
macro(_add_example _name)
_add_exec(${_name} ${ARGN})
# because Microsoft's toolchain is dumb
if(MSVC)
set_property(TARGET ${_name} APPEND_STRING PROPERTY
LINK_FLAGS " /ENTRY:mainCRTStartup")
endif()
endmacro()
_add_example(controlgallery
controlgallery/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(histogram
histogram/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(cpp-multithread
cpp-multithread/main.cpp
${_EXAMPLE_RESOURCES_RC}
)
if(NOT WIN32)
target_link_libraries(cpp-multithread pthread)
endif()
_add_example(drawtext
drawtext/attributes.c
drawtext/basic.c
@ -48,11 +17,3 @@ _add_example(opentype
)
target_include_directories(opentype
PRIVATE opentype)
add_custom_target(examples
DEPENDS
controlgallery
histogram
cpp-multithread
drawtext
opentype)

View File

@ -1,19 +1,378 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
# 31 march 2019
trigger:
- *
branches:
include:
- '*'
tags:
include:
- '*'
variables:
releaseExamples: 'controlgallery cpp-multithread datetime drawtext histogram tester timer'
jobs:
# linux {
- job: linux_386_shared
displayName: 'Linux 386 Shared'
pool:
vmImage: 'Ubuntu-16.04'
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/linux-386-install-gtk-dev-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
defaultLibrary: shared
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: 386
libtype: shared
libfiles: libui.so.0
osHeader: ui_unix.h
- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
- job: linux_386_static
displayName: 'Linux 386 Static'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/linux-386-install-gtk-dev-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
defaultLibrary: static
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: 386
libtype: static
libfiles: libui.a
osHeader: ui_unix.h
- job: linux_amd64_shared
displayName: 'Linux amd64 Shared'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/linux-install-gtk-dev-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: shared
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: amd64
libtype: shared
libfiles: libui.so.0
osHeader: ui_unix.h
- job: linux_amd64_static
displayName: 'Linux amd64 Static'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/linux-install-gtk-dev-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: static
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: amd64
libtype: static
libfiles: libui.a
osHeader: ui_unix.h
# }
# windows vs2015 {
- job: windows_386_msvc2015_shared
displayName: 'Windows 386 MSVC2015 Shared'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- template: azure-pipelines/vs2015-install-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
defaultLibrary: shared
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2015
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- job: windows_386_msvc2015_static
displayName: 'Windows 386 MSVC2015 Static'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- template: azure-pipelines/vs2015-install-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
defaultLibrary: static
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2015
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- job: windows_amd64_msvc2015_shared
displayName: 'Windows amd64 MSVC2015 Shared'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- template: azure-pipelines/vs2015-install-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
defaultLibrary: shared
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2015
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- job: windows_amd64_msvc2015_static
displayName: 'Windows amd64 MSVC2015 Static'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- template: azure-pipelines/vs2015-install-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
defaultLibrary: static
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2015
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
# }
# windows vs2017 {
- job: windows_386_msvc2017_shared
displayName: 'Windows 386 MSVC2017 Shared'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
defaultLibrary: shared
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2017
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- job: windows_386_msvc2017_static
displayName: 'Windows 386 MSVC2017 Static'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
defaultLibrary: static
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2017
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- job: windows_amd64_msvc2017_shared
displayName: 'Windows amd64 MSVC2017 Shared'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
defaultLibrary: shared
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2017
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- job: windows_amd64_msvc2017_static
displayName: 'Windows amd64 MSVC2017 Static'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
defaultLibrary: static
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2017
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
# }
# mac {
# TODO beforeConfigure/beforeBuild: export SDKROOT=$(xcodebuild -version -sdk macosx10.13 Path)?
- job: darwin_amd64_shared
displayName: 'Darwin amd64 Shared'
pool:
vmImage: 'macos-10.13'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/darwin-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: shared
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: darwin
arch: amd64
libtype: shared
libfiles: libui.A.dylib
osHeader: ui_darwin.h
- job: darwin_amd64_static
displayName: 'Darwin amd64 Static'
pool:
vmImage: 'macos-10.13'
workspace:
clean: all
steps:
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/install-latest-meson.yml
- template: azure-pipelines/darwin-install-ninja.yml
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: static
- template: azure-pipelines/build.yml
- template: azure-pipelines/artifacts.yml
parameters:
os: darwin
arch: amd64
libtype: static
libfiles: libui.a
osHeader: ui_darwin.h
# }

399
azure-pipelines/TODOMatrix Normal file
View File

@ -0,0 +1,399 @@
# 31 march 2019
variables:
releaseExamples: 'controlgallery cpp-multithread datetime drawtext histogram tester timer'
strategy:
matrix:
# targetname:
# os: 'fill this in'
# arch: 'fill this in'
# toolchain: 'fill this in'
# libtype: 'fill this in'
# vmImage: 'fill this in'
# python3Template: 'fill filename'
# depsAndNinjaTemplate: 'fill filename'
# beforeConfigure: 'fill this in'
# beforeBuild: 'fill this in'
# afterBuild: 'fill this in'
# artifactTemplate: 'fill filename'
# libfiles: 'fill this in'
# osHeader: 'fill this in'
linux_386_shared:
os: 'linux'
arch: '386'
libtype: 'shared'
vmImage: 'ubuntu-16.04'
python3Template: 'azure-pipelines/setup-python3.yml'
depsAndNinjaTemplate: 'azure-pipelines/linux-386-install-gtk-dev-ninja.yml'
beforeConfigure: 'export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig'
artifactTemplate: 'azure-pipelines/artifacts.yml'
libfiles: 'libui.so.0'
osHeader: 'ui_unix.h'
pool:
vmImage: $(vmImage)
workspace:
clean: all
steps:
- template: $(variables.python3Template)
- template: azure-pipelines/install-latest-meson.yml
- template: $(variables.depsAndNinjaTemplate)
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: $(beforeConfigure)
defaultLibrary: $(libtype)
- template: azure-pipelines/build.yml
parameters:
beforeBuild: $(beforeBuild)
afterBuild: $(afterBuild)
- template: $(variables.artifactTemplate)
parameters:
os: $(os)
arch: $(arch)
toolchain: $(toolchain)
libtype: $(libtype)
libfiles: $(libfiles)
osHeader: $(osHeader)
## linux {
#- job: linux_386_static
# displayName: 'Linux 386 Static'
# pool:
# vmImage: 'ubuntu-16.04'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/linux-386-install-gtk-dev-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: linux
# arch: 386
# libtype: static
# libfiles: libui.a
# osHeader: ui_unix.h
#
#- job: linux_amd64_shared
# displayName: 'Linux amd64 Shared'
# pool:
# vmImage: 'ubuntu-16.04'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/linux-install-gtk-dev-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: linux
# arch: amd64
# libtype: shared
# libfiles: libui.so.0
# osHeader: ui_unix.h
#
#- job: linux_amd64_static
# displayName: 'Linux amd64 Static'
# pool:
# vmImage: 'ubuntu-16.04'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/linux-install-gtk-dev-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: linux
# arch: amd64
# libtype: static
# libfiles: libui.a
# osHeader: ui_unix.h
#
## }
#
## windows vs2015 {
#
#- job: windows_386_msvc2015_shared
# displayName: 'Windows 386 MSVC2015 Shared'
# pool:
# vmImage: 'vs2015-win2012r2'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/vs2015-install-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: 386
# toolchain: msvc2015
# libtype: shared
# libfiles: libui.dll libui.exp libui.lib
# osHeader: ui_windows.h
#
#- job: windows_386_msvc2015_static
# displayName: 'Windows 386 MSVC2015 Static'
# pool:
# vmImage: 'vs2015-win2012r2'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/vs2015-install-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
# afterBuild: ren build\meson-out\libui.a libui.lib
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: 386
# toolchain: msvc2015
# libtype: static
# libfiles: libui.lib
# osHeader: ui_windows.h
#
#- job: windows_amd64_msvc2015_shared
# displayName: 'Windows amd64 MSVC2015 Shared'
# pool:
# vmImage: 'vs2015-win2012r2'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/vs2015-install-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: amd64
# toolchain: msvc2015
# libtype: shared
# libfiles: libui.dll libui.exp libui.lib
# osHeader: ui_windows.h
#
#- job: windows_amd64_msvc2015_static
# displayName: 'Windows amd64 MSVC2015 Static'
# pool:
# vmImage: 'vs2015-win2012r2'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/vs2015-install-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
# afterBuild: ren build\meson-out\libui.a libui.lib
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: amd64
# toolchain: msvc2015
# libtype: static
# libfiles: libui.lib
# osHeader: ui_windows.h
#
## }
#
## windows vs2017 {
#
#- job: windows_386_msvc2017_shared
# displayName: 'Windows 386 MSVC2017 Shared'
# pool:
# vmImage: 'vs2017-win2016'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: 386
# toolchain: msvc2017
# libtype: shared
# libfiles: libui.dll libui.exp libui.lib
# osHeader: ui_windows.h
#
#- job: windows_386_msvc2017_static
# displayName: 'Windows 386 MSVC2017 Static'
# pool:
# vmImage: 'vs2017-win2016'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
# afterBuild: ren build\meson-out\libui.a libui.lib
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: 386
# toolchain: msvc2017
# libtype: static
# libfiles: libui.lib
# osHeader: ui_windows.h
#
#- job: windows_amd64_msvc2017_shared
# displayName: 'Windows amd64 MSVC2017 Shared'
# pool:
# vmImage: 'vs2017-win2016'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: amd64
# toolchain: msvc2017
# libtype: shared
# libfiles: libui.dll libui.exp libui.lib
# osHeader: ui_windows.h
#
#- job: windows_amd64_msvc2017_static
# displayName: 'Windows amd64 MSVC2017 Static'
# pool:
# vmImage: 'vs2017-win2016'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/windows-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# parameters:
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
# afterBuild: ren build\meson-out\libui.a libui.lib
# - template: azure-pipelines/windows-artifacts.yml
# parameters:
# os: windows
# arch: amd64
# toolchain: msvc2017
# libtype: static
# libfiles: libui.lib
# osHeader: ui_windows.h
#
## }
#
## mac {
#
## TODO beforeConfigure/beforeBuild: export SDKROOT=$(xcodebuild -version -sdk macosx10.13 Path)?
#
#- job: darwin_amd64_shared
# displayName: 'Darwin amd64 Shared'
# pool:
# vmImage: 'macos-10.13'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/darwin-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# defaultLibrary: shared
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: darwin
# arch: amd64
# libtype: shared
# libfiles: libui.A.dylib
# osHeader: ui_darwin.h
#
#- job: darwin_amd64_static
# displayName: 'Darwin amd64 Static'
# pool:
# vmImage: 'macos-10.13'
# workspace:
# clean: all
# steps:
# - template: azure-pipelines/setup-python3.yml
# - template: azure-pipelines/install-latest-meson.yml
# - template: azure-pipelines/darwin-install-ninja.yml
# - template: azure-pipelines/configure.yml
# parameters:
# defaultLibrary: static
# - template: azure-pipelines/build.yml
# - template: azure-pipelines/artifacts.yml
# parameters:
# os: darwin
# arch: amd64
# libtype: static
# libfiles: libui.a
# osHeader: ui_darwin.h
#
## }

View File

@ -0,0 +1,30 @@
# 6 april 2019
# TODO the github task requires authorization for the connection on non-master branches but I can't seem to figure out how to do that with a YAML pipeline
parameters:
os: ''
arch: ''
libtype: ''
libfiles: ''
osHeader: ''
steps:
- script: |
set -x
pushd build/meson-out
cp ../../ui.h ../../${{ parameters.osHeader }} .
tar czf $(Build.ArtifactStagingDirectory)/libui-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.tgz ${{ parameters.libfiles }} ui.h ${{ parameters.osHeader}}
tar czf $(Build.ArtifactStagingDirectory)/examples-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.tgz $(releaseExamples)
rm ui.h ${{ parameters.osHeader }}
popd
displayName: 'Create Artifacts'
- ${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
- task: GitHubRelease@0
inputs:
gitHubConnection: andlabs
repositoryName: andlabs/libui
action: 'edit'
addChangelog: false
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'

12
azure-pipelines/build.yml Normal file
View File

@ -0,0 +1,12 @@
# 5 april 2019
parameters:
beforeBuild: ''
afterBuild: ''
steps:
- script: |
${{ parameters.beforeBuild }}
ninja -C build -v
${{ parameters.afterBuild }}
displayName: 'Build'

View File

@ -0,0 +1,43 @@
# 7 april 2019
BEGIN {
RS = ""
FS = "\n +- "
}
/^- job:/ {
for (i = 1; i <= NF; i++) {
if (!(i in nextindex)) {
# fast path for first occurrence
lines[i, 0] = $i
nextindex[i] = 1
if (maxIndex < i)
maxIndex = i
continue
}
found = 0
for (j = 0; j < nextindex[i]; j++)
if (lines[i, j] == $i) {
found = 1
break
}
if (!found) {
lines[i, nextindex[i]] = $i
nextindex[i]++
}
}
}
END {
for (i = 1; i <= maxIndex; i++) {
if (nextindex[i] == 1) {
# only one entry here, just print it
print "- " lines[i, 0]
continue
}
print "{"
for (j = 0; j < nextindex[i]; j++)
print "- " lines[i, j]
print "}"
}
}

298
azure-pipelines/collapsed Normal file
View File

@ -0,0 +1,298 @@
{
- - job: linux_386_shared
displayName: 'Linux 386 Shared'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- - job: linux_386_static
displayName: 'Linux 386 Static'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- - job: linux_amd64_shared
displayName: 'Linux amd64 Shared'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- - job: linux_amd64_static
displayName: 'Linux amd64 Static'
pool:
vmImage: 'ubuntu-16.04'
workspace:
clean: all
steps:
- - job: windows_386_msvc2015_shared
displayName: 'Windows 386 MSVC2015 Shared'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- - job: windows_386_msvc2015_static
displayName: 'Windows 386 MSVC2015 Static'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- - job: windows_amd64_msvc2015_shared
displayName: 'Windows amd64 MSVC2015 Shared'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- - job: windows_amd64_msvc2015_static
displayName: 'Windows amd64 MSVC2015 Static'
pool:
vmImage: 'vs2015-win2012r2'
workspace:
clean: all
steps:
- - job: windows_386_msvc2017_shared
displayName: 'Windows 386 MSVC2017 Shared'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- - job: windows_386_msvc2017_static
displayName: 'Windows 386 MSVC2017 Static'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- - job: windows_amd64_msvc2017_shared
displayName: 'Windows amd64 MSVC2017 Shared'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- - job: windows_amd64_msvc2017_static
displayName: 'Windows amd64 MSVC2017 Static'
pool:
vmImage: 'vs2017-win2016'
workspace:
clean: all
steps:
- - job: darwin_amd64_shared
displayName: 'Darwin amd64 Shared'
pool:
vmImage: 'macos-10.13'
workspace:
clean: all
steps:
- - job: darwin_amd64_static
displayName: 'Darwin amd64 Static'
pool:
vmImage: 'macos-10.13'
workspace:
clean: all
steps:
}
{
- template: azure-pipelines/setup-python3.yml
- template: azure-pipelines/vs2015-install-python3.yml
}
- template: azure-pipelines/install-latest-meson.yml
{
- template: azure-pipelines/linux-386-install-gtk-dev-ninja.yml
- template: azure-pipelines/linux-install-gtk-dev-ninja.yml
- template: azure-pipelines/windows-install-ninja.yml
- template: azure-pipelines/darwin-install-ninja.yml
}
{
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
defaultLibrary: static
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
defaultLibrary: shared
- template: azure-pipelines/configure.yml
parameters:
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
defaultLibrary: static
}
{
- template: azure-pipelines/build.yml
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
afterBuild: ren build\meson-out\libui.a libui.lib
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
- template: azure-pipelines/build.yml
parameters:
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
afterBuild: ren build\meson-out\libui.a libui.lib
}
{
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: 386
libtype: shared
libfiles: libui.so.0
osHeader: ui_unix.h
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: 386
libtype: static
libfiles: libui.a
osHeader: ui_unix.h
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: amd64
libtype: shared
libfiles: libui.so.0
osHeader: ui_unix.h
- template: azure-pipelines/artifacts.yml
parameters:
os: linux
arch: amd64
libtype: static
libfiles: libui.a
osHeader: ui_unix.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2015
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2015
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2015
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2015
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2017
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: 386
toolchain: msvc2017
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2017
libtype: shared
libfiles: libui.dll libui.exp libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/windows-artifacts.yml
parameters:
os: windows
arch: amd64
toolchain: msvc2017
libtype: static
libfiles: libui.lib
osHeader: ui_windows.h
- template: azure-pipelines/artifacts.yml
parameters:
os: darwin
arch: amd64
libtype: shared
libfiles: libui.A.dylib
osHeader: ui_darwin.h
- template: azure-pipelines/artifacts.yml
parameters:
os: darwin
arch: amd64
libtype: static
libfiles: libui.a
osHeader: ui_darwin.h
}

View File

@ -0,0 +1,11 @@
# 5 april 2019
parameters:
beforeConfigure: ''
defaultLibrary: 'must-be-set'
steps:
- script: |
${{ parameters.beforeConfigure }}
meson setup build --buildtype=release --default-library=${{ parameters.defaultLibrary }}
displayName: 'Configure'

View File

@ -0,0 +1,13 @@
# 5 april 2019
# because brew install is also slow (it runs an update task first)
steps:
- script: |
sudo mkdir -p /opt/ninja
pushd /opt/ninja
sudo wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-mac.zip
sudo unzip ninja-mac.zip
sudo chmod a+rx ninja
popd
echo '##vso[task.prependpath]/opt/ninja'
displayName: 'Install Ninja'

View File

@ -0,0 +1,7 @@
# 4 april 2019
steps:
- script: |
python -m pip install --upgrade pip setuptools wheel
pip install meson
displayName: 'Install Latest Meson'

View File

@ -0,0 +1,17 @@
# 7 april 2019
# TODO figure out how to get meson to recognize the compiler is producing 32-bit output
steps:
- script: |
# Azure Pipelines ships with a patched version of this and that patch is only available on 64-bit systems, so trying to install the 32-bit versions will remove the 64-bit versions outright
# This is a dependency of Mesa, so we'll have to downgrade to the stock distro ones :/
llvmPackages=
for i in libllvm6.0 clang-6.0 libclang-common-6.0-dev liblldb-6.0 liblldb-6.0-dev lld-6.0 lldb-6.0 llvm-6.0-dev python-lldb-6.0 libclang1-6.0 llvm-6.0 llvm-6.0-runtime; do llvmPackages="$llvmPackages $i=1:6.0-1ubuntu2~16.04.1"; done
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --allow-downgrades \
gcc-multilib g++-multilib \
$llvmPackages \
libgtk-3-dev:i386 ninja-build
displayName: 'Install GTK+ Dev Files and Ninja'

View File

@ -0,0 +1,6 @@
# 7 april 2019
steps:
- script: |
sudo apt-get install libgtk-3-dev ninja-build
displayName: 'Install GTK+ Dev Files and Ninja'

View File

@ -0,0 +1,7 @@
# 4 april 2019
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: 'x64'

View File

@ -0,0 +1,10 @@
# 4 april 2019
# see https://github.com/Microsoft/azure-pipelines-image-generation/issues/374 for context and source
steps:
- script: |
powershell -Command "Invoke-WebRequest https://www.python.org/ftp/python/3.7.1/python-3.7.1-amd64-webinstall.exe -OutFile C:\py3-setup.exe"
C:\py3-setup.exe /quiet PrependPath=0 InstallAllUsers=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_test=0 Include_doc=0 Include_dev=0 Include_debug=0 Include_tcltk=0 TargetDir=C:\Python37
@echo ##vso[task.prependpath]C:\Python37
@echo ##vso[task.prependpath]C:\Python37\Scripts
displayName: 'Install Python 3'

View File

@ -0,0 +1,28 @@
# 6 april 2019
parameters:
os: ''
arch: ''
toolchain: ''
libtype: ''
libfiles: ''
osHeader: ''
steps:
- powershell: |
pushd build\meson-out
Copy-Item @("..\..\ui.h","..\..\${{ parameters.osHeader }}") -Destination .
Compress-Archive -Destination $(Build.ArtifactStagingDirectory)\libui-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.toolchain }}-${{ parameters.libtype }}.zip -Path @("${{ parameters.libfiles }}".Split(" ") + @("ui.h","${{ parameters.osHeader}}"))
Compress-Archive -Destination $(Build.ArtifactStagingDirectory)\examples-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.zip -Path @("$(releaseExamples)".Split(" ") | % {$_ + ".exe"})
Remove-Item @("ui.h","${{ parameters.osHeader }}")
popd
displayName: 'Create Artifacts'
- ${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
- task: GitHubRelease@0
inputs:
gitHubConnection: andlabs
repositoryName: andlabs/libui
action: 'edit'
addChangelog: false
assets: '$(Build.ArtifactStagingDirectory)/*'
assetUploadMode: 'replace'

View File

@ -0,0 +1,10 @@
# 4 april 2019
# why this? because choco isn't available on the VS2015 image and is extremely slow on the VS2017 one (it should not take 2.5 minutes to install just ninja!)
steps:
- script: |
powershell -Command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -OutFile C:\ninja-win.zip"
mkdir C:\ninja
powershell -Command "Expand-Archive -LiteralPath C:\ninja-win.zip -DestinationPath C:\ninja"
@echo ##vso[task.prependpath]C:\ninja
displayName: 'Install Ninja'

View File

@ -1,23 +0,0 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
common/attribute.c
common/attrlist.c
common/attrstr.c
common/areaevents.c
common/control.c
common/debug.c
common/matrix.c
common/opentype.c
common/shouldquit.c
common/tablemodel.c
common/tablevalue.c
common/userbugs.c
common/utf.c
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
common
)
set(_LIBUI_INCLUDEDIRS ${_LIBUI_INCLUDEDIRS} PARENT_SCOPE)

17
common/meson.build Normal file
View File

@ -0,0 +1,17 @@
# 23 march 2019
libui_sources += [
'common/attribute.c',
'common/attrlist.c',
'common/attrstr.c',
'common/areaevents.c',
'common/control.c',
'common/debug.c',
'common/matrix.c',
'common/opentype.c',
'common/shouldquit.c',
'common/tablemodel.c',
'common/tablevalue.c',
'common/userbugs.c',
'common/utf.c',
]

View File

@ -1,64 +0,0 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
darwin/aat.m
darwin/alloc.m
darwin/area.m
darwin/areaevents.m
darwin/attrstr.m
darwin/autolayout.m
darwin/box.m
darwin/button.m
darwin/checkbox.m
darwin/colorbutton.m
darwin/combobox.m
darwin/control.m
darwin/datetimepicker.m
darwin/debug.m
darwin/draw.m
darwin/drawtext.m
darwin/editablecombo.m
darwin/entry.m
darwin/fontbutton.m
darwin/fontmatch.m
darwin/fonttraits.m
darwin/fontvariation.m
darwin/form.m
darwin/future.m
darwin/graphemes.m
darwin/grid.m
darwin/group.m
darwin/image.m
darwin/label.m
darwin/main.m
darwin/map.m
darwin/menu.m
darwin/multilineentry.m
darwin/opentype.m
darwin/progressbar.m
darwin/radiobuttons.m
darwin/scrollview.m
darwin/separator.m
darwin/slider.m
darwin/spinbox.m
darwin/stddialogs.m
darwin/tab.m
darwin/table.m
darwin/tablecolumn.m
darwin/text.m
darwin/undocumented.m
darwin/util.m
darwin/window.m
darwin/winmoveresize.m
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
# TODO is this correct?
list(APPEND _LIBUI_INCLUDEDIRS
darwin
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
set(_LIBUI_LIBS
objc "-framework Foundation" "-framework AppKit"
PARENT_SCOPE)

64
darwin/meson.build Normal file
View File

@ -0,0 +1,64 @@
# 23 march 2019
libui_sources += [
'darwin/aat.m',
'darwin/alloc.m',
'darwin/area.m',
'darwin/areaevents.m',
'darwin/attrstr.m',
'darwin/autolayout.m',
'darwin/box.m',
'darwin/button.m',
'darwin/checkbox.m',
'darwin/colorbutton.m',
'darwin/combobox.m',
'darwin/control.m',
'darwin/datetimepicker.m',
'darwin/debug.m',
'darwin/draw.m',
'darwin/drawtext.m',
'darwin/editablecombo.m',
'darwin/entry.m',
'darwin/fontbutton.m',
'darwin/fontmatch.m',
'darwin/fonttraits.m',
'darwin/fontvariation.m',
'darwin/form.m',
'darwin/future.m',
'darwin/graphemes.m',
'darwin/grid.m',
'darwin/group.m',
'darwin/image.m',
'darwin/label.m',
'darwin/main.m',
'darwin/map.m',
'darwin/menu.m',
'darwin/multilineentry.m',
'darwin/opentype.m',
'darwin/progressbar.m',
'darwin/radiobuttons.m',
'darwin/scrollview.m',
'darwin/separator.m',
'darwin/slider.m',
'darwin/spinbox.m',
'darwin/stddialogs.m',
'darwin/tab.m',
'darwin/table.m',
'darwin/tablecolumn.m',
'darwin/text.m',
'darwin/undocumented.m',
'darwin/util.m',
'darwin/window.m',
'darwin/winmoveresize.m',
]
libui_deps += [
meson.get_compiler('objc').find_library('objc',
required: true),
dependency('appleframeworks',
modules: ['Foundation', 'AppKit'],
required: true),
]
libui_soversion = 'A'
# the / is required by some older versions of OS X
libui_rpath = '@executable_path/'

View File

@ -1,62 +0,0 @@
# 3 june 2016
if(WIN32)
set(_EXAMPLE_RESOURCES_RC resources.rc)
endif()
macro(_add_example _name)
_add_exec(${_name} ${ARGN})
# because Microsoft's toolchain is dumb
if(MSVC)
set_property(TARGET ${_name} APPEND_STRING PROPERTY
LINK_FLAGS " /ENTRY:mainCRTStartup")
endif()
endmacro()
_add_example(controlgallery
controlgallery/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(histogram
histogram/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(cpp-multithread
cpp-multithread/main.cpp
${_EXAMPLE_RESOURCES_RC}
)
if(NOT WIN32)
target_link_libraries(cpp-multithread pthread)
endif()
if(APPLE)
# since we use a deployment target of 10.8, the non-C++11-compliant libstdc++ is chosen by default; we need C++11
# see issue #302 for more details
target_compile_options(cpp-multithread PRIVATE --stdlib=libc++)
target_link_libraries(cpp-multithread --stdlib=libc++)
endif()
_add_example(drawtext
drawtext/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(timer
timer/main.c
${_EXAMPLE_RESOURCES_RC}
)
_add_example(datetime
datetime/main.c
${_EXAMPLE_RESOURCES_RC}
)
add_custom_target(examples
DEPENDS
controlgallery
histogram
cpp-multithread
drawtext
timer
datetime)

61
examples/meson.build Normal file
View File

@ -0,0 +1,61 @@
# 24 march 2019
libui_example_sources = []
libui_example_link_args = []
libui_example_cpp_extra_args = []
if libui_OS == 'windows'
libui_example_manifest = 'example.manifest'
if libui_mode == 'static'
libui_example_manifest = 'example.static.manifest'
endif
libui_example_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: [libui_example_manifest]),
]
# because Microsoft's toolchain is dumb
if libui_MSVC
libui_example_link_args += ['/ENTRY:mainCRTStartup']
endif
elif libui_OS == 'darwin'
# since we use a deployment target of 10.8, the non-C++11-compliant libstdc++ is chosen by default; we need C++11
# see issue #302 for more details
libui_example_cpp_extra_args += ['--stdlib=libc++']
endif
libui_examples = {
'controlgallery': {
'sources': ['controlgallery/main.c'],
},
'histogram': {
'sources': ['histogram/main.c'],
},
'cpp-multithread': {
'sources': ['cpp-multithread/main.cpp'],
'deps': [
dependency('threads',
required: true),
],
'cpp_args': libui_example_cpp_extra_args,
'link_args': libui_example_cpp_extra_args,
},
'drawtext': {
'sources': ['drawtext/main.c'],
},
'timer': {
'sources': ['timer/main.c'],
},
'datetime': {
'sources': ['datetime/main.c'],
},
}
foreach name, args : libui_examples
# TODO once we upgrade to 0.49.0, add pie: true
executable(name, args['sources'] + libui_example_sources,
dependencies: args.get('deps', []) + libui_binary_deps,
link_with: libui_libui,
cpp_args: args.get('cpp_args', []),
link_args: args.get('link_args', []) + libui_example_link_args,
gui_app: false,
install: false)
endforeach

176
meson.build Normal file
View File

@ -0,0 +1,176 @@
# 17 march 2019
# TODO I'm not sure how to allow building 32-bit instead of 64-bit with meson
# TODO remove cpp from this list once https://github.com/mesonbuild/meson/issues/5181 is settled; move it to the OS checks and under cpp-multithread
project('libui', ['c', 'cpp'],
meson_version: '>=0.48.0',
default_options: [
'buildtype=debug', # build debug by default
'default_library=shared', # build shared libraries by default
'layout=flat', # keep all outputs together by default
# these are forced options, but meson doesn't let me set these up separately before I call project() (TODO https://github.com/mesonbuild/meson/issues/5179)
'warning_level=3', # always max warnings
'b_pch=false', # we don't want precompiled headers
'b_staticpic=true', # use PIC even for static libraries
'c_std=c99', # strict C99
'c_winlibs=', # we define our own Windows libraries
'cpp_std=c++11', # strict C++11
'cpp_eh=sc', # shut the compiler up in some cases
'cpp_winlibs=', # likewise as with c_winlibs
],
license: 'MIT')
# TODO after https://github.com/mesonbuild/meson/issues/5179 is settled, remove these
libui_OS = host_machine.system()
libui_MSVC = meson.get_compiler('c').get_id() == 'msvc'
# TODO switch to tabs; the spaces are just so I can share this file while I'm writing it
libui_forced_options = {
'warning_level': '3', # always max warnings
'b_pch': 'false', # we don't want precompiled headers
'b_staticpic': 'true', # use PIC even for static libraries
'c_std': 'c99', # strict C99
'c_winlibs': '[]', # we define our own Windows libraries
'cpp_std': 'c++11', # strict C++11
'cpp_eh': 'sc', # shut the compiler up in some cases
'cpp_winlibs': '[]', # likewise as with c_winlibs
}
foreach name, value : libui_forced_options
# TODO rewrite this when https://github.com/mesonbuild/meson/issues/5181 is settled
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)
endif
endif
endforeach
libui_OS = host_machine.system()
libui_MSVC = meson.get_compiler('c').get_id() == 'msvc'
if libui_OS == 'darwin'
add_languages('objc',
required: true)
endif
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
libui_is_debug = get_option('buildtype').startswith('debug')
libui_project_compile_args = []
libui_project_link_args = []
if libui_OS == 'darwin'
libui_macosx_version_min = '-mmacosx-version-min=10.8'
libui_project_compile_args += [libui_macosx_version_min]
libui_project_link_args += [libui_macosx_version_min]
endif
if libui_MSVC
# TODO subsystem version
libui_project_compile_args += [
'/wd4100',
'/bigobj',
]
if libui_is_debug
libui_project_compile_args += ['/RTC1', '/RTCs', '/RTCu']
endif
libui_project_link_args += [
'/LARGEADDRESSAWARE',
'/INCREMENTAL:NO',
'/MANIFEST:NO',
]
# TODO autogenerate a .def file?
else
libui_project_compile_args += [
'-Wno-unused-parameter',
'-Wno-switch',
]
if libui_OS == 'windows'
# don't require shipping the MinGW-w64 DLLs
libui_project_link_args += [
'-static',
'-static-libgcc',
'-static-libstdc++',
]
endif
endif
# TODO come up with a better way to do this, both for libui (the compiler define, used by winapi.hpp, and the manifest args) and for the binaries (the manifest args)
# TODO (after the above TODO is resolved) move that below the part below that actually adds these arguments
libui_manifest_args = []
if libui_mode == 'static'
libui_project_compile_args += ['-D_UI_STATIC']
libui_manifest_args = ['-D_UI_STATIC']
endif
add_project_arguments(libui_project_compile_args,
language: ['c', 'cpp', 'objc'])
add_project_link_arguments(libui_project_link_args,
language: ['c', 'cpp', 'objc'])
# TODO:
# meson determins whether -Wl,--no-undefined is provided via
# built-in option b_lundef, and it's true by default, which is what
# we want (so I don't make mistakes like asking for unknown
# functions in my dependencies). However, meson also is smart
# about specifying this properly on systems that don't support it, like
# FreeBSD (where I had the comment "figure out why FreeBSD
# follows linked libraries here" when I was on cmake) and OpenBSD
# (according to someone on freenode #mesonbuild), but it isn't clear
# whether it's just ignored or if the value is forced to false.
# Therefore, once this is determined, we can uncomment the
# following.
libui_libui_link_args = []
#if not libui_MSVC and get_option("b_lundef")
# TODO what should this be on MSVC?
# libui_libui_link_args += ['-Wl,--no-allow-shlib-undefined']
#endif
libui_sources = []
libui_deps = []
libui_soversion = ''
libui_rpath = ''
subdir('common')
if libui_OS == 'windows'
subdir('windows')
install_headers('ui_windows.h')
elif libui_OS == 'darwin'
subdir('darwin')
install_headers('ui_darwin.h')
else
subdir('unix')
install_headers('ui_unix.h')
endif
libui_libui = library('ui', libui_sources,
dependencies: libui_deps,
build_rpath: libui_rpath,
install_rpath: libui_rpath,
name_prefix: 'lib', # always call it libui, even in Windows DLLs
install: true,
gnu_symbol_visibility: 'hidden',
c_args: ['-Dlibui_EXPORTS'],
cpp_args: ['-Dlibui_EXPORTS'],
objc_args: ['-Dlibui_EXPORTS'],
link_args: libui_libui_link_args,
soversion: libui_soversion,
darwin_versions: []) # TODO
install_headers('ui.h')
# TODO when the API is stable enough to be versioned, create a pkg-config file (https://mesonbuild.com/Pkgconfig-module.html) and a declare_dependency() section too
libui_binary_deps = []
if libui_mode == 'static'
libui_binary_deps = libui_deps
endif
subdir('test')
subdir('examples')

View File

@ -1,40 +0,0 @@
# 3 june 2016
if(WIN32)
set(_TEST_RESOURCES_RC resources.rc)
endif()
_add_exec(tester
drawtests.c
images.c
main.c
menus.c
page1.c
page2.c
page3.c
page4.c
page5.c
page6.c
page7.c
page7a.c
page7b.c
page7c.c
# page8.c
# page9.c
# page10.c
page11.c
page12.c
page13.c
page14.c
page15.c
page16.c
spaced.c
${_TEST_RESOURCES_RC}
)
target_include_directories(tester
PRIVATE test
)
set_target_properties(tester PROPERTIES
OUTPUT_NAME test
WIN32_EXECUTABLE FALSE
)

48
test/meson.build Normal file
View File

@ -0,0 +1,48 @@
# 23 march 2019
libui_test_sources = [
'drawtests.c',
'images.c',
'main.c',
'menus.c',
'page1.c',
'page2.c',
'page3.c',
'page4.c',
'page5.c',
'page6.c',
'page7.c',
'page7a.c',
'page7b.c',
'page7c.c',
# 'page8.c',
# 'page9.c',
# 'page10.c',
'page11.c',
'page12.c',
'page13.c',
'page14.c',
'page15.c',
'page16.c',
'spaced.c',
]
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]),
]
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???? we'll probably need to file a feature request for this
# TODO once we upgrade to 0.49.0, add pie: true
executable('tester', libui_test_sources,
dependencies: libui_binary_deps,
link_with: libui_libui,
gui_app: false,
install: false)

View File

@ -1,66 +0,0 @@
# 3 june 2016
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
list(APPEND _LIBUI_SOURCES
unix/alloc.c
unix/area.c
unix/attrstr.c
unix/box.c
unix/button.c
unix/cellrendererbutton.c
unix/checkbox.c
unix/child.c
unix/colorbutton.c
unix/combobox.c
unix/control.c
unix/datetimepicker.c
unix/debug.c
unix/draw.c
unix/drawmatrix.c
unix/drawpath.c
unix/drawtext.c
unix/editablecombo.c
unix/entry.c
unix/fontbutton.c
unix/fontmatch.c
unix/form.c
unix/future.c
unix/graphemes.c
unix/grid.c
unix/group.c
unix/image.c
unix/label.c
unix/main.c
unix/menu.c
unix/multilineentry.c
unix/opentype.c
unix/progressbar.c
unix/radiobuttons.c
unix/separator.c
unix/slider.c
unix/spinbox.c
unix/stddialogs.c
unix/tab.c
unix/table.c
unix/tablemodel.c
unix/text.c
unix/util.c
unix/window.c
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
unix
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
# TODO the other variables don't work?
set(_LIBUI_CFLAGS
${GTK_CFLAGS}
PARENT_SCOPE)
set(_LIBUI_LIBS
${GTK_LDFLAGS} m ${CMAKE_DL_LIBS}
PARENT_SCOPE)

62
unix/meson.build Normal file
View File

@ -0,0 +1,62 @@
# 23 march 2019
libui_sources += [
'unix/alloc.c',
'unix/area.c',
'unix/attrstr.c',
'unix/box.c',
'unix/button.c',
'unix/cellrendererbutton.c',
'unix/checkbox.c',
'unix/child.c',
'unix/colorbutton.c',
'unix/combobox.c',
'unix/control.c',
'unix/datetimepicker.c',
'unix/debug.c',
'unix/draw.c',
'unix/drawmatrix.c',
'unix/drawpath.c',
'unix/drawtext.c',
'unix/editablecombo.c',
'unix/entry.c',
'unix/fontbutton.c',
'unix/fontmatch.c',
'unix/form.c',
'unix/future.c',
'unix/graphemes.c',
'unix/grid.c',
'unix/group.c',
'unix/image.c',
'unix/label.c',
'unix/main.c',
'unix/menu.c',
'unix/multilineentry.c',
'unix/opentype.c',
'unix/progressbar.c',
'unix/radiobuttons.c',
'unix/separator.c',
'unix/slider.c',
'unix/spinbox.c',
'unix/stddialogs.c',
'unix/tab.c',
'unix/table.c',
'unix/tablemodel.c',
'unix/text.c',
'unix/util.c',
'unix/window.c',
]
libui_deps += [
dependency('gtk+-3.0',
version: '>=3.10.0',
method: 'pkg-config',
required: true),
# We specify these as not required because some Unix systems include them with libc instead of providing them as separate files (thanks textshell and jpakkane in freenode #mesonbuild)
meson.get_compiler('c').find_library('m',
required: false),
meson.get_compiler('c').find_library('dl',
required: false),
]
libui_soversion = '0'
libui_rpath = '$ORIGIN'

View File

@ -1,94 +0,0 @@
# 3 june 2016
list(APPEND _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(BUILD_SHARED_LIBS)
list(APPEND _LIBUI_SOURCES
windows/resources.rc
)
endif()
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
windows
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
# TODO prune this list
set(_LIBUI_LIBS
user32 kernel32 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid windowscodecs
PARENT_SCOPE)
if(NOT MSVC)
if(BUILD_SHARED_LIBS)
message(FATAL_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()
endif()

View File

@ -314,7 +314,7 @@ static void drawGrid(ID2D1RenderTarget *rt, D2D1_RECT_F *fillRect)
pformat = rt->GetPixelFormat();
#else
{
typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *);
typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *) const;
GetPixelFormatF gpf;
gpf = (GetPixelFormatF) (&(rt->GetPixelFormat));

View File

@ -19,7 +19,7 @@ HRESULT _logLastError(debugargs, const WCHAR *s)
useFormatted = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, le, 0, (LPWSTR) (&formatted), 0, NULL) != 0;
if (!useFormatted)
formatted = L"\n";
formatted = (WCHAR *) L"\n"; // TODO
msg = strf(L"[libui] %s:%s:%s() %s: GetLastError() == %I32u %s",
file, line, func,
s, le, formatted);
@ -46,7 +46,7 @@ HRESULT _logHRESULT(debugargs, const WCHAR *s, HRESULT hr)
useFormatted = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hr, 0, (LPWSTR) (&formatted), 0, NULL) != 0;
if (!useFormatted)
formatted = L"\n";
formatted = (WCHAR *) L"\n"; // TODO
msg = strf(L"[libui] %s:%s:%s() %s: HRESULT == 0x%08I32X %s",
file, line, func,
s, hr, formatted);

View File

@ -368,7 +368,7 @@ static void fontDialogDrawSampleText(struct fontDialog *f, ID2D1RenderTarget *rt
sample = uiprivFontCollectionCorrectString(f->fc, sampleStrings);
sampleStrings->Release();
} else
sample = L"The quick brown fox jumps over the lazy dog.";
sample = (WCHAR *) L"The quick brown fox jumps over the lazy dog."; // TODO
// DirectWrite doesn't allow creating a text format from a font; we need to get this ourselves
family = cbGetItemText(f->familyCombobox, f->curFamily);

View File

@ -22,7 +22,7 @@ static const char *initerr(const char *message, const WCHAR *label, DWORD value)
hassysmsg = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, value, 0, (LPWSTR) (&sysmsg), 0, NULL) != 0;
if (!hassysmsg)
sysmsg = L"";
sysmsg = (WCHAR *) L""; // TODO
wmessage = toUTF16(message + 1);
wout = strf(L"-error initializing libui: %s; code %I32d (0x%08I32X) %s",
wmessage,

91
windows/meson.build Normal file
View File

@ -0,0 +1,91 @@
# 23 march 2019
windows = import('windows')
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).
if libui_mode == 'shared'
libui_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: ['libui.manifest']),
]
endif
# TODO prune this list
foreach lib : ['user32', 'kernel32', 'gdi32', 'comctl32', 'uxtheme', 'msimg32', 'comdlg32', 'd2d1', 'dwrite', 'ole32', 'oleaut32', 'oleacc', 'uuid', 'windowscodecs']
libui_deps += [
meson.get_compiler('cpp').find_library(lib,
required: true),
]
endforeach
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

View File

@ -144,7 +144,7 @@ D2D1_SIZE_F realGetSize(ID2D1RenderTarget *rt)
return rt->GetSize();
#else
D2D1_SIZE_F size;
typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *);
typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *) const;
GetSizeF gs;
gs = (GetSizeF) (&(rt->GetSize));