From a926c74ae5cb927317f80865909b799e3512ea29 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Sat, 16 Jan 2021 16:35:46 -0700 Subject: [PATCH] [Lib] Add CMake script to compile the repack design constraint library --- libopenfpga/librepackdc/CMakeLists.txt | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 libopenfpga/librepackdc/CMakeLists.txt diff --git a/libopenfpga/librepackdc/CMakeLists.txt b/libopenfpga/librepackdc/CMakeLists.txt new file mode 100644 index 000000000..6cc89c037 --- /dev/null +++ b/libopenfpga/librepackdc/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.9) + +project("librepackdc") + +file(GLOB_RECURSE EXEC_SOURCES test/*.cpp) +file(GLOB_RECURSE LIB_SOURCES src/*.cpp) +file(GLOB_RECURSE LIB_HEADERS src/*.h) +files_to_dirs(LIB_HEADERS LIB_INCLUDE_DIRS) + +#Remove test executable from library +list(REMOVE_ITEM LIB_SOURCES ${EXEC_SOURCES}) + +#Create the library +add_library(librepackdc STATIC + ${LIB_HEADERS} + ${LIB_SOURCES}) +target_include_directories(librepackdc PUBLIC ${LIB_INCLUDE_DIRS}) +set_target_properties(librepackdc PROPERTIES PREFIX "") #Avoid extra 'lib' prefix + +#Specify link-time dependancies +target_link_libraries(librepackdc + libopenfpgautil + libvtrutil + libpugixml + libpugiutil) + +#Create the test executable +foreach(testsourcefile ${EXEC_SOURCES}) + # Use a simple string replace, to cut off .cpp. + get_filename_component(testname ${testsourcefile} NAME_WE) + add_executable(${testname} ${testsourcefile}) + # Make sure the library is linked to each test executable + target_link_libraries(${testname} librepackdc) +endforeach(testsourcefile ${EXEC_SOURCES})