cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
patelvrajn
Visitor
Visitor
293 Views
Registered: ‎10-18-2020

Xilinx Simulation C++ Interface

Jump to solution

Hi,

So I am trying to drive my simulation signals using the C++ XSI interface however, I seem to be having issues linking the libraries/required files. I am using a CMakeLists directory in Visual Studio to build, link, and execute my C++ testbench. Both the required DLLs for the simulation "librdi_simulator_kernel.dll" and "xsimk.dll" are pulled into the same directory before it even links (as seen below). I am following relevant steps in UG900 starting at Page 252, however, I am unsure what is being done incorrectly. See the CMakeLists and VS console output below for the linking error. 

--- CMAKELISTS.TXT ---

cmake_minimum_required(VERSION "3.19")

project("My_CPP_Code" VERSION "0.0")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

add_subdirectory("Data_Structures")

set(XILINX_XSI_INCLUDE_DIR
"V:/Off-Disk_Software/Xilinx/Vivado/2020.2/data/xsim/include"
)

set(XILINX_HEADER_FILES
"${XILINX_XSI_INCLUDE_DIR}/xsi.h"
)

set (XILINX
${XILINX_HEADER_FILES}
${XILINX_LOCAL}
)

add_executable("Main_App" "Applications/Main.cpp" ${XILINX})

add_custom_command(TARGET "Main_App" PRE_BUILD
    COMMAND copy /-y "\"X:\\VHDL_Development\\Simulation\\Simulation_Runs\\Xilinx_DLLs\\*.dll\"" "\"X:\\C++_Development\\out\\build\\x64-Debug\"")

target_include_directories("Main_App" PUBLIC ${XILINX_XSI_INCLUDE_DIR})

target_link_libraries("Main_App"
INTERFACE "Data_Structures")

--- VISUAL STUDIO OUTPUT BELOW ---

>------ Build started: Project: CMakeLists, Configuration: Debug ------
  [0/2] Re-checking globbed directories...
  [1/2] Building CXX object CMakeFiles\Main_App.dir\Applications\Main.cpp.obj
  [2/2] Linking CXX executable Main_App.exe
  FAILED: Main_App.exe 
  cmd.exe /C "cmd.exe /C "cd /D X:\C++_Development\out\build\x64-Debug && copy /-y "X:\VHDL_Development\Simulation\Simulation_Runs\Xilinx_DLLs\*.dll" "X:\C++_Development\out\build\x64-Debug" && cd X:\C++_Development\out\build\x64-Debug" && V:\Off-Disk_Software\Visual_Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\Main_App.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- V:\Off-Disk_Software\Visual_Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\link.exe /nologo CMakeFiles\Main_App.dir\Applications\Main.cpp.obj  /out:Main_App.exe /implib:Main_App.lib /pdb:Main_App.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
  X:\VHDL_Development\Simulation\Simulation_Runs\Xilinx_DLLs\librdi_simulator_kernel.dll
  X:\VHDL_Development\Simulation\Simulation_Runs\Xilinx_DLLs\xsimk.dll
          2 file(s) copied.
  LINK Pass 1: command "V:\Off-Disk_Software\Visual_Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\Hostx64\x64\link.exe /nologo CMakeFiles\Main_App.dir\Applications\Main.cpp.obj /out:Main_App.exe /implib:Main_App.lib /pdb:Main_App.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\Main_App.dir/intermediate.manifest CMakeFiles\Main_App.dir/manifest.res" failed (exit code 1120) with the following output:
X:\C++_Development\out\build\x64-Debug\Main.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl Xsi::Loader::Loader(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Loader@Xsi@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) referenced in function main
X:\C++_Development\out\build\x64-Debug\Main.cpp.obj : error LNK2019: unresolved external symbol "public: __cdecl Xsi::Loader::~Loader(void)" (??1Loader@Xsi@@QEAA@XZ) referenced in function main
X:\C++_Development\out\build\x64-Debug\Main_App.exe : fatal error LNK1120: 2 unresolved externals
  ninja: build stopped: subcommand failed.

 

0 Kudos
1 Solution

Accepted Solutions
patelvrajn
Visitor
Visitor
191 Views
Registered: ‎10-18-2020

Resolved the issue by redoing the CMakeFiles.

cmake_minimum_required(VERSION "3.19")

project("My_CPP_Code" VERSION "0.0")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(XILINX_XSI_INCLUDE_DIR
"V:/Off-Disk_Software/Xilinx/Vivado/2020.2/data/xsim/include"
)

set(XILINX_HEADER_FILES
"${XILINX_XSI_INCLUDE_DIR}/xsi.h"
)

include_directories("${XILINX_XSI_INCLUDE_DIR}")

add_subdirectory("Data_Structures")
add_subdirectory("Xilinx")

set (XILINX
${XILINX_HEADER_FILES}
${XILINX_LOCAL_LIB}
)

add_executable("Main_App" "Applications/Main.cpp" ${XILINX})

add_custom_command(TARGET "Main_App" PRE_BUILD
    COMMAND copy /y "\"X:\\TheSocraticEngineer\\VHDL_Development\\Simulation\\Simulation_Runs\\Xilinx_DLLs\\*.dll\"" "\"X:\\TheSocraticEngineer\\C++_Development\\out\\build\\x64-Debug\"")

target_link_libraries("Main_App"
INTERFACE "Data_Structures"
PUBLIC    "XILINX_LOCAL")

 

file(GLOB XILINX_LOCAL_LIB CONFIGURE_DEPENDS "*.h" "*.cpp")

add_library(XILINX_LOCAL STATIC "${XILINX_LOCAL_LIB}")

View solution in original post

0 Kudos
1 Reply
patelvrajn
Visitor
Visitor
192 Views
Registered: ‎10-18-2020

Resolved the issue by redoing the CMakeFiles.

cmake_minimum_required(VERSION "3.19")

project("My_CPP_Code" VERSION "0.0")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(XILINX_XSI_INCLUDE_DIR
"V:/Off-Disk_Software/Xilinx/Vivado/2020.2/data/xsim/include"
)

set(XILINX_HEADER_FILES
"${XILINX_XSI_INCLUDE_DIR}/xsi.h"
)

include_directories("${XILINX_XSI_INCLUDE_DIR}")

add_subdirectory("Data_Structures")
add_subdirectory("Xilinx")

set (XILINX
${XILINX_HEADER_FILES}
${XILINX_LOCAL_LIB}
)

add_executable("Main_App" "Applications/Main.cpp" ${XILINX})

add_custom_command(TARGET "Main_App" PRE_BUILD
    COMMAND copy /y "\"X:\\TheSocraticEngineer\\VHDL_Development\\Simulation\\Simulation_Runs\\Xilinx_DLLs\\*.dll\"" "\"X:\\TheSocraticEngineer\\C++_Development\\out\\build\\x64-Debug\"")

target_link_libraries("Main_App"
INTERFACE "Data_Structures"
PUBLIC    "XILINX_LOCAL")

 

file(GLOB XILINX_LOCAL_LIB CONFIGURE_DEPENDS "*.h" "*.cpp")

add_library(XILINX_LOCAL STATIC "${XILINX_LOCAL_LIB}")

View solution in original post

0 Kudos