Skip to content

Instantly share code, notes, and snippets.

@ccloli
Created April 19, 2019 11:43
Show Gist options
  • Save ccloli/156390d0c18769c422d3f4b52484e298 to your computer and use it in GitHub Desktop.
Save ccloli/156390d0c18769c422d3f4b52484e298 to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.5)
project(animeloop-cli)
find_package(PkgConfig REQUIRED)
add_subdirectory(${PROJECT_SOURCE_DIR}/cxxopts)
include_directories(${PROJECT_SOURCE_DIR}/cxxopts/include)
include_directories(${PROJECT_SOURCE_DIR}/research)
include_directories(/mingw64/include)
link_directories(/mingw64/lib)
link_directories(/mingw64/share/OpenCV/lib)
set(CMAKE_CXX_STANDARD 11)
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
# SET(BUILD_SHARED_LIBS OFF)
# SET(CMAKE_EXE_LINKER_FLAGS "-static")
set(CLI_SOURCE_FILES
animeloop-cli/algorithm.cpp
animeloop-cli/algorithm.hpp
animeloop-cli/filter.cpp
animeloop-cli/filter.hpp
animeloop-cli/loop_video.cpp
animeloop-cli/loop_video.hpp
animeloop-cli/main.cpp
animeloop-cli/models.cpp
animeloop-cli/models.hpp
animeloop-cli/utils.cpp
animeloop-cli/utils.hpp
animeloop-cli/thread_pool.h
animeloop-cli/progress_bar.hpp
animeloop-cli/child_process.cpp
animeloop-cli/child_process.hpp)
add_executable(animeloop-cli ${CLI_SOURCE_FILES})
set(SIMILAR_SAME_SOURCE_FILES
animeloop-cli/algorithm.cpp
animeloop-cli/algorithm.hpp
research/similar_and_same.cpp)
add_executable(similar-and-same ${SIMILAR_SAME_SOURCE_FILES})
set(CUTS_SWITCH_SOURCE_FILES
animeloop-cli/algorithm.cpp
animeloop-cli/algorithm.hpp
animeloop-cli/utils.cpp
animeloop-cli/utils.hpp
research/cuts_switch.cpp)
add_executable(cuts-switch ${CUTS_SWITCH_SOURCE_FILES})
set(COLOR_SOURCE_FILES
research/color.cpp)
add_executable(color ${COLOR_SOURCE_FILES})
# Jsoncpp
set(JSONCPP_INCLUDE_DIRS /mingw64/include/json)
set(JSONCPP_LIBRARIES /mingw64/lib/libjsoncpp.dll.a)
pkg_check_modules(JSONCPP jsoncpp)
target_link_libraries(animeloop-cli ${JSONCPP_LIBRARIES})
### temp fix for Ubuntu ###
include_directories(animeloop-cli /usr/include/jsoncpp)
# OpenCV
set(OpenCV_RUNTIME mingw)
set(MINGW 1)
set(MINGW64 1)
set(OpenCV_ARCH x64)
find_package( OpenCV 3.2 REQUIRED )
target_link_libraries( animeloop-cli ${OpenCV_LIBS} )
target_link_libraries( similar-and-same ${OpenCV_LIBS})
target_link_libraries( cuts-switch ${OpenCV_LIBS})
target_link_libraries( color ${OpenCV_LIBS})
# Boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost COMPONENTS filesystem date_time REQUIRED)
target_link_libraries( animeloop-cli ${Boost_LIBRARIES} )
target_link_libraries( cuts-switch ${Boost_LIBRARIES} )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment