Changeset 4f3fe48 in buchla-emu


Ignore:
Timestamp:
07/23/2017 04:41:10 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
8e1b163
Parents:
2a75e87
Message:

Support cross-build for Windows.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r2a75e87 r4f3fe48  
    11OS :=                   $(shell uname)
    22
     3ifndef WIN
     4GCC :=                  gcc
    35SDL2 :=                 /opt/sdl2
     6else
     7GCC :=                  x86_64-w64-mingw32-gcc
     8SDL2 :=                 /opt/sdl2-win
     9endif
     10
    411SDL2_INC :=             $(SDL2)/include
    512SDL2_LIB :=             $(SDL2)/lib
     
    1623                                -I cpu -I emu -I build -I $(SDL2_INC)
    1724
     25ifndef WIN
    1826ifeq ($(OS), Linux)
    1927FLAGS_EMU +=    -D EMU_LINUX
     
    4250                                -l iconv
    4351endif
     52else
     53FLAGS_EMU +=    -D EMU_WIN
     54FLAGS_LNK :=    $(FLAGS) -Wall -Wextra
     55LIBS :=                 -l mingw32 \
     56                                $(SDL2_LIB)/libSDL2.a \
     57                                $(SDL2_LIB)/libSDL2main.a \
     58                                $(SDL2_LIB)/libSDL2_ttf.a \
     59                                $(SDL2_LIB)/libfreetype.a \
     60                                -l gdi32 \
     61                                -l imm32 \
     62                                -l ole32 \
     63                                -l oleaut32 \
     64                                -l version \
     65                                -l winmm
     66endif
    4467
    4568HEADERS :=              $(wildcard cpu/*.h) $(wildcard emu/*.h)
     
    6790
    6891build/%.o:              build/%.c $(HEADERS)
    69                                 gcc $(FLAGS_CPU) -c -o $@ $<
     92                                $(GCC) $(FLAGS_CPU) -c -o $@ $<
    7093
    7194CPU_C :=                m68kcpu.c m68kdasm.c
     
    7497
    7598build/%.o:              cpu/%.c $(HEADERS) $(GEN_HP) | build
    76                                 gcc $(FLAGS_CPU) -c -o $@ $<
     99                                $(GCC) $(FLAGS_CPU) -c -o $@ $<
    77100
    78101EMU_C :=                main.c cpu.c vid.c fpu.c tim.c lcd.c ser.c mid.c fdd.c snd.c \
     
    82105
    83106build/%.o:              emu/%.c $(HEADERS) | build
    84                                 gcc $(FLAGS_EMU) -c -o $@ $<
     107                                $(GCC) $(FLAGS_EMU) -c -o $@ $<
    85108
    86109buchla:                 $(CPU_OP) $(GEN_OP)     $(EMU_OP)
    87                                 gcc $(FLAGS_LNK) -o buchla \
     110                                $(GCC) $(FLAGS_LNK) -o buchla \
    88111                                $(CPU_OP) $(GEN_OP) $(EMU_OP) \
    89112                                $(LIBS)
  • readme.txt

    r2a75e87 r4f3fe48  
    3232  https://www.freetype.org/
    3333
    34 Currently, the emulator supports Linux and OS X. A port to Windows
    35 should be pretty easy, given that it doesn't use any platform-specific
    36 features, just C99 and SDL2.
     34Currently, we build the emulator code natively on Linux and OS X. The
     35Windows version is cross-compiled on Linux using a x86_64-w64-mingw32
     36toolchain.
    3737
    38 Our Makefile expects all of the above libraries to reside in
    39 /opt/sdl2. This is how we typically install them:
     38For Linux and OS X, our Makefile expects all of the above libraries to
     39reside in /opt/sdl2. This is how we typically install them:
    4040
    4141  # Build and install FreeType first
     
    8585
    8686from the top-level directory of this repository to build the emulator.
     87
     88The cross-build for Windows is done similarly, with the following
     89differences when configuring the libraries:
     90
     91  * We use "--prefix=/opt/sdl2-win" instead of "--prefix=/opt/sdl2",
     92    so that the Windows versions of the libraries go to a different
     93    directory.
     94
     95  * We additionally specify "--host=x86_64-w64-mingw32" to enable
     96    cross-compilation.
     97
     98Then, to cross-build the emulator, invoke
     99
     100  make buchla WIN=1
     101
     102from the top-level directory of this repository.
    87103
    88104
Note: See TracChangeset for help on using the changeset viewer.