Skip to content

Commit 8aaf619

Browse files
committed
Make ports dependant on metacall distributable.
1 parent bef97c2 commit 8aaf619

File tree

5 files changed

+66
-37
lines changed

5 files changed

+66
-37
lines changed

source/ports/CMakeLists.txt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,6 @@ set(MODULE_NAMES
6161
rb_port
6262
)
6363

64-
#
65-
# External dependencies
66-
#
67-
68-
# MetaCall Library
69-
find_package(MetaCall)
70-
71-
if(NOT METACALL_FOUND)
72-
message(STATUS "MetaCall libraries not found")
73-
return()
74-
endif()
75-
76-
include_directories(${METACALL_INCLUDE_DIRS})
77-
7864
#
7965
# Port languages (Standalone)
8066
#
@@ -95,6 +81,18 @@ endif()
9581

9682
include(${SWIG_USE_FILE})
9783

84+
#
85+
# Set MetaCall inlcude directories for SWIG
86+
#
87+
88+
get_filename_component(CMAKE_PARENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
89+
get_filename_component(CMAKE_PARENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY)
90+
91+
list(APPEND CMAKE_SWIG_FLAGS
92+
"-I${CMAKE_PARENT_SOURCE_DIR}/metacall/include"
93+
"-I${CMAKE_PARENT_BINARY_DIR}/metacall/include"
94+
)
95+
9896
#
9997
# Port languages (Swig)
10098
#

source/ports/js_port/CMakeLists.txt

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ source_group_by_path(${source_path} "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$"
6767

6868
# Set SWIG flags (use V8 engine)
6969
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
70-
set(CMAKE_SWIG_FLAGS "-v8" "-DDEBUG")
70+
list(APPEND CMAKE_SWIG_FLAGS "-v8" "-DDEBUG")
7171
else()
72-
set(CMAKE_SWIG_FLAGS "-v8" "-DNDEBUG")
72+
list(APPEND CMAKE_SWIG_FLAGS "-v8" "-DNDEBUG")
7373
endif()
7474

7575
# Set SWIG include path
@@ -107,6 +107,17 @@ swig_add_module(${target}
107107
${sources}
108108
)
109109

110+
set_property(TARGET ${target} PROPERTY SWIG_USE_LIBRARY_INCLUDE_DIRECTORIES TRUE)
111+
112+
#
113+
# Dependecies
114+
#
115+
116+
# Add metacall distributable dependency
117+
add_dependencies(${SWIG_MODULE_${target}_REAL_NAME}
118+
${META_PROJECT_NAME}::metacall_distributable
119+
)
120+
110121
# Create namespaced alias
111122
add_library(${META_PROJECT_NAME}::${target} ALIAS ${SWIG_MODULE_${target}_REAL_NAME})
112123

@@ -161,8 +172,6 @@ target_include_directories(${SWIG_MODULE_${target}_REAL_NAME}
161172

162173
${V8_INCLUDE_DIR} # V8 includes
163174

164-
${METACALL_INCLUDE_DIRS} # MetaCall includes
165-
166175
PUBLIC
167176
${DEFAULT_INCLUDE_DIRECTORIES}
168177

@@ -180,8 +189,7 @@ swig_link_libraries(${target}
180189
PRIVATE
181190
${V8_LIBRARIES} # V8 libraries
182191

183-
${METACALL_LIBRARIES} # MetaCall libraries
184-
192+
${META_PROJECT_NAME}::metacall_distributable
185193

186194
PUBLIC
187195
${DEFAULT_LIBRARIES}
@@ -222,6 +230,9 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}
222230

223231
target_link_libraries(${SWIG_MODULE_${target}_REAL_NAME}
224232
PRIVATE
233+
${V8_LIBRARIES} # V8 libraries
234+
235+
${META_PROJECT_NAME}::metacall_distributable
225236

226237
PUBLIC
227238
${DEFAULT_LINKER_OPTIONS}
@@ -298,6 +309,15 @@ add_executable(${js_port_test}
298309
test/main.cpp
299310
)
300311

312+
#
313+
# Dependecies
314+
#
315+
316+
# Add metacall distributable dependency
317+
add_dependencies(${js_port_test}
318+
${META_PROJECT_NAME}::metacall_distributable
319+
)
320+
301321
# Export library for downstream projects
302322
export(TARGETS ${js_port_test} NAMESPACE ${META_PROJECT_NAME}:: FILE ${PROJECT_BINARY_DIR}/cmake/${js_port_test}/${js_port_test}-export.cmake)
303323

@@ -323,8 +343,6 @@ target_include_directories(${js_port_test}
323343

324344
${V8_INCLUDE_DIR} # V8 includes
325345

326-
${METACALL_INCLUDE_DIRS} # MetaCall includes
327-
328346
PUBLIC
329347
${DEFAULT_INCLUDE_DIRECTORIES}
330348

@@ -344,8 +362,7 @@ target_link_libraries(${js_port_test}
344362

345363
${CMAKE_DL_LIBS}
346364

347-
${METACALL_LIBRARIES} # MetaCall libraries
348-
365+
${META_PROJECT_NAME}::metacall_distributable
349366

350367
PUBLIC
351368
${DEFAULT_LIBRARIES}

source/ports/node_port/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ add_library(${target}
8383
#
8484

8585
# Add metacall distributable dependency
86-
add_dependencies(${target}
86+
add_dependencies(${SWIG_MODULE_${target}_REAL_NAME}
8787
${META_PROJECT_NAME}::metacall_distributable
8888
)
8989

@@ -142,8 +142,6 @@ target_include_directories(${target}
142142

143143
${V8_INCLUDE_DIR} # V8 includes
144144

145-
${METACALL_INCLUDE_DIRS} # MetaCall includes
146-
147145
PUBLIC
148146
${DEFAULT_INCLUDE_DIRECTORIES}
149147

@@ -161,7 +159,7 @@ target_link_libraries(${target}
161159
PRIVATE
162160
${V8_LIBRARIES} # V8 library
163161

164-
${METACALL_LIBRARIES} # MetaCall libraries
162+
${META_PROJECT_NAME}::metacall_distributable
165163

166164
PUBLIC
167165
${DEFAULT_LIBRARIES}

source/ports/py_port/CMakeLists.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ else()
8181
set(PY_PORT_DEBUG_FLAGS "-DNDEBUG")
8282
endif()
8383

84-
set(CMAKE_SWIG_FLAGS "${PY_PORT_DEBUG_FLAGS}" "-threads")
84+
list(APPEND CMAKE_SWIG_FLAGS "${PY_PORT_DEBUG_FLAGS}" "-threads")
8585

8686
if(MSVC)
8787
set(SWIG_MODULE_${target}_NOPROXY TRUE)
@@ -114,6 +114,15 @@ swig_add_module(${target}
114114
${sources}
115115
)
116116

117+
#
118+
# Dependecies
119+
#
120+
121+
# Add metacall distributable dependency
122+
add_dependencies(${SWIG_MODULE_${target}_REAL_NAME}
123+
${META_PROJECT_NAME}::metacall_distributable
124+
)
125+
117126
# Create namespaced alias
118127
add_library(${META_PROJECT_NAME}::${target} ALIAS ${SWIG_MODULE_${target}_REAL_NAME})
119128

@@ -168,8 +177,6 @@ target_include_directories(${SWIG_MODULE_${target}_REAL_NAME}
168177

169178
${PYTHON_INCLUDE_DIRS} # Python includes
170179

171-
${METACALL_INCLUDE_DIRS} # MetaCall includes
172-
173180
PUBLIC
174181
${DEFAULT_INCLUDE_DIRECTORIES}
175182

@@ -187,7 +194,7 @@ swig_link_libraries(${target}
187194
PRIVATE
188195
${PYTHON_LIBRARIES} # Python libraries
189196

190-
${METACALL_LIBRARIES} # MetaCall libraries
197+
${META_PROJECT_NAME}::metacall_distributable
191198

192199
PUBLIC
193200
${DEFAULT_LIBRARIES}
@@ -228,6 +235,7 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}
228235

229236
target_link_libraries(${SWIG_MODULE_${target}_REAL_NAME}
230237
PRIVATE
238+
${META_PROJECT_NAME}::metacall_distributable
231239

232240
PUBLIC
233241
${DEFAULT_LINKER_OPTIONS}

source/ports/rb_port/CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ source_group_by_path(${source_path} "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$"
6767

6868
# Set SWIG flags
6969
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
70-
set(CMAKE_SWIG_FLAGS "-DDEBUG")
70+
list(APPEND CMAKE_SWIG_FLAGS "-DDEBUG")
7171
else()
72-
set(CMAKE_SWIG_FLAGS "-DNDEBUG")
72+
list(APPEND CMAKE_SWIG_FLAGS "-DNDEBUG")
7373
endif()
7474

7575
# Set SWIG include path
@@ -99,6 +99,15 @@ swig_add_module(${target}
9999
${sources}
100100
)
101101

102+
#
103+
# Dependecies
104+
#
105+
106+
# Add metacall distributable dependency
107+
add_dependencies(${SWIG_MODULE_${target}_REAL_NAME}
108+
${META_PROJECT_NAME}::metacall_distributable
109+
)
110+
102111
# Create namespaced alias
103112
add_library(${META_PROJECT_NAME}::${target} ALIAS ${SWIG_MODULE_${target}_REAL_NAME})
104113

@@ -153,8 +162,6 @@ target_include_directories(${SWIG_MODULE_${target}_REAL_NAME}
153162

154163
${RUBY_INCLUDE_DIRS} # Ruby includes
155164

156-
${METACALL_INCLUDE_DIRS} # MetaCall includes
157-
158165
PUBLIC
159166
${DEFAULT_INCLUDE_DIRECTORIES}
160167

@@ -172,7 +179,7 @@ swig_link_libraries(${target}
172179
PRIVATE
173180
${RUBY_LIBRARY} # Ruby libraries
174181

175-
${METACALL_LIBRARIES} # MetaCall libraries
182+
${META_PROJECT_NAME}::metacall_distributable
176183

177184
PUBLIC
178185
${DEFAULT_LIBRARIES}
@@ -213,6 +220,7 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}
213220

214221
target_link_libraries(${SWIG_MODULE_${target}_REAL_NAME}
215222
PRIVATE
223+
${META_PROJECT_NAME}::metacall_distributable
216224

217225
PUBLIC
218226
${DEFAULT_LINKER_OPTIONS}

0 commit comments

Comments
 (0)