forked from libjpeg-turbo/libjpeg-turbo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
2065 lines (1868 loc) · 87.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
cmake_minimum_required(VERSION 2.8.12...3.28)
if(CMAKE_EXECUTABLE_SUFFIX)
set(CMAKE_EXECUTABLE_SUFFIX_TMP ${CMAKE_EXECUTABLE_SUFFIX})
endif()
project(libjpeg-turbo C)
set(VERSION 3.0.91)
set(COPYRIGHT_YEAR "1991-2024")
string(REPLACE "." ";" VERSION_TRIPLET ${VERSION})
list(GET VERSION_TRIPLET 0 VERSION_MAJOR)
list(GET VERSION_TRIPLET 1 VERSION_MINOR)
list(GET VERSION_TRIPLET 2 VERSION_REVISION)
function(pad_number NUMBER OUTPUT_LEN)
string(LENGTH "${${NUMBER}}" INPUT_LEN)
if(INPUT_LEN LESS OUTPUT_LEN)
math(EXPR ZEROES "${OUTPUT_LEN} - ${INPUT_LEN} - 1")
set(NUM ${${NUMBER}})
foreach(C RANGE ${ZEROES})
set(NUM "0${NUM}")
endforeach()
set(${NUMBER} ${NUM} PARENT_SCOPE)
endif()
endfunction()
set(TMP_VERSION_MINOR ${VERSION_MINOR})
set(TMP_VERSION_REVISION ${VERSION_REVISION})
pad_number(TMP_VERSION_MINOR 3)
pad_number(TMP_VERSION_REVISION 3)
set(LIBJPEG_TURBO_VERSION_NUMBER
${VERSION_MAJOR}${TMP_VERSION_MINOR}${TMP_VERSION_REVISION})
set(MSVC_LIKE 0)
if(MSVC OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC")
set(MSVC_LIKE 1)
endif()
# The libjpeg-turbo build system has never supported and will never support
# being integrated into another build system using add_subdirectory(), because
# doing so would require that we (minimally):
#
# 1. avoid using certain CMake variables, such as CMAKE_SOURCE_DIR,
# CMAKE_BINARY_DIR, and CMAKE_PROJECT_NAME;
# 2. avoid using implicit include directories and relative paths;
# 3. optionally provide a way to skip the installation of libjpeg-turbo
# components when the 'install' target is built;
# 4. optionally provide a way to postfix target names, to avoid namespace
# conflicts;
# 5. restructure the top-level CMakeLists.txt so that it properly sets the
# PROJECT_VERSION variable; and
# 6. design automated regression tests to ensure that new commits don't break
# any of the above.
#
# Even if we did all of that, issues would still arise, because it is
# impossible for an upstream build system to anticipate the widely varying
# needs of every downstream build system. That's why the CMake
# ExternalProject_Add() function exists. Downstream projects that wish to
# integrate libjpeg-turbo as a subdirectory should either use
# ExternalProject_Add() or make downstream modifications to the libjpeg-turbo
# build system to suit their specific needs. Please do not file bug reports,
# feature requests, or pull requests regarding this.
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(FATAL_ERROR "The libjpeg-turbo build system cannot be integrated into another build system using add_subdirectory(). Use ExternalProject_Add() instead.")
endif()
# CMake 3.14 and later sets CMAKE_MACOSX_BUNDLE to TRUE by default when
# CMAKE_SYSTEM_NAME is iOS, tvOS, or watchOS, which breaks the libjpeg-turbo
# build. (Specifically, when CMAKE_MACOSX_BUNDLE is TRUE, executables for
# Apple platforms are built as application bundles, which causes CMake to
# complain that our install() directives for executables do not specify a
# BUNDLE DESTINATION. Even if CMake did not complain, building executables as
# application bundles would break our iOS packages.)
set(CMAKE_MACOSX_BUNDLE FALSE)
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY
GENERATOR_IS_MULTI_CONFIG)
# If the GENERATOR_IS_MULTI_CONFIG property doesn't exist (CMake < 3.9), then
# set the GENERATOR_IS_MULTI_CONFIG variable manually if the generator is
# Visual Studio or Xcode (the only multi-config generators in CMake < 3.9).
if(NOT GENERATOR_IS_MULTI_CONFIG AND (MSVC_IDE OR XCODE))
set(GENERATOR_IS_MULTI_CONFIG TRUE)
endif()
string(TIMESTAMP DEFAULT_BUILD "%Y%m%d")
set(BUILD ${DEFAULT_BUILD} CACHE STRING "Build string (default: ${DEFAULT_BUILD})")
# NOTE: On Windows, this does nothing except when using MinGW or Cygwin.
# CMAKE_BUILD_TYPE has no meaning in Visual Studio, and it always defaults to
# Debug when using NMake.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}")
include(cmakescripts/PackageInfo.cmake)
# Detect CPU type and whether we're building 64-bit or 32-bit code
math(EXPR BITS "${CMAKE_SIZEOF_VOID_P} * 8")
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_LC)
set(COUNT 1)
foreach(ARCH ${CMAKE_OSX_ARCHITECTURES})
if(COUNT GREATER 1)
message(FATAL_ERROR "libjpeg-turbo contains assembly code, so it cannot be built with multiple values in CMAKE_OSX_ARCHITECTURES.")
endif()
math(EXPR COUNT "${COUNT}+1")
endforeach()
if(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86_64" OR
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "amd64" OR
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "i[0-9]86" OR
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "x86" OR
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "ia32")
if(BITS EQUAL 64 OR CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
set(CPU_TYPE x86_64)
else()
set(CPU_TYPE i386)
endif()
if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ${CPU_TYPE})
set(CMAKE_SYSTEM_PROCESSOR ${CPU_TYPE})
endif()
elseif(CMAKE_SYSTEM_PROCESSOR_LC STREQUAL "aarch64" OR
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^arm")
if(BITS EQUAL 64)
set(CPU_TYPE arm64)
else()
set(CPU_TYPE arm)
endif()
elseif(CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^ppc" OR
CMAKE_SYSTEM_PROCESSOR_LC MATCHES "^powerpc")
set(CPU_TYPE powerpc)
else()
set(CPU_TYPE ${CMAKE_SYSTEM_PROCESSOR_LC})
endif()
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR
CMAKE_OSX_ARCHITECTURES MATCHES "arm64" OR
CMAKE_OSX_ARCHITECTURES MATCHES "i386")
set(CPU_TYPE ${CMAKE_OSX_ARCHITECTURES})
endif()
if(CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
set(CPU_TYPE powerpc)
endif()
if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64")
set(CPU_TYPE arm64)
endif()
message(STATUS "${BITS}-bit build (${CPU_TYPE})")
###############################################################################
# INSTALL DIRECTORIES
###############################################################################
if(WIN32)
if(MSVC_LIKE)
set(CMAKE_INSTALL_DEFAULT_PREFIX "c:/${CMAKE_PROJECT_NAME}")
else()
set(CMAKE_INSTALL_DEFAULT_PREFIX "c:/${CMAKE_PROJECT_NAME}-gcc")
endif()
if(BITS EQUAL 64)
set(CMAKE_INSTALL_DEFAULT_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}64")
endif()
else()
if(NOT CMAKE_INSTALL_DEFAULT_PREFIX)
set(CMAKE_INSTALL_DEFAULT_PREFIX /opt/${CMAKE_PROJECT_NAME})
endif()
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_DEFAULT_PREFIX}" CACHE PATH
"Directory into which to install ${CMAKE_PROJECT_NAME} (default: ${CMAKE_INSTALL_DEFAULT_PREFIX})"
FORCE)
endif()
message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
# When the prefix is /opt/${CMAKE_PROJECT_NAME}, we assume that an "official"
# build is being created, and thus we install things into specific locations.
if(CMAKE_INSTALL_PREFIX STREQUAL "${CMAKE_INSTALL_DEFAULT_PREFIX}")
set(CMAKE_INSTALL_DEFAULT_DATAROOTDIR "")
set(CMAKE_INSTALL_DEFAULT_DOCDIR "<CMAKE_INSTALL_DATAROOTDIR>/doc")
set(CMAKE_INSTALL_DEFAULT_JAVADIR "<CMAKE_INSTALL_DATAROOTDIR>/classes")
if(UNIX AND NOT APPLE)
if(BITS EQUAL 64)
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib64")
elseif(CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
set(CMAKE_INSTALL_DEFAULT_LIBDIR "libx32")
else()
set(CMAKE_INSTALL_DEFAULT_LIBDIR "lib32")
endif()
endif()
endif()
include(cmakescripts/GNUInstallDirs.cmake)
macro(report_directory var)
if(CMAKE_INSTALL_${var} STREQUAL CMAKE_INSTALL_FULL_${var})
message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}}")
else()
message(STATUS "CMAKE_INSTALL_${var} = ${CMAKE_INSTALL_${var}} (${CMAKE_INSTALL_FULL_${var}})")
endif()
mark_as_advanced(CLEAR CMAKE_INSTALL_${var})
endmacro()
set(DIRLIST "BINDIR;DATAROOTDIR;DOCDIR;INCLUDEDIR;LIBDIR")
if(UNIX)
list(APPEND DIRLIST "MANDIR")
endif()
foreach(dir ${DIRLIST})
report_directory(${dir})
endforeach()
###############################################################################
# CONFIGURATION OPTIONS
###############################################################################
macro(boolean_number var)
if(${var})
set(${var} 1 ${ARGN})
else()
set(${var} 0 ${ARGN})
endif()
endmacro()
option(ENABLE_SHARED "Build shared libraries" TRUE)
boolean_number(ENABLE_SHARED)
option(ENABLE_STATIC "Build static libraries" TRUE)
boolean_number(ENABLE_STATIC)
option(REQUIRE_SIMD
"Generate a fatal error if SIMD extensions are not available for this platform (default is to fall back to a non-SIMD build)"
FALSE)
boolean_number(REQUIRE_SIMD)
option(WITH_ARITH_DEC
"Include arithmetic decoding support when emulating the libjpeg v6b API/ABI"
TRUE)
boolean_number(WITH_ARITH_DEC)
option(WITH_ARITH_ENC
"Include arithmetic encoding support when emulating the libjpeg v6b API/ABI"
TRUE)
boolean_number(WITH_ARITH_ENC)
if(CMAKE_C_COMPILER_ABI MATCHES "ELF X32")
set(WITH_JAVA 0)
else()
option(WITH_JAVA
"Build Java wrapper for the TurboJPEG API library (implies ENABLE_SHARED=1)"
FALSE)
boolean_number(WITH_JAVA)
endif()
option(WITH_JPEG7
"Emulate libjpeg v7 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)"
FALSE)
boolean_number(WITH_JPEG7)
option(WITH_JPEG8
"Emulate libjpeg v8 API/ABI (this makes ${CMAKE_PROJECT_NAME} backward-incompatible with libjpeg v6b)"
FALSE)
boolean_number(WITH_JPEG8)
option(WITH_SIMD "Include SIMD extensions, if available for this platform" TRUE)
boolean_number(WITH_SIMD)
option(WITH_TURBOJPEG
"Include the TurboJPEG API library and associated test programs" TRUE)
boolean_number(WITH_TURBOJPEG)
option(WITH_FUZZ "Build fuzz targets" FALSE)
macro(report_option var desc)
if(${var})
message(STATUS "${desc} enabled (${var} = ${${var}})")
else()
message(STATUS "${desc} disabled (${var} = ${${var}})")
endif()
endmacro()
if(WITH_JAVA)
set(ENABLE_SHARED 1)
endif()
# Explicitly setting CMAKE_POSITION_INDEPENDENT_CODE=FALSE disables PIC for all
# targets, which will cause the shared library builds to fail. Thus, if shared
# libraries are enabled and CMAKE_POSITION_INDEPENDENT_CODE is explicitly set
# to FALSE, we need to unset it, thus restoring the default behavior
# (automatically using PIC for shared library targets.)
if(DEFINED CMAKE_POSITION_INDEPENDENT_CODE AND
NOT CMAKE_POSITION_INDEPENDENT_CODE AND ENABLE_SHARED)
unset(CMAKE_POSITION_INDEPENDENT_CODE CACHE)
endif()
report_option(ENABLE_SHARED "Shared libraries")
report_option(ENABLE_STATIC "Static libraries")
if(ENABLE_SHARED)
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
endif()
if(WITH_JPEG8 OR WITH_JPEG7)
set(WITH_ARITH_ENC 1)
set(WITH_ARITH_DEC 1)
endif()
if(WITH_ARITH_DEC)
set(D_ARITH_CODING_SUPPORTED 1)
endif()
report_option(WITH_ARITH_DEC "Arithmetic decoding support")
if(WITH_ARITH_ENC)
set(C_ARITH_CODING_SUPPORTED 1)
endif()
report_option(WITH_ARITH_ENC "Arithmetic encoding support")
report_option(WITH_TURBOJPEG "TurboJPEG API library")
report_option(WITH_JAVA "TurboJPEG Java wrapper")
if(NOT WITH_JPEG8)
set(MEM_SRCDST_FUNCTIONS "global: jpeg_mem_dest; jpeg_mem_src;")
endif()
# 0: Original libjpeg v6b/v7/v8 API/ABI
#
# libjpeg v6b/v7 API/ABI emulation:
# 1: + In-memory source/destination managers (libjpeg-turbo 1.3.x)
# 2: + Partial image decompression functions (libjpeg-turbo 1.5.x)
# 3: + ICC functions (libjpeg-turbo 2.0.x)
# 4: + 12-bit-per-sample and lossless functions (libjpeg-turbo 3.0.x)
#
# libjpeg v8 API/ABI emulation:
# 1: + Partial image decompression functions (libjpeg-turbo 1.5.x)
# 2: + ICC functions (libjpeg-turbo 2.0.x)
# 3: + 12-bit-per-sample and lossless functions (libjpeg-turbo 3.0.x)
set(SO_AGE 3)
if(NOT WITH_JPEG8)
set(SO_AGE 4)
endif()
if(WITH_JPEG8)
set(JPEG_LIB_VERSION 80)
elseif(WITH_JPEG7)
set(JPEG_LIB_VERSION 70)
else()
set(JPEG_LIB_VERSION 62)
endif()
math(EXPR JPEG_LIB_VERSION_DIV10 "${JPEG_LIB_VERSION} / 10")
math(EXPR JPEG_LIB_VERSION_MOD10 "${JPEG_LIB_VERSION} % 10")
if(JPEG_LIB_VERSION STREQUAL "62")
set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION})
else()
set(DEFAULT_SO_MAJOR_VERSION ${JPEG_LIB_VERSION_DIV10})
endif()
if(JPEG_LIB_VERSION STREQUAL "80")
set(DEFAULT_SO_MINOR_VERSION 2)
else()
set(DEFAULT_SO_MINOR_VERSION 0)
endif()
# This causes SO_MAJOR_VERSION/SO_MINOR_VERSION to reset to defaults if
# WITH_JPEG7 or WITH_JPEG8 has changed.
if((DEFINED WITH_JPEG7_INT AND NOT WITH_JPEG7 EQUAL WITH_JPEG7_INT) OR
(DEFINED WITH_JPEG8_INT AND NOT WITH_JPEG8 EQUAL WITH_JPEG8_INT))
set(FORCE_SO_VERSION "FORCE")
endif()
set(WITH_JPEG7_INT ${WITH_JPEG7} CACHE INTERNAL "")
set(WITH_JPEG8_INT ${WITH_JPEG8} CACHE INTERNAL "")
set(SO_MAJOR_VERSION ${DEFAULT_SO_MAJOR_VERSION} CACHE STRING
"Major version of the libjpeg API shared library (default: ${DEFAULT_SO_MAJOR_VERSION})"
${FORCE_SO_VERSION})
set(SO_MINOR_VERSION ${DEFAULT_SO_MINOR_VERSION} CACHE STRING
"Minor version of the libjpeg API shared library (default: ${DEFAULT_SO_MINOR_VERSION})"
${FORCE_SO_VERSION})
set(JPEG_LIB_VERSION_DECIMAL "${JPEG_LIB_VERSION_DIV10}.${JPEG_LIB_VERSION_MOD10}")
message(STATUS "Emulating libjpeg API/ABI v${JPEG_LIB_VERSION_DECIMAL} (WITH_JPEG7 = ${WITH_JPEG7}, WITH_JPEG8 = ${WITH_JPEG8})")
message(STATUS "libjpeg API shared library version = ${SO_MAJOR_VERSION}.${SO_AGE}.${SO_MINOR_VERSION}")
# Because the TurboJPEG API library uses versioned symbols and changes the
# names of functions whenever they are modified in a backward-incompatible
# manner, it is always backward-ABI-compatible with itself, so the major and
# minor SO versions don't change. However, we increase the middle number (the
# SO "age") whenever functions are added to the API, because adding functions
# affects forward API/ABI compatibility.
set(TURBOJPEG_SO_MAJOR_VERSION 0)
# 0: TurboJPEG 1.3.x API
# 1: TurboJPEG 1.4.x API
# The TurboJPEG 1.5.x API modified some of the function prototypes, adding
# the const keyword in front of pointers to unmodified buffers, but that did
# not affect forward API/ABI compatibility.
# 2: TurboJPEG 2.0.x API
# The TurboJPEG 2.1.x API modified the behavior of the tjDecompressHeader3()
# function so that it accepts "abbreviated table specification" (AKA
# "tables-only") datastreams as well as JPEG images, but that did not affect
# forward API/ABI compatibility.
# 3: TurboJPEG 3.0.x API
# 4: TurboJPEG 3.1.x API
set(TURBOJPEG_SO_AGE 4)
set(TURBOJPEG_SO_VERSION 0.${TURBOJPEG_SO_AGE}.0)
###############################################################################
# COMPILER SETTINGS
###############################################################################
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UC)
if(MSVC_LIKE)
option(WITH_CRT_DLL
"Link all ${CMAKE_PROJECT_NAME} libraries and executables with the C run-time DLL (msvcr*.dll) instead of the static C run-time library (libcmt*.lib.) The default is to use the C run-time DLL only with the libraries and executables that need it."
FALSE)
boolean_number(WITH_CRT_DLL)
if(NOT WITH_CRT_DLL)
# Use the static C library for all build types
if(CMAKE_VERSION VERSION_EQUAL "3.15" OR
CMAKE_VERSION VERSION_GREATER "3.15")
if(CMAKE_BUILD_TYPE_UC STREQUAL "DEBUG")
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
elseif(MSVC_IDE)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
endif()
message(STATUS "Visual C++ run-time library: ${CMAKE_MSVC_RUNTIME_LIBRARY} (WITH_CRT_DLL = ${WITH_CRT_DLL})")
elseif(MSVC)
foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
endif()
endforeach()
endif()
endif()
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
# Use the maximum optimization level for release builds
foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${var} MATCHES "-O2")
string(REGEX REPLACE "-O2" "-O3" ${var} "${${var}}")
endif()
endforeach()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
if(CMAKE_C_COMPILER_ID MATCHES "SunPro")
# Use the maximum optimization level for release builds
foreach(var CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO)
if(${var} MATCHES "-xO3")
string(REGEX REPLACE "-xO3" "-xO5" ${var} "${${var}}")
endif()
if(${var} MATCHES "-xO2")
string(REGEX REPLACE "-xO2" "-xO5" ${var} "${${var}}")
endif()
endforeach()
endif()
endif()
set(EFFECTIVE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
message(STATUS "Compiler flags = ${EFFECTIVE_C_FLAGS}")
set(EFFECTIVE_LD_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
message(STATUS "Linker flags = ${EFFECTIVE_LD_FLAGS}")
include(CheckCSourceCompiles)
include(CheckIncludeFiles)
include(CheckTypeSize)
check_type_size("size_t" SIZE_T)
check_type_size("unsigned long" UNSIGNED_LONG)
if(SIZE_T EQUAL UNSIGNED_LONG)
check_c_source_compiles("int main(int argc, char **argv) { unsigned long a = argc; return __builtin_ctzl(a); }"
HAVE_BUILTIN_CTZL)
endif()
if(MSVC_LIKE)
check_include_files("intrin.h" HAVE_INTRIN_H)
endif()
if(UNIX)
if(CMAKE_CROSSCOMPILING)
set(RIGHT_SHIFT_IS_UNSIGNED 0)
else()
include(CheckCSourceRuns)
check_c_source_runs("
#include <stdio.h>
#include <stdlib.h>
static int is_shifting_signed (long arg) {
long res = arg >> 4;
if (res == -0x7F7E80CL)
return 1; /* right shift is signed */
/* see if unsigned-shift hack will fix it. */
/* we can't just test exact value since it depends on width of long... */
res |= 0xFFFFFFFFL << (32-4);
if (res == -0x7F7E80CL)
return 0; /* right shift is unsigned */
printf(\"Right shift isn't acting as I expect it to.\\\\n\");
printf(\"I fear the JPEG software will not work at all.\\\\n\\\\n\");
return 0; /* try it with unsigned anyway */
}
int main (void) {
exit(is_shifting_signed(-0x7F7E80B1L));
}" RIGHT_SHIFT_IS_UNSIGNED)
endif()
endif()
if(NOT MSVC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
check_c_source_compiles("extern const int table[1]; const int __attribute__((visibility(\"hidden\"))) table[1] = { 0 }; int main(void) { return table[0]; }"
HIDDEN_WORKS)
if(HIDDEN_WORKS)
set(HIDDEN "__attribute__((visibility(\"hidden\")))")
message(STATUS "HIDDEN = ${HIDDEN}")
endif()
endif()
if(MSVC)
set(INLINE_OPTIONS "__inline;inline")
else()
set(INLINE_OPTIONS "__inline__;inline")
endif()
option(FORCE_INLINE "Force function inlining" TRUE)
boolean_number(FORCE_INLINE)
if(FORCE_INLINE)
if(MSVC)
list(INSERT INLINE_OPTIONS 0 "__forceinline")
else()
list(INSERT INLINE_OPTIONS 0 "inline __attribute__((always_inline))")
list(INSERT INLINE_OPTIONS 0 "__inline__ __attribute__((always_inline))")
endif()
endif()
foreach(inline ${INLINE_OPTIONS})
check_c_source_compiles("${inline} static int foo(void) { return 0; } int main(void) { return foo(); }"
INLINE_WORKS)
if(INLINE_WORKS)
set(INLINE ${inline})
break()
endif()
endforeach()
if(NOT INLINE_WORKS)
message(FATAL_ERROR "Could not determine how to inline functions.")
endif()
message(STATUS "INLINE = ${INLINE} (FORCE_INLINE = ${FORCE_INLINE})")
if(MSVC)
set(THREAD_LOCAL "__declspec(thread)")
else()
set(THREAD_LOCAL "__thread")
endif()
check_c_source_compiles("static ${THREAD_LOCAL} int i; int main(void) { i = 0; return i; }"
HAVE_THREAD_LOCAL)
if(HAVE_THREAD_LOCAL)
message(STATUS "THREAD_LOCAL = ${THREAD_LOCAL}")
else()
message(WARNING "Thread-local storage is not available. The TurboJPEG API library's global error handler will not be thread-safe.")
unset(THREAD_LOCAL)
endif()
if(UNIX AND NOT APPLE)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map "VERS_1 { global: *; };")
set(CMAKE_REQUIRED_FLAGS
"-Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
check_c_source_compiles("int main(void) { return 0; }" HAVE_VERSION_SCRIPT)
set(CMAKE_REQUIRED_FLAGS)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map)
if(HAVE_VERSION_SCRIPT)
message(STATUS "Linker supports GNU-style version scripts")
set(MAPFLAG "-Wl,--version-script,")
set(TJMAPFLAG "-Wl,--version-script,")
else()
message(STATUS "Linker does not support GNU-style version scripts")
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
# The Solaris linker doesn't like our version script for the libjpeg API
# library, but the version script for the TurboJPEG API library should
# still work.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map
"VERS_1 { global: foo; local: *; }; VERS_2 { global: foo2; } VERS_1;")
set(CMAKE_REQUIRED_FLAGS "-Wl,-M,${CMAKE_CURRENT_BINARY_DIR}/conftest.map -shared")
check_c_source_compiles("int foo() { return 0; } int foo2() { return 2; }"
HAVE_MAPFILE)
set(CMAKE_REQUIRED_FLAGS)
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/conftest.map)
if(HAVE_MAPFILE)
message(STATUS "Linker supports mapfiles")
set(TJMAPFLAG "-Wl,-M,")
else()
message(STATUS "Linker does not support mapfiles")
endif()
endif()
endif()
endif()
# Generate files
configure_file(src/jversion.h.in jversion.h)
if(UNIX)
configure_file(src/libjpeg.map.in libjpeg.map)
endif()
# Include directories and compiler definitions
include_directories(${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src)
###############################################################################
# TARGETS
###############################################################################
if(CMAKE_EXECUTABLE_SUFFIX_TMP)
set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX_TMP})
endif()
message(STATUS "CMAKE_EXECUTABLE_SUFFIX = ${CMAKE_EXECUTABLE_SUFFIX}")
set(JPEG16_SOURCES src/jcapistd.c src/jccolor.c src/jcdiffct.c src/jclossls.c
src/jcmainct.c src/jcprepct.c src/jcsample.c src/jdapistd.c src/jdcolor.c
src/jddiffct.c src/jdlossls.c src/jdmainct.c src/jdpostct.c src/jdsample.c
src/jutils.c)
set(JPEG12_SOURCES ${JPEG16_SOURCES} src/jccoefct.c src/jcdctmgr.c
src/jdcoefct.c src/jddctmgr.c src/jdmerge.c src/jfdctfst.c src/jfdctint.c
src/jidctflt.c src/jidctfst.c src/jidctint.c src/jidctred.c src/jquant1.c
src/jquant2.c)
set(JPEG_SOURCES ${JPEG12_SOURCES} src/jcapimin.c src/jchuff.c src/jcicc.c
src/jcinit.c src/jclhuff.c src/jcmarker.c src/jcmaster.c src/jcomapi.c
src/jcparam.c src/jcphuff.c src/jctrans.c src/jdapimin.c src/jdatadst.c
src/jdatasrc.c src/jdhuff.c src/jdicc.c src/jdinput.c src/jdlhuff.c
src/jdmarker.c src/jdmaster.c src/jdphuff.c src/jdtrans.c src/jerror.c
src/jfdctflt.c src/jmemmgr.c src/jmemnobs.c src/jpeg_nbits.c)
if(WITH_ARITH_ENC OR WITH_ARITH_DEC)
set(JPEG_SOURCES ${JPEG_SOURCES} src/jaricom.c)
endif()
if(WITH_ARITH_ENC)
set(JPEG_SOURCES ${JPEG_SOURCES} src/jcarith.c)
endif()
if(WITH_ARITH_DEC)
set(JPEG_SOURCES ${JPEG_SOURCES} src/jdarith.c)
endif()
if(WITH_SIMD)
add_subdirectory(simd)
if(NEON_INTRINSICS)
add_definitions(-DNEON_INTRINSICS)
endif()
else()
message(STATUS "SIMD extensions: None (WITH_SIMD = ${WITH_SIMD})")
endif()
# We have to generate these here, because if the build system tries and fails
# to enable the SIMD extensions, the value of WITH_SIMD will have changed.
configure_file(src/jconfig.h.in jconfig.h)
configure_file(src/jconfigint.h.in jconfigint.h)
if(WITH_SIMD)
message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})")
if(MSVC_IDE OR XCODE)
set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
endif()
set(SIMD_TARGET_OBJECTS $<TARGET_OBJECTS:simd>)
endif()
if(WITH_JAVA)
add_subdirectory(java)
endif()
if(ENABLE_SHARED)
# Compile a separate version of these source files with 12-bit and 16-bit
# data precision.
add_library(jpeg12 OBJECT ${JPEG12_SOURCES})
set_property(TARGET jpeg12 PROPERTY COMPILE_FLAGS "-DBITS_IN_JSAMPLE=12")
set_target_properties(jpeg12 PROPERTIES POSITION_INDEPENDENT_CODE 1)
add_library(jpeg16 OBJECT ${JPEG16_SOURCES})
set_property(TARGET jpeg16 PROPERTY COMPILE_FLAGS "-DBITS_IN_JSAMPLE=16")
set_target_properties(jpeg16 PROPERTIES POSITION_INDEPENDENT_CODE 1)
add_subdirectory(sharedlib)
endif()
if(ENABLE_STATIC)
# Compile a separate version of these source files with 12-bit and 16-bit
# data precision.
add_library(jpeg12-static OBJECT ${JPEG12_SOURCES})
set_property(TARGET jpeg12-static PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=12")
add_library(jpeg16-static OBJECT ${JPEG16_SOURCES})
set_property(TARGET jpeg16-static PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=16")
add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_TARGET_OBJECTS}
${SIMD_OBJS} $<TARGET_OBJECTS:jpeg12-static>
$<TARGET_OBJECTS:jpeg16-static>)
if(NOT MSVC_LIKE)
set_target_properties(jpeg-static PROPERTIES OUTPUT_NAME jpeg)
endif()
endif()
if(WITH_TURBOJPEG)
if(ENABLE_SHARED)
set(TURBOJPEG_SOURCES ${JPEG_SOURCES} ${SIMD_TARGET_OBJECTS} ${SIMD_OBJS}
src/turbojpeg.c src/transupp.c src/jdatadst-tj.c src/jdatasrc-tj.c
src/rdbmp.c src/rdppm.c src/wrbmp.c src/wrppm.c $<TARGET_OBJECTS:jpeg12>
$<TARGET_OBJECTS:jpeg16>)
set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/src/turbojpeg-mapfile)
if(WITH_JAVA)
set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} java/turbojpeg-jni.c)
include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/src/turbojpeg-mapfile.jni)
endif()
if(MSVC_LIKE)
configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in
${CMAKE_BINARY_DIR}/win/turbojpeg.rc)
set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES}
${CMAKE_BINARY_DIR}/win/turbojpeg.rc)
endif()
add_library(turbojpeg12 OBJECT src/rdppm.c src/wrppm.c)
set_property(TARGET turbojpeg12 PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=12 -DPPM_SUPPORTED")
set_target_properties(turbojpeg12 PROPERTIES POSITION_INDEPENDENT_CODE 1)
add_library(turbojpeg16 OBJECT src/rdppm.c src/wrppm.c)
set_property(TARGET turbojpeg16 PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=16 -DPPM_SUPPORTED")
set_target_properties(turbojpeg16 PROPERTIES POSITION_INDEPENDENT_CODE 1)
add_library(turbojpeg SHARED ${TURBOJPEG_SOURCES}
$<TARGET_OBJECTS:turbojpeg12> $<TARGET_OBJECTS:turbojpeg16>)
set_property(TARGET turbojpeg PROPERTY COMPILE_FLAGS
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
if(WIN32)
set_target_properties(turbojpeg PROPERTIES DEFINE_SYMBOL DLLDEFINE)
endif()
if(MINGW)
set_target_properties(turbojpeg PROPERTIES LINK_FLAGS -Wl,--kill-at)
endif()
if(APPLE AND (NOT CMAKE_OSX_DEPLOYMENT_TARGET OR
CMAKE_OSX_DEPLOYMENT_TARGET VERSION_GREATER 10.4))
if(NOT CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG)
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")
endif()
set_target_properties(turbojpeg PROPERTIES MACOSX_RPATH 1)
endif()
set_target_properties(turbojpeg PROPERTIES
SOVERSION ${TURBOJPEG_SO_MAJOR_VERSION} VERSION ${TURBOJPEG_SO_VERSION})
if(TJMAPFLAG)
set_target_properties(turbojpeg PROPERTIES
LINK_FLAGS "${TJMAPFLAG}${TJMAPFILE}")
endif()
add_executable(tjunittest src/tjunittest.c src/tjutil.c src/md5/md5.c
src/md5/md5hl.c)
target_link_libraries(tjunittest turbojpeg)
add_executable(tjbench src/tjbench.c src/tjutil.c)
target_link_libraries(tjbench turbojpeg)
if(UNIX)
target_link_libraries(tjbench m)
endif()
add_executable(tjcomp src/tjcomp.c)
target_link_libraries(tjcomp turbojpeg)
add_executable(tjdecomp src/tjdecomp.c)
target_link_libraries(tjdecomp turbojpeg)
add_executable(tjtran src/tjtran.c)
target_link_libraries(tjtran turbojpeg)
add_custom_target(tjdoc COMMAND doxygen -s ../doc/doxygen.config
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src)
endif()
if(ENABLE_STATIC)
add_library(turbojpeg12-static OBJECT src/rdppm.c src/wrppm.c)
set_property(TARGET turbojpeg12-static PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=12 -DPPM_SUPPORTED")
add_library(turbojpeg16-static OBJECT src/rdppm.c src/wrppm.c)
set_property(TARGET turbojpeg16-static PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=16 -DPPM_SUPPORTED")
add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_TARGET_OBJECTS}
${SIMD_OBJS} src/turbojpeg.c src/transupp.c src/jdatadst-tj.c
src/jdatasrc-tj.c src/rdbmp.c src/rdppm.c src/wrbmp.c src/wrppm.c
$<TARGET_OBJECTS:jpeg12-static> $<TARGET_OBJECTS:jpeg16-static>
$<TARGET_OBJECTS:turbojpeg12-static>
$<TARGET_OBJECTS:turbojpeg16-static>)
set_property(TARGET turbojpeg-static PROPERTY COMPILE_FLAGS
"-DBMP_SUPPORTED -DPPM_SUPPORTED")
if(NOT MSVC_LIKE)
set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
endif()
add_executable(tjunittest-static src/tjunittest.c src/tjutil.c
src/md5/md5.c src/md5/md5hl.c)
target_link_libraries(tjunittest-static turbojpeg-static)
add_executable(tjbench-static src/tjbench.c src/tjutil.c)
target_link_libraries(tjbench-static turbojpeg-static)
if(UNIX)
target_link_libraries(tjbench-static m)
endif()
endif()
endif()
if(WIN32)
set(USE_SETMODE "-DUSE_SETMODE")
endif()
set(CDJPEG_COMPILE_FLAGS
"-DBMP_SUPPORTED -DGIF_SUPPORTED -DPPM_SUPPORTED -DTARGA_SUPPORTED ${USE_SETMODE}")
if(ENABLE_STATIC)
# Compile a separate version of these source files with 12-bit and 16-bit
# data precision.
add_library(cjpeg12-static OBJECT src/rdppm.c)
set_property(TARGET cjpeg12-static PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=12 -DGIF_SUPPORTED -DPPM_SUPPORTED")
add_library(cjpeg16-static OBJECT src/rdppm.c)
set_property(TARGET cjpeg16-static PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=16 -DGIF_SUPPORTED -DPPM_SUPPORTED")
add_executable(cjpeg-static src/cjpeg.c src/cdjpeg.c src/rdbmp.c src/rdgif.c
src/rdppm.c src/rdswitch.c src/rdtarga.c $<TARGET_OBJECTS:cjpeg12-static>
$<TARGET_OBJECTS:cjpeg16-static>)
set_property(TARGET cjpeg-static PROPERTY COMPILE_FLAGS
${CDJPEG_COMPILE_FLAGS})
target_link_libraries(cjpeg-static jpeg-static)
# Compile a separate version of these source files with 12-bit and 16-bit
# data precision.
add_library(djpeg12-static OBJECT src/rdcolmap.c src/wrgif.c src/wrppm.c)
set_property(TARGET djpeg12-static PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=12 -DGIF_SUPPORTED -DPPM_SUPPORTED")
add_library(djpeg16-static OBJECT src/wrppm.c)
set_property(TARGET djpeg16-static PROPERTY COMPILE_FLAGS
"-DBITS_IN_JSAMPLE=16 -DPPM_SUPPORTED")
add_executable(djpeg-static src/djpeg.c src/cdjpeg.c src/rdcolmap.c
src/rdswitch.c src/wrbmp.c src/wrgif.c src/wrppm.c src/wrtarga.c
$<TARGET_OBJECTS:djpeg12-static> $<TARGET_OBJECTS:djpeg16-static>)
set_property(TARGET djpeg-static PROPERTY COMPILE_FLAGS
${CDJPEG_COMPILE_FLAGS})
target_link_libraries(djpeg-static jpeg-static)
add_executable(jpegtran-static src/jpegtran.c src/cdjpeg.c src/rdswitch.c
src/transupp.c)
target_link_libraries(jpegtran-static jpeg-static)
set_property(TARGET jpegtran-static PROPERTY COMPILE_FLAGS "${USE_SETMODE}")
add_executable(example-static src/example.c)
target_link_libraries(example-static jpeg-static)
endif()
add_executable(rdjpgcom src/rdjpgcom.c)
add_executable(wrjpgcom src/wrjpgcom.c)
###############################################################################
# TESTS
###############################################################################
if(WITH_FUZZ)
add_subdirectory(fuzz)
endif()
add_executable(strtest src/strtest.c)
add_subdirectory(src/md5)
if(GENERATOR_IS_MULTI_CONFIG)
set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/")
else()
set(OBJDIR "")
endif()
enable_testing()
if(WITH_JAVA)
add_test(TJUnitTest
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest)
add_test(TJUnitTest-yuv
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -yuv)
add_test(TJUnitTest-yuv-nopad
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -yuv -noyuvpad)
add_test(TJUnitTest-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -lossless)
add_test(TJUnitTest-bi
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -bi)
add_test(TJUnitTest-bi-yuv
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -bi -yuv)
add_test(TJUnitTest-bi-yuv-nopad
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -bi -yuv -noyuvpad)
add_test(TJUnitTest-bi-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -bi -lossless)
add_test(TJUnitTest-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -bmp)
add_test(TJUnitTest12
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 12)
add_test(TJUnitTest12-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 12 -lossless)
add_test(TJUnitTest12-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 12 -bmp)
add_test(TJUnitTest2-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 2)
add_test(TJUnitTest2-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 2 -bmp)
add_test(TJUnitTest3-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 3)
add_test(TJUnitTest3-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 3 -bmp)
add_test(TJUnitTest4-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 4)
add_test(TJUnitTest4-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 4 -bmp)
add_test(TJUnitTest5-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 5)
add_test(TJUnitTest5-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 5 -bmp)
add_test(TJUnitTest6-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 6)
add_test(TJUnitTest6-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 6 -bmp)
add_test(TJUnitTest7-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 7)
add_test(TJUnitTest7-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 7 -bmp)
add_test(TJUnitTest9-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 9)
add_test(TJUnitTest9-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 9 -bmp)
add_test(TJUnitTest10-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 10)
add_test(TJUnitTest10-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 10 -bmp)
add_test(TJUnitTest11-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 11)
add_test(TJUnitTest11-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 11 -bmp)
add_test(TJUnitTest13-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 13)
add_test(TJUnitTest13-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 13 -bmp)
add_test(TJUnitTest14-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 14)
add_test(TJUnitTest14-bmp
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar
-Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR}
TJUnitTest -precision 14 -bmp)
add_test(TJUnitTest15-lossless
${Java_JAVA_EXECUTABLE} ${JAVAARGS} -cp java/turbojpeg.jar