Skip to content

Commit 4655ecf

Browse files
committed
Migrating to meson build system.
1 parent 7a3db79 commit 4655ecf

14 files changed

Lines changed: 182 additions & 136 deletions

File tree

.gitignore

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +0,0 @@
1-
*~
2-
*.layout
3-
.bin
4-
.obj
5-
.src
6-
ChangeLog
7-
aclocal.m4
8-
autom4te.cache
9-
config.*
10-
configure
11-
*.depend
12-
stamp-h1
13-
Makefile
14-
*.zip
15-
*.tar
16-
*.gz
17-
*.bz2
18-
rpm/BUILD
19-
rpm/BUILDROOT
20-
rpm/RPMS
21-
rpm/SOURCES
22-
rpm/SPECS
23-
rpm/SRPMS
24-
scripts
25-
*.[0-9]
26-
*.bak
27-
*.rc
28-
*.cache
29-
MANIFEST
30-
dist
31-
*.xml
32-
*.egg*
33-
ABOUT-NLS
34-
intl
35-
m4
36-
po
37-

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"python.pythonPath": "C:\\Program Files\\Python37\\python.exe"
2+
"python.pythonPath": "C:\\Program Files\\Python37\\python.exe",
3+
"C_Cpp.default.configurationProvider": "mesonbuild.mesonbuild",
4+
"C_Cpp.default.compileCommands": "/home/perry/project/pw3270/python/.build/compile_commands.json"
35
}

gitsync.sh

Lines changed: 0 additions & 34 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

meson.build

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Maintainer: Perry Werneck <perry.werneck@gmail.com>
2+
3+
# SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
# Copyright (C) 2025 Perry Werneck <perry.werneck@gmail.com>
6+
#
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU Lesser General Public License as published
9+
# by the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public License
18+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
project(
21+
'pytn3270',
22+
['c', 'cpp'],
23+
version: '5.5.0',
24+
default_options : ['cpp_std=c++17'],
25+
license: 'GPL-3.0-or-later',
26+
)
27+
28+
project_description = 'Python bindings for lib3270/pw3270.'
29+
30+
#
31+
# Versioning
32+
#
33+
pkg_version = meson.project_version()
34+
version_array = pkg_version.split('.')
35+
pkg_major_version = version_array[0].to_int()
36+
pkg_minor_version = version_array[1].to_int()
37+
pkg_micro_version = version_array[2].to_int()
38+
39+
#
40+
# Compiler flags
41+
#
42+
cxx = meson.get_compiler('cpp')
43+
cc = meson.get_compiler('c')
44+
enable_debug = get_option('debug') or get_option('buildtype').contains('debug')
45+
46+
compiler_flags_common = [
47+
'-fvisibility=hidden',
48+
'-DHAVE_CONFIG_H=1',
49+
'-ggdb3',
50+
'-fPIC',
51+
]
52+
53+
if enable_debug
54+
compiler_flags_common += [
55+
'-DDEBUG=1'
56+
]
57+
else
58+
compiler_flags_common += [
59+
'-DNDEBUG=1'
60+
]
61+
endif
62+
63+
add_project_arguments(cxx.get_supported_arguments(compiler_flags_common), language: 'cpp')
64+
add_project_arguments(cc.get_supported_arguments(compiler_flags_common), language: 'c')
65+
66+
#
67+
# Dependencies
68+
#
69+
ipc3270 = dependency(
70+
'libipc3270',
71+
required: true,
72+
version: '>= 5.5.0',
73+
fallback: [
74+
'libipc3270',
75+
'static_library'
76+
]
77+
)
78+
79+
#
80+
# Configuration
81+
#
82+
app_conf = configuration_data()
83+
app_conf.set_quoted('PACKAGE_NAME', meson.project_name())
84+
app_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
85+
app_conf.set_quoted('PACKAGE_DESCRIPTION', project_description)
86+
app_conf.set('PACKAGE_VERSION_MAJOR', pkg_major_version)
87+
app_conf.set('PACKAGE_VERSION_MINOR', pkg_minor_version)
88+
app_conf.set('PACKAGE_VERSION_MICRO', pkg_micro_version)
89+
90+
app_conf.set('PRODUCT_NAME', meson.project_name())
91+
app_conf.set('PRODUCT_VERSION', meson.project_version())
92+
93+
if cxx.compiles('#include <unistd.h>', name : 'unistd.h')
94+
app_conf.set('HAVE_UNISTD_H', 1)
95+
endif
96+
97+
config_src = [
98+
configure_file(
99+
output : 'config.h',
100+
configuration : app_conf
101+
)
102+
]
103+
104+
#
105+
# Dependencies
106+
#
107+
sources = [
108+
'src/module/init.c',
109+
'src/module/types.c',
110+
'src/module/properties.cc',
111+
'src/module/windows/init.cc',
112+
'src/module/tools.cc',
113+
'src/objects/action.cc',
114+
'src/objects/session.cc',
115+
'src/session/actions.cc',
116+
'src/session/attributes.cc',
117+
'src/session/get.cc',
118+
'src/session/network.cc',
119+
'src/session/set.cc',
120+
'src/session/tools.cc',
121+
'src/session/wait.cc',
122+
'src/session/misc.cc',
123+
]
124+
125+
includes_dir = include_directories('src/include')
126+
127+
if host_machine.system() == 'windows'
128+
129+
# https://mesonbuild.com/Windows-module.html
130+
windows = import('windows')
131+
resources = windows.compile_resources(
132+
configure_file(
133+
input : 'src/module/windows/resources.rc.in',
134+
output : 'resources.rc',
135+
configuration : app_conf
136+
)
137+
)
138+
139+
sources += resources
140+
141+
endif
142+
143+
144+
shared_library(
145+
'meson.project_name()',
146+
sources,
147+
install: true,
148+
dependencies: [
149+
ipc3270,
150+
dependency(
151+
'python3',
152+
required: true,
153+
),
154+
],
155+
include_directories: includes_dir
156+
)
157+
158+

pushtag.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)