Skip to content

Commit

Permalink
Build udkapi headers and use them in targets.
Browse files Browse the repository at this point in the history
Change-Id: I277a036700d43799113194c23ec643ba6f6b56de
  • Loading branch information
jpakkane committed Feb 8, 2020
1 parent 54d7218 commit 417908a
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 10 deletions.
2 changes: 1 addition & 1 deletion codemaker/meson.build
Expand Up @@ -10,7 +10,7 @@ codemaker_st_lib = static_library('codemaker_static',
cpp_args: ['-DLIBO_INTERNAL_ONLY'],
)

cppumaker = executable('cppumaker',
cppumaker_exe = executable('cppumaker',
'source/cppumaker/cppumaker.cxx',
'source/cppumaker/cppuoptions.cxx',
'source/cppumaker/cpputype.cxx',
Expand Down
2 changes: 1 addition & 1 deletion config_host/meson.build
Expand Up @@ -50,7 +50,7 @@ cdata.set('LIBO_VERSION_PATCH', patch_version)
cdata.set('LIBO_THIS_YEAR', this_year)


cdata.set10('LIBLANGTAG_INLINE_FIX', true)
cdata.set10('LIBLANGTAG_INLINE_FIX', false)

configure_file(input: 'config_typesizes.h.meson',
output: 'config_typesizes.h',
Expand Down
9 changes: 5 additions & 4 deletions cppu/meson.build
@@ -1,6 +1,6 @@
cppu_lib = shared_library('cppu.cxx',
cppu_lib = shared_library('cppu',
'source/cppu/compat.cxx',
# 'source/cppu/cppu_opt.cxx',
'source/cppu/cppu_opt.cxx',
'source/threadpool/current.cxx',
'source/threadpool/jobqueue.cxx',
'source/threadpool/thread.cxx',
Expand All @@ -9,7 +9,7 @@ cppu_lib = shared_library('cppu.cxx',
'source/typelib/static_types.cxx',
'source/typelib/typelib.cxx',
'source/uno/any.cxx',
# 'source/uno/cascade_mapping.cxx',
'source/uno/cascade_mapping.cxx',
'source/uno/check.cxx',
'source/uno/data.cxx',
'source/uno/EnvDcp.cxx',
Expand All @@ -19,7 +19,8 @@ cppu_lib = shared_library('cppu.cxx',
'source/uno/lbmap.cxx',
'source/uno/loadmodule.cxx',
'source/uno/sequence.cxx',
include_directories: [main_inc],
udk_fake_h,
include_directories: [main_inc, udkh_inc],
cpp_args: ['-DLIBO_INTERNAL_ONLY',
'-DCPPU_IMPLEMENTATION'],
link_with: [salhelper_lib, sal_lib],
Expand Down
5 changes: 4 additions & 1 deletion i18nlangtag/meson.build
Expand Up @@ -4,5 +4,8 @@ i18nlangtag_lib = shared_library('i18nlangtag',
'source/isolang/mslangid.cxx',
'source/languagetag/languagetag.cxx',
'source/languagetag/languagetagicu.cxx',
include_directories: [main_inc],
udk_fake_h,
include_directories: [main_inc, udkh_inc],
dependencies: [langtag_dep],
cpp_args: ['-DLIBO_INTERNAL_ONLY'],
)
6 changes: 4 additions & 2 deletions meson.build
Expand Up @@ -24,6 +24,7 @@ thread_dep = dependency('threads')
dl_dep = cpp.find_library('dl', required: false)
cppunit_dep = dependency('cppunit')
main_inc = include_directories('include', 'config_host')
langtag_dep = dependency('liblangtag')

cdata = configuration_data()

Expand All @@ -35,5 +36,6 @@ subdir('registry')
subdir('idlc')
subdir('unoidl')
subdir('codemaker')
subdir('i18nlangtag')
#subdir('cppu')
subdir('udkapi')
#subdir('i18nlangtag')
subdir('cppu')
42 changes: 42 additions & 0 deletions udkapi/classnamebuilder.py
@@ -0,0 +1,42 @@
#!/usr/bin/env python3

from pathlib import Path
import sys, os, subprocess

# NOTE: cppumaker is _very_ picky about paths. For
# example if you pass the output directory as relative
# it will fail with a misleading error that has _nothing_
# to do with the actual problem.

idlwrite = sys.argv[1]
cppumaker = sys.argv[2]
out_dir = sys.argv[3]
out_dir_abs = os.path.join(os.getcwd(), sys.argv[3])
priv_dir = sys.argv[4]
priv_dir_abs = os.path.join(os.getcwd(), sys.argv[4])
fakeout = sys.argv[5]
source_dir = sys.argv[6]
classnamefile = os.path.join(priv_dir, 'classnames')
rdbfile = os.path.join(os.getcwd(), priv_dir, 'udkapi.rdb')

if not os.path.exists(priv_dir):
os.mkdir(priv_dir)

with open(classnamefile, 'w') as of:
fnames = Path(source_dir).glob('com/**/*.idl')
for fname in fnames:
dotname = str(fname.relative_to(source_dir).with_suffix('')).replace('/', '.')
if dotname == 'com.sun.star.modules':
continue
of.write(dotname)
of.write(' ')

subprocess.check_call([idlwrite,
source_dir,
'@' + classnamefile,
rdbfile])

subprocess.check_call([cppumaker,
'-Gc',
'-O' + out_dir_abs, # FIXME, should be priv_dir_abs
rdbfile])
15 changes: 15 additions & 0 deletions udkapi/meson.build
@@ -0,0 +1,15 @@
cnbuilder = find_program('classnamebuilder.py')

# FIXME, this only generates headers. There is no
# proper dependency tracking or dealing of the rdb file.
udk_fake_h = custom_target('udkapi_h',
output: 'udk_fake.h',
command: [cnbuilder,
unoidl_write_exe,
cppumaker_exe,
'@OUTDIR@',
'@PRIVATE_DIR@',
'@OUTPUT@',
meson.current_source_dir()]
)
udkh_inc = include_directories('.')
2 changes: 1 addition & 1 deletion unoidl/meson.build
Expand Up @@ -35,7 +35,7 @@ executable('unoidl-read',
link_with: [unoidl_lib, salhelper_lib, sal_lib],
)

executable('unoidl-write',
unoidl_write_exe = executable('unoidl-write',
'source/unoidl-write.cxx',
include_directories: [main_inc],
cpp_args: ['-DLIBO_INTERNAL_ONLY'],
Expand Down

0 comments on commit 417908a

Please sign in to comment.