8000 refactoring for GIT_SELF tests by headupinclouds · Pull Request #90 · elucideye/acf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactoring for GIT_SELF tests #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@
*.app

# Hunter/polly
_logs/*
_builds/*
_install/*
_framework/*
_os/*
_archives/*
_assets/*
_*/

# Stored releases
releases/*
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ if(ACF_USE_DRISHTI_UPLOAD)
)
endif()
else()
set(ACF_HUNTER_GATE_URL "https://github.com/ruslo/hunter/archive/v0.21.19.tar.gz")
set(ACF_HUNTER_GATE_SHA1 "5ead1e069b437930d0de8a21824b20fb52b37b50")
set(ACF_HUNTER_GATE_URL "https://github.com/ruslo/hunter/archive/v0.22.8.tar.gz")
set(ACF_HUNTER_GATE_SHA1 "e7fe3f0b61b1b4844d440ec0a02ac73ddc5f0bb2")
if(HUNTER_ENABLED AND NOT ACF_IS_REPO_BUILD)
# DEPENDENCY: if(HUNTER_ENABLE): we are being used as a dependency from
# another project and we will use the config.cmake from the parent project.
Expand Down Expand Up @@ -94,7 +94,7 @@ endif()
###################

# See https://github.com/hunter-packages/check_ci_tag when changing VERSION
project(acf VERSION 0.1.12)
project(acf VERSION 0.1.13)

set(ACF_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}")

Expand Down
32 changes: 21 additions & 11 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# the oepncv protobuf isn't friendly to a lot of compilers, skip it by default
set(opencv_cmake_args
WITH_PROTOBUF=OFF
BUILD_PROTOBUF=OFF
BUILD_LIBPROTOBUF_FROM_SOURCES=NO
BUILD_opencv_dnn=OFF

WITH_JASPER=OFF
BUILD_JASPER=OFF
)
hunter_config(OpenCV VERSION ${HUNTER_OpenCV_VERSION} CMAKE_ARGS ${opencv_cmake_args})
### aglet ###
set(aglet_cmake_args
AGLET_OPENGL_ES3=${ACF_OPENGL_ES3}
)
hunter_config(ogles_gpgpu VERSION ${HUNTER_ogles_gpgpu_VERSION} CMAKE_ARGS ${ogles_gpgpu_cmake_args})

### ogles_gpgpu ###
set(ogles_gpgpu_cmake_args
Expand All @@ -17,4 +11,20 @@ set(ogles_gpgpu_cmake_args
)
hunter_config(ogles_gpgpu VERSION ${HUNTER_ogles_gpgpu_VERSION} CMAKE_ARGS ${ogles_gpgpu_cmake_args})

### opencv ###
set(opencv_cmake_args
BUILD_LIST=core,imgproc,videoio,highgui
)
hunter_config(OpenCV VERSION ${HUNTER_OpenCV_VERSION} CMAKE_ARGS ${opencv_cmake_args})

### ACF (GIT_SELF) : support relocatable package testing ###
set(acf_cmake_args
ACF_BUILD_TESTS=${ACF_BUILD_TESTS}
ACF_BUILD_EXAMPLES=${ACF_BUILD_EXAMPLES}
ACF_SERIALIZE_WITH_CVMATIO=${ACF_SERIALIZE_WITH_CVMATIO}
ACF_SERIALIZE_WITH_CEREAL=ON
ACF_BUILD_OGLES_GPGPU=${ACF_BUILD_OGLES_GPGPU}
)
hunter_config(acf GIT_SELF CMAKE_ARGS ${acf_cmake_args})


62 changes: 56 additions & 6 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,62 @@
###############
### cxxopts ### :: std::regex >= gcc 4.8
###############
hunter_add_package(cxxopts)
find_package(cxxopts CONFIG REQUIRED)
if(NOT TARGET acf::acf)

set(ACF_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../..")

cmake_minimum_required(VERSION 3.9) # CMAKE_INTERPROCEDURAL_OPTIMIZATION

# https://docs.hunter.sh/en/latest/reference/user-variables.html#hunter-keep-package-sources
option(HUNTER_KEEP_PACKAGE_SOURCES "Keep installed package sources for debugging (caveat...)" OFF)

list(APPEND CMAKE_MODULE_PATH "${ACF_ROOT_DIR}/cmake/Modules")

# Test SDK samples using the Hunter packages (release based)
include("${ACF_ROOT_DIR}/cmake/default_options.cmake")
include("${ACF_ROOT_DIR}/cmake/HunterGate.cmake")

HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.22.8.tar.gz"
SHA1 "e7fe3f0b61b1b4844d440ec0a02ac73ddc5f0bb2"
FILEPATH "${ACF_ROOT_DIR}/cmake/Hunter/config.cmake"
)

project(acf-apps VERSION 0.0.1)

hunter_add_package(acf)
find_package(acf CONFIG REQUIRED)

hunter_add_package(cxxopts)
find_package(cxxopts CONFIG REQUIRED)

hunter_add_package(spdlog)
find_package(spdlog CONFIG REQUIRED)

hunter_add_package(sugar)
find_package(sugar CONFIG REQUIRED)

# Create acf_util lib
sugar_include("${ACF_ROOT_DIR}/src/lib/util")
add_library(acf_util ${ACF_UTIL_SRCS} ${ACF_UTIL_HDRS})
target_link_libraries(acf_util PUBLIC spdlog::spdlog)
target_include_directories(acf_util
PUBLIC
"$<BUILD_INTERFACE:${ACF_ROOT_DIR}/src/lib>"
)

if(ACF_BUILD_OGLES_GPGPU AND ACF_HAS_GPU)
hunter_add_package(aglet)
find_package(aglet CONFIG REQUIRED)
endif()

else()

hunter_add_package(cxxopts)
find_package(cxxopts CONFIG REQUIRED)

endif()

add_subdirectory(acf)

if (ACF_BUILD_OGLES_GPGPU AND TARGET aglet::aglet)
if (ACF_BUILD_OGLES_GPGPU AND ACF_HAS_GPU)
add_subdirectory(pipeline)
endif()

Expand Down
4 changes: 2 additions & 2 deletions src/app/acf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(${ACF_DO_GPU})
endif()

add_executable(${test_app} ${acf_srcs})
target_link_libraries(${test_app} PUBLIC acf acf_util cxxopts::cxxopts)
target_link_libraries(${test_app} PUBLIC acf::acf acf_util cxxopts::cxxopts)

if(${ACF_DO_GPU})
target_include_directories(${test_app} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/../>")
Expand Down Expand Up @@ -46,7 +46,7 @@ set(conv_app acf-mat2cpb)

if(ACF_SERIALIZE_WITH_CVMATIO)
add_executable(${conv_app} mat2cpb.cpp)
target_link_libraries(${conv_app} PUBLIC acf acf_util cxxopts::cxxopts cereal::cereal)
target_link_libraries(${conv_app} PUBLIC acf::acf acf_util cxxopts::cxxopts cereal::cereal)
set_property(TARGET ${conv_app} PROPERTY FOLDER "app/console")
install(TARGETS ${conv_app} DESTINATION bin)
endif()
6 changes: 3 additions & 3 deletions src/app/acf/acf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ int gauze_main(int argc, char** argv)
("h,help", "Print help message");
// clang-format on

options.parse(argc, argv);
auto cli = options.parse(argc, argv);

if ((argumentCount <= 1) || options.count("help"))
if ((argumentCount <= 1) || cli.count("help"))
{
std::cout << options.help({ "" }) << std::endl;
logger->info("{}", options.help({""}));
return 0;
}

Expand Down
18 changes: 14 additions & 4 deletions src/app/acf/mat2cpb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
# include "io/stdlib_string.h"
#endif
#include <acf/ACF.h>
#include <io/cereal_pba.h>
#include <util/Logger.h>

#include <cereal/cereal.hpp>
#include <cereal/archives/portable_binary.hpp>

#include <cxxopts.hpp>

#include <exception>
Expand Down Expand Up @@ -43,9 +45,9 @@ int gauze_main(int argc, char** argv)
("h,help", "Print help message");
// clang-format on

options.parse(argc, argv);
auto cli = options.parse(argc, argv);

if ((argumentCount <= 1) || options.count("help"))
if ((argumentCount <= 1) || cli.count("help"))
{
logger->info("{}", options.help({ "" }));
return 0;
Expand Down Expand Up @@ -76,7 +78,15 @@ int gauze_main(int argc, char** argv)

acf::Detector acf(sInput);

save_cpb(sOutput, acf);
// Serialize:
std::ofstream ofs(sOutput, std::ios::binary);
if(!ofs)
{
logger->error("Failed to open {}", sOutput);
return 1;
}
cereal::PortableBinaryOutputArchive oa(ofs);
oa << acf;

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/pipeline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(acf_srcs
)

add_executable(${test_app} ${acf_srcs})
target_link_libraries(${test_app} PUBLIC acf acf_util cxxopts::cxxopts ${OpenCV_LIBS})
target_link_libraries(${test_app} PUBLIC acf::acf acf_util cxxopts::cxxopts ${OpenCV_LIBS})

# cross platform testing
hunter_add_package(gauze)
Expand Down
6 changes: 3 additions & 3 deletions src/app/pipeline/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,10 @@ int gauze_main(int argc, char** argv)
;
// clang-format on

options.parse(argc, argv);
if ((argumentCount <= 1) || options.count("help"))
auto cli = options.parse(argc, argv);
if ((argumentCount <= 1) || cli.count("help"))
{
std::cout << options.help({ "" }) << std::endl;
logger->info("{}", options.help({""}));
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/pyramid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 10000 +5,6 @@ set(test_app acf-pyramid)
###############

add_executable(${test_app} pyramid.cpp)
target_link_libraries(${test_app} PUBLIC acf acf_util cxxopts::cxxopts cereal::cereal)
target_link_libraries(${test_app} PUBLIC acf::acf acf_util cxxopts::cxxopts cereal::cereal)
set_property(TARGET ${test_app} PROPERTY FOLDER "app/console")
install(TARGETS ${test_app} DESTINATION bin)
4 changes: 2 additions & 2 deletions src/app/pyramid/pyramid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ int gauze_main(int argc, char** argv)
("h,help", "Print help message");
// clang-format on

options.parse(argc, argv);
auto cli = options.parse(argc, argv);

if ((argumentCount <= 1) || options.count("help"))
if ((argumentCount <= 1) || cli.count("help"))
{
logger->info("{}", options.help({ "" }));
return 0;
Expand Down
30 changes: 17 additions & 13 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@
find_package(sugar CONFIG REQUIRED)
sugar_include(.)


### acf_util ###
### acf_util ### : for console apps
add_library(acf_util ${ACF_UTIL_SRCS} ${ACF_UTIL_HDRS})
target_link_libraries(acf_util PUBLIC spdlog::spdlog ${OpenCV_LIBS})
set(acf_modules acf_util)
target_link_libraries(acf_util PUBLIC spdlog::spdlog)

### acf_shaders ###
### acf_shaders ### : for acf lib and tests
if(ACF_BUILD_OGLES_GPGPU)
add_library(acf_shaders ${ACF_GPU_SRCS} ${ACF_GPU_HDRS})
target_link_libraries(acf_shaders PUBLIC spdlog::spdlog ${OpenCV_LIBS})
list(APPEND acf_modules acf_shaders)
target_link_libraries(acf_shaders PUBLIC ogles_gpgpu::ogles_gpgpu)
set(acf_modules acf_shaders)
endif()

### acf ###
Expand All @@ -30,32 +28,38 @@ else()
set(acf_lib_type STATIC)
endif()

add_library(acf ${acf_lib_type}
set(acf_srcs
${ACF_SRCS}
${ACF_HDRS}
${ACF_HDRS_PUBLIC}
)

add_library(acf ${acf_lib_type} ${acf_srcs})

add_library(${PROJECT_NAME}::acf ALIAS acf)

target_link_libraries(acf
PUBLIC ${ACF_3RDPARTY_PKG_LIBS}
PRIVATE ${ACF_3RDPARTY_PKG_LIBS_} ${acf_modules}
)

target_compile_definitions(acf PUBLIC ACF_DO_HALF=1) # half precision serialization
if(ACF_SERIALIZE_WITH_CVMATIO)
target_compile_definitions(acf PUBLIC ACF_SERIALIZE_WITH_CVMATIO=1)
endif()

target_include_directories(acf
PUBLIC
"$<BUILD_INTERFACE:${ACF_ROOT_DIR}/src/lib/>"
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>" # generated acf_export.h
)

foreach(lib acf ${acf_modules})
foreach(lib acf ${acf_modules} acf_util)
message("LIB = ${lib} >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
target_include_directories(${lib} PUBLIC "$<BUILD_INTERFACE:${ACF_ROOT_DIR}/src/lib/>")
target_include_directories(${lib}
PUBLIC
"$<BUILD_INTERFACE:${ACF_ROOT_DIR}/src/lib/>" # for util
"$<BUILD_INTERFACE:${ACF_ROOT_DIR}/src/lib/acf>" # for io, acf
)
if(MSVC)
target_compile_definitions(${lib} PUBLIC _USE_MATH_DEFINES) # define M_PI_2 for Visual Studio
target_compile_definitions(${lib} PUBLIC NOMINMAX=1) # avoid std::{min,max}() conflicts
Expand Down Expand Up @@ -168,6 +172,6 @@ install(

# unit tests:
if(ACF_BUILD_TESTS)
add_subdirectory(acf/ut)
add_subdirectory(acf/acf/ut)
endif()

1 change: 1 addition & 0 deletions src/lib/acf/ACF.cpp → src/lib/acf/acf/ACF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <acf/ACF.h>
#include <acf/MatP.h>
#include <acf/ACFIO.h>
#include <acf/acf_common.h>
#include <acf/acf_export.h>
#include <acf/random.h>
Expand Down
1 change: 0 additions & 1 deletion src/lib/acf/ACF.h → src/lib/acf/acf/ACF.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <acf/ObjectDetector.h> // interface
#include <acf/acf_common.h>
#include <acf/acf_export.h>
#include <acf/ACFIO.h>

#include <opencv2/core.hpp>
#include <opencv2/core/mat.hpp>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
0 < F438 a title="src/lib/acf/chnsPyramid.cpp → src/lib/acf/acf/chnsPyramid.cpp" class="Link--primary Truncate-text" href="#diff-83473253723982159bcbb6a001556a06becc003f706479d9ebe6be6ee8489f8e">src/lib/acf/chnsPyramid.cpp → src/lib/acf/acf/chnsPyramid.cpp
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions src/lib/acf/draw.cpp → src/lib/acf/acf/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ cv::Mat draw(acf::Detector::Pyramid& pyramid)
}
cv::vconcat(images, Ccpu);

// Instead of upright:
//cv::vconcat(pyramid.data[i][0].get(), Ccpu);

if (levels.size())
{
cv::copyMakeBorder(Ccpu, Ccpu, 0, levels.front().rows - Ccpu.rows, 0, 0, cv::BORDER_CONSTANT);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
0