Skip to content

Commit 27b22f2

Browse files
committed
update dependencies
- remove openssl lib - use usr lib jsoncpp
1 parent 06e6e6c commit 27b22f2

File tree

8 files changed

+26
-102
lines changed

8 files changed

+26
-102
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "cxxopts"]
22
path = cxxopts
33
url = https://github.com/jarro2783/cxxopts.git
4-
[submodule "jsoncpp"]
5-
path = jsoncpp
6-
url = https://github.com/open-source-parsers/jsoncpp.git

CMakeLists.txt

+9-19
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ find_package(PkgConfig REQUIRED)
66
add_subdirectory(${PROJECT_SOURCE_DIR}/cxxopts)
77

88
include_directories(${PROJECT_SOURCE_DIR}/cxxopts/include)
9-
include_directories(${PROJECT_SOURCE_DIR}/jsoncpp/dist/json)
109
include_directories(${PROJECT_SOURCE_DIR}/research)
1110

1211
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
@@ -22,16 +21,14 @@ set(CLI_SOURCE_FILES
2221
animeloop-cli/models.cpp
2322
animeloop-cli/models.hpp
2423
animeloop-cli/utils.cpp
25-
animeloop-cli/utils.hpp
26-
jsoncpp/dist/jsoncpp.cpp
27-
)
24+
animeloop-cli/utils.hpp)
2825

2926
add_executable(animeloop-cli ${CLI_SOURCE_FILES})
3027

3128
set(SIMILAR_SAME_SOURCE_FILES
3229
animeloop-cli/algorithm.cpp
3330
animeloop-cli/algorithm.hpp
34-
research/similar_and_same.cpp)
31+
research/similar_and_same.cpp)
3532

3633
add_executable(similar-and-same ${SIMILAR_SAME_SOURCE_FILES})
3734

@@ -49,6 +46,12 @@ set(COLOR_SOURCE_FILES
4946

5047
add_executable(color ${COLOR_SOURCE_FILES})
5148

49+
# Jsoncpp
50+
pkg_check_modules(JSONCPP jsoncpp)
51+
target_link_libraries(animeloop-cli ${JSONCPP_LIBRARIES})
52+
### temp fix for Ubuntu ###
53+
include_directories(animeloop-cli /usr/include/jsoncpp)
54+
5255
# OpenCV
5356
find_package( OpenCV 3.2 REQUIRED )
5457
target_link_libraries( animeloop-cli ${OpenCV_LIBS} )
@@ -59,17 +62,4 @@ target_link_libraries( color ${OpenCV_LIBS})
5962
# Boost
6063
find_package(Boost COMPONENTS filesystem date_time system program_options REQUIRED)
6164
target_link_libraries( animeloop-cli ${Boost_LIBRARIES} )
62-
target_link_libraries( cuts-switch ${Boost_LIBRARIES} )
63-
64-
# Search OpenSSL
65-
pkg_search_module(OPENSSL REQUIRED openssl)
66-
67-
if( OPENSSL_FOUND )
68-
include_directories(${OPENSSL_INCLUDE_DIRS})
69-
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
70-
else()
71-
# Error; with REQUIRED, pkg_search_module() will throw an error by it's own
72-
endif()
73-
74-
target_link_libraries( animeloop-cli ${OPENSSL_LIBRARIES})
75-
target_link_libraries( cuts-switch ${OPENSSL_LIBRARIES})
65+
target_link_libraries( cuts-switch ${Boost_LIBRARIES} )

animeloop-cli.xcodeproj/project.pbxproj

+7-32
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
8818F2EC1E920F260085F368 /* models.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8818F2EA1E920F260085F368 /* models.cpp */; };
2020
8818F2EF1E920F3E0085F368 /* utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8818F2ED1E920F3E0085F368 /* utils.cpp */; };
2121
8818F2F51E9242310085F368 /* filter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8818F2F31E9242310085F368 /* filter.cpp */; };
22-
884E2E261F30D787001EA03E /* libcrypto.1.0.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 884E2E241F30D769001EA03E /* libcrypto.1.0.0.dylib */; };
2322
88537E9D1E4C501900385BCB /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 88537E9C1E4C501900385BCB /* main.cpp */; };
23+
88C992831F947CF70012ED53 /* libjsoncpp.1.8.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 88C992821F947CF70012ED53 /* libjsoncpp.1.8.3.dylib */; };
2424
88DC61451E585CCE0062B914 /* algorithm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 88DC61431E585CCE0062B914 /* algorithm.cpp */; };
25-
88E08EB61E5ACAD60080D35E /* jsoncpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 88E08EB51E5ACAD60080D35E /* jsoncpp.cpp */; };
2625
/* End PBXBuildFile section */
2726

