Skip to content

Commit

Permalink
Adding dynamic library function for .dll and .lib files specific to e…
Browse files Browse the repository at this point in the history
…ach algorithm and IO processor
  • Loading branch information
grf14003 committed Feb 20, 2020
1 parent 9d5cc72 commit c294c4e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 6 deletions.
50 changes: 45 additions & 5 deletions bfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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()
2 changes: 1 addition & 1 deletion bfs/implementations/breadcrumbs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

set (VirtualOutputIOProcessor_IMPL_DLLS
set (VirtualOutputIOProcessor_IMPL_LIBS
ea_tdk
PARENT_SCOPE)
6 changes: 6 additions & 0 deletions bfs/scripts/log.txt
Original file line number Diff line number Diff line change
@@ -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...

0 comments on commit c294c4e

Please sign in to comment.