Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Commit

Permalink
Restrict swig targets includes (#1221)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
  • Loading branch information
lebdron committed Apr 16, 2018
1 parent 9bd7535 commit 728f0c1
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions shared_model/bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ if (SWIG_PYTHON OR SWIG_JAVA OR SWIG_CSHARP OR SWIG_NODE)
if (SHARED_MODEL_DISABLE_COMPATIBILITY)
set(CMAKE_SWIG_FLAGS "-DDISABLE_BACKWARD")
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set_source_files_properties(bindings.i PROPERTIES CPLUSPLUS ON)
set_property(GLOBAL PROPERTY SWIG_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})

Expand All @@ -51,28 +50,29 @@ if (SWIG_PYTHON)
find_package(PythonLibs 3.6 REQUIRED)
endif()

# path to where Python.h is found
include_directories(${PYTHON_INCLUDE_DIRS})

if (${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
set(MAC_OPTS "-flat_namespace -undefined suppress")
endif()

swig_add_library(iroha LANGUAGE python SOURCES bindings.i)
swig_link_libraries(iroha ${Python_LIBRARIES} bindings ${MAC_OPTS})
add_custom_target(irohapy DEPENDS ${SWIG_MODULE_iroha_REAL_NAME})

# path to where Python.h is found
target_include_directories(${SWIG_MODULE_iroha_REAL_NAME} PUBLIC
${PYTHON_INCLUDE_DIRS}
)
endif()

if (SWIG_JAVA)
find_package(JNI REQUIRED)
# the include path to jni.h
include_directories(${JAVA_INCLUDE_PATH})
# the include path to jni_md.h
include_directories(${JAVA_INCLUDE_PATH2})

swig_add_library(irohajava LANGUAGE java SOURCES bindings.i)
swig_link_libraries(irohajava ${Java_LIBRARIES} bindings)
# the include path to jni.h and jni_md.h
target_include_directories(${SWIG_MODULE_irohajava_REAL_NAME} PUBLIC
${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH2}
)
endif()

if (SWIG_CSHARP)
Expand All @@ -83,10 +83,6 @@ endif()

if (SWIG_NODE)
find_package (nodejs REQUIRED)
include_directories (
${NODEJS_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/..
)

set (V8_VERSION_HEX 0x0${V8_VERSION_MAJOR}${V8_VERSION_MINOR}${V8_VERSION_PATCH})
string (LENGTH "${V8_VERSION_HEX}" V8_VERSION_HEX_length)
Expand All @@ -110,4 +106,7 @@ if (SWIG_NODE)
)
set_target_properties(irohanode PROPERTIES PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
target_link_libraries(irohanode bindings ${MAC_OPTS})
target_include_directories(${SWIG_MODULE_irohanode_REAL_NAME} PUBLIC
${NODEJS_INCLUDE_DIRS}
)
endif()

0 comments on commit 728f0c1

Please sign in to comment.