2827
/* Begin PBXCopyFilesBuildPhase section */
@@ -62,29 +61,27 @@
6261
88537EAC1E4C671F00385BCB /* libopencv_imgproc.3.2.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopencv_imgproc.3.2.0.dylib; path = ../../../../../usr/local/lib/libopencv_imgproc.3.2.0.dylib; sourceTree = "<group>"; };
6362
889337CA1E9E318C004C69AD /* libopencv_face.3.2.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopencv_face.3.2.0.dylib; path = ../../../../../usr/local/lib/libopencv_face.3.2.0.dylib; sourceTree = "<group>"; };
6463
889337CC1E9E31AE004C69AD /* libopencv_objdetect.3.2.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libopencv_objdetect.3.2.0.dylib; path = ../../../../../usr/local/lib/libopencv_objdetect.3.2.0.dylib; sourceTree = "<group>"; };
64+
88C992821F947CF70012ED53 /* libjsoncpp.1.8.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libjsoncpp.1.8.3.dylib; path = ../../../../../usr/local/Cellar/jsoncpp/1.8.3/lib/libjsoncpp.1.8.3.dylib; sourceTree = "<group>"; };
6565
88DC61431E585CCE0062B914 /* algorithm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = algorithm.cpp; path = "animeloop-cli/algorithm.cpp"; sourceTree = "<group>"; };
6666
88DC61441E585CCE0062B914 /* algorithm.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = algorithm.hpp; path = "animeloop-cli/algorithm.hpp"; sourceTree = "<group>"; };
6767
88DC91531E7FD737005C122D /* libMagick++-7.Q16HDRI.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libMagick++-7.Q16HDRI.2.dylib"; path = "../../../../../usr/local/Cellar/imagemagick/7.0.5-3/lib/libMagick++-7.Q16HDRI.2.dylib"; sourceTree = "<group>"; };
6868
88DC91551E7FD7BF005C122D /* libMagick++-7.Q16HDRI.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libMagick++-7.Q16HDRI.a"; path = "../../../../../usr/local/Cellar/imagemagick/7.0.5-3/lib/libMagick++-7.Q16HDRI.a"; sourceTree = "<group>"; };
69-
88E08EB51E5ACAD60080D35E /* jsoncpp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsoncpp.cpp; path = jsoncpp/dist/jsoncpp.cpp; sourceTree = "<group>"; };
70-
88E08EB81E5ACB030080D35E /* json-forwards.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "json-forwards.h"; sourceTree = "<group>"; };
71-
88E08EB91E5ACB030080D35E /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = json.h; sourceTree = "<group>"; };
7269
/* End PBXFileReference section */
7370

