aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/cmake/tf_cc_ops.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/contrib/cmake/tf_cc_ops.cmake')
-rw-r--r--tensorflow/contrib/cmake/tf_cc_ops.cmake36
1 files changed, 24 insertions, 12 deletions
diff --git a/tensorflow/contrib/cmake/tf_cc_ops.cmake b/tensorflow/contrib/cmake/tf_cc_ops.cmake
index a5f5ae5478..f63aca4a83 100644
--- a/tensorflow/contrib/cmake/tf_cc_ops.cmake
+++ b/tensorflow/contrib/cmake/tf_cc_ops.cmake
@@ -148,7 +148,11 @@ list(REMOVE_ITEM tf_cc_srcs ${tf_cc_test_srcs})
add_library(tf_cc OBJECT ${tf_cc_srcs})
add_dependencies(tf_cc tf_cc_framework tf_cc_ops)
-set (pywrap_tensorflow_lib "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/pywrap_tensorflow_internal.lib")
+if (WIN32)
+ set (pywrap_tensorflow_lib "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/pywrap_tensorflow_internal.lib")
+else (WIN32)
+ set (pywrap_tensorflow_lib "${CMAKE_CURRENT_BINARY_DIR}/libpywrap_tensorflow_internal.so")
+endif (WIN32)
add_custom_target(tf_extension_ops)
function(AddUserOps)
@@ -164,15 +168,13 @@ function(AddUserOps)
# create shared library from source and cuda obj
add_library(${_AT_TARGET} SHARED ${_AT_SOURCES} ${gpu_lib})
target_link_libraries(${_AT_TARGET} ${pywrap_tensorflow_lib})
- if(WIN32)
- if (tensorflow_ENABLE_GPU AND _AT_GPUSOURCES)
- # some ops call out to cuda directly; need to link libs for the cuda dlls
- target_link_libraries(${_AT_TARGET} ${CUDA_LIBRARIES})
- endif()
- if (_AT_DISTCOPY)
- add_custom_command(TARGET ${_AT_TARGET} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${_AT_TARGET}> ${_AT_DISTCOPY}/)
- endif()
+ if (tensorflow_ENABLE_GPU AND _AT_GPUSOURCES)
+ # some ops call out to cuda directly; need to link libs for the cuda dlls
+ target_link_libraries(${_AT_TARGET} ${CUDA_LIBRARIES})
+ endif()
+ if (_AT_DISTCOPY)
+ add_custom_command(TARGET ${_AT_TARGET} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${_AT_TARGET}> ${_AT_DISTCOPY}/)
endif()
if (_AT_DEPENDS)
add_dependencies(${_AT_TARGET} ${_AT_DEPENDS})
@@ -180,9 +182,19 @@ function(AddUserOps)
# make sure TF_COMPILE_LIBRARY is not defined for this target
get_target_property(target_compile_flags ${_AT_TARGET} COMPILE_FLAGS)
if(target_compile_flags STREQUAL "target_compile_flags-NOTFOUND")
- set(target_compile_flags "/UTF_COMPILE_LIBRARY")
+ if (WIN32)
+ set(target_compile_flags "/UTF_COMPILE_LIBRARY")
+ else (WIN32)
+ # gcc uses UTF as default
+ set(target_compile_flags "-finput-charset=UTF-8")
+ endif (WIN32)
else()
- set(target_compile_flags "${target_compile_flags} /UTF_COMPILE_LIBRARY")
+ if (WIN32)
+ set(target_compile_flags "${target_compile_flags} /UTF_COMPILE_LIBRARY")
+ else (WIN32)
+ # gcc uses UTF as default
+ set(target_compile_flags "${target_compile_flags} -finput-charset=UTF-8")
+ endif (WIN32)
endif()
set_target_properties(${_AT_TARGET} PROPERTIES COMPILE_FLAGS ${target_compile_flags})
add_dependencies(tf_extension_ops ${_AT_TARGET})