kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #01730
Cross-Compiling under Linux for Windows
Hi,
I've tried to cross-compile under linux and it works! It is a hack though.
1. Make sure You have installed CMake 2.6.
2. Make sure You have installed mingw:
e.g.
f3nix@spider:~$ i586-mingw32msvc-gcc --version
i586-mingw32msvc-gcc (GCC) 4.2.1-sjlj (mingw32-2)
f3nix@spider:~$ i586-mingw32msvc-g++ --version
i586-mingw32msvc-g++ (GCC) 4.2.1-sjlj (mingw32-2)
3. Create a directory for a toolchain:
mkdir ~/devel/TC-mingw
4. Download Boost:
http://downloads.sourceforge.net/boost/boost_1_36_0.tar.bz2?modtime=1218749396&big_mirror=0
5. Extract Boost to the toolchain directory:
tar xvjf boost_1_36_0.tar.bz2 -C ~/devel/TC-mingw
6. Download wxWidgets:
http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.8.zip
7. Extract wxWidgets:
unzip wxMSW-2.8.8.zip
8. Cross-compile wxWidgets and install it:
Inside unpacked wxWidgets directory do:
mkdir build-release
cd build-release
../configure --enable-unicode --enable-monolithic --disable-shared
--with-msw --with-opengl --prefix=/home/f3nix/devel/TC-mingw
--host=i586-mingw32msvc --build=x86_64-linux
make
make install
NOTE:
If you are on x86 linux then use --build=i686-linux
9. Download zlib:
http://www.zlib.net/zlib-1.2.3.tar.gz
10. Extract zlib:
tar xvzf zlib-1.2.3.tar.gz
11. Cross-compile zlib and install it:
Inside unpacked zlib directory do:
CC=i586-mingw32msvc-gcc RANLIB=i586-mingw32msvc-ranlib ./configure
--prefix=/home/f3nix/TC-mingw/
make
make install
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.
13. Edit the MinGWResourceCompiler.cmake in the CMakeModules
directory. Change the windres.exe command to i586-mingw32msvc-windres
14. Create a build directory in the main kicad folder. Change to it and then:
cmake -DCMAKE_BUILD_TYPE=Release
-DCMAKE_TOOLCHAIN_FILE=/home/f3nix/devel/TC-mingw/TC-mingw.cmake
-DCMAKE_INSTALL_PREFIX=/home/f3nix/devel/kicad-win-cc
-DBOOST_INCLUDEDIR=/home/f3nix/devel/TC-mingw/boost_1_36_0 ../
make
make install
15. Copy the mingwm10.dll to the bin directory.
16. Test the binaries under Windows (wine does not seem to work)...
------------------------
I know these instructions are very rough, but I hope they will be helpful.
Happy cross-compiling!
Cheers,
Mateusz
--
AKA f3nix AKA metyl AKA skowri ;)
Follow ups