Skip to content

Commit a6216ea

Browse files
committed
Fixed: Cross compilation with MinGW-12 under Linux
1 parent b17ad23 commit a6216ea

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,3 +384,4 @@ MigrationBackup/
384384
#Exteranls
385385
/CMakeSettings.json
386386
out/
387+
/build*

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ project(ImageCodec)
44
#Image Codec
55
set(CMAKE_CXX_STANDARD 20)
66

7+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
8+
message("Cross compiling: Host: linux, Target: Windows")
9+
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
10+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
11+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
12+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
13+
set(CMAKE_SYSTEM_PROCESSOR x86_64)
14+
set(CMAKE_SYSTEM_VERSION 10)
15+
endif()
16+
17+
718
include_directories(./ImageCodec/Include)
819
include_directories(./External/LLUtils/Include)
920

Codecs/CodecJPG/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ add_library (${TargetName} ${sourceFiles} )
1313
set(libjpeg-turboFolder ../../External/libjpeg-turbo)
1414
#Enable ASM provided by NASM
1515

16-
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
16+
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows" AND NOT ${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
1717
set(CMAKE_ASM_NASM_COMPILER ${CMAKE_CURRENT_SOURCE_DIR}/../../External/bintools/nasm-2.15.05/nasm.exe)
1818
endif()
1919
#set(ENV{ASM_NASM} ${CMAKE_CURRENT_SOURCE_DIR}/../../External/bintools/nasm-2.15.05/nasm.exe)

External/libjpeg-turbo

0 commit comments

Comments
 (0)