Revision 7b498bcd
Added by David Sorber almost 8 years ago
| software/photo_compress_archiver/CMakeLists.txt | ||
|---|---|---|
|
project("Photo Compress Archiver")
|
||
|
cmake_minimum_required(VERSION 3.2)
|
||
|
PROJECT("Photo Compress Archiver")
|
||
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||
|
|
||
|
set(CMAKE_CXX_STANDARD 11)
|
||
|
SET(CMAKE_CXX_STANDARD 11)
|
||
|
|
||
|
include_directories(.)
|
||
|
include_directories(/usr/include/)
|
||
|
INCLUDE_DIRECTORIES(.)
|
||
|
INCLUDE_DIRECTORIES(/usr/include/)
|
||
|
|
||
|
set(EXTERNAL_LIBS)
|
||
|
SET(EXTERNAL_LIBS)
|
||
|
|
||
|
find_package(Threads)
|
||
|
FIND_PACKAGE(Threads)
|
||
|
|
||
|
find_package(Boost 1.58.0 COMPONENTS system regex program_options filesystem REQUIRED)
|
||
|
if (Boost_FOUND)
|
||
|
include_directories(${Boost_INCLUDE_DIRS})
|
||
|
set(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${Boost_LIBRARIES})
|
||
|
endif()
|
||
|
FIND_PACKAGE(Boost 1.58.0 COMPONENTS system regex program_options filesystem REQUIRED)
|
||
|
IF (Boost_FOUND)
|
||
|
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
|
||
|
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${Boost_LIBRARIES})
|
||
|
ENDIF()
|
||
|
|
||
|
# NOTE: PCA now uses the libpackjpg that I created instead of the executable
|
||
|
# Not sure why this is required... but doesn't seem to work otherwise
|
||
|
SET(LIBPACKJPG)
|
||
|
find_library(LIBPACKJPG packjpg REQUIRED)
|
||
|
FIND_LIBRARY(LIBPACKJPG packjpg REQUIRED)
|
||
|
#~ message(STATUS LIBPACKJPG: ${LIBPACKJPG})
|
||
|
set(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${LIBPACKJPG})
|
||
|
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${LIBPACKJPG})
|
||
|
#~ message(STATUS LIBS: ${EXTERNAL_LIBS})
|
||
|
|
||
|
# PCA sources
|
||
|
set(pca_sources
|
||
|
SET(pca_sources
|
||
|
../PhotoCompressArchiver.cc
|
||
|
)
|
||
|
|
||
|
# Build the PCA executable
|
||
|
add_definitions("-std=c++11 -g -O3 -march=native")
|
||
|
add_executable(pca
|
||
|
#~ ADD_DEFINITIONS("-std=c++11 -g -O3 -march=native")
|
||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -O3 -march=native -fuse-ld=gold")
|
||
|
ADD_EXECUTABLE(pca
|
||
|
${pca_sources}
|
||
|
../main.cc)
|
||
|
target_link_libraries(pca ${CMAKE_THREAD_LIBS_INIT} ${EXTERNAL_LIBS} stdc++fs)
|
||
|
TARGET_LINK_LIBRARIES(pca ${CMAKE_THREAD_LIBS_INIT} ${EXTERNAL_LIBS} stdc++fs)
|
||
| software/photo_compress_archiver/PhotoCompressArchiver.cc | ||
|---|---|---|
|
// Found directory recurse
|
||
|
find_files(dir_iter->path(), file_regex);
|
||
|
}
|
||
|
else if (boost::regex_match(dir_iter->path().filename().string(), file_regex))
|
||
|
else if (boost::regex_match(dir_iter->path().filename().string(), file_regex) &&
|
||
|
bfs::is_regular_file(dir_iter->path()))
|
||
|
{
|
||
|
// Found file match
|
||
|
|
||
| ... | ... | |
|
std::ios::binary | std::ios::in);
|
||
|
if (! input_stream)
|
||
|
{
|
||
|
WRKR_OUT_ERR("unable to read from \"" << work_unit->m_path
|
||
|
<< "\"\n")
|
||
|
WRKR_OUT_ERR("unable to read from " << work_unit->m_path << "\n")
|
||
|
m_errors.push_back(work_unit);
|
||
|
continue;
|
||
|
}
|
||
| ... | ... | |
|
}
|
||
|
else
|
||
|
{
|
||
|
WRKR_OUT_ERR("the input file \"" << work_unit->m_path
|
||
|
<< "\" does not appear to be a valid "
|
||
|
WRKR_OUT_ERR("the input file " << work_unit->m_path
|
||
|
<< " does not appear to be a valid "
|
||
|
"packjpg (.pjg) file even though its filename "
|
||
|
"suggests it is!")
|
||
|
m_errors.push_back(work_unit);
|
||
| ... | ... | |
|
}
|
||
|
else
|
||
|
{
|
||
|
WRKR_OUT_ERR("the input file \"" << work_unit->m_path
|
||
|
<< "\" does not appear to be a valid "
|
||
|
WRKR_OUT_ERR("the input file " << work_unit->m_path
|
||
|
<< " does not appear to be a valid "
|
||
|
"JPEG (.jpg) file even though its filename "
|
||
|
"suggests it is!")
|
||
|
m_errors.push_back(work_unit);
|
||
| software/photo_compress_archiver/PhotoCompressArchiver.hh | ||
|---|---|---|
|
const std::string YELLOW("\033[33m");
|
||
|
const std::string PURPLE("\033[35m");
|
||
|
|
||
|
const std::string version("v0.3.3");
|
||
|
const std::string version("v0.3.4");
|
||
|
|
||
|
const boost::regex JPEG_REGEX("^.+\\.(jpg)|(jpeg)$", boost::regex::icase);
|
||
|
const boost::regex PJG_REGEX("^.+\\.pjg$", boost::regex::icase);
|
||
Reformat CMakeLists.txt, use gold linker, reformat several error
messages to remove extra double quotes, and confirm path is regular file
before adding to the input file list.