On 05/21/2018 03:12 PM, Kornel Benko wrote:
>
> Am Montag, 21. Mai 2018 12:25:00 CEST schrieb Richard Kimberly Heck
> <rikih...@lyx.org>:
>
> > On 05/21/2018 11:47 AM, Kornel Benko wrote:
>
> > >
>
> > > Am Montag, 21. Mai 2018 11:21:30 CEST schrieb Richard Kimberly Heck
>
> > > <rikih...@lyx.org>:
>
> > >
>
> > > > On 05/19/2018 01:48 PM, Kornel Benko wrote:
>
> > >
>
> > > > >
>
> > >
>
> > > > > Am Samstag, 19. Mai 2018 17:42:41 CEST schrieb Jürgen Spitzmüller
>
> > >
>
> > > > > <sp...@lyx.org>:
>
> > >
>
> > > > >
>
> > >
>
> > > > > > Am Samstag, den 19.05.2018, 17:37 +0200 schrieb Kornel Benko:
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > Am Samstag, 19. Mai 2018 12:58:37 CEST schrieb Jürgen
>
> > > Spitzmüller <sp
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > i...@lyx.org>:
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > Am Samstag, den 19.05.2018, 12:07 +0200 schrieb Kornel
> Benko:
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > No, it does not. For windows it is using
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > 'development/cmake/lyx.rc'.
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > But, for reason I don't
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > understand, the icon creation is explicitly disabled
> if using
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > mingw.
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > See src/CMakeLists.txt:97
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > if(WIN32 AND NOT MINGW)
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > message(STATUS "Using icon defined in resource file:
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > ${FILE_RC}")
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > endif()
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > >
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > Is this relevant?
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > >
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > https://stackoverflow.com/questions/3526794/
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > >
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > Jürgen
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > >
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > > > Kornel
>
> > >
>
> > > > >
>
> > >
>
> > > > > > >
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > It is. Since we are compiling with mingw, both WIN32 and
> MINGW are
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > set.
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > In this case is FILE_RC not set, so that LyX.exe is not
>
> > > dependent on
>
> > >
>
> > > > >
>
> > >
>
> > > > > > > lyx.rc.
>
> > >
>
> > > > >
>
> > >
>
> > > > > >
>
> > >
>
> > > > >
>
> > >
>
> > > > > > I meant whether the stackexchange threat I posted was relevant,
>
> > > since
>
> > >
>
> > > > >
>
> > >
>
> > > > > > it deals with some setting that needs to be done for windres
>
> > > with MinGW
>
> > >
>
> > > > >
>
> > >
>
> > > > > > and cmake.
>
> > >
>
> > > > >
>
> > >
>
> > > > > >
>
> > >
>
> > > > >
>
> > >
>
> > > > > > Jürgen
>
> > >
>
> > > > >
>
> > >
>
> > > > >  
>
> > >
>
> > > > >
>
> > >
>
> > > > > Ah, OK. Should be doable that way. Provided one has windres. In my
>
> > >
>
> > > > > case, although ubuntu is based on debian,
>
> > >
>
> > > > >
>
> > >
>
> > > > > I don't get it through standard package sources.
>
> > >
>
> > > > >
>
> > >
>
> > > >
>
> > >
>
> > > > I seem to have windres, actually, though under a slightly different
>
> > >
>
> > > > name. It's part of the mingw32-binutils package, but is installed as
>
> > >
>
> > > > /usr/bin/i686-w64-mingw32-windres. There is code in
> CMakeLists.txt to
>
> > >
>
> > > > set this, and it seems to work:
>
> > >
>
> > > >
>
> > >
>
> > > > build/CMakeFiles/3.11.0/CMakeRCCompiler.cmake:set(CMAKE_RC_COMPILER
>
> > >
>
> > > > "/usr/bin/i686-w64-mingw32-windres")
>
> > >
>
> > > >
>
> > >
>
> > > > But it doesn't seem to get used anywhere.
>
> > >
>
> > > >
>
> > >
>
> > > > I guess all we need to do now is figure out where and how to
> invoke this
>
> > >
>
> > > > to build a resource file from /development/cmake/lyx.rc. The
> link that
>
> > >
>
> > > > Jürgen found suggests we need somthing like:
>
> > >
>
> > > >
>
> > >
>
> > > > ${CMAKE_RC_COMPILER} -O coff -i development/cmake/lyx.rc -o lyx.coff
>
> > >
>
> > > >
>
> > >
>
> > > > and then to link the lyx.coff file into the executable.
>
> > >
>
> > > >
>
> > >
>
> > > > Riki
>
> > >
>
> > > >
>
> > >
>
> > >  
>
> > >
>
> > > I found it too, but unfortunately it is not working.
>
> > >
>
> > > 1.) The RC-compiler grumbles about not able to find "config.h".
>
> > >
>
> > > 2.) Copying this file to '.' does not help either. This time because
>
> > > of undefined resource.
>
> > >
>
> > > 3.) /usr/bin/i686-w64-mingw32-windres --help does not give me a clue
>
> > > about the correct
>
> > >
>
> > > settings to be used.
>
> > >
>
> > >  
>
> > >
>
> > > I gave up.
>
> > >
>
> >
>
> > I had to change the lyx.rc file to use "/" instead of "\". Otherwise, of
>
> > course, it fails to find the icon file. But then I do get lyx.coff
>
> > (which I'm attaching in case you need to use it for testing). Now how to
>
> > link it into the main executable? (Well, and longer term, how to build
>
> > it automatically, though we could just put lyx.coff into
>
> > development/cmake/, too.)
>
> >
>
> > Riki
>
> >
>
>  
>
> I still get
>
> i686-w64-mingw32-windres: no resources
>
> src/CMakeFiles/LyX.dir/build.make:1531: recipe for target
> 'src/CMakeFiles/LyX.dir/__/development/cmake/lyx.rc.res' failed
>
>  
>
> What is this file 'lyx.coff' you write about, and how is it created?
>

GNU ld can't handle the res format, but it can handle coff apparently,
so you have to pass "-O coff" to windres to get it to build this. (The
`file' command says: Intel 80386 COFF object file.) Assuming it was
built right, I think we can just put it into our sources. It shouldn't
change unless either lyx.rc does or the icon itself does.

The attached defines FILE_RC as needed. I think all that's left is to
arrange for this to be linked into the binary. See e.g.
   
https://stackoverflow.com/questions/708238/how-do-i-add-an-icon-to-a-mingw-gcc-compiled-executable

Riki

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 39c751f3ff..3ae6820aa0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -94,9 +94,13 @@ if (LYX_VLD)
        lyx_add_info_files(VLD ${vld_files})
 endif()
 
-if(WIN32 AND NOT MINGW)
-       set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
-       message(STATUS "Using icon defined in resource file: ${FILE_RC}")
+if(WIN32)
+    if (MINGW)
+        set(FILE_RC ${TOP_CMAKE_PATH}/lyx.coff)
+    else()
+        set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
+    endif()
+    message(STATUS "Using icon defined in resource file: ${FILE_RC}")
 endif()
 
 lyx_find_info_files(LyXInfoFiles ${TOP_SRC_DIR}/*)

Reply via email to