From e40e7f697c8ea7f3e19cddb52346d25810c64c86 Mon Sep 17 00:00:00 2001 From: Andrei Date: Sat, 5 Oct 2019 15:28:00 +0300 Subject: [PATCH] added base crossplatform files and mingw win32 and win64 --- ProjectOut.cmake | 6 +++++ Version.cmake | 5 ++++ ccache.cmake | 6 +++++ crossplatform/Linux/utils/win-base.cmake | 31 ++++++++++++++++++++++++ crossplatform/Linux/win32-g++.cmake | 21 ++++++++++++++++ crossplatform/Linux/win64-g++.cmake | 20 +++++++++++++++ crossplatform/crossplatform.cmake | 27 +++++++++++++++++++++ 7 files changed, 116 insertions(+) create mode 100755 crossplatform/Linux/utils/win-base.cmake create mode 100755 crossplatform/Linux/win32-g++.cmake create mode 100755 crossplatform/Linux/win64-g++.cmake create mode 100755 crossplatform/crossplatform.cmake diff --git a/ProjectOut.cmake b/ProjectOut.cmake index 9ad59c5..114a1aa 100644 --- a/ProjectOut.cmake +++ b/ProjectOut.cmake @@ -5,6 +5,12 @@ # of this license document, but changing it is not allowed. # +if(DEFINED PROJECT_OUT_SUPPORT) + return() +else() + set(PROJECT_OUT_SUPPORT 1) +endif() + IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Release) ENDIF(NOT CMAKE_BUILD_TYPE) diff --git a/Version.cmake b/Version.cmake index 02459a9..6b96fa8 100644 --- a/Version.cmake +++ b/Version.cmake @@ -5,6 +5,11 @@ # of this license document, but changing it is not allowed. # +if(DEFINED PROJECT_VERSIONS_SUPPORT) + return() +else() + set(PROJECT_VERSIONS_SUPPORT 1) +endif() function(setVersion maj min rev) diff --git a/ccache.cmake b/ccache.cmake index 30c10c4..251baaa 100644 --- a/ccache.cmake +++ b/ccache.cmake @@ -5,6 +5,12 @@ # of this license document, but changing it is not allowed. # +if(DEFINED CCACHE_SUPPORT) + return() +else() + set(CCACHE_SUPPORT 1) +endif() + find_program(CCACHE_PROGRAM ccache) if(CCACHE_PROGRAM) message("using ccache in ${CCACHE_PROGRAM}") diff --git a/crossplatform/Linux/utils/win-base.cmake b/crossplatform/Linux/utils/win-base.cmake new file mode 100755 index 0000000..9bd38ff --- /dev/null +++ b/crossplatform/Linux/utils/win-base.cmake @@ -0,0 +1,31 @@ +# +# Copyright (C) 2018-2019 QuasarApp. +# Distributed under the MIT software license, see the accompanying +# Everyone is permitted to copy and distribute verbatim copies +# of this license document, but changing it is not allowed. +# + +if(DEFINED CROSSPLATFORM_BUILD_TOOLCHAIN_WIN_BASE) + return() +else() + set(CROSSPLATFORM_BUILD_TOOLCHAIN_WIN_BASE 1) +endif() + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Windows) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER ${PLATFORM_COMPILLER_NAME}-${BASE_COMPILLER_NAME}-gcc) +SET(CMAKE_CXX_COMPILER ${PLATFORM_COMPILLER_NAME}-${BASE_COMPILLER_NAME}-g++) +SET(CMAKE_RC_COMPILER ${PLATFORM_COMPILLER_NAME}-${BASE_COMPILLER_NAME}-windres) + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH /usr/${PLATFORM_COMPILLER_NAME}-${BASE_COMPILLER_NAME}) + +# 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) + diff --git a/crossplatform/Linux/win32-g++.cmake b/crossplatform/Linux/win32-g++.cmake new file mode 100755 index 0000000..2a75640 --- /dev/null +++ b/crossplatform/Linux/win32-g++.cmake @@ -0,0 +1,21 @@ +# +# Copyright (C) 2018-2019 QuasarApp. +# Distributed under the MIT software license, see the accompanying +# Everyone is permitted to copy and distribute verbatim copies +# of this license document, but changing it is not allowed. +# + +if(DEFINED CROSSPLATFORM_BUILD_TOOLCHAIN_WIN_32) + return() +else() + set(CROSSPLATFORM_BUILD_TOOLCHAIN_WIN_32 1) +endif() + + +# the name of the target operating system +SET(BASE_COMPILLER_NAME w64-mingw32) +SET(PLATFORM_COMPILLER_NAME i686) + + +include(${CMAKE_CURRENT_LIST_DIR}/utils/win-base.cmake) + diff --git a/crossplatform/Linux/win64-g++.cmake b/crossplatform/Linux/win64-g++.cmake new file mode 100755 index 0000000..5e698a2 --- /dev/null +++ b/crossplatform/Linux/win64-g++.cmake @@ -0,0 +1,20 @@ +# +# Copyright (C) 2018-2019 QuasarApp. +# Distributed under the MIT software license, see the accompanying +# Everyone is permitted to copy and distribute verbatim copies +# of this license document, but changing it is not allowed. +# + +if(DEFINED CROSSPLATFORM_BUILD_TOOLCHAIN_WIN_64) + return() +else() + set(CROSSPLATFORM_BUILD_TOOLCHAIN_WIN_64 1) +endif() + +# the name of the target operating system +SET(BASE_COMPILLER_NAME w64-mingw32) +SET(PLATFORM_COMPILLER_NAME x86_64) + + +include(${CMAKE_CURRENT_LIST_DIR}/utils/win-base.cmake) + diff --git a/crossplatform/crossplatform.cmake b/crossplatform/crossplatform.cmake new file mode 100755 index 0000000..cdf2943 --- /dev/null +++ b/crossplatform/crossplatform.cmake @@ -0,0 +1,27 @@ +# +# Copyright (C) 2018-2019 QuasarApp. +# Distributed under the MIT software license, see the accompanying +# Everyone is permitted to copy and distribute verbatim copies +# of this license document, but changing it is not allowed. +# + +if(DEFINED CROSSPLATFORM_BUILD_TOOLCHAIN) + return() +else() + set(CROSSPLATFORM_BUILD_TOOLCHAIN 1) +endif() + +# use TRGET_PLATFORM_LOOLCHAIN + +set(CROSSPLATFORM_BUILD_TOOLCHAIN_PATH ${CMAKE_CURRENT_LIST_DIR}/${CMAKE_HOST_SYSTEM_NAME}/${TRGET_PLATFORM_TOOLCHAIN}) + +if(EXISTS ${CROSSPLATFORM_BUILD_TOOLCHAIN_PATH}) + + message("${TRGET_PLATFORM_TOOLCHAIN} exits in ${CROSSPLATFORM_BUILD_TOOLCHAIN_PATH}") + + include(${CROSSPLATFORM_BUILD_TOOLCHAIN_PATH}) + +else(EXISTS ${CROSSPLATFORM_BUILD_TOOLCHAIN_PATH}) + message("${TRGET_PLATFORM_TOOLCHAIN} not exits in ${CROSSPLATFORM_BUILD_TOOLCHAIN_PATH}") +endif() +