Skip to content

Commit b926537

Browse files
committed
Fixed: Linux compilation
1 parent eb37381 commit b926537

28 files changed

Lines changed: 114 additions & 79 deletions

File tree

CMakelists.txt renamed to CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ option(IMCODEC_BUILD_CODEC_FREEIMAGE "Build Codec FREEIMAGE" FALSE)
2323

2424
option(IMCODEC_BUILD_EXAMPLES "Build Examples" TRUE)
2525

26+
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
27+
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
28+
endif()
29+
2630

2731
if ( ${IMCODEC_BUILD_CODEC_PSD})
2832
add_definitions(-DIMCODEC_BUILD_CODEC_PSD=1)
@@ -65,10 +69,10 @@ option(tinyxml2_BUILD_TESTING "Build tests for tinyxml2" OFF)
6569
add_subdirectory(./External/tinyxml2)
6670

6771
option(TINY_EXIF_BUILD_DEMO "build demo binary" OFF)
68-
add_subdirectory(./External/tinyEXIF)
72+
add_subdirectory(./External/TinyEXIF)
6973

7074
add_subdirectory(ImageCodec)
7175

72-
if (IMCODEC_BUILD_EXAMPLES)
76+
if (IMCODEC_BUILD_EXAMPLES AND IMCODEC_BUILD_CODEC_JPG AND IMCODEC_BUILD_CODEC_PNG)
7377
add_subdirectory(Example)
7478
endif()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ if ( ${IMCODEC_BUILD_CODEC_GIF})
1919
add_subdirectory(CodecGif)
2020
endif()
2121
if ( ${IMCODEC_BUILD_CODEC_TIFF})
22-
add_subdirectory(CodecTIFF)
22+
add_subdirectory(CodecTiff)
2323
endif()
2424
if ( ${IMCODEC_BUILD_CODEC_WEBP})
25-
add_subdirectory(CodecWEBP)
25+
add_subdirectory(CodecWebP)
2626
endif()
2727
if ( ${IMCODEC_BUILD_CODEC_FREEIMAGE})
2828
add_subdirectory(CodecFreeImage)

Codecs/CodecBMP/Source/CodecBMP.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ namespace IMCodec
107107
{ 0x20fda67, 0x8877, 0x4ead, { 0x8e, 0x8e, 0xd1, 0x54, 0x64, 0xb7, 0xc6, 0xc7 } }
108108

109109
,CodecCapabilities::Decode
110-
,L"BMP image codec"
110+
,LLUTILS_TEXT("BMP image codec")
111111
,
112112
{
113113
{
114-
{ L"Bitmap image file"}
115-
,{ L"bmp"}
114+
{ LLUTILS_TEXT("Bitmap image file")}
115+
,{ LLUTILS_TEXT("bmp")}
116116
}
117117
}
118118
}

Codecs/CodecDDS/Source/CodecDDS.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ namespace IMCodec
2020
// {252347B1-91E7-4C5C-8F06-726B0A52DE6D}
2121
{ 0x252347b1, 0x91e7, 0x4c5c, { 0x8f, 0x6, 0x72, 0x6b, 0xa, 0x52, 0xde, 0x6d } }
2222
,CodecCapabilities::Decode
23-
,L"NV_DDS image codec"
23+
,LLUTILS_TEXT("NV_DDS image codec")
2424
,
2525
{
2626
{
27-
{ L"DDS - DirectDraw Surface Image"}
28-
,{ L"dds"}
27+
{ LLUTILS_TEXT("DDS - DirectDraw Surface Image")}
28+
,{ LLUTILS_TEXT("dds")}
2929
}
3030
}
3131
}

Codecs/CodecGif/Source/CodecGif.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ namespace IMCodec
3838
// {1D076943-F907-426A-8DC6-838B8CCE320C}
3939
{ 0x1d076943, 0xf907, 0x426a, { 0x8d, 0xc6, 0x83, 0x8b, 0x8c, 0xce, 0x32, 0xc } }
4040
,CodecCapabilities::Decode
41-
, L"Gif Codec"
41+
, LLUTILS_TEXT("Gif Codec")
4242
,
4343
{
4444
{
45-
{ L"Graphics Interchange Format"}
46-
,{ L"gif"}
45+
{ LLUTILS_TEXT("Grapics Interchange Format")}
46+
,{ LLUTILS_TEXT("gif")}
4747
}
4848
}
4949
};

Codecs/CodecIcon/Source/CodecIcon.h

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ namespace IMCodec
3333
IcoDirEntry entry[1];
3434
};
3535

36+
struct BitmapInfoHeader
37+
{
38+
uint32_t biSize;
39+
int32_t biWidth;
40+
int32_t biHeight;
41+
uint16_t biPlanes;
42+
uint16_t biBitCount;
43+
uint32_t biCompression;
44+
uint32_t biSizeImage;
45+
int32_t biXPelsPerMeter;
46+
int32_t biYPelsPerMeter;
47+
uint32_t biClrUsed;
48+
uint32_t biClrImportant;
49+
};
50+
51+
3652
#pragma pack(pop)
3753

3854
class CodecIcon : public IImagePlugin
@@ -50,17 +66,17 @@ namespace IMCodec
5066
{ 0x1599fc40, 0x58df, 0x4950, { 0xa4, 0x9b, 0x28, 0x80, 0xe7, 0x28, 0xce, 0x0 } }
5167

5268
,CodecCapabilities::Decode
53-
, L"Icon/Cursor Codec"
69+
, LLUTILS_TEXT("Icon/Cursor Codec")
5470
,
5571
{
5672
{
57-
{ L"Windows Icon File"}
58-
,{ L"ico",L"icon"}
73+
{ LLUTILS_TEXT("Windows Icon File")}
74+
,{ LLUTILS_TEXT("ico"),LLUTILS_TEXT("icon")}
5975
}
6076
,
6177
{
62-
{ L"Windows Cursor File"}
63-
,{ L"cur"}
78+
{LLUTILS_TEXT("Windows Cursor File")}
79+
,{ LLUTILS_TEXT("cur")}
6480
}
6581
}
6682

@@ -121,8 +137,7 @@ namespace IMCodec
121137

122138
auto& currentDescriptor = imageItem->descriptor;
123139
const IcoDirEntry* currentEntry = (&icoFile->entry)[i];
124-
125-
const BITMAPINFOHEADER* bitmapInfo = reinterpret_cast<const BITMAPINFOHEADER*>(baseAddress + currentEntry->offsetData);
140+
const BitmapInfoHeader* bitmapInfo = reinterpret_cast<const BitmapInfoHeader*>(baseAddress + currentEntry->offsetData);
126141
if (bitmapInfo->biSize == 40)
127142
{
128143
if (bitmapInfo->biCompression != 0)
@@ -234,7 +249,7 @@ namespace IMCodec
234249
sIsLoading = true;
235250
static thread_local ImageLoader helper;
236251
ImageResult pngRes = helper.Decode(reinterpret_cast<const std::byte*>(baseAddress + currentEntry->offsetData), currentEntry->imageDataSize
237-
, ImageLoadFlags::None, {}, L"png", PluginTraverseMode::AnyPlugin, pngImage);
252+
, ImageLoadFlags::None, {}, LLUTILS_TEXT("png"), PluginTraverseMode::AnyPlugin, pngImage);
238253

239254
if (pngRes == ImageResult::Success)
240255
{

Codecs/CodecJPG/CMakeLists.txt

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

16-
set(CMAKE_ASM_NASM_COMPILER ${CMAKE_CURRENT_SOURCE_DIR}/../../External/bintools/nasm-2.15.05/nasm.exe)
16+
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
17+
set(CMAKE_ASM_NASM_COMPILER ${CMAKE_CURRENT_SOURCE_DIR}/../../External/bintools/nasm-2.15.05/nasm.exe)
18+
endif()
1719
#set(ENV{ASM_NASM} ${CMAKE_CURRENT_SOURCE_DIR}/../../External/bintools/nasm-2.15.05/nasm.exe)
1820

1921
#set(CMAKE_ASM_COMPILE_OBJECT "-I<CMAKE_CURRENT_SOURCE_DIR>/../../External/libjpeg-turbo/simd/nasm
@@ -30,4 +32,7 @@ add_subdirectory(${libjpeg-turboFolder} ./external/libjpeg-turbo)
3032
target_include_directories(${TargetName} PRIVATE ${libjpeg-turboFolder})
3133

3234
target_link_libraries(${TargetName} turbojpeg)
33-
target_link_options(${TargetName} PUBLIC "/DELAYLOAD:$<TARGET_FILE_BASE_NAME:turbojpeg>.dll")
35+
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
36+
target_link_options(${TargetName} PUBLIC "/DELAYLOAD:$<TARGET_FILE_BASE_NAME:turbojpeg>.dll")
37+
else()
38+
endif()

Codecs/CodecJPG/Source/CodecJpeg.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ namespace IMCodec
1515
// {7798CB6A-5546-4EAD-BA95-A114C8520D0D}
1616
{ 0x7798cb6a, 0x5546, 0x4ead, { 0xba, 0x95, 0xa1, 0x14, 0xc8, 0x52, 0xd, 0xd } }
1717
, CodecCapabilities::Encode | CodecCapabilities::Decode
18-
,L"TurboJpeg"
18+
,LLUTILS_TEXT("TurboJpeg")
1919
,
2020
{
2121
{
22-
{ L"Joint Photographic Experts Group"}
23-
,{ L"jpg",L"jpeg"}
22+
{ LLUTILS_TEXT("Joint Photographic Experts Group")}
23+
,{ LLUTILS_TEXT("jpg"),LLUTILS_TEXT("jpeg")}
2424
}
2525
}
2626
};
@@ -158,8 +158,9 @@ namespace IMCodec
158158
}
159159

160160
ImageResult GetEncoderParameters(ListParameterDescriptors& out_encodeParameters) override
161-
{
162-
out_encodeParameters = { {L"quality",L"double",L"Jpeg compression quality",L"Higher value means better quality",L"80",L"0",L"100"} };
161+
{
162+
out_encodeParameters = { {LLUTILS_TEXT("quality"),LLUTILS_TEXT("double"),LLUTILS_TEXT("Jpeg compression quality")
163+
,LLUTILS_TEXT("Higher value means better quality"),LLUTILS_TEXT("80"),LLUTILS_TEXT("0"),LLUTILS_TEXT("100")} };
163164
return ImageResult::Success;
164165
}
165166
};

Codecs/CodecPNG/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ add_library (${TargetName} ${sourceFiles} )
1414
option(ZLIB_BUILD_BINARIES "Build zlib test sample and example" OFF)
1515
set(LibPNGFolder ../../External/libpng)
1616
set(zlibFolder ../../External/zlib)
17+
cmake_path(ABSOLUTE_PATH zlibFolder NORMALIZE OUTPUT_VARIABLE zlibFolder)
1718

1819
#Remove -Wdeprecated-non-prototype for zblib
1920
if (IMCODEC_DISABLE_WARNINGS_EXTERNAL_LIBS)

Codecs/CodecPNG/Source/CodecPng.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ namespace IMCodec
5353
{ 0x22a82f61, 0x4c92, 0x432e, { 0x93, 0xeb, 0x63, 0x5e, 0x24, 0x54, 0x53, 0x6 } }
5454

5555
, CodecCapabilities::Decode | CodecCapabilities::Encode
56-
, L"PNG Codec"
56+
, LLUTILS_TEXT("PNG Codec")
5757
,
5858
{
5959
{
60-
{ L"Portable Network Graphics"}
61-
,{ L"png"}
60+
{ LLUTILS_TEXT("Portable Network Graphics")}
61+
,{ LLUTILS_TEXT("png")}
6262
}
6363
}
6464
};

0 commit comments

Comments
 (0)