add_definitions(-DEIGEN_AVOID_STL_ARRAY)
if(WIN32)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ # 64 bits
+ add_definitions(-DWIN64)
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ # 32 bits
+ # temporary fix for #18241
+ add_definitions(-DEIGEN_DEFAULT_DENSE_INDEX_TYPE=std::int64_t)
+ endif()
add_definitions(-DNOMINMAX -D_WIN32_WINNT=0x0A00 -DLANG_CXX11)
- add_definitions(-DWIN32 -DOS_WIN -D_MBCS -DWIN64 -DWIN32_LEAN_AND_MEAN -DNOGDI -DPLATFORM_WINDOWS)
+ add_definitions(-DWIN32 -DOS_WIN -D_MBCS -DWIN32_LEAN_AND_MEAN -DNOGDI -DPLATFORM_WINDOWS)
add_definitions(-DTENSORFLOW_USE_EIGEN_THREADPOOL -DEIGEN_HAS_C99_MATH)
add_definitions(-DTF_COMPILE_LIBRARY)
add_definitions(/bigobj /nologo /EHsc /GF /MP /Gm-)
set(pywrap_tensorflow_deffile "${CMAKE_CURRENT_BINARY_DIR}/pywrap_tensorflow.def")
endif()
set_source_files_properties(${pywrap_tensorflow_deffile} PROPERTIES GENERATED TRUE)
-
+ math(EXPR tensorflow_target_bitness "${CMAKE_SIZEOF_VOID_P}*8")
add_custom_command(TARGET pywrap_tensorflow_internal_static POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/create_def_file.py
--input "${pywrap_tensorflow_internal_static_dependencies}"
--output "${pywrap_tensorflow_deffile}"
--target _pywrap_tensorflow_internal.pyd
+ --bitness "${tensorflow_target_bitness}"
BYPRODUCTS ${pywrap_tensorflow_deffile} # Required for Ninja
)
endif(WIN32)
set(tensorflow_deffile "${CMAKE_CURRENT_BINARY_DIR}/tensorflow.def")
endif()
set_source_files_properties(${tensorflow_deffile} PROPERTIES GENERATED TRUE)
-
+ math(EXPR tensorflow_target_bitness "${CMAKE_SIZEOF_VOID_P}*8")
add_custom_command(TARGET tensorflow_static POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/create_def_file.py
--input "${tensorflow_static_dependencies}"
--output "${tensorflow_deffile}"
--target tensorflow.dll
+ --bitness "${tensorflow_target_bitness}"
)
endif(WIN32)
r"^(TFE_\w*)$|"
r"tensorflow::|"
r"functor::|"
- r"nsync_|"
+ r"\?nsync_|"
r"perftools::gputools")
# We want to identify data members explicitly in the DEF file, so that no one
required=True)
parser.add_argument("--output", help="output deffile", required=True)
parser.add_argument("--target", help="name of the target", required=True)
+ parser.add_argument("--bitness", help="build target bitness", required=True)
args = parser.parse_args()
return args
# Header for the def file.
def_fp.write("LIBRARY " + args.target + "\n")
def_fp.write("EXPORTS\n")
- def_fp.write("\t ??1OpDef@tensorflow@@UEAA@XZ\n")
+ if args.bitness == "64":
+ def_fp.write("\t??1OpDef@tensorflow@@UEAA@XZ\n")
+ else:
+ def_fp.write("\t??1OpDef@tensorflow@@UAE@XZ\n")
# Each symbols returned by undname matches the same position in candidates.
# We compare on undname but use the decorated name from candidates.
inline int Log2FloorNonZero(uint64 n) {
#if defined(__GNUC__)
return 63 ^ __builtin_clzll(n);
-#elif defined(PLATFORM_WINDOWS)
+#elif defined(PLATFORM_WINDOWS) && (_WIN64)
unsigned long index;
_BitScanReverse64(&index, n);
return index;