← Back to team overview

kicad-developers team mailing list archive

Re: Cross-Compiling under Linux for Windows

 

Hi,

2008/9/5 Mateusz Skowroński <skowri@xxxxxxxxx>:

> Hi,
> I've tried to cross-compile under linux and it works! It is a hack though.
>
>
>
> 12. Create a file named TC-mingw.cmake in the toolchain directory:
>
>  It should look like this:
>
> === CUT ===
>
> # the name of the target operating system
> set(CMAKE_SYSTEM_NAME Windows)
>
> # which compilers to use for C and C++
> set(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
> set(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
>
> # where is the target environment located
> set(CMAKE_FIND_ROOT_PATH
>    /usr/i586-mingw32msvc
>    /home/f3nix/devel/TC-mingw)
>
> # adjust the default bahaviour of the FIND_XXX() commands:
> # search programs in the host environment
> set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>
> # search headers and libraries in the target environment
> set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>
> === CUT ===
>
> NOTE:
>  Adjust the CMAKE_FIND_ROOT_PATH variable to your needs.
>

As of r1241 this file should look like this:

=== CUT ===
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C, C++ and resource files
set(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
set(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
set(CMAKE_RC_COMPILER i586-mingw32msvc-windres)

# where is the target environment located
set(CMAKE_FIND_ROOT_PATH
   /usr/i586-mingw32msvc
   /home/f3nix/devel/TC-mingw)

# adjust the default bahaviour of the FIND_XXX() commands:
# search programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# search headers and libraries in the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
=== CUT ===


> 13. Edit the MinGWResourceCompiler.cmake in the CMakeModules
> directory. Change the windres.exe command to i586-mingw32msvc-windres

This step is not necessary since r1241.

Cheers,
Mateusz

-- 
AKA f3nix AKA metyl AKA skowri ;)

References