@@ -64,6 +64,25 @@ incdir = include_directories('..')
6464nanoarrow_dep = declare_dependency (include_directories : [curdir, incdir],
6565 link_with : nanoarrow_lib)
6666
67+ if get_option (' ipc' )
68+ cmake = import (' cmake' )
69+ cmake_opts = cmake.subproject_options()
70+ cmake_opts.add_cmake_defines({' CMAKE_POSITION_INDEPENDENT_CODE' : true })
71+ flatcc_subproj = cmake.subproject (' flatcc' , options : cmake_opts)
72+ flatcc_dep = flatcc_subproj.dependency (' flatccrt' )
73+
74+ nanoarrow_ipc_lib = build_target (
75+ ' nanoarrow_ipc' ,
76+ ' nanoarrow_ipc_decoder.c' ,
77+ ' nanoarrow_ipc_reader.c' ,
78+ dependencies : [nanoarrow_dep, flatcc_dep],
79+ install : true ,
80+ target_type : libtype,
81+ )
82+ nanoarrow_ipc_dep = declare_dependency (include_directories : [incdir],
83+ link_with : nanoarrow_ipc_lib)
84+ endif
85+
6786if get_option (' tests' ) or get_option (' integration_tests' )
6887 nlohmann_json_dep = dependency (' nlohmann_json' )
6988
@@ -147,4 +166,38 @@ if get_option('tests')
147166 include_directories : incdir)
148167 test (' c_data_integration test' , c_data_integration_test)
149168
169+ if get_option (' ipc' )
170+ zlib_dep = dependency (' zlib' )
171+ ipc_test_files = {
172+ ' nanoarrow-ipc-decoder' : {
173+ ' deps' : [nanoarrow_dep, flatcc_dep, arrow_dep, gtest_dep],
174+ },
175+ ' nanoarrow-ipc-reader' : {
176+ ' deps' : [nanoarrow_dep, flatcc_dep, arrow_dep, gtest_dep],
177+ },
178+ ' nanoarrow-ipc-files' : {
179+ ' deps' : [
180+ nanoarrow_dep,
181+ flatcc_dep,
182+ zlib_dep,
183+ arrow_dep,
184+ gtest_dep,
185+ nlohmann_json_dep
186+ ],
187+ },
188+ ' nanoarrow-ipc-hpp' : {
189+ ' deps' : [nanoarrow_dep, flatcc_dep, gtest_dep],
190+ },
191+ }
192+
193+ foreach name, config : ipc_test_files
194+ exc = executable (
195+ name + ' -test' ,
196+ name.replace(' -' , ' _' ) + ' _test.cc' ,
197+ link_with : nanoarrow_ipc_lib,
198+ dependencies : config[' deps' ]
199+ )
200+ test (name, exc)
201+ endforeach
202+ endif
150203endif
0 commit comments