Sounds like we need to determine the level of compiler needed for C++
compatibility and have autotools only enable it if those requirements are
met.

On Tue, Feb 24, 2015 at 3:25 PM, Maxim Uvarov <[email protected]>
wrote:

> 2 small comments, bellow.
>
>
> On 02/25/2015 12:13 AM, Mike Holmes wrote:
>
>> From: Simon Kagstrom <[email protected]>
>>
>> Add conditional test to link and run ODP from a cpp application.
>>
>> Signed-off-by: Simon Kagstrom <[email protected]>
>> Signed-off-by: Mike Holmes <[email protected]>
>> ---
>> v3
>> added dissable to configure
>> added stc=c++11
>>
>> NOTE checkpatch gets confused with the cc - looks like it thinks it is
>> an email cc.
>>
>>   configure.ac                            | 25 ++++++++++++++++++++++++-
>>   test/Makefile.am                        |  2 +-
>>   test/Makefile.inc                       |  5 +++--
>>   test/miscellaneous/.gitignore           |  1 +
>>   test/miscellaneous/Makefile.am          | 12 ++++++++++++
>>   test/miscellaneous/gitignore            |  1 +
>>   test/miscellaneous/odp_api_from_cpp.cpp | 12 ++++++++++++
>>   7 files changed, 54 insertions(+), 4 deletions(-)
>>   create mode 100644 test/miscellaneous/.gitignore
>>   create mode 100644 test/miscellaneous/Makefile.am
>>   create mode 100644 test/miscellaneous/gitignore
>>   create mode 100644 test/miscellaneous/odp_api_from_cpp.cpp
>>
>> diff --git a/configure.ac b/configure.ac
>> index e5c1c56..2fe9d49 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -13,6 +13,8 @@ AM_SILENT_RULES([yes])
>>   AC_PROG_CC
>>   AM_PROG_CC_C_O
>>   +AC_PROG_CXX
>> +
>>   AC_PROG_INSTALL
>>   AC_PROG_MAKE_SET
>>   @@ -114,6 +116,24 @@ AC_ARG_ENABLE([test-perf],
>>   AM_CONDITIONAL([test_perf], [test x$test_perf = xyes ])
>>     ############################################################
>> ##############
>> +# Enable/disable test-cpp
>> +###########################################################
>> ###############
>> +if test "$GXX" = "yes"; then
>> +test_cpp=yes
>> +else
>> +test_cpp=no
>> +fi
>> +AC_ARG_ENABLE([test-cpp],
>> +    [  --enable-test-cpp       run basic test aginast cpp],
>>
> I think that output is better:
>   --enable-test-cpp       run basic test aginast cpp
>   --disable-test-cpp
>
> AC_ARG_ENABLE([test-cpp],
>     [  --enable-test-cpp       run basic test aginast cpp
>   --disable-test-cpp ],
>     [if test "x$enableval" = "xyes"; then
> ....
>
>> +    [if test "x$enableval" = "xyes"; then
>> +        test_cpp=yes
>> +     else
>> +        test_cpp=no
>> +    fi])
>> +
>> +AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ])
>> +
>> +###########################################################
>> ###############
>>   # Set optional CUnit path
>>   ############################################################
>> ##############
>>   AC_ARG_WITH([cunit-path],
>> @@ -223,11 +243,11 @@ ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror
>> -Wstrict-prototypes -Wmissing-prototype
>>   ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations -Wold-style-definition
>> -Wpointer-arith"
>>   ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual
>> -Wformat-nonliteral"
>>   ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings"
>> -
>>
>
> No need to delete this line.
>
>
>    ############################################################
>> ##############
>>   # Default include setup
>>   ############################################################
>> ##############
>>   AM_CFLAGS="$AM_CFLAGS $ODP_CFLAGS"
>> +AM_CXXFLAGS="-std=c++11"
>>     AC_CONFIG_FILES([Makefile
>>                  doc/Makefile
>> @@ -244,6 +264,7 @@ AC_CONFIG_FILES([Makefile
>>                  test/api_test/Makefile
>>                  test/performance/Makefile
>>                  test/validation/Makefile
>> +                test/miscellaneous/Makefile
>>                  ])
>>     AC_SEARCH_LIBS([timer_create],[rt posix4])
>> @@ -276,6 +297,7 @@ AC_MSG_RESULT([
>>         cc:                     ${CC}
>>         cppflags:               ${CPPFLAGS}
>>         am_cppflags:            ${AM_CPPFLAGS}
>> +       am_cxxflags:            ${AM_CXXFLAGS}
>>         cflags:                 ${CFLAGS}
>>         am_cflags:              ${AM_CFLAGS}
>>         ldflags:                ${LDFLAGS}
>> @@ -284,4 +306,5 @@ AC_MSG_RESULT([
>>         cunit:                  ${cunit_support}
>>         test_vald:              ${test_vald}
>>         test_perf:              ${test_perf}
>> +       test_cpp:               ${test_cpp}
>>   ])
>> diff --git a/test/Makefile.am b/test/Makefile.am
>> index ec2b248..2ba8008 100644
>> --- a/test/Makefile.am
>> +++ b/test/Makefile.am
>> @@ -1,4 +1,4 @@
>> -SUBDIRS = api_test performance
>> +SUBDIRS = api_test performance miscellaneous
>>     if cunit_support
>>       SUBDIRS += validation
>> diff --git a/test/Makefile.inc b/test/Makefile.inc
>> index ebee80a..93ead25 100644
>> --- a/test/Makefile.inc
>> +++ b/test/Makefile.inc
>> @@ -2,12 +2,13 @@ include $(top_srcdir)/Makefile.inc
>>   include $(top_srcdir)/platform/@with_platform@/Makefile.inc
>>   LIB   = $(top_builddir)/lib
>>   LDADD = $(LIB)/libodp.la
>> -AM_CFLAGS += \
>> -       -I$(srcdir) \
>> +INCFLAGS = -I$(srcdir) \
>>         -I$(top_srcdir)/test \
>>         -I$(top_srcdir)/platform/@with_platform@/include \
>>         -I$(top_srcdir)/platform/linux-generic/include \
>>         -I$(top_srcdir)/include \
>>         -I$(top_srcdir)/helper/include
>> +AM_CFLAGS += $(INCFLAGS)
>> +AM_CXXFLAGS = $(INCFLAGS)
>>     AM_LDFLAGS += -L$(LIB)
>> diff --git a/test/miscellaneous/.gitignore b/test/miscellaneous/.
>> gitignore
>> new file mode 100644
>> index 0000000..134df38
>> --- /dev/null
>> +++ b/test/miscellaneous/.gitignore
>> @@ -0,0 +1 @@
>> +odp_api_from_cpp
>> diff --git a/test/miscellaneous/Makefile.am
>> b/test/miscellaneous/Makefile.am
>> new file mode 100644
>> index 0000000..863643c
>> --- /dev/null
>> +++ b/test/miscellaneous/Makefile.am
>> @@ -0,0 +1,12 @@
>> +include $(top_srcdir)/test/Makefile.inc
>> +
>> +if test_cpp
>> +bin_PROGRAMS =  odp_api_from_cpp
>> +TESTS = odp_api_from_cpp
>> +endif
>> +
>> +odp_api_from_cpp_CXXFLAGS = $(AM_CXXFLAGS)
>> +
>> +odp_api_from_cpp_LDFLAGS = $(AM_LDFLAGS) -static
>> +
>> +dist_odp_api_from_cpp_SOURCES = odp_api_from_cpp.cpp
>> diff --git a/test/miscellaneous/gitignore b/test/miscellaneous/gitignore
>> new file mode 100644
>> index 0000000..134df38
>> --- /dev/null
>> +++ b/test/miscellaneous/gitignore
>> @@ -0,0 +1 @@
>> +odp_api_from_cpp
>> diff --git a/test/miscellaneous/odp_api_from_cpp.cpp
>> b/test/miscellaneous/odp_api_from_cpp.cpp
>> new file mode 100644
>> index 0000000..e62ef8d
>> --- /dev/null
>> +++ b/test/miscellaneous/odp_api_from_cpp.cpp
>> @@ -0,0 +1,12 @@
>> +#include <cstdio>
>> +#include <odp.h>
>> +#include <odp/helper/linux.h>
>> +
>> +int main(int argc, const char *argv[])
>> +{
>> +
>> +       printf("\tODP API version: %s\n", odp_version_api_str());
>> +       printf("\tODP implementation version: %s\n",
>> odp_version_impl_str());
>> +
>> +       return 0;
>> +}
>>
>
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to