Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: use CROSSCOMPILING_EMULATOR #99

Merged
merged 1 commit into from Apr 29, 2021
Merged

Conversation

xantares
Copy link
Contributor

@xantares xantares commented Mar 15, 2021

it's a cmake built-in idiom that simplifies wrapping of wine, so no need for WINE_EXECUTABLE etc

@xantares xantares marked this pull request as ready for review March 15, 2021 10:42
@xantares
Copy link
Contributor Author

@traversaro what do you say about this one ?

@traversaro
Copy link
Collaborator

Ok for me, pinging @rhabacker and @pali if they have any objection.

@rhabacker
Copy link
Contributor

I suggest to add the following cmake code to the top level CMakeLists.txt to give users a hint if the emulator is not available.

if(BUILD_TESTS AND CMAKE_CROSSCOMPILING_EMULATOR)
    list(GET CMAKE_CROSSCOMPILING_EMULATOR 0 WRAPPER)
    find_program(WRAPPER_FOUND ${WRAPPER})
    if(NOT WRAPPER_FOUND)
        message(FATAL_ERROR "Running cross-compiled tests requested, but requirements are not met.")
    endif()
endif()

@rhabacker
Copy link
Contributor

Also a hint added to Readme.md for this support would be nice.

@traversaro
Copy link
Collaborator

@rhabacker are you sure that find_program will work fine when asked to found command with its full path?

@rhabacker
Copy link
Contributor

The cmake doc says nothing about this, but the code shows it does https://github.com/Kitware/CMake/blob/eeb771e4d6b9a1127a0818a211cafb722a2dc387/Source/cmFindProgramCommand.cxx#L93

@rhabacker
Copy link
Contributor

If you are concerned about using an undocumented function, the code can be changed to

f(BUILD_TESTS AND CMAKE_CROSSCOMPILING_EMULATOR)
    list(GET CMAKE_CROSSCOMPILING_EMULATOR 0 WRAPPER)
    get_filename_component(DIR ${WRAPPER} DIRECTORY)
    get_filename_component(FILE ${WRAPPER} NAME)
    find_program(_wrapper ${FILE} PATHS ${DIR})
    if(NOT _wrapper)
        message(FATAL_ERROR "Running cross-compiled tests requested, but requirements are not met.")
    endif()
endif()

@xantares
Copy link
Contributor Author

done, it's probably easier to check for CMAKE_CROSSCOMPILING_EMULATOR

note that its not even mandatory if you have binfmt

@traversaro traversaro merged commit 0109690 into dlfcn-win32:master Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants