From a6216eaa7523be69bb2dd13eaf113595a21ddeaa Mon Sep 17 00:00:00 2001 From: Lior Date: Wed, 26 Jun 2024 20:50:44 +0300 Subject: [PATCH] Fixed: Cross compilation with MinGW-12 under Linux --- .gitignore | 1 + CMakeLists.txt | 11 +++++++++++ Codecs/CodecJPG/CMakeLists.txt | 2 +- External/libjpeg-turbo | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 27b3eea..d0c0764 100644 --- a/.gitignore +++ b/.gitignore @@ -384,3 +384,4 @@ MigrationBackup/ #Exteranls /CMakeSettings.json out/ +/build* \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 8983b39..ca84a8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,17 @@ project(ImageCodec) #Image Codec set(CMAKE_CXX_STANDARD 20) +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") + message("Cross compiling: Host: linux, Target: Windows") + set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) + set(CMAKE_SYSTEM_PROCESSOR x86_64) + set(CMAKE_SYSTEM_VERSION 10) +endif() + + include_directories(./ImageCodec/Include) include_directories(./External/LLUtils/Include) diff --git a/Codecs/CodecJPG/CMakeLists.txt b/Codecs/CodecJPG/CMakeLists.txt index 9a8e8e2..405fa43 100644 --- a/Codecs/CodecJPG/CMakeLists.txt +++ b/Codecs/CodecJPG/CMakeLists.txt @@ -13,7 +13,7 @@ add_library (${TargetName} ${sourceFiles} ) set(libjpeg-turboFolder ../../External/libjpeg-turbo) #Enable ASM provided by NASM -if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND NOT ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") set(CMAKE_ASM_NASM_COMPILER ${CMAKE_CURRENT_SOURCE_DIR}/../../External/bintools/nasm-2.15.05/nasm.exe) endif() #set(ENV{ASM_NASM} ${CMAKE_CURRENT_SOURCE_DIR}/../../External/bintools/nasm-2.15.05/nasm.exe) diff --git a/External/libjpeg-turbo b/External/libjpeg-turbo index b21c7be..b165110 160000 --- a/External/libjpeg-turbo +++ b/External/libjpeg-turbo @@ -1 +1 @@ -Subproject commit b21c7be108a5936fbdc8aa117aa05f5a8ea3fbc8 +Subproject commit b165110aaab51aeaabad60f6ecc7c5287e8042d4