Skip to content

Commit

Permalink
Make ports dependant on metacall distributable.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Jan 24, 2019
1 parent bef97c2 commit 8aaf619
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 37 deletions.
26 changes: 12 additions & 14 deletions source/ports/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@ set(MODULE_NAMES
rb_port
)

#
# External dependencies
#

# MetaCall Library
find_package(MetaCall)

if(NOT METACALL_FOUND)
message(STATUS "MetaCall libraries not found")
return()
endif()

include_directories(${METACALL_INCLUDE_DIRS})

#
# Port languages (Standalone)
#
Expand All @@ -95,6 +81,18 @@ endif()

include(${SWIG_USE_FILE})

#
# Set MetaCall inlcude directories for SWIG
#

get_filename_component(CMAKE_PARENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(CMAKE_PARENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY)

list(APPEND CMAKE_SWIG_FLAGS
"-I${CMAKE_PARENT_SOURCE_DIR}/metacall/include"
"-I${CMAKE_PARENT_BINARY_DIR}/metacall/include"
)

#
# Port languages (Swig)
#
Expand Down
37 changes: 27 additions & 10 deletions source/ports/js_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ source_group_by_path(${source_path} "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$"

# Set SWIG flags (use V8 engine)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_SWIG_FLAGS "-v8" "-DDEBUG")
list(APPEND CMAKE_SWIG_FLAGS "-v8" "-DDEBUG")
else()
set(CMAKE_SWIG_FLAGS "-v8" "-DNDEBUG")
list(APPEND CMAKE_SWIG_FLAGS "-v8" "-DNDEBUG")
endif()

# Set SWIG include path
Expand Down Expand Up @@ -107,6 +107,17 @@ swig_add_module(${target}
${sources}
)

set_property(TARGET ${target} PROPERTY SWIG_USE_LIBRARY_INCLUDE_DIRECTORIES TRUE)

#
# Dependecies
#

# Add metacall distributable dependency
add_dependencies(${SWIG_MODULE_${target}_REAL_NAME}
${META_PROJECT_NAME}::metacall_distributable
)

# Create namespaced alias
add_library(${META_PROJECT_NAME}::${target} ALIAS ${SWIG_MODULE_${target}_REAL_NAME})

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

${V8_INCLUDE_DIR} # V8 includes

${METACALL_INCLUDE_DIRS} # MetaCall includes

PUBLIC
${DEFAULT_INCLUDE_DIRECTORIES}

Expand All @@ -180,8 +189,7 @@ swig_link_libraries(${target}
PRIVATE
${V8_LIBRARIES} # V8 libraries

${METACALL_LIBRARIES} # MetaCall libraries

${META_PROJECT_NAME}::metacall_distributable

PUBLIC
${DEFAULT_LIBRARIES}
Expand Down Expand Up @@ -222,6 +230,9 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}

target_link_libraries(${SWIG_MODULE_${target}_REAL_NAME}
PRIVATE
${V8_LIBRARIES} # V8 libraries

${META_PROJECT_NAME}::metacall_distributable

PUBLIC
${DEFAULT_LINKER_OPTIONS}
Expand Down Expand Up @@ -298,6 +309,15 @@ add_executable(${js_port_test}
test/main.cpp
)

#
# Dependecies
#

# Add metacall distributable dependency
add_dependencies(${js_port_test}
${META_PROJECT_NAME}::metacall_distributable
)

# Export library for downstream projects
export(TARGETS ${js_port_test} NAMESPACE ${META_PROJECT_NAME}:: FILE ${PROJECT_BINARY_DIR}/cmake/${js_port_test}/${js_port_test}-export.cmake)

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

${V8_INCLUDE_DIR} # V8 includes

${METACALL_INCLUDE_DIRS} # MetaCall includes

PUBLIC
${DEFAULT_INCLUDE_DIRECTORIES}

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

${CMAKE_DL_LIBS}

${METACALL_LIBRARIES} # MetaCall libraries

${META_PROJECT_NAME}::metacall_distributable

PUBLIC
${DEFAULT_LIBRARIES}
Expand Down
6 changes: 2 additions & 4 deletions source/ports/node_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ add_library(${target}
#

# Add metacall distributable dependency
add_dependencies(${target}
add_dependencies(${SWIG_MODULE_${target}_REAL_NAME}
${META_PROJECT_NAME}::metacall_distributable
)

Expand Down Expand Up @@ -142,8 +142,6 @@ target_include_directories(${target}

${V8_INCLUDE_DIR} # V8 includes

${METACALL_INCLUDE_DIRS} # MetaCall includes

PUBLIC
${DEFAULT_INCLUDE_DIRECTORIES}

Expand All @@ -161,7 +159,7 @@ target_link_libraries(${target}
PRIVATE
${V8_LIBRARIES} # V8 library

${METACALL_LIBRARIES} # MetaCall libraries
${META_PROJECT_NAME}::metacall_distributable

PUBLIC
${DEFAULT_LIBRARIES}
Expand Down
16 changes: 12 additions & 4 deletions source/ports/py_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ else()
set(PY_PORT_DEBUG_FLAGS "-DNDEBUG")
endif()

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

if(MSVC)
set(SWIG_MODULE_${target}_NOPROXY TRUE)
Expand Down Expand Up @@ -114,6 +114,15 @@ swig_add_module(${target}
${sources}
)

#
# Dependecies
#

# Add metacall distributable dependency
add_dependencies(${SWIG_MODULE_${target}_REAL_NAME}
${META_PROJECT_NAME}::metacall_distributable
)

# Create namespaced alias
add_library(${META_PROJECT_NAME}::${target} ALIAS ${SWIG_MODULE_${target}_REAL_NAME})

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

${PYTHON_INCLUDE_DIRS} # Python includes

${METACALL_INCLUDE_DIRS} # MetaCall includes

PUBLIC
${DEFAULT_INCLUDE_DIRECTORIES}

Expand All @@ -187,7 +194,7 @@ swig_link_libraries(${target}
PRIVATE
${PYTHON_LIBRARIES} # Python libraries

${METACALL_LIBRARIES} # MetaCall libraries
${META_PROJECT_NAME}::metacall_distributable

PUBLIC
${DEFAULT_LIBRARIES}
Expand Down Expand Up @@ -228,6 +235,7 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}

target_link_libraries(${SWIG_MODULE_${target}_REAL_NAME}
PRIVATE
${META_PROJECT_NAME}::metacall_distributable

PUBLIC
${DEFAULT_LINKER_OPTIONS}
Expand Down
18 changes: 13 additions & 5 deletions source/ports/rb_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ source_group_by_path(${source_path} "\\\\.cpp$|\\\\.c$|\\\\.h$|\\\\.hpp$"

# Set SWIG flags
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_SWIG_FLAGS "-DDEBUG")
list(APPEND CMAKE_SWIG_FLAGS "-DDEBUG")
else()
set(CMAKE_SWIG_FLAGS "-DNDEBUG")
list(APPEND CMAKE_SWIG_FLAGS "-DNDEBUG")
endif()

# Set SWIG include path
Expand Down Expand Up @@ -99,6 +99,15 @@ swig_add_module(${target}
${sources}
)

#
# Dependecies
#

# Add metacall distributable dependency
add_dependencies(${SWIG_MODULE_${target}_REAL_NAME}
${META_PROJECT_NAME}::metacall_distributable
)

# Create namespaced alias
add_library(${META_PROJECT_NAME}::${target} ALIAS ${SWIG_MODULE_${target}_REAL_NAME})

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

${RUBY_INCLUDE_DIRS} # Ruby includes

${METACALL_INCLUDE_DIRS} # MetaCall includes

PUBLIC
${DEFAULT_INCLUDE_DIRECTORIES}

Expand All @@ -172,7 +179,7 @@ swig_link_libraries(${target}
PRIVATE
${RUBY_LIBRARY} # Ruby libraries

${METACALL_LIBRARIES} # MetaCall libraries
${META_PROJECT_NAME}::metacall_distributable

PUBLIC
${DEFAULT_LIBRARIES}
Expand Down Expand Up @@ -213,6 +220,7 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}

target_link_libraries(${SWIG_MODULE_${target}_REAL_NAME}
PRIVATE
${META_PROJECT_NAME}::metacall_distributable

PUBLIC
${DEFAULT_LINKER_OPTIONS}
Expand Down

0 comments on commit 8aaf619

Please sign in to comment.