-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
78 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,44 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
project(jpeg-compressor) | ||
|
||
set(BUILD_SHARED_LIBS OFF) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
set(JPGD_SRC_LIST jpgd.cpp) | ||
set(JPGD_HDR_LIST jpgd.h jpgd_idct.h) | ||
add_library(jpgd ${JPGD_SRC_LIST} ${JPGD_HDR_LIST}) | ||
target_include_directories(jpgd PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
set(JPGE_SRC_LIST jpge.cpp) | ||
set(JPGE_HDR_LIST jpge.h jpge.h) | ||
add_library(jpge EXCLUDE_FROM_ALL ${JPGE_SRC_LIST} ${JPGE_HDR_LIST}) | ||
target_include_directories(jpge PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
set_target_properties(jpgd jpge PROPERTIES | ||
FOLDER "3rdparty" | ||
POSITION_INDEPENDENT_CODE ON | ||
) | ||
find_package(jpeg-compressor QUIET) | ||
|
||
if(jpeg-compressor_FOUND) | ||
|
||
if(NOT TARGET jpeg-compressor) | ||
if(TARGET jpeg-compressor::jpeg-compressor) | ||
add_library(jpeg-compressor ALIAS jpeg-compressor::jpeg-compressor) | ||
else() | ||
add_library(jpeg-compressor INTERFACE) | ||
if(jpeg-compressor_INCLUDE_DIRS) | ||
target_include_directories(jpeg-compressor INTERFACE ${jpeg-compressor_INCLUDE_DIRS}) | ||
endif() | ||
if(jpeg-compressor_LIBRARIES) | ||
target_link_libraries(jpeg-compressor INTERFACE ${jpeg-compressor_LIBRARIES}) | ||
endif() | ||
if(jpeg-compressor_COMPILE_DEFINITIONS) | ||
target_compile_definitions(jpeg-compressor INTERFACE ${jpeg-compressor_COMPILE_DEFINITIONS}) | ||
endif() | ||
if(jpeg-compressor_COMPILE_OPTIONS_LIST) | ||
target_compile_options(jpeg-compressor INTERFACE ${jpeg-compressor_COMPILE_OPTIONS_LIST}) | ||
endif() | ||
endif() | ||
endif() | ||
|
||
else() | ||
|
||
message(STATUS "jpeg-compressor not found") | ||
message(STATUS "Building jpeg-compressor from 3rdparty sources") | ||
|
||
set(JPGC_SRC_LIST jpgd.cpp jpge.cpp) | ||
set(JPGC_HDR_LIST jpgd.h jpgd_idct.h jpge.h) | ||
add_library(jpeg-compressor OBJECT EXCLUDE_FROM_ALL ${JPGC_SRC_LIST} ${JPGC_HDR_LIST}) | ||
target_include_directories(jpeg-compressor PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
set_target_properties(jpeg-compressor PROPERTIES | ||
FOLDER "3rdparty" | ||
POSITION_INDEPENDENT_CODE ON | ||
) | ||
|
||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters