Browse Source

fixed copying dlls

cl-refactor
ethdev zug 10 years ago
parent
commit
98a2805b5c
  1. 2
      alethzero/CMakeLists.txt
  2. 21
      cmake/EthExecutableHelper.cmake
  3. 13
      cmake/scripts/copydlls.cmake
  4. 4
      eth/CMakeLists.txt
  5. 2
      ethrpctest/CMakeLists.txt
  6. 2
      third/CMakeLists.txt

2
alethzero/CMakeLists.txt

@ -64,5 +64,5 @@ if (NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
endif() endif()
# eth_install_executable is defined in cmake/EthExecutableHelper.cmake # eth_install_executable is defined in cmake/EthExecutableHelper.cmake
eth_install_executable(${EXECUTABLE} DLLS ${MHD_DLL_RELEASE}) eth_install_executable(${EXECUTABLE} DLLS MHD_DLLS)

21
cmake/EthExecutableHelper.cmake

@ -44,10 +44,18 @@ macro(eth_add_executable EXECUTABLE)
endmacro() endmacro()
macro(eth_copy_dlls EXECUTABLE DLLS) macro(eth_copy_dlls EXECUTABLE DLLS)
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD COMMNAND ${CMAKE_COMMAND} # dlls must be unsubstitud list variable (without ${}) in format
-DLIBS="${DLLS}" # optimized;path_to_dll.dll;debug;path_to_dlld.dll
-DCONFIGURATION="$<CONFIGURATION>" list(GET ${DLLS} 1 DLL_RELEASE)
-DDESTINATION="${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" list(GET ${DLLS} 3 DLL_DEBUG)
add_custom_command(TARGET ${EXECUTABLE}
POST_BUILD
COMMAND ${CMAKE_COMMAND} ARGS
-DDLL_RELEASE="${DLL_RELEASE}"
-DDLL_DEBUG="${DLL_DEBUG}"
-DCONF="$<CONFIGURATION>"
-DDESTINATION="${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
-P "${ETH_SCRIPTS_DIR}/copydlls.cmake"
) )
endmacro() endmacro()
@ -115,10 +123,7 @@ macro(eth_install_executable EXECUTABLE)
#copy additional dlls #copy additional dlls
foreach(dll ${ETH_INSTALL_EXECUTABLE_DLLS}) foreach(dll ${ETH_INSTALL_EXECUTABLE_DLLS})
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD eth_copy_dlls(${EXECUTABLE} ${dll})
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${dll} "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}"
)
endforeach(dll) endforeach(dll)
install( TARGETS ${EXECUTABLE} RUNTIME install( TARGETS ${EXECUTABLE} RUNTIME

13
cmake/scripts/copydlls.cmake

@ -1,16 +1,17 @@
# this module expects # this module expects
# DLLS # DLLS
# CONFIGURATION # CONF
# DESTINATION # DESTINATION
# example usage: # example usage:
# cmake -DLLS=${MHD_LIBRARIES} -DCONFIGURATION=Release -DDESTINATION=dest -P scripts/copydlls.cmake # cmake -DDLL_DEBUG=xd.dll -DDLL_RELEASE=x.dll -DCONFIGURATION=Release -DDESTINATION=dest -P scripts/copydlls.cmake
# expects DLLS to be in format optimized;path_to_dll.dll;debug;path_to_dll_d.dll # this script is created cause we do not know configuration in multiconfiguration generators at cmake configure phase ;)
if (${CONFIGURATION} STREQUAL "Release")
list(GET DLLS 1 DLL) if ("${CONF}" STREQUAL "Release")
set(DLL ${DLL_RELEASE})
else () # Debug else () # Debug
list(GET DLLS 3 DLL) set(DLL ${DLL_DEBUG})
endif() endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${DLL}" "${DESTINATION}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${DLL}" "${DESTINATION}")

4
eth/CMakeLists.txt

@ -29,9 +29,7 @@ target_link_libraries(${EXECUTABLE} webthree)
target_link_libraries(${EXECUTABLE} ethash) target_link_libraries(${EXECUTABLE} ethash)
if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW) if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW)
eth_copy_dlls(${EXECUTABLE} ${MHD_DLLS}) eth_copy_dlls("${EXECUTABLE}" MHD_DLLS)
#add_custom_command(TARGET ${EXECUTABLE} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${MHD_DLL_RELEASE} "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
endif() endif()
install( TARGETS ${EXECUTABLE} DESTINATION bin ) install( TARGETS ${EXECUTABLE} DESTINATION bin )

2
ethrpctest/CMakeLists.txt

@ -28,7 +28,7 @@ target_link_libraries(${EXECUTABLE} testutils)
target_link_libraries(${EXECUTABLE} web3jsonrpc) target_link_libraries(${EXECUTABLE} web3jsonrpc)
if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW) if (DEFINED WIN32 AND NOT DEFINED CMAKE_COMPILER_IS_MINGW)
add_custom_command(TARGET ${EXECUTABLE} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${MHD_DLL_RELEASE} "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") eth_copy_dlls("${EXECUTABLE}" MHD_DLLS)
endif() endif()
install( TARGETS ${EXECUTABLE} DESTINATION bin ) install( TARGETS ${EXECUTABLE} DESTINATION bin )

2
third/CMakeLists.txt

@ -52,5 +52,5 @@ target_link_libraries(${EXECUTABLE} web3jsonrpc)
target_link_libraries(${EXECUTABLE} jsqrc) target_link_libraries(${EXECUTABLE} jsqrc)
# eth_install_executable is defined in cmake/EthExecutableHelper.cmake # eth_install_executable is defined in cmake/EthExecutableHelper.cmake
eth_install_executable(${EXECUTABLE} DLLS ${MHD_DLL_RELEASE}) eth_install_executable(${EXECUTABLE} DLLS MHD_DLLS)

Loading…
Cancel
Save