-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
7 changed files
with
104 additions
and
78 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,33 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(jpeg-compressor) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
set(JPEGCOMPRESSOR_SOURCE_SUBFOLDER "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder") | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
cmake_minimum_required(VERSION 3.8) | ||
project(jpeg-compressor LANGUAGES CXX) | ||
|
||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
|
||
# jgpd lib | ||
|
||
set(JPGD_SRC_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd.cpp) | ||
set(JPGD_HDR_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd.h ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd_idct.h) | ||
add_library(jpgd ${JPGD_SRC_LIST} ${JPGD_HDR_LIST}) | ||
target_include_directories(jpgd PUBLIC ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}) | ||
|
||
install(TARGETS jpgd) | ||
install(FILES ${JPGD_HDR_LIST} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
|
||
# jgpe lib | ||
|
||
set(JPGE_SRC_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.cpp) | ||
set(JPGE_HDR_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.h ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.h) | ||
add_library(jpge ${JPGE_SRC_LIST} ${JPGE_HDR_LIST}) | ||
target_include_directories(jpge PUBLIC ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}) | ||
|
||
install(TARGETS jpge) | ||
install(FILES ${JPGE_HDR_LIST} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
# jpgd lib | ||
set(JPGD_HDR_LIST ${JPEGCOMPRESSOR_SRC_DIR}/jpgd.h ${JPEGCOMPRESSOR_SRC_DIR}/jpgd_idct.h) | ||
add_library(jpgd ${JPEGCOMPRESSOR_SRC_DIR}/jpgd.cpp) | ||
target_include_directories(jpgd PUBLIC ${JPEGCOMPRESSOR_SRC_DIR}) | ||
target_compile_features(jpgd PRIVATE cxx_std_11) | ||
|
||
# jpge lib | ||
set(JPGE_HDR_LIST ${JPEGCOMPRESSOR_SRC_DIR}/jpge.h ${JPEGCOMPRESSOR_SRC_DIR}/jpge.h) | ||
add_library(jpge ${JPEGCOMPRESSOR_SRC_DIR}/jpge.cpp) | ||
target_include_directories(jpge PUBLIC ${JPEGCOMPRESSOR_SRC_DIR}) | ||
target_compile_features(jpge PRIVATE cxx_std_11) | ||
|
||
include(GNUInstallDirs) | ||
install( | ||
TARGETS jpgd jpge | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBIR} | ||
) | ||
install(FILES ${JPGD_HDR_LIST} ${JPGE_HDR_LIST} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package LANGUAGES CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(jpeg-compressor REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE jpeg-compressor::jpeg-compressor) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
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,18 +1,27 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, cmake_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
img_path = os.path.join(self.source_folder, "testimg.jpg") | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run("{} {}".format(bin_path, img_path), run_environment=True) | ||
self.run(f"{bin_path} {img_path}", env="conanrun") |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package) |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
img_path = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") | ||
self.run(f"{bin_path} {img_path}", run_environment=True) |