2

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?

CAMOBAP
  • 5,523
  • 8
  • 58
  • 93

2 Answers2

5

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

kuga
  • 1,483
  • 1
  • 17
  • 38
1

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

CAMOBAP
  • 5,523
  • 8
  • 58
  • 93