7471
/* Begin PBXFrameworksBuildPhase section */
7572
88537E961E4C501900385BCB /* Frameworks */ = {
7673
isa = PBXFrameworksBuildPhase;
7774
buildActionMask = 2147483647;
7875
files = (
79-
884E2E261F30D787001EA03E /* libcrypto.1.0.0.dylib in Frameworks */,
76+
88C992831F947CF70012ED53 /* libjsoncpp.1.8.3.dylib in Frameworks */,
8077
88088C1A1E4E333A00601DBD /* libboost_date_time.dylib in Frameworks */,
8178
88088C181E4E29E400601DBD /* libboost_system.dylib in Frameworks */,
79+
88088C111E4E28B900601DBD /* libboost_filesystem.dylib in Frameworks */,
8280
88088C121E4E294600601DBD /* libopencv_core.3.2.0.dylib in Frameworks */,
8381
88088C131E4E294600601DBD /* libopencv_imgcodecs.3.2.0.dylib in Frameworks */,
8482
88088C141E4E294600601DBD /* libopencv_imgproc.3.2.0.dylib in Frameworks */,
8583
88088C151E4E294600601DBD /* libopencv_video.3.2.0.dylib in Frameworks */,
8684
88088C161E4E294600601DBD /* libopencv_videoio.3.2.0.dylib in Frameworks */,
87-
88088C111E4E28B900601DBD /* libboost_filesystem.dylib in Frameworks */,
8885
);
8986
runOnlyForDeploymentPostprocessing = 0;
9087
};
@@ -130,7 +127,6 @@
130127
88537E9B1E4C501900385BCB /* animeloop-cli */,
131128
88088BF91E4DF6B700601DBD /* loop-video */,
132129
88088BFA1E4E1BEF00601DBD /* cxxopts */,
133-
88E08E731E5AC9950080D35E /* jsoncpp */,
134130
88537E9A1E4C501900385BCB /* Products */,
135131
88537EA61E4C52CC00385BCB /* Frameworks */,
136132
);
@@ -155,6 +151,7 @@
155151
88537EA61E4C52CC00385BCB /* Frameworks */ = {
156152
isa = PBXGroup;
157153
children = (
154+
88C992821F947CF70012ED53 /* libjsoncpp.1.8.3.dylib */,
158155
884E2E241F30D769001EA03E /* libcrypto.1.0.0.dylib */,
159156
889337CC1E9E31AE004C69AD /* libopencv_objdetect.3.2.0.dylib */,
160157
889337CA1E9E318C004C69AD /* libopencv_face.3.2.0.dylib */,
@@ -174,25 +171,6 @@
174171
name = Frameworks;
175172
sourceTree = "<group>";
176173
};
177-
88E08E731E5AC9950080D35E /* jsoncpp */ = {
178-
isa = PBXGroup;
179-
children = (
180-
88E08EB71E5ACB030080D35E /* json */,
181-
88E08EB51E5ACAD60080D35E /* jsoncpp.cpp */,
182-
);
183-
name = jsoncpp;
184-
sourceTree = "<group>";
185-
};
186-
88E08EB71E5ACB030080D35E /* json */ = {
187-
isa = PBXGroup;
188-
children = (
189-
88E08EB81E5ACB030080D35E /* json-forwards.h */,
190-
88E08EB91E5ACB030080D35E /* json.h */,
191-
);
192-
name = json;
193-
path = jsoncpp/dist/json;
194-
sourceTree = "<group>";
195-
};
196174
/* End PBXGroup section */
197175

198176
/* Begin PBXNativeTarget section */
@@ -250,7 +228,6 @@
250228
isa = PBXSourcesBuildPhase;
251229
buildActionMask = 2147483647;
252230
files = (
253-
88E08EB61E5ACAD60080D35E /* jsoncpp.cpp in Sources */,
254231
8818F2F51E9242310085F368 /* filter.cpp in Sources */,
255232
8818F2EC1E920F260085F368 /* models.cpp in Sources */,
256233
88DC61451E585CCE0062B914 /* algorithm.cpp in Sources */,
@@ -372,8 +349,7 @@
372349
/usr/local/lib,
373350
/usr/local/Cellar/ffmpeg/3.2.3/lib,
374351
/usr/local/Cellar/boost/1.63.0/lib,
375-
/usr/local/Cellar/openssl/1.0.2j/lib,
376-
/usr/local/Cellar/openssl/1.0.2l/lib,
352+
/usr/local/Cellar/jsoncpp/1.8.3/lib,
377353
);
378354
MACOSX_DEPLOYMENT_TARGET = 10.10;
379355
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -390,8 +366,7 @@
390366
/usr/local/lib,
391367
/usr/local/Cellar/ffmpeg/3.2.3/lib,
392368
/usr/local/Cellar/boost/1.63.0/lib,
393-
/usr/local/Cellar/openssl/1.0.2j/lib,
394-
/usr/local/Cellar/openssl/1.0.2l/lib,
369+
/usr/local/Cellar/jsoncpp/1.8.3/lib,
395370
);
396371
MACOSX_DEPLOYMENT_TARGET = 10.10;
397372
PRODUCT_NAME = "$(TARGET_NAME)";

animeloop-cli/loop_video.cpp

+5-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "utils.hpp"
1212
#include "filter.hpp"
1313

14-
#include "json.h"
14+
#include <json/json.h>
1515
#include <sys/wait.h>
1616

1717
using namespace std;
@@ -21,7 +21,6 @@ using namespace al;
2121

2222

2323
al::LoopVideo::LoopVideo(std::string input, std::string output_path) {
24-
this->md5 = md5_of_file(input);
2524

2625
this->filename = path(input).stem().string();
2726
this->title = this->filename;
@@ -100,15 +99,14 @@ int fork_gen_cover(string video_filepath, string cover_filepath) {
10099

101100
void al::LoopVideo::generate(const LoopDurations durations) {
102101
VideoInfo info = get_info(this->input_filepath);
103-
102+
104103
Json::Value videos_json;
105104
videos_json["title"] = this->title;
106105

107-
videos_json["version"] = kVersion;
106+
videos_json["version"] = kOutputVersion;
108107

109108
Json::Value source_json;
110109
source_json["filename"] = this->filename;
111-
source_json["md5"] = this->md5;
112110
videos_json["source"].append(source_json);
113111

114112
int count = 0;
@@ -185,15 +183,12 @@ void al::LoopVideo::generate(const LoopDurations durations) {
185183
period_json["begin"] = al::time_string(start_frame / info.fps);
186184
period_json["end"] = al::time_string(end_frame / info.fps);
187185
video_json["period"] = period_json;
188-
189-
auto md5 = al::md5_of_file(video_filepath);
190-
video_json["md5"] = md5;
191-
186+
192187
videos_json["loops"].append(video_json);
193188
});
194189

195190
string json_string = videos_json.toStyledString();
196191
std::ofstream out(path(this->loops_dirpath).append(this->filename + ".json").string());
197192
out << json_string;
198193
out.close();
199-
}
194+
}

animeloop-cli/loop_video.hpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
#include <boost/filesystem.hpp>
1717

1818
namespace al {
19-
const std::string kVersion = "2.0.0";
19+
const std::string kVersion = "2.0.1";
20+
const std::string kOutputVersion = "2.0.0";
2021

2122
class LoopVideo {
2223
public:
@@ -81,11 +82,7 @@ namespace al {
8182
@param durations durations data
8283
*/
8384
void generate(const al::LoopDurations filtered_durations);
84-
85-
private:
86-
std::string md5;
8785
};
8886
}
8987

90-
9188
#endif /* loop_video_hpp */

animeloop-cli/utils.cpp

+3-24
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#include "utils.hpp"
1010
#include "algorithm.hpp"
1111

12-
#include "json.h"
12+
#include <json/json.h>
1313
#include <boost/filesystem.hpp>
1414
#include <boost/date_time/posix_time/posix_time.hpp>
1515
#include <boost/regex.hpp>
16-
#include <openssl/md5.h>
16+
//#include <openssl/md5.h>
1717
#include <numeric>
1818
#include <sys/wait.h>
1919
#include <fstream>
@@ -315,25 +315,4 @@ std::string al::time_string(double seconds) {
315315
auto ms = boost::posix_time::milliseconds(seconds * 1000);
316316
auto time = boost::posix_time::time_duration(ms);
317317
return boost::posix_time::to_simple_string(time);
318-
}
319-
320-
std::string al::md5_of_file(std::string filename) {
321-
MD5_CTX ctx;
322-
MD5_Init(&ctx);
323-
324-
std::ifstream ifs(filename, std::ios::binary);
325-
326-
char file_buffer[4096];
327-
while (ifs.read(file_buffer, sizeof(file_buffer)) || ifs.gcount()) {
328-
MD5_Update(&ctx, file_buffer, ifs.gcount());
329-
}
330-
unsigned char digest[MD5_DIGEST_LENGTH] = {};
331-
MD5_Final(digest, &ctx);
332-
333-
std::stringstream stream;
334-
for(unsigned i=0; i <MD5_DIGEST_LENGTH; i++) {
335-
stream << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(digest[i]);
336-
}
337-
std::string md5_string = stream.str();
338-
return md5_string;
339-
}
318+
}

animeloop-cli/utils.hpp

-8
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ namespace al {
5555
@return Time string
5656
*/
5757
std::string time_string(double seconds);
58-
59-
/**
60-
Generate the MD5 checksum of a file.
61-
62-
@param filename file path
63-
@return md5 string value
64-
*/
65-
std::string md5_of_file(std::string filename);
6658
}
6759

6860
#endif /* utils_hpp */

jsoncpp

-1
This file was deleted.

0 commit comments

Comments
 (0)