From c294c4e0da878c07f255c6a72172fbc76757de31 Mon Sep 17 00:00:00 2001 From: Greg Foss Date: Thu, 20 Feb 2020 13:09:08 -0500 Subject: [PATCH] Adding dynamic library function for .dll and .lib files specific to each algorithm and IO processor --- bfs/CMakeLists.txt | 50 +++++++++++++++++-- .../breadcrumbs/CMakeLists.txt | 2 +- bfs/scripts/log.txt | 6 +++ 3 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 bfs/scripts/log.txt diff --git a/bfs/CMakeLists.txt b/bfs/CMakeLists.txt index bc4ae62..42ced92 100644 --- a/bfs/CMakeLists.txt +++ b/bfs/CMakeLists.txt @@ -51,7 +51,6 @@ foreach(X IN LISTS LIB_INCLUDES) endforeach() find_library(TactorInterface NAME TactorInterface.lib PATHS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ea_tdk) -message("====> ${TactorInterface}") find_library(TActionManager NAME TActionManager.lib PATHS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ea_tdk) # puts all .cpp files inside src to the SOURCES variable @@ -104,6 +103,8 @@ foreach(IMPL IN LISTS IMPLEMENTAIONS) # Compiling BFS implementation source files file(GLOB_RECURSE IMPL_SRC CONFIGURE_DEPENDS "${IMPL}/*.cpp") list(FILTER IMPL_SRC EXCLUDE REGEX "${IMPL}/gen/*") + list(FILTER IMPL_SRC EXCLUDE REGEX "${IMPL}/algos/*") + list(FILTER IMPL_SRC EXCLUDE REGEX "${IMPL}/io_procs/*") # Getting template output files to create executables file(GLOB IMPL_EXECS CONFIGURE_DEPENDS "${IMPL}/gen/*.cpp") @@ -114,12 +115,51 @@ foreach(IMPL IN LISTS IMPLEMENTAIONS) foreach(X IN LISTS IMPL_EXECS) get_filename_component(N ${X} NAME_WE) message(STATUS "Generating Executable: ${N}.exe Main File: ${X}"}) - add_executable(${N} ${IMPL_SRC} ${X} ${BFS_SOURCE}) - # All exe's depend on tinyxml + # Including any DLLs or LIBs + set(ALL_LIBS "") + message("Libs Stored in ${N}_IMPL_DLLS: ${${N}_IMPL_LIBS}") + foreach(LIB_PATH IN ITEMS "${${N}_IMPL_LIBS}") + set(LIB_ABS_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${LIB_PATH}") + if (IS_DIRECTORY ${LIB_ABS_PATH}) + # Need to include all DLLs and LIBs in the directory + file(GLOB DLLS CONFIGURE_DEPENDS "${LIB_ABS_PATH}/*.dll") + file(GLOB LIBS CONFIGURE_DEPENDS "${LIB_ABS_PATH}/*.lib") + foreach(DLL IN ITEMS ${DLLS}) + message("Adding DLL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DLL_N") + get_filename_component(DLL_N ${DLL} NAME) + configure_file(${DLL} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DLL_N} COPYONLY) + endforeach() + + foreach(LIB IN ITEMS ${LIBS}) + get_filename_component(LIB_N ${LIB} NAME_WE) + find_library(${LIB_N} NAME ${LIB_N}.lib PATHS ${LIB}) + message("Linking library: ${${LIB_N}}") + list(APPEND ALL_LIBS ${LIB_N}) + endforeach() + else() + # Need to include just the given Library file (DLL or LIB) + + endif() + endforeach() + + # Getting Algorithm or IO Processor implementation source file: + set(EXEC_IMPL_SRC_FILE "") + if(EXISTS ${IMPL}/algos/${N}.cpp) + set(EXEC_IMPL_SRC_FILE "${IMPL}/algos/${N}.cpp") + elseif(EXISTS ${IMPL}/io_procs/${N}.cpp) + set(EXEC_IMPL_SRC_FILE "${IMPL}/io_procs/${N}.cpp") + endif() + + add_executable(${N} ${IMPL_SRC} ${EXEC_IMPL_SRC_FILE} ${X} ${BFS_SOURCE}) + + # Exe specialized libraries + foreach(LIB IN ITEMS ${ALL_LIBS}) + target_link_libraries(${N} ${${LIB}}) + endforeach() + + # All exe's depend on tinyxmls target_link_libraries(${N} tinyxml2) - target_link_libraries(${N} ${TactorInterface}) - target_link_libraries(${N} ${TActionManager}) endforeach() endforeach() diff --git a/bfs/implementations/breadcrumbs/CMakeLists.txt b/bfs/implementations/breadcrumbs/CMakeLists.txt index 2ee81a5..341ff68 100644 --- a/bfs/implementations/breadcrumbs/CMakeLists.txt +++ b/bfs/implementations/breadcrumbs/CMakeLists.txt @@ -1,4 +1,4 @@ -set (VirtualOutputIOProcessor_IMPL_DLLS +set (VirtualOutputIOProcessor_IMPL_LIBS ea_tdk PARENT_SCOPE) diff --git a/bfs/scripts/log.txt b/bfs/scripts/log.txt new file mode 100644 index 0000000..17f6f37 --- /dev/null +++ b/bfs/scripts/log.txt @@ -0,0 +1,6 @@ +Could not acquire mutex to add new client thread +Listening for clients... +Could not acquire mutex to add new client thread +Listening for clients... +Hello new client! +Listening for clients...