[opensuse-buildservice] cmake and MS Windows builds

Curious that there is no cmake for the Mingw build system on OBS. Is this because building cmake requires a pre-installed binary of cmake. A chicken and egg thing? How might one best accomplish that on OBS? -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Thu, Nov 15, 2018 at 11:49 AM Roger Oberholtzer <roger.oberholtzer@gmail.com> wrote:
Curious that there is no cmake for the Mingw build system on OBS.
Is this because building cmake requires a pre-installed binary of cmake. A chicken and egg thing?
How might one best accomplish that on OBS?
Foolish me... I was looking for a package called something like mingw64-cmake. But it seems that the package set up to cmake/configure a cross-compile is also called simply called cmake. So the order of the defined repos decides if you get that or a cmake that configures a Linux target. All is working. But is seems inconsistent. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Thu, Nov 15, 2018 at 01:24:53PM +0100, Roger Oberholtzer wrote:
On Thu, Nov 15, 2018 at 11:49 AM Roger Oberholtzer <roger.oberholtzer@gmail.com> wrote:
Curious that there is no cmake for the Mingw build system on OBS.
Is this because building cmake requires a pre-installed binary of cmake. A chicken and egg thing?
How might one best accomplish that on OBS?
Foolish me...
I was looking for a package called something like mingw64-cmake. But it seems that the package set up to cmake/configure a cross-compile is also called simply called cmake. So the order of the defined repos decides if you get that or a cmake that configures a Linux target.
All is working. But is seems inconsistent.
mingw99-XXX is binary/library for windows - a PE binary. Such binaries will only run on Windows. mingw99-cross-XXX is a cross compiling tool. Something that runs a Linux and produces a windows output. XXX is the Linux version of the tool. You would be looking for a mingw64-cross-cmake - but as this would be the same as a normal cmake, there is no need for such a package. Please note, that the build target is determined by cmake options - not any repository order or special cmake packages. %_mingw32_cmake/%_mingw64_cmake will do all the magic for cross compiling. Regards, MArtin -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Thu, Nov 15, 2018 at 8:06 PM Martin Koegler <martin.koegler@chello.at> wrote:
You would be looking for a mingw64-cross-cmake - but as this would be the same as a normal cmake, there is no need for such a package.
Of course it would be that name. But I was curious about how a non-cross cmake knew that you wanted to do a cross-compile for Windows. It is running on Linux, so I would have thought that was the default.
Please note, that the build target is determined by cmake options - not any repository order or special cmake packages.
%_mingw32_cmake/%_mingw64_cmake will do all the magic for cross compiling.
This is of course what I am doing. Anyway, all this was a false alarm. All is working fine. -- Roger Oberholtzer -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org

On Fri, Nov 16, 2018 at 11:44:33AM +0100, Roger Oberholtzer wrote:
On Thu, Nov 15, 2018 at 8:06 PM Martin Koegler <martin.koegler@chello.at> wrote: Of course it would be that name. But I was curious about how a non-cross cmake knew that you wanted to do a cross-compile for Windows. It is running on Linux, so I would have thought that was the default.
Setting lots options. Read /etc/rpm/macros.mingw* For non-rpm build, I would prefer a toolchain definition: Create toolchain definition for windows, file /inst/toolchain.def: --------------------------------------------------------------------- # the name of the target operating system SET(CMAKE_SYSTEM_NAME Windows) SET(MSYS 1) # which compilers to use for C and C++ SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc) SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++) SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres) SET(PKG_CONFIG_EXECUTABLE i686-w64-mingw32-pkg-config) # here is the target environment located SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /inst) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) --------------------------------------------------------------------- cmake -DCMAKE_TOOLCHAIN_FILE=/inst/toolchain.def .... -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (2)
-
Martin Koegler
-
Roger Oberholtzer