[waffle] [PATCH v2 2/4] waffle: add support for building Waffle using NaCl toolchain

Tapani Pälli tapani.palli at intel.com
Sun Dec 28 23:11:50 PST 2014



On 12/23/2014 12:28 AM, Chad Versace wrote:
> On 12/21/2014 07:53 AM, Emil Velikov wrote:
>> On 17 December 2014 at 10:17, Tapani Pälli <tapani.palli at intel.com> wrote:
>>> Patch adds changes required to use NaCl compiler and libraries to
>>> build Waffle. Build can be configured to use specific version of
>>> the NaCl SDK, toolchain for the build needs to be selected with
>>> cmake variable CMAKE_TOOLCHAIN_FILE.
>>>
>>> Example command line to configure a build:
>>>
>>> cmake -Dwaffle_has_nacl=ON \
>>>        -Dnacl_sdk_path=/home/tpalli/nacl/nacl_sdk \
>>>        -Dnacl_version=pepper_39 \
>> Tbh I'm not a huge fan of having those piped via the top cmake into
>> the toolchain file.
>>
>> Quick look indicates that nacl_sdk as of Dec 2011 has/is defining NACL_SDL_ROOT.
>> Perhaps we can reuse that one and error out if it's missing.
>> Considering we can use (have tested only) a single version we could
>> just hardcode it into the toolchain file ?
>
> Emil, I don't understand. What do you mean that nacl_sdk defines NACL_SDK_ROOT?
> I see that some GNU Makefiles in the SDK define NACL_SDK_ROOT, but I failed
> to find any CMake files in the SDK.
>
> I also think that the CMake configure line can be improved and the toolchain files
> simplified. I'll suggest those changes in a different subthread, though.
>
>>>        -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-nacl-linux-glibc-x86_64.cmake \
>>>        -DCMAKE_BUILD_TYPE=Release \
>>>        .
>
>>> diff --git a/cmake/Modules/WaffleValidateOptions.cmake b/cmake/Modules/WaffleValidateOptions.cmake
>>> index ea60b0e..1275463 100644
>>> --- a/cmake/Modules/WaffleValidateOptions.cmake
>>> +++ b/cmake/Modules/WaffleValidateOptions.cmake
>>> @@ -46,11 +46,38 @@ endif()
>>>
>>>   if(waffle_on_linux)
>>>       if(NOT waffle_has_glx AND NOT waffle_has_wayland AND
>>> -       NOT waffle_has_x11_egl AND NOT waffle_has_gbm)
>>> +       NOT waffle_has_x11_egl AND NOT waffle_has_gbm AND
>>> +       NOT waffle_has_nacl)
>>>           message(FATAL_ERROR
>>>                   "Must enable at least one of: "
>>>                   "waffle_has_glx, waffle_has_wayland, "
>>> -                "waffle_has_x11_egl, waffle_has_gbm.")
>>> +                "waffle_has_x11_egl, waffle_has_gbm, "
>>> +                "waffle_has_nacl.")
>>> +    endif()
>>> +    if(waffle_has_nacl)
>>> +        if(NOT EXISTS ${nacl_sdk_path})
>>> +            message(FATAL_ERROR "NaCl SDK path not found : ${nacl_sdk_path}")
>>> +        endif()
>>> +
>
>> In the future as we add a proper build check, we can add it into the
>> auto-detection. Can you add a single line of comment ?
>
> I don't see a way for Waffle's CMake to autodetect the nacl_sdk_path, because the
> NaCl SDK is usually (I think) installed by the user into his home directory in a custom location.
> For example:
>    Tapani: ~/nacl/nacl_sdk
>    Chad:   ~/opt/nacl_sdk
>    Emil:   ????
>
> I admit that I'm a complete NaCl newbie, though. Emil, do you have some plan
> on how to perform autodetection?
>
>>> +        if(NOT EXISTS ${CMAKE_TOOLCHAIN_FILE})
>>> +            message(FATAL_ERROR "Toolchain for Nacl not found. This must be "
>>> +                                "configured using CMAKE_TOOLCHAIN_FILE.")
>>> +        endif()
>>> +
>> Don't think we need this check, but I'll leave it up-to Chad to be the
>> final judge.
>
> Correct. CMake validates CMAKE_TOOLCHAIN_FILE very early during configuration.
> If I understand correctly, CMake validates it before reading any of the
> project's CMake files.

I added the check to make sure that nacl is only compiled with the 
toolchain files, otherwise the build will fail. For example if you leave 
it out from the example line in commit message, build fails and error 
message for user is a missing header.

// Tapani


More information about the waffle mailing list