On 13-Nov-16 00:48, Florent Castelli wrote:
> On 12/11/2016 13:35, Ruslan Baratov wrote:
>> On 12-Nov-16 19:09, Florent Castelli wrote:
>>> On 12/11/2016 06:53, Ruslan Baratov wrote:
>>>> On 12-Nov-16 08:21, Florent Castelli wrote:
>>>>> On 10/11/2016 16:05, Ruslan Baratov via cmake-developers wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I wonder if it's possible to introduce next variables describing
>>>>>> Android
>>>>>> tools:
>>>>>> * C preprocessor. Similar to CMAKE_CXX_COMPILER the variable that
>>>>>> will
>>>>>> contain the path to preprocessor. Example:
>>>>>>    * CMAKE_CXX_COMPILER =
>>>>>> <ndk-root>/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
>>>>>>
>>>>>>
>>>>>>    * CMAKE_C_PREPROCESSOR =
>>>>>> <ndk-root>/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-cpp
>>>>>>
>>>>>>
>>>>>> * ANDROID_TOOLCHAIN_MACHINE_NAME. In fact I'm not sure what this
>>>>>> variable mean but it's an important part of move from taka-no-me
>>>>>> toolchain to CMake 3.7. I guess it's like
>>>>>>    * CMAKE_CXX_COMPILER =
>>>>>> <ndk-root>/toolchains/${ANDROID_TOOLCHAIN_MACHINE_NAME}-4.9/prebuilt/linux-x86_64/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-g++
>>>>>>
>>>>>>
>>>>>>
>>>>>> Of course if I'm not missing something and they are not already
>>>>>> somewhere :)
>>>>>>
>>>>>> Ruslo
>>>>> How about ${CMAKE_C/CXX_COMPILER} -E to call the preprocessor?
>>>> I have no idea and not planning to test it because the old code was
>>>> using `cpp` preprocessor and I see no point of changing it.
>>> Well, you can define your preprocessor to be "${CMAKE_C_COMPILER}
>>> -E" locally and it will work with GCC-like compilers.
>>> That's a more robust way to call it as there is no
>>> CMAKE_C_PREPROCESSOR standard value in any CMake file.
>>> Nobody should call "cpp" manually anymore, but use the compiler
>>> driver instead to do it for you.
>>>
>>> That's why there's no standard CPP variable in CMake, it's not
>>> needed at all.
>>> For the same reasons, you rarely have to call the linker directly,
>>> it's usually done through the compiler driver.
>> Just like I said I'm not using it - this variable needed for 3rd
>> party package. I have no idea how it was used, the only thing I know
>> is that if I remove this variable the package stop working.
> Then just set it yourself as I said. You don't even need 3.7.0, you
> can just override it in the current version of CMake and previous
> toolchain you used.
I'm trying to move to 3.7.0 variables (that now became standard) and
drop old toolchain. And you're giving me advice to not rely on 3.7.0 and
use previous toolchain?

> The 3rd party package using it should still work.
> Use small incremental steps, in order to migrate. It will be easier.
That's exactly what I'm doing now.

>
>>
>>>
>>>>> Calling it directly is kind of dangerous though since you will
>>>>> probably be missing the proper language information and other options
>>>>> that might affect the predefined preprocessor defines.
>>>> I'm not calling it directly, it was used by `configure` script of
>>>> 3rd party.
>>>>
>>>>> gcc has different binaries for different target archs and has some
>>>>> defines baked in, but this won't apply to Clang that uses only one
>>>>> binary and a target triple.
>>>> For clang based android toolchain the
>>>> CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX
>>>> variable points to the directory with gcc, so it will find `cpp`
>>>> preprocessor too. I don't know if it's good or bad :)
>>>
>>> I think that's an implementation detail you shouldn't rely on. The
>>> compilers in the NDK are changing, GCC is deprecated and you
>>> shouldn't expect that.
>>> Clang is mostly self contained and using very little from the GCC
>>> distribution (binutils), it will be gone at some point, so you
>>> should be ready for the future.
>> My goal now is to move from taka-no-me to CMake 3.7+ Android. I don't
>> bother about the destiny of GCC distribution. When this stuff will
>> change the problems will appear in both taka-no-me and CMake 3.7+.
> Well, you should care as the cpp program will likely disappear and you
> will need other means to preprocess anything directly (gcc/clang -E).
> Better do it now and break one of the last dependency you have and
> migrate away from old custom variables.
There are a lot of "small" and "obvious" things to improve during
migration, however I will never end it if I will rush to fix them all.
I'm focused now on using new variables. Just like you said "Use small
incremental steps".

>
>>
>>>
>>> If you're updating CMake and changing the toolchain file, then I
>>> would expect that some work has to be done, including making changes
>>> to the invocation of a 3rd party script that is using custom
>>> variables from the old toolchain.
>> There is a tricky part about that. I do define variables like
>> CMAKE_SYSTEM_VERSION or CMAKE_ANDROID_ARCH_ABI and CMake gives me
>> back CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX. But
>> CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX is only available **after**
>> toolchain processed hence I can't use such variable in toolchain to
>> create my custom variables. So if we want to have everything play
>> nice this should be defined in CMake.
> Why do you need that variable to be defined in the toolchain? It
> shouldn't be a problem to define it outside of it or just before you
> use the 3rd party package that is using it.
Where outside? If they used by several projects I have to duplicate this
code. Or create extra module with such variables... Similar variables
already defined by toolchain. Those variables are obviously strongly
coupled with Android toolchain and not with the package.

>
>>
>>> Overall, I consider that taka-no-me Android toolchain to be tech
>>> debt. It hasn't been updated for a long time, doesn't work with
>>> recent NDK (unless you resort to use a standalone toolchain), locks
>>> people with some custom variables making them believe they are
>>> standard and has tons of other small bugs and issues.
>>> I understand its appeal for most people, but to me, it has caused
>>> more trouble than help.
>> Just like I said before, those variables needed in 3rd party tools
>> which is not related neither to CMake nor to taka-no-me toolchain. I
>> see no point of discussing issues you have with taka-no-me toolchain.
> So the content of the variables is needed by the 3rd party tools, but
> the variables are used by your script initially, so it's your
> responsibility to pass another content, like the one I suggested.
Sibling variables defined by CMake, some of the variables defined
internally already and all that need to be done is to make them public.
"Do it locally" - I don't understand that point at all.
CMAKE_CXX_COMPILER_VERSION - why we need this? You can always do
`CMAKE_CXX_COMPILER -version`. CMAKE_HOST_SYSTEM - why we need this?
Just parse `uname`, etc.

>
>>
>>> It could have been done so much better.
>> It's open source world. From my opinion every question like "why it's
>> not so good?" should really be "why I'm not improving it?" or "why
>> I'm not doing something better?".
>>
> The problem is that the owner abandoned it and isn't answering to
> issues or merging any pull request.
And what is the problem exactly? Did he made a promise to you? Did you
pay him money and then he refused to keep supporting you? According to
the history it started in 2011 so it's about 5 years now of saving
developers from headache of creating their own Android toolchains. And
note that it's **CMake** toolchain for development on **Android**
platform, so why you're not asking Google and/or CMake first where they
were all this years?

> Sure people can fork it, but they will likely not be found by users.
> People who didn't check the PRs on the project are probably stuck at
> some older version of the NDK, inhibiting progress.
This sounds like 1000 plus one reason to not to do anything about it.
Developers should take the responsibility and move on in such cases,
instead of whining and complaining.

Ruslo
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to