# Generated by the Vitis IDE. Do not modify.

cmake_minimum_required(VERSION 3.20)
include(${CMAKE_CURRENT_SOURCE_DIR}/UserConfig.cmake)
project(host
LANGUAGES
C CXX
)

# Including the cmake modules from the Vitis Install.
set(CMAKE_MODULE_PATH
"$ENV{XILINX_VITIS}/vitis-server/scripts/cmake"
${CMAKE_MODULE_PATH}
)
find_package(Host REQUIRED)

# Default Target is x86sim, can be overridden by passing cmake argument. Valid
# values are x86sim or hw Example: -DVITIS_TARGET=hw  builds the project for
# target hw
set(VITIS_TARGET
x86sim
CACHE STRING
"Target for which the project should be built"
)
set_property(CACHE VITIS_TARGET
   PROPERTY
    STRINGS x86sim hw
)

set(VITIS_PLATFORM_PATH
/opt/amd/2025.1/Vitis/base_platforms/xilinx_vck190_base_202510_1/xilinx_vck190_base_202510_1.xpfm
CACHE STRING
"Vitis Platform"
)

# Generated by the Vitis IDE. Only modify the sections marked as USER SETTINGS.
Set(VitisArch arm64)
set(CMAKE_CXX_STANDARD_VERSION
14
)
if( DEFINED USER_CMAKE_CXX_STANDARD AND NOT USER_CMAKE_CXX_STANDARD STREQUAL "" )
  set (CMAKE_CXX_STANDARD_VERSION ${USER_CMAKE_CXX_STANDARD})
endif()
set(CMAKE_CXX_STANDARD
${CMAKE_CXX_STANDARD_VERSION}
CACHE STRING
"The C++ standard to use"
)
set(CMAKE_CXX_STANDARD_REQUIRED
ON
)
set(CMAKE_CXX_EXTENSIONS
OFF
)
add_executable(${CMAKE_PROJECT_NAME} "")



###    USER SETTINGS  START    ###

# For adding pre build step.
# Any script can be used as a pre build step
# Uncomment below section to use the pre-build step.
# Example:  To copy a data file into to a pre-defined location.
#add_custom_command(TARGET gzipApp PRE_BUILD
#COMMAND cp   <source location>  <target location>
#)


# For adding post build step.
# Any script can be used as a post build step, it can take the build output as input.
# Uncomment below section to use the post build step.
# Example:  To copy the binary to a pre-defined location.
#add_custom_command(TARGET gzipApp POST_BUILD
#COMMAND cp  $<TARGET_FILE:gzipApp>  ${CMAKE_SOURCE_DIR}/../
#)

###   END OF USER SETTINGS SECTION ####

####    CAUTION in updating below section    ####
# These setting are required to build the application as per the project template used.
#  Update below only to modify the default settings.

# The sources listed below will be updated automtically, based on changes done to the sources.
# This updation is done as part of the pre-cmake configure step.
# When running cmake without using Vitis-CLI Or Vitis-IDE,

if( "${VITIS_TARGET}" STREQUAL "x86sim" )
set(HOST_COMPILE_OPTIONS
""
)
set(HOST_INCLUDE_DIRECTORIES
${Vitis_INCLUDE_DIRS}
)
set(HOST_LINK_LIBRARIES
${Vitis_LIBRARIES}
)
set(HOST_LINK_DIRECTORIES
$ENV{XILINX_XRT}/lib
$ENV{XILINX_VITIS_AIETOOLS}/lib/lnx64.o
)
set(HOST_LINK_OPTIONS
""
)
else()
set(HOST_COMPILE_OPTIONS
--sysroot=${SYSROOT}
)
set(HOST_INCLUDE_DIRECTORIES
${SYSROOT}/usr/include
${SYSROOT}/usr/include/xrt
${Vitis_HLS_INCLUDE_DIR}
)
set(HOST_LINK_LIBRARIES
-lxilinxopencl
)
set(HOST_LINK_DIRECTORIES
${SYSROOT}/usr/lib
$ENV{XILINX_VITIS_AIETOOLS}/lib/aarch64.o
)
set(HOST_LINK_OPTIONS
--sysroot=${SYSROOT}
)
endif()

target_sources(${CMAKE_PROJECT_NAME}
PRIVATE
    ${USER_COMPILE_SOURCES}
)
# Below compile definitions are derived from the application template used to
# create this project.Update them to suite your requirement. They will not be
# modified further by the tool.If new compile definitions needed, they can be
# added to USER_COMPILE_DEFINITIONS
target_compile_definitions(${CMAKE_PROJECT_NAME}
PRIVATE
    __USE_XOPEN2K8
    ${USER_COMPILE_DEFINITIONS}
)
# Compile Options, derived from the application template used to create this
# project.They will not be modified further by the tool.If new compile options
# needed to be added, they can be added to USER_COMPILE_OPTIONS
target_compile_options(${CMAKE_PROJECT_NAME}
PRIVATE
    -g
    ${HOST_COMPILE_OPTIONS}
    ${USER_COMPILE_OPTIONS}
)
# Include Directories, derived from the application template used to create this
# project.They will not be modified further by the tool.If new sources are
# added, the new INCLUDE Directories can be added to USER_INCLUDE_DIRECTORIES
target_include_directories(${CMAKE_PROJECT_NAME}
PRIVATE
    ${HOST_INCLUDE_DIRECTORIES}
    $ENV{XILINX_VITIS_AIETOOLS}/include
    ${USER_INCLUDE_DIRECTORIES}
)
# Libraries to be linked, derived from the application template used to create
# this project.They will not be modified further by the tool.If new libraries to
# be linked, they can be added to USER_LINK_LIBRARIES.
target_link_libraries(${CMAKE_PROJECT_NAME}
PRIVATE
    ${HOST_LINK_LIBRARIES}
    -lpthread
    -lrt
    -lstdc++
    xrt_coreutil
    adf_api_xrt 
    ${USER_LINK_LIBRARIES}
)
# Linker Library Search Directories to be passed to linker, derived from the
# application template used to create this project.They will not be modified
# further by the tool.If new library directory to be added, they can be added to
# USER_LINK_DIRECTORIES.
target_link_directories(${CMAKE_PROJECT_NAME}
PRIVATE
    ${HOST_LINK_DIRECTORIES}
    ${USER_LINK_DIRECTORIES}
)
# Linker options, derived from the application template used to create this
# project.They will not be modified further by the tool.If new linker options to
# be added, they can be added to USER_LINK_OPTIONS.
target_link_options(${CMAKE_PROJECT_NAME}
PRIVATE
    ${HOST_LINK_OPTIONS}
    ${USER_LINK_OPTIONS}
)

# Caution, do not modify the block below, this will not be further modify by the tool.
if( NOT ${VITIS_PLATFORM_PATH} STREQUAL "" )

# Number of devices used for emulation, change below number to suite your need.
# This will not be further modified by the tool.
# This is used only for software and hardware emulation.
set(NUMBER_OF_DEVICES
1
)


ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/emconfig.json
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/.Xil
COMMAND ${Vitis_EMCONFIG_UTIL} --od . --nd ${NUMBER_OF_DEVICES} --platform ${VITIS_PLATFORM_PATH}
)

ADD_CUSTOM_TARGET(GenerateEmulationConfig ALL
    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/emconfig.json
)

endif()
