Check if the CRAN packet is checked

Some functions in my package work much faster using C ++ 11 containers, but CRAN does not accept my package using both $(SHLIB_OPENMP_CXXFLAGS) and $(CXX1XSTD) , because it does not compile on Solaris (or other lower platforms ) The CRAN recommendation was to write a script configuration, but I think it would be too laborious for me to learn, and unnecessarily complicate my code for platforms that few people use.

At the moment, I just commented on all the C ++ 11 code and removed $(CXX1XSTD) from Makevars to represent CRAN. This is a bad job, and I would rather detect CRAN in Makevars and place the housing, so I do not need to support the CRAN plug for each version.

I'm still checking if C ++ 11 is available, but it's just a combination of the C ++ 11 and OpenMP flags in Makevars, which is a sticking point in Solaris with CRAN views. I feel that there must be a trivial path around this.

Is there an environment variable that I should use to check whether CRAN checks my package and with what I can check in Makevars ? I searched the R code base and read the R Internals and Writing R Extensions, although I can't say that I know them by heart, which some CRAN-enabled expect. There are environment variables that CRAN probably sets, but I expect that testing something like _R_CHECK_CRAN_INCOMING_=TRUE will cause support for the maintainers to fail.

I don’t think that the "if solaris" test in Makevars will be sufficient: the presence of both C ++ 11 and OpenMP flags together is not allowed, because they can potentially not work on platforms used even less often than Solaris.

Maybe I'm just getting this wrong.

+6
source share
1 answer

Although it may be possible to do this, the script setting is really correct. I used configure.ac autoconf to create it, which was not so difficult in the end. Then C ++ code can use ifdef to check for C ++ 11 characters and use OpenMP #pragma declarations. Windows requires special handling. I used the method from the RODBC package. This has not yet been sent to CRAN or verified on Solaris, but it directly meets the recommendations of the accompanying CRAN.

See: https://github.com/jackwasey/icd

Relevant files are: configure.ac, src / config.h.in, src / Makevars.in

+2
source

Source: https://habr.com/ru/post/984126/


All Articles