Le 05/05/11 12:34, Kornel a écrit :
What do you miss in cmake? I tried to (somehow) mimic all I was aware of
from autotools.

It surely is more then 80% ...

From the top of my head (I ask for forgiveness if some accusations are unfounded, this is from memory)

- NLS disabled by default
- I do not know how to have a list of variables from the command line (before I actually run it). cmake --help is not useful - does not work in place by default (actually build_support_dir stuff should be removed now, but I have no time)
- I do not know what LYX_CPACK does (what is cpack?)
- spellchecker should be automatically selected if present
- I would like to see a BUILD_TYPE flag like in autotools, with automatic selection from lyx version - what does LYX_DEVEL_VERSION do? What is the difference with LYX_RELEASE=OFF? - autotools can do merging selectively (mathed, insets...). I am not sure it is used, though - stdlib-debug mode should be merged with windows debug mode, since it is the same basically
- how do I specify whether I want debug informations (-g flag) for unix?
- building internal LIBINTL does not work. I have a unfinished patch for this - LYX_EXTERNAL_LIBINTL=OFF triggers compilation in intl even when LYX_NLS is OFF - "non verbose" make file have very long paths that are less readable than the automake counterpart (I do not doubt that IDEs have a nice display instead)
- generation of pyc and pyo files is verbose even in non-verbose mode
- I do not like the weird paths where built files go. I really cannot find my way there - when running "make -j3" and there is an error, the other processes continue (one process by directory??)


I assume there are other things, but this is a good start.

Eventually, cmake without option should generate a makefile that has reasonable defaults for everything (nls, spellcheck, build type, ...). Extra options should be needed only for special needs.

Here is my patch for included libintl. Part of it is a IMO better fix to the startup assertion encountered with cmake. I guess the code is not linked against libintl, because I get

Linking CXX executable ../bin/LyX2.1
Undefined symbols:
  "_libintl_textdomain", referenced from:
      lyx::Messages::init()    in libsupport.a(Messages.cpp.o)
  "_libintl_gettext", referenced from:
lyx::Messages::get(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) constin libsupport.a(Messages.cpp.o)
  "_libintl_bind_textdomain_codeset", referenced from:
      lyx::Messages::init()    in libsupport.a(Messages.cpp.o)
lyx::Messages::get(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) constin libsupport.a(Messages.cpp.o)
  "_libintl_bindtextdomain", referenced from:
      lyx::Messages::init()    in libsupport.a(Messages.cpp.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [bin/LyX2.1] Error 1
make[1]: *** [src/CMakeFiles/LyX2.1.dir/all] Error 2
make: *** [all] Error 2

However, how can I see what the command line was. With autoconf I'd just do "make V=1", what shall I do with cmake?


JMarc


Index: development/cmake/config.h.cmake
===================================================================
--- development/cmake/config.h.cmake    (revision 38589)
+++ development/cmake/config.h.cmake    (working copy)
@@ -13,9 +13,9 @@
 #define _CONFIG_H
 
 // obligatory flags
-#define QT_NO_STL
-#define QT_NO_KEYWORDS
-#define HAVE_ICONV
+#define QT_NO_STL 1
+#define QT_NO_KEYWORDS 1
+#define HAVE_ICONV 1
 
 #include "configCompiler.h"
 
@@ -75,7 +75,38 @@
 
 #cmakedefine LYX_NLS 1
 #ifdef LYX_NLS
-#define ENABLE_NLS
+#define ENABLE_NLS 1
+// These are needed when building included gettext (taken from autoconf macro)
+// FIXME: this only makes send when LYX_EXTERNAL_LIBINTL is OFF.
+#define __libc_lock_t                   gl_lock_t
+#define __libc_lock_define              gl_lock_define
+#define __libc_lock_define_initialized  gl_lock_define_initialized
+#define __libc_lock_init                gl_lock_init
+#define __libc_lock_lock                gl_lock_lock
+#define __libc_lock_unlock              gl_lock_unlock
+#define __libc_lock_recursive_t                   gl_recursive_lock_t
+#define __libc_lock_define_recursive              gl_recursive_lock_define
+#define __libc_lock_define_initialized_recursive  
gl_recursive_lock_define_initialized
+#define __libc_lock_init_recursive                gl_recursive_lock_init
+#define __libc_lock_lock_recursive                gl_recursive_lock_lock
+#define __libc_lock_unlock_recursive              gl_recursive_lock_unlock
+#define glthread_in_use  libintl_thread_in_use
+#define glthread_lock_init     libintl_lock_init
+#define glthread_lock_lock     libintl_lock_lock
+#define glthread_lock_unlock   libintl_lock_unlock
+#define glthread_lock_destroy  libintl_lock_destroy
+#define glthread_rwlock_init     libintl_rwlock_init
+#define glthread_rwlock_rdlock   libintl_rwlock_rdlock
+#define glthread_rwlock_wrlock   libintl_rwlock_wrlock
+#define glthread_rwlock_unlock   libintl_rwlock_unlock
+#define glthread_rwlock_destroy  libintl_rwlock_destroy
+#define glthread_recursive_lock_init     libintl_recursive_lock_init
+#define glthread_recursive_lock_lock     libintl_recursive_lock_lock
+#define glthread_recursive_lock_unlock   libintl_recursive_lock_unlock
+#define glthread_recursive_lock_destroy  libintl_recursive_lock_destroy
+#define glthread_once                 libintl_once
+#define glthread_once_call            libintl_once_call
+#define glthread_once_singlethreaded  libintl_once_singlethreaded
 #endif
 
 
Index: src/LyX.cpp
===================================================================
--- src/LyX.cpp (revision 38589)
+++ src/LyX.cpp (working copy)
@@ -292,10 +292,11 @@
        try {
                init_package(os::utf8_argv(0), string(), string(),
                        top_build_dir_is_one_level_up);
+               // we do not get to this point when init_package throws an 
exception
+               locale_init();
        } catch (ExceptionMessage const & message) {
                LYXERR(Debug::LOCALE, message.title_ + ", " + message.details_);
        }
-       locale_init();
 
        // Here we need to parse the command line. At least
        // we need to parse for "-dbg" and "-help"
Index: src/support/gettext.cpp
===================================================================
--- src/support/gettext.cpp     (revision 38589)
+++ src/support/gettext.cpp     (working copy)
@@ -38,9 +38,7 @@
        setlocale(LC_MESSAGES, "");
 #  endif
        setlocale(LC_CTYPE, "");
-       if (support::packageInitialized()) {
-               Messages::init();
-       }
+       Messages::init();
 #endif
        setlocale(LC_NUMERIC, "C");
 }
Index: src/support/Package.h
===================================================================
--- src/support/Package.h       (revision 38589)
+++ src/support/Package.h       (working copy)
@@ -52,8 +52,6 @@
                  std::string const & command_line_user_support_dir,
                  exe_build_dir_to_top_build_dir);
 
-bool packageInitialized();
-
 /** Accessor to the global data.
  *  Asserts that init_package() has been called first.
  */
Index: src/support/Messages.cpp
===================================================================
--- src/support/Messages.cpp    (revision 38589)
+++ src/support/Messages.cpp    (working copy)
@@ -64,7 +64,7 @@
 #  if HAVE_GETTEXT
 #    include <libintl.h>      // use the header already in the system *EK*
 #  else
-#    include "../../intl/libintl.h"
+#    include "intl/libintl.h"
 #  endif
 
 using namespace lyx::support;
Index: src/support/Package.cpp
===================================================================
--- src/support/Package.cpp     (revision 38589)
+++ src/support/Package.cpp     (working copy)
@@ -65,12 +65,6 @@
 }
 
 
-bool packageInitialized()
-{
-       return initialised_;
-}
-
-
 Package const & package()
 {
        LASSERT(initialised_, /**/);
Index: src/client/Messages.cpp
===================================================================
--- src/client/Messages.cpp     (revision 38589)
+++ src/client/Messages.cpp     (working copy)
@@ -77,7 +77,7 @@
 #  if HAVE_GETTEXT
 #    include <libintl.h>      // use the header already in the system *EK*
 #  else
-#    include "../../intl/libintl.h"
+#    include "intl/libintl.h"
 #  endif
 
 // This is a more traditional variant.

Reply via email to