From 7589a8ad015a0746b33eba606abff93addf0964a Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 24 Mar 2020 12:32:26 +0100 Subject: [PATCH] Add the CMake build system generator option back for Windows. This option was in the autogen.sh (based on uname instead of proper detection by configure script, which is now also changed). Add it back properly in the Makefile rule. Of course it will be used only for **native** builds on Windows for Windows. Cross-builds for the librtprocess dependency are still to be done separately. Also move the rules inside deps/Makefile as it should be, now that we have a Makefile.am there. --- Makefile.am | 11 ----------- configure.ac | 21 +++++++++++++++++++++ deps/Makefile.am | 11 +++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index a656aee87..6dbb55437 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,17 +8,6 @@ SUBDIRS = deps \ pixmaps \ platform-specific -if !HAVE_LIBRTPROCESS -# not adding it in subdirs because we don't want to run most targets in it, and specifying -# the rtprocess_static target allows us to build only the static lib we link against -build-librtprocess: - mkdir -p $(top_builddir)/deps/librtprocess/build - $(CMAKE) -DCMAKE_BUILD_TYPE="Release" -DWITH_STATIC_LIB=ON -DOPTION_OMP=OFF -S $(top_srcdir)/deps/librtprocess/ -B $(top_builddir)/deps/librtprocess/build - $(MAKE) -C $(top_builddir)/deps/librtprocess/build rtprocess_static - -all: build-librtprocess -endif - # TODO add a conditionnal and a configure switch # to be able to choose the language. Also, this should # be a recussive make with a separate file list. diff --git a/configure.ac b/configure.ac index 7c2b97873..36d96db76 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,20 @@ if test "x$STD_ATOMIC_NEED_LIBATOMIC" = xyes; then fi AC_SUBST([LIBATOMIC_LIBS]) +dnl ================ PLATFORM CHECKS ================ + +AC_MSG_CHECKING([if compiling for Win32]) +case "$host_os" in + mingw* | cygwin*) + platform_win32=yes + ;; + *) + platform_win32=no + ;; +esac +AC_MSG_RESULT([$platform_win32]) +AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes") + dnl ================ MANDATORY DEPENDECIES ================ dnl check math lib AC_CHECK_LIB(m, log, LIBS="$LIBS -lm") @@ -162,6 +176,13 @@ if test "x$have_rtprocess" = "xno"; then if test "x$CMAKE" = xno; then AC_MSG_ERROR([CMAKE not found (needed to built internal librtprocess)]) fi + + CMAKE_GENERATOR= + if test "$platform_win32" = "yes"; then + CMAKE_GENERATOR="-G \"MSYS Makefiles\"" + fi + AC_SUBST([CMAKE_GENERATOR]) + AC_MSG_NOTICE([librtprocess will be built statically]) else # When cross-compiling, you should build rtprocess yourself and diff --git a/deps/Makefile.am b/deps/Makefile.am index b7a2df37d..c1ab29a21 100644 --- a/deps/Makefile.am +++ b/deps/Makefile.am @@ -10,3 +10,14 @@ all-local: if [ ! -f "$(top_builddir)/deps/kplot/Makefile" ]; then \ cp -fr "$(top_srcdir)/deps/kplot" "$(top_builddir)/deps/kplot"; \ fi + +if !HAVE_LIBRTPROCESS +# not adding it in subdirs because we don't want to run most targets in it, and specifying +# the rtprocess_static target allows us to build only the static lib we link against +build-librtprocess: + mkdir -p $(top_builddir)/deps/librtprocess/build + $(CMAKE) $(CMAKE_GENERATOR) -DCMAKE_BUILD_TYPE="Release" -DWITH_STATIC_LIB=ON -DOPTION_OMP=OFF -S $(top_srcdir)/deps/librtprocess/ -B $(top_builddir)/deps/librtprocess/build + $(MAKE) -C $(top_builddir)/deps/librtprocess/build rtprocess_static + +all: build-librtprocess +endif