Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
612 B
2
Indexable
Never
cmake_minimum_required(VERSION 3.0)
project(vpi)

set(CMAKE_C_COMPILER gcc)

# set include directories
include_directories(/home/r2com/eda/install/ghdl/include/ghdl)

# create object file from test.c
add_library(vpi_obj OBJECT ../tb/test.c)
set_target_properties(vpi_obj PROPERTIES
  POSITION_INDEPENDENT_CODE ON
  COMPILE_FLAGS "-fPIC"
)

# link object file and create shared library
add_library(vpi SHARED $<TARGET_OBJECTS:vpi_obj>)
target_link_libraries(vpi
  /home/r2com/eda/install/ghdl/lib/libghdl.so
)

# set output file name
set_target_properties(vpi PROPERTIES OUTPUT_NAME vpi.vpi)