@@ -64,6 +64,26 @@ 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+ dependencies : [nanoarrow_dep, flatcc_dep])
85+ endif
86+
6787if get_option (' tests' ) or get_option (' integration_tests' )
6888 nlohmann_json_dep = dependency (' nlohmann_json' )
6989
@@ -147,4 +167,36 @@ if get_option('tests')
147167 include_directories : incdir)
148168 test (' c_data_integration test' , c_data_integration_test)
149169
170+ if get_option (' ipc' )
171+ zlib_dep = dependency (' zlib' )
172+ ipc_test_files = {
173+ ' nanoarrow-ipc-decoder' : {
174+ ' deps' : [nanoarrow_ipc_dep, arrow_dep, gtest_dep],
175+ },
176+ ' nanoarrow-ipc-reader' : {
177+ ' deps' : [nanoarrow_ipc_dep, arrow_dep, gtest_dep],
178+ },
179+ ' nanoarrow-ipc-files' : {
180+ ' deps' : [
181+ nanoarrow_ipc_dep,
182+ zlib_dep,
183+ arrow_dep,
184+ gtest_dep,
185+ nlohmann_json_dep
186+ ],
187+ },
188+ ' nanoarrow-ipc-hpp' : {
189+ ' deps' : [nanoarrow_ipc_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+ dependencies : config[' deps' ]
198+ )
199+ test (name, exc)
200+ endforeach
201+ endif
150202endif
0 commit comments