2019-02-08 06:19:36 +08:00
|
|
|
find_package(WIX)
|
|
|
|
|
|
|
|
if(WIX_FOUND)
|
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FDBInstaller.wxs
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DOUT=${CMAKE_CURRENT_BINARY_DIR}/FDBInstaller.wxs
|
|
|
|
-DIN=${CMAKE_CURRENT_SOURCE_DIR}/FDBInstaller.wxs.cmake
|
|
|
|
-Dfdbserver=$<TARGET_FILE:fdbserver>
|
|
|
|
-Dfdbcli=$<TARGET_FILE:fdbcli>
|
|
|
|
-Dfdbbackup=$<TARGET_FILE:fdbbackup>
|
|
|
|
-Dfdbmonitor=$<TARGET_FILE:fdbmonitor>
|
|
|
|
-Dfdbc=$<TARGET_FILE:fdb_c>
|
|
|
|
-DSOURCE_ROOT=${CMAKE_SOURCE_DIR}
|
|
|
|
-DBUILD_ROOT=${CMAKE_BINARY_DIR}
|
|
|
|
-DCURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DVERSION=${CMAKE_PROJECT_VERSION}
|
|
|
|
-DVERSION_NAME=${FDB_VERSION}
|
|
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/generate_wxs.cmake
|
2019-02-17 04:07:52 +08:00
|
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/FDBInstaller.wxs ${CMAKE_CURRENT_SOURCE_DIR}/generate_wsx.cmake
|
2019-02-08 06:19:36 +08:00
|
|
|
COMMENT "Generate WIX file")
|
|
|
|
add_custom_target(wix_file DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/FDBInstaller.wxs)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FDBInstaller.wixobj
|
|
|
|
COMMAND ${WIX_CANDLE} FDBInstaller.wxs
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
DEPENDS wix_file
|
|
|
|
COMMENT "Create WIX Object file"
|
|
|
|
)
|
|
|
|
add_custom_target(wixobj DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/FDBInstaller.wixobj)
|
2019-02-17 04:07:52 +08:00
|
|
|
add_dependencies(wixobj fdbserver fdbcli fdbmonitor fdb_c fdbbackup python_binding)
|
|
|
|
string(REPLACE "/" "\\" msi_out_file "${CMAKE_BINARY_DIR}/packages/FDBInstaller.msi")
|
2019-02-08 06:19:36 +08:00
|
|
|
add_custom_command(
|
2019-02-17 04:07:52 +08:00
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/packages/FDBInstaller.msi
|
|
|
|
COMMAND ${WIX_LIGHT} FDBInstaller.wixobj -ext WixUIExtension -out ${msi_out_file}
|
2019-02-08 06:19:36 +08:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Generate MSI installer"
|
|
|
|
)
|
2019-02-17 04:07:52 +08:00
|
|
|
add_custom_target(installer DEPENDS ${CMAKE_BINARY_DIR}/packages/FDBInstaller.msi)
|
|
|
|
add_dependencies(installer wixobj)
|
|
|
|
add_dependencies(packages installer)
|
2019-02-08 06:19:36 +08:00
|
|
|
#add_dependencies(installer fdbserver fdbcli fdbmonitor fdbbackup)
|
|
|
|
else()
|
|
|
|
message(WARNING "Could NOT find WIX - will not build installer")
|
|
|
|
endif()
|