Hi Attached is a patch to improve support for CMake in the autobuilder, based on the existing support for Meson.
Regards Cameron
Index: build =================================================================== --- build (revision 7454) +++ build (working copy) @@ -76,7 +76,7 @@ popd fi fi - for build_prog in cvs svn wget autoconf automake rman realpath pkg-config doxygen xgettext unzip autoconf2.13 flex bison gperf glib-genmarshal xsltproc intltoolize automake-1.11 meson ninja ; do + for build_prog in cvs svn wget autoconf automake rman realpath pkg-config doxygen xgettext unzip autoconf2.13 flex bison gperf glib-genmarshal xsltproc intltoolize automake-1.11 meson cmake ninja ; do if ! type $build_prog > /dev/null 2>&1 ; then echo "Autobuilder: $build_prog not found; is it installed on your path?" exit 1; Index: build-program =================================================================== --- build-program (revision 7454) +++ build-program (working copy) @@ -30,7 +30,12 @@ AB_MESON_FLAGS="-Dbuildtype=release -Ddefault_library=both" AB_MESON_BUILD_DIR=build-meson-cross +# CMake support +AB_CMAKE=no +AB_PRECMAKE= AB_CMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake +AB_CMAKE_FLAGS=-DCMAKE_BUILD_TYPE=Release +AB_CMAKE_BUILD_DIR=build-cmake-cross # if the AB_CPUS variable is set, use that number of parallel processes in # our compile (may go wrong if makefiles are poorly written) @@ -737,6 +742,10 @@ export CXX=c++ mkdir -p $AB_MESON_BUILD_DIR eval $AB_PREMESON meson $AB_MESON_BUILD_DIR --prefix $GCCSDK_INSTALL_ENV --cross-file $AB_MESON_CROSS_FILE $AB_MESON_FLAGS + elif [ "x$AB_CMAKE" == "xyes" ] ; then + echo "Autobuilder: Calling cmake command: $AB_PRECMAKE cmake -B$AB_CMAKE_BUILD_DIR -G Ninja -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_TOOLCHAIN_FILE=$AB_CMAKE_TOOLCHAIN_FILE $AB_CMAKE_FLAGS" + mkdir -p $AB_CMAKE_BUILD_DIR + eval $AB_PRECMAKE cmake -B$AB_CMAKE_BUILD_DIR -G Ninja -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_TOOLCHAIN_FILE=$AB_CMAKE_TOOLCHAIN_FILE $AB_CMAKE_FLAGS elif [ -e Imakefile ] ; then echo "Autobuilder: Calling xmkmf" $GCCSDK_INSTALL_ENV/ro-path $GCCSDK_INSTALL_ENV/bin/xmkmf -a @@ -757,6 +766,9 @@ if [ "x$AB_MESON" == "xyes" ] ; then echo "Autobuilder: Running ninja command:" ninja -C $AB_MESON_BUILD_DIR + elif [ "x$AB_CMAKE" == "xyes" ] ; then + echo "Autobuilder: Running cmake --build command:" + cmake --build $AB_CMAKE_BUILD_DIR else echo "Autobuilder: Running make command: $AB_MAKE" ab_make @@ -781,6 +793,20 @@ mv -f -t $AB_DIR/package $AB_DIR/package/$GCCSDK_INSTALL_ENV/* rm -fr $AB_DIR/package/home fi + elif [ "x$AB_CMAKE" == "xyes" ] ; then + if [ "$AB_INSTALL" == "env" ] || [ "$AB_INSTALL" == "yes" ] ; then + echo "Autobuilder: Installing to $GCCSDK_INSTALL_ENV" + cmake --build $AB_CMAKE_BUILD_DIR --target install + fi + if [ "$AB_INSTALL" == "yes" ] ; then + echo "Autobuilder: Installing to $AB_DIR/package" + DESTDIR=$AB_DIR/package cmake --build $AB_CMAKE_BUILD_DIR --target install + # This install isn't quite what we want, we get the full original prefix + # path inside the 'package' directory. Move everything down to the + # package directory and delete the empty directory structure. + mv -f -t $AB_DIR/package $AB_DIR/package/$GCCSDK_INSTALL_ENV/* + rm -fr $AB_DIR/package/home + fi else # Need to install in $GCCSDK_INSTALL_ENV ? if [ "$AB_INSTALL" == "env" ] || [ "$AB_INSTALL" == "yes" ] ; then @@ -796,6 +822,8 @@ export AB_INSTALLDOCS export AB_MESON export AB_MESON_BUILD_DIR + export AB_CMAKE + export AB_CMAKE_BUILD_DIR export RO_PKG=${AB_PACKAGE}_${AB_PVERSION}${AB_TARGET}-${AB_ROVERSION}${AB_ROVERSION_SUFFIX} $AB_HOME/ro-libpack Index: ro-libpack =================================================================== --- ro-libpack (revision 7454) +++ ro-libpack (working copy) @@ -14,7 +14,7 @@ fi mkdir -p $AB_DIR/package/doc/$RO_PKG -if [ "x$AB_MESON" != "xyes" ] ; then +if [ "x$AB_MESON" != "xyes" ] && [ "x$AB_CMAKE" != "xyes" ] ; then mkdir -p $AB_DIR/package/lib mkdir -p $AB_DIR/package/lib/pkgconfig mkdir -p $AB_DIR/package/include/ Index: setvars-template =================================================================== --- setvars-template (revision 7454) +++ setvars-template (working copy) @@ -162,6 +162,29 @@ # You will not normally have to change this. #AB_MESON_BUILD_DIR=build-meson-cross +# When set to yes, use cmake to configure the package. The package +# must support building by meson (contains a 'CMakeLists.txt' file). +# Note that ab_make() will not be called. +#AB_CMAKE=no + +# This is added before the cmake configuration command to allow any +# environment variables to be set. +#AB_PRECMAKE= + +# When configuring using cmake, this gives the full path to a toolchain +# file suitable for the target compiler. You will not normally have to +# change this as the autobuilder will set it as required. +#AB_CMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake + +# These are the flags that are passed to cmake. By default, a release +# build is created. These flags can be replaced by setting a new value +# to the variable, or added to. +#AB_CMAKE_FLAGS=-DCMAKE_BUILD_TYPE=Release + +# This is the name of the directory where the built files will be placed. +# You will not normally have to change this. +#AB_CMAKE_BUILD_DIR=build-cmake-cross + # When # Make function #
_______________________________________________ GCCSDK mailing list gcc@gccsdk.riscos.info Bugzilla: http://www.riscos.info/bugzilla/index.cgi List Info: http://www.riscos.info/mailman/listinfo/gcc Main Page: http://www.riscos.info/index.php/GCCSDK