diff options
Diffstat (limited to 'Tests/CPackWiXGenerator')
-rw-r--r-- | Tests/CPackWiXGenerator/CMakeLists.txt | 116 | ||||
-rw-r--r-- | Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake | 77 | ||||
-rw-r--r-- | Tests/CPackWiXGenerator/file with spaces.h | 0 | ||||
-rw-r--r-- | Tests/CPackWiXGenerator/license.txt | 9 | ||||
-rw-r--r-- | Tests/CPackWiXGenerator/mylib.cpp | 7 | ||||
-rw-r--r-- | Tests/CPackWiXGenerator/mylib.h | 1 | ||||
-rw-r--r-- | Tests/CPackWiXGenerator/mylibapp.cpp | 6 | ||||
-rw-r--r-- | Tests/CPackWiXGenerator/myotherapp.cpp | 1 | ||||
-rw-r--r-- | Tests/CPackWiXGenerator/patch.xml | 7 |
9 files changed, 224 insertions, 0 deletions
diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/CPackWiXGenerator/CMakeLists.txt new file mode 100644 index 0000000000..638e788a99 --- /dev/null +++ b/Tests/CPackWiXGenerator/CMakeLists.txt @@ -0,0 +1,116 @@ +cmake_minimum_required(VERSION 2.8) + +project(CPackWiXGenerator) + +add_library(mylib mylib.cpp) + +add_executable(my-libapp mylibapp.cpp) +target_link_libraries(my-libapp mylib) + +add_executable(my-other-app myotherapp.cpp) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/empty + DESTINATION extras + COMPONENT extras) + +install(TARGETS mylib + ARCHIVE + DESTINATION lib + COMPONENT libraries) + +install(TARGETS my-libapp + RUNTIME + DESTINATION bin + COMPONENT applications) + +install(TARGETS my-other-app + RUNTIME + DESTINATION bin + COMPONENT applications2) + +install(FILES mylib.h "file with spaces.h" + DESTINATION include + COMPONENT headers) + +set(CPACK_GENERATOR "WIX") + +set(CPACK_PACKAGE_NAME "MyLib") +set(CPACK_PACKAGE_VENDOR "CMake.org") +set(CPACK_PACKAGE_CONTACT "somebody@cmake.org") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY + "MyLib - CPack Component Installation Example") + +set(CPACK_PACKAGE_VERSION_MAJOR "1") +set(CPACK_PACKAGE_VERSION_MINOR "0") +set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") + +set(CPACK_WIX_UPGRADE_GUID "BF20CE5E-7F7C-401D-8F7C-AB45E8D170E6") +set(CPACK_WIX_UNINSTALL "1") + +set(CPACK_PACKAGE_EXECUTABLES + "my-libapp" "CPack WiX Test" + "my-other-app" "Second CPack WiX Test" +) + +set(CPACK_CREATE_DESKTOP_LINKS + "my-libapp" + "my-other-app" +) + +set(CPACK_WIX_PATCH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/patch.xml") + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt") + +set(CPACK_WIX_PROPERTY_ARPCOMMENTS "My Custom ARPCOMMENTS") +set(CPACK_WIX_PROPERTY_ARPHELPLINK "http://www.cmake.org") + +include(CPack) + +cpack_add_install_type(Full DISPLAY_NAME "Everything") +cpack_add_install_type(Developer) + +cpack_add_component_group(Runtime) + +cpack_add_component_group(Development + EXPANDED + DESCRIPTION "All of the tools you'll ever need to develop software") + +cpack_add_component(extras + DISPLAY_NAME "Extras" + DESCRIPTION "Extras" + GROUP Runtime + INSTALL_TYPES Full) + +cpack_add_component(applications + REQUIRED + DISPLAY_NAME "MyLib Application" + DESCRIPTION "An extremely useful application that makes use of MyLib" + GROUP Runtime + INSTALL_TYPES Full) + +cpack_add_component(applications2 + DISPLAY_NAME "MyLib Extra Application" + DESCRIPTION "Another extremely useful application that makes use of MyLib" + GROUP Runtime + INSTALL_TYPES Full) + +cpack_add_component(documentation + DISPLAY_NAME "MyLib Documentation" + DESCRIPTION "The extensive suite of MyLib Application documentation files" + GROUP Runtime + INSTALL_TYPES Full) + +cpack_add_component(libraries + DISPLAY_NAME "Libraries" + DESCRIPTION "Static libraries used to build programs with MyLib" + GROUP Development + INSTALL_TYPES Developer Full) + +cpack_add_component(headers + DISPLAY_NAME "C++ Headers" + DESCRIPTION "C/C++ header files for use with MyLib" + GROUP Development + DEPENDS libraries + INSTALL_TYPES Developer Full) diff --git a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake new file mode 100644 index 0000000000..ca9fd90495 --- /dev/null +++ b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake @@ -0,0 +1,77 @@ +message(STATUS "=============================================================") +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message(STATUS "") + +if(NOT CPackWiXGenerator_BINARY_DIR) + message(FATAL_ERROR "CPackWiXGenerator_BINARY_DIR not set") +endif() + +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") +message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}") +message(STATUS "CPackWiXGenerator_BINARY_DIR: ${CPackWiXGenerator_BINARY_DIR}") + +if(config) + set(_C_config -C ${config}) +endif() + +execute_process(COMMAND "${CMAKE_CPACK_COMMAND}" + ${_C_config} + RESULT_VARIABLE CPack_result + OUTPUT_VARIABLE CPack_output + ERROR_VARIABLE CPack_error + WORKING_DIRECTORY "${CPackWiXGenerator_BINARY_DIR}") + +if(CPack_result) + message(FATAL_ERROR "CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") +else () + message(STATUS "CPack_output=${CPack_output}") +endif() + +set(expected_file_mask "*.msi") +file(GLOB installer_file "${expected_file_mask}") + +message(STATUS "installer_file='${installer_file}'") +message(STATUS "expected_file_mask='${expected_file_mask}'") + +if(NOT installer_file) + message(FATAL_ERROR "installer_file does not exist.") +endif() + +function(run_wix_command command) + file(TO_CMAKE_PATH "$ENV{WIX}" WIX_ROOT) + set(WIX_PROGRAM "${WIX_ROOT}/bin/${command}.exe") + + if(NOT EXISTS "${WIX_PROGRAM}") + message(FATAL_ERROR "Failed to find WiX Tool: ${WIX_PROGRAM}") + endif() + + message(STATUS "Running WiX Tool: ${command} ${ARGN}") + + execute_process(COMMAND "${WIX_PROGRAM}" ${ARGN} + RESULT_VARIABLE WIX_result + OUTPUT_VARIABLE WIX_output + ERROR_VARIABLE WIX_output + WORKING_DIRECTORY "${CPackWiXGenerator_BINARY_DIR}") + + message(STATUS "${command} Output: \n${WIX_output}") + + if(WIX_result) + message(FATAL_ERROR "WiX ${command} failed: ${WIX_result}") + endif() +endfunction() + +file(GLOB WXS_SOURCE_FILES + "${CPackWiXGenerator_BINARY_DIR}/_CPack_Packages/*/WIX/*.wxs") + +if(NOT WXS_SOURCE_FILES) + message(FATAL_ERROR "Failed finding WiX source files to validate.") +endif() + +foreach(WXS_SOURCE_FILE IN LISTS WXS_SOURCE_FILES) + run_wix_command(wixcop "${WXS_SOURCE_FILE}") +endforeach() + +# error SMOK1076 : ICE61: This product should remove only older +# versions of itself. The Maximum version is not less +# than the current product. (1.0.0 1.0.0) +run_wix_command(smoke -nologo -wx -sw1076 "${installer_file}") diff --git a/Tests/CPackWiXGenerator/file with spaces.h b/Tests/CPackWiXGenerator/file with spaces.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/Tests/CPackWiXGenerator/file with spaces.h diff --git a/Tests/CPackWiXGenerator/license.txt b/Tests/CPackWiXGenerator/license.txt new file mode 100644 index 0000000000..79427833d3 --- /dev/null +++ b/Tests/CPackWiXGenerator/license.txt @@ -0,0 +1,9 @@ +hello world +merhaba dünya +ハローワールド +привет мир +مرحبا العالم +你好世界 + +4-Byte sequences: + Perch (Fish) 𩶘 Elevator 𨋢! diff --git a/Tests/CPackWiXGenerator/mylib.cpp b/Tests/CPackWiXGenerator/mylib.cpp new file mode 100644 index 0000000000..8ddac198c1 --- /dev/null +++ b/Tests/CPackWiXGenerator/mylib.cpp @@ -0,0 +1,7 @@ +#include "mylib.h" +#include "stdio.h" + +void mylib_function() +{ + printf("This is mylib"); +} diff --git a/Tests/CPackWiXGenerator/mylib.h b/Tests/CPackWiXGenerator/mylib.h new file mode 100644 index 0000000000..5d0a822db0 --- /dev/null +++ b/Tests/CPackWiXGenerator/mylib.h @@ -0,0 +1 @@ +void mylib_function(); diff --git a/Tests/CPackWiXGenerator/mylibapp.cpp b/Tests/CPackWiXGenerator/mylibapp.cpp new file mode 100644 index 0000000000..a438ac77ff --- /dev/null +++ b/Tests/CPackWiXGenerator/mylibapp.cpp @@ -0,0 +1,6 @@ +#include "mylib.h" + +int main() +{ + mylib_function(); +} diff --git a/Tests/CPackWiXGenerator/myotherapp.cpp b/Tests/CPackWiXGenerator/myotherapp.cpp new file mode 100644 index 0000000000..c272dabaeb --- /dev/null +++ b/Tests/CPackWiXGenerator/myotherapp.cpp @@ -0,0 +1 @@ +int main() {}
\ No newline at end of file diff --git a/Tests/CPackWiXGenerator/patch.xml b/Tests/CPackWiXGenerator/patch.xml new file mode 100644 index 0000000000..13c392d3ce --- /dev/null +++ b/Tests/CPackWiXGenerator/patch.xml @@ -0,0 +1,7 @@ +<CPackWiXPatch> + <CPackWiXFragment Id="CM_CP_applications.bin.my_libapp.exe"> + <Environment Id="MyEnvironment" Action="set" + Name="CPackWiXGeneratorTest" + Value="CPackWiXGeneratorTest"/> + </CPackWiXFragment> +</CPackWiXPatch> |