4

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?

2 Answers 2

7

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

1

I have written 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 @[email protected]

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 creates an executable with .exe postfix and this solution uses this 'feature'

Update

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.