From ad5bd38f9d806d0da853509e97c446b076c87907 Mon Sep 17 00:00:00 2001 From: 45Tatami Date: Tue, 23 May 2023 00:12:18 +0200 Subject: [PATCH] implement (cross-)compilation via meson --- .gitignore | 4 +++- README.md | 26 +++++++++++++++++++++++--- cross/i686-w64-mingw32.txt | 13 +++++++++++++ cross/x86_64-w64-mingw32.txt | 13 +++++++++++++ meson.build | 20 ++++++++++++++++++++ 5 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 cross/i686-w64-mingw32.txt create mode 100644 cross/x86_64-w64-mingw32.txt create mode 100644 meson.build diff --git a/.gitignore b/.gitignore index 9491a2f..3358a1e 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,6 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd + +*.swp diff --git a/README.md b/README.md index a2d4594..14bd458 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,29 @@ Useful for setups where the clipboard is not enough. See [here](https://github.com/45Tatami/native-inserter) for an example of the receiving server side. -Requires Visual Studio 2019. Drop into VS, build x86 or x64 depending on which Textractor architecture you use. -Drop resulting dll into Textractor extension window. - Configuration done at runtime via interface. ![Purrint_1707](https://user-images.githubusercontent.com/96940591/149813301-b10d229c-f093-43fa-a483-5848f71e9d2c.png) + +## Building + +Requires Visual Studio 2019 or meson. Drop into VS, build x86 or x64 depending on which Textractor architecture you use. +Drop resulting dll into Textractor extension window. + +### meson + +``` +meson setup build +ninja -Cbuild +``` + +Project includes example cross-compilation definition files for a mingw32 toolchain under `cross`. + + +``` +# x86/32bit +meson setup --cross-file=cross/i686-w64-mingw32.txt build + +# x86_64/64bit +meson setup --cross-file=cross/x86_64-w64-mingw32.txt build +``` diff --git a/cross/i686-w64-mingw32.txt b/cross/i686-w64-mingw32.txt new file mode 100644 index 0000000..9214274 --- /dev/null +++ b/cross/i686-w64-mingw32.txt @@ -0,0 +1,13 @@ +[binaries] +c = 'i686-w64-mingw32-gcc' +cpp = 'i686-w64-mingw32-g++' +ar = 'i686-w64-mingw32-ar' +strip = 'i686-w64-mingw32-strip' +windres = 'i686-w64-mingw32-windres' +exe_wrapper = 'wine' + +[host_machine] +system = 'windows' +cpu_family = 'x86' +cpu = 'i686' +endian = 'little' diff --git a/cross/x86_64-w64-mingw32.txt b/cross/x86_64-w64-mingw32.txt new file mode 100644 index 0000000..72dff14 --- /dev/null +++ b/cross/x86_64-w64-mingw32.txt @@ -0,0 +1,13 @@ +[binaries] +c = 'x86_64-w64-mingw32-gcc' +cpp = 'x86_64-w64-mingw32-g++' +ar = 'x86_64-w64-mingw32-ar' +strip = 'x86_64-w64-mingw32-strip' +windres = 'x86_64-w64-mingw32-windres' +exe_wrapper = 'wine64' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..b4719dc --- /dev/null +++ b/meson.build @@ -0,0 +1,20 @@ +project('Textractor-TCPSender', 'cpp', + default_options : ['cpp_std=c++17']) + +add_project_arguments('-DUNICODE', language : 'cpp') + +compiler = meson.get_compiler('cpp') + +src = files( + 'TCPSender/TCPSender.cpp', + 'TCPSender/ExtensionImpl.cpp' +) + +windows = import('windows') +src += windows.compile_resources('TCPSender/resource.rc') + +deps = [] +deps += compiler.find_library('ws2_32') + +library('tcpsender', src, + dependencies : deps)