File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,21 @@ target_include_directories(
48
48
set (BRIDGE_OBJECT_FILES $<TARGET_OBJECTS:bridge>)
49
49
50
50
51
+ file (GLOB PYTORCH_LIBS "${LIBTORCH_DIR} /lib/*.a" "${LIBTORCH_DIR} /lib/*.dylib" "${LIBTORCH_DIR} /lib/*.so" )
52
+
53
+ set (PYTORCH_LIBS_LINKER_ARGS "-ltorch" ) # Will hold the list of "-l..." flags.
54
+ foreach (lib_path IN LISTS PYTORCH_LIBS)
55
+ # Get just the filename without the directory or extension
56
+ get_filename_component (lib_name "${lib_path} " NAME_WE )
57
+ # If it starts with "lib", strip that off
58
+ string (REGEX REPLACE "^lib" "" lib_name "${lib_name} " )
59
+ # Now prepend "-l" to the actual library name
60
+ list (APPEND PYTORCH_LIBS_LINKER_ARGS "-l${lib_name} " )
61
+ endforeach ()
62
+
63
+ # cmake_print_variables(PYTORCH_LIBS)
64
+ cmake_print_variables(PYTORCH_LIBS_LINKER_ARGS)
65
+
51
66
add_executable (TorchBridge ${BRIDGE_DIR} /lib/Bridge.chpl)
52
67
add_dependencies (TorchBridge bridge)
53
68
target_link_options (TorchBridge
@@ -58,6 +73,7 @@ target_link_options(TorchBridge
58
73
"-ltorch"
59
74
"-ltorch_cpu"
60
75
"-lc10"
76
+ ${PYTORCH_LIBS_LINKER_ARGS}
61
77
--ldflags "-Wl,-rpath,${LIBTORCH_DIR} /lib"
62
78
)
63
- install (TARGETS TorchBridge DESTINATION "." )
79
+ # install(TARGETS TorchBridge DESTINATION ".")
You can’t perform that action at this time.
0 commit comments