From 74b32c3a5ce19bdfdeaf153e1143b41ad5a2ad3a Mon Sep 17 00:00:00 2001 From: tangxifan Date: Thu, 1 Dec 2022 11:42:25 -0800 Subject: [PATCH] [script] enable shared library for openfpga --- .github/workflows/build.yml | 1 + .gitignore | 3 ++- openfpga/CMakeLists.txt | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 504c5cc35..874c884df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -149,6 +149,7 @@ jobs: build/vtr-verilog-to-routing/vpr/libvpr.a build/vtr-verilog-to-routing/vpr/vpr build/openfpga/libopenfpga.a + build/openfpga/libopenfpga_shared.so build/openfpga/openfpga yosys/install/share yosys/install/bin diff --git a/.gitignore b/.gitignore index e8bbaa599..ea68480ae 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ __pycache__/ *.d *.o *.a +*.so vpr7_x2p/vpr/vpr vpr7_x2p/printhandler/printhandlerdemo vpr7_x2p/libarchfpga/read_arch @@ -52,4 +53,4 @@ vpr/vpr # Ignore temp directories node_modules package-lock.json -/_*/ \ No newline at end of file +/_*/ diff --git a/openfpga/CMakeLists.txt b/openfpga/CMakeLists.txt index 9fd427144..81f68a566 100644 --- a/openfpga/CMakeLists.txt +++ b/openfpga/CMakeLists.txt @@ -11,6 +11,7 @@ files_to_dirs(LIB_HEADERS LIB_INCLUDE_DIRS) list(REMOVE_ITEM LIB_SOURCES ${EXEC_SOURCE}) #Create the library +#Static linked library for other C++ libraries add_library(libopenfpga STATIC ${LIB_HEADERS} ${LIB_SOURCES}) @@ -31,6 +32,28 @@ target_link_libraries(libopenfpga libpugixml libvpr) +#Dynamic linked library for high-level interfaces, e.g., Tcl +add_library(libopenfpga_shared SHARED + ${LIB_HEADERS} + ${LIB_SOURCES}) +target_include_directories(libopenfpga_shared PUBLIC ${LIB_INCLUDE_DIRS}) +set_target_properties(libopenfpga_shared PROPERTIES PREFIX "") #Avoid extra 'lib' prefix + +#Specify link-time dependancies +target_link_libraries(libopenfpga_shared + libarchopenfpga + libopenfpgashell + libopenfpgautil + libfabrickey + libfpgabitstream + libini + libpcf + libvtrutil + libbusgroup + libpugixml + libvpr) + + #Create the test executable add_executable(openfpga ${EXEC_SOURCE}) target_link_libraries(openfpga libopenfpga)