简体   繁体   中英

CMake/CTest integration with wine/qemu

What I have:

I develop native unity plugin for different platforms including

  • iOS
  • Android
  • Windows
  • OSX

I use cmake as build-system and ctest for unit-tests

My build environment - osx , so it's not a problem to run unit tests on osx.

Also I know that for testing Android and Windows I can use qemu and wine accordingly.

Questions:

  • I just wondering cmake/ctest provide any variables to specify some emulators like wine or qemu ? Or should I write some custom scripts for this?

  • How can I run native unit tests on iOS (device or emulator)? Is it possible with qemu ?

Check out CMAKE_CROSSCOMPILING_EMULATOR . Best set it in your toolchain file.

I have wrote my own solution for wine

WineCTestWrapper.cmake:

macro (add_wine_test_wrapper_script TEST)
    set(TESTNAME ${TEST})
    configure_file (
        ${PROJECT_SOURCE_DIR}/thirdparty/cmake/modules/WineCTestWrapper.sh.in
        ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME} @ONLY
    )
endmacro ()

WineCTestWrapper.sh.in:

#!/bin/bash
# simple wrapper for windows PE-executable format

wine @TESTNAME@.exe

How to use it:

include(WineCTestWrapper)

...

find_program(WINE_FOUND wine)
add_test(some_test some_test)
if(WINE_FOUND)
    add_wine_test_wrapper_script(some_test)
endif()

Pay attention that by default MXE create executable with .exe postfix, and this solution use this 'feature'

Update

Another possible somution https://cmake.org/pipermail/cmake/2008-August/023534.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM