CAMOBAP
CAMOBAP

Reputation: 5657

CMake/CTest integration with wine/qemu

What I have:

I develop native unity plugin for different platforms including

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:

Upvotes: 4

Views: 2277

Answers (2)

CAMOBAP
CAMOBAP

Reputation: 5657

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

Upvotes: 1

kuga
kuga

Reputation: 1755

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

Upvotes: 7

Related Questions