mirror of https://github.com/zxdos/zxuno.git
sdk: improve `cmake` usage for cross-compilation for Windows platform
This commit is contained in:
parent
9f4d22d86c
commit
e2a1c2a817
|
|
@ -0,0 +1,23 @@
|
|||
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# From https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/cross_compiling/Mingw
|
||||
|
||||
# the name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
SET(MINGW_VER i686-w64-mingw32)
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER ${MINGW_VER}-gcc)
|
||||
SET(CMAKE_CXX_COMPILER ${MINGW_VER}-g++)
|
||||
SET(CMAKE_RC_COMPILER ${MINGW_VER}-windres)
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/${MINGW_VER} )
|
||||
|
||||
# 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)
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
# SPDX-FileCopyrightText: 2021 Ivan Tatarinov <ivan-tat@ya.ru>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# From https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/cross_compiling/Mingw
|
||||
|
||||
# the name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
SET(MINGW_VER x86_64-w64-mingw32)
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER ${MINGW_VER}-gcc)
|
||||
SET(CMAKE_CXX_COMPILER ${MINGW_VER}-g++)
|
||||
SET(CMAKE_RC_COMPILER ${MINGW_VER}-windres)
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/${MINGW_VER} )
|
||||
|
||||
# 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)
|
||||
|
|
@ -20,20 +20,12 @@
|
|||
|
||||
include ../../common.mk
|
||||
|
||||
CMAKEFLAGS :=
|
||||
|
||||
ifeq ($(BUILD),mingw32)
|
||||
CMAKEFLAGS += CMAKE_SYSTEM_NAME=Windows
|
||||
CMAKEFLAGS += CMAKE_SYSTEM_PROCESSOR=x86
|
||||
CMAKEFLAGS += CMAKE_C_COMPILER=i686-w64-mingw32-gcc
|
||||
CMAKEFLAGS += CMAKE_CXX_COMPILER=i686-w64-mingw32-g++
|
||||
CMAKEFLAGS := $(patsubst %,-D%,$(CMAKEFLAGS))
|
||||
CMAKEFLAGS := -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw32.cmake
|
||||
else ifeq ($(BUILD),mingw64)
|
||||
CMAKEFLAGS += CMAKE_SYSTEM_NAME=Windows
|
||||
CMAKEFLAGS += CMAKE_SYSTEM_PROCESSOR=AMD64
|
||||
CMAKEFLAGS += CMAKE_C_COMPILER=x86_64-w64-mingw32-gcc
|
||||
CMAKEFLAGS += CMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++
|
||||
CMAKEFLAGS := $(patsubst %,-D%,$(CMAKEFLAGS))
|
||||
CMAKEFLAGS := -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw64.cmake
|
||||
else
|
||||
CMAKEFLAGS :=
|
||||
endif
|
||||
|
||||
SJASMPLUS := sjasmplus$(EXECEXT)
|
||||
|
|
|
|||
Loading…
Reference in New Issue