Skip to content

Commit

Permalink
fix rpath format
Browse files Browse the repository at this point in the history
* set CMAKE_INSTALL_RPATH w/ list syntax of string syntax
* add Context::updateGL() to allow use to call `glewInit()` from within windows DLL (requirement) for multi-context scenarios and bump minor sdk version
* add `add_library(drishti::drishti ALIAS drishti)` in install section for `add_subdirectory()` compatibility
* update driahti-face-test sample config file defaults

```
  set(CMAKE_INSTALL_RPATH "${DRISHTI_ORIGIN}/../lib" "${DRISHTI_ORIGIN}")
```
  • Loading branch information
headupinclouds committed May 24, 2018
1 parent f00983f commit 2de6c84
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 18 deletions.
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ if(DRISHTI_USE_DRISHTI_UPLOAD)
)
endif()
else()
set(DRISHTI_HUNTER_GATE_URL "https://github.com/ruslo/hunter/archive/v0.21.9.tar.gz")
set(DRISHTI_HUNTER_GATE_SHA1 "0056188988906abb63a06c6f1aaef01832c62b74")

set(DRISHTI_HUNTER_GATE_URL "https://github.com/ruslo/hunter/archive/v0.21.15.tar.gz")
set(DRISHTI_HUNTER_GATE_SHA1 "f52db0eb7c1663d4cdedbda82b61b23d5d6a75d9")
if(HUNTER_ENABLED AND NOT DRISHTI_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 +93,7 @@ endif()
### Drishti project ###
#######################

project(drishtisdk VERSION 0.11.1)
project(drishtisdk VERSION 0.12.0)

set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) # for 3rd parties added by add_subdirectory

Expand Down
5 changes: 3 additions & 2 deletions cmake/Modules/drishti_set_rpath.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#https://cmake.org/Wiki/CMake_RPATH_handling

macro(drishti_set_rpath)
set(DRISHTI_ORIGIN "$ORIGIN")
if (APPLE)
set(DRISHTI_ORIGIN "@loader_path")
else()
set(DRISHTI_ORIGIN "$ORIGIN")
endif()
set(CMAKE_INSTALL_RPATH "${DRISHTI_ORIGIN}/../lib:${DRISHTI_ORIGIN}/")
set(CMAKE_INSTALL_RPATH "${DRISHTI_ORIGIN}/../lib" "${DRISHTI_ORIGIN}")
endmacro()
1 change: 0 additions & 1 deletion src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ endif()
target_include_directories(drishti PUBLIC $<BUILD_INTERFACE:${DRISHTI_INCLUDE_DIRECTORIES}/drishti>)
add_library(drishti::drishti ALIAS drishti)

set(DRISHTI_BUNDLE_SDK_SAMPLES ON) # indicate they will be bundled
add_subdirectory(sdk)
2 changes: 1 addition & 1 deletion src/app/sdk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# etc).
################################################################################

if(NOT DRISHTI_BUNDLE_SDK_SAMPLES)
if(NOT TARGET drishti::drishti)

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

Expand Down
1 change: 1 addition & 0 deletions src/app/sdk/face/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ endif()
if(DRISHTI_HAVE_LOCALECONV)
target_compile_definitions(drishti-face-test PUBLIC DRISHTI_HAVE_LOCALECONV=1)
endif()

install(TARGETS drishti-face-test DESTINATION bin)
12 changes: 6 additions & 6 deletions src/app/sdk/face/config/orbbec_astra_pro.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"acfCalibration": 0.015,
"acfCalibration": 0.002,
"doAnnotation": true,
"doSimplePipeline": false,
"faceFinderInterval": 0.0,
"videoWidth": 1920,
"videoHeight": 1080,
"videoWidth": 1280,
"videoHeight": 720,
"focalLength": 1618.0,
"minDetectionDistance": 0.0,
"maxDetectionDistance": 3.0,
"minDetectionDistance": 0.1,
"maxDetectionDistance": 2.0,
"maxTrackMisses": 2,
"minFaceSeparation": 0.1,
"minTrackHits": 3,
"multiFace": false,
"multiFace": true,
"regressorCropScale": 1.1,
"doCpuAcf": false
}
3 changes: 3 additions & 0 deletions src/lib/drishti/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ if((NOT DRISHTI_BUILD_SHARED_SDK) AND DRISHTI_BUILD_MERGED_SDK)
list(APPEND drishti_interface_libs drishti)
endif()

# ALIAS target allow us to have same interface while including project
add_library(drishti::drishti ALIAS drishti)

if(DRISHTI_BUILD_SHARED_SDK AND NOT (IOS AND DRISHTI_BUILD_MERGED_SDK))
# Error: ld: Assertion failed: (0 && "need to handle arm64 -r reloc")
#drishti_strip(drishti)
Expand Down
13 changes: 9 additions & 4 deletions src/lib/drishti/drishti/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,24 @@ Context::Impl::Impl(drishti::sdk::SensorModel& sensor)
, logger(drishti::core::Logger::create(DRISHTI_LOGGER_NAME))
, threads(std::make_shared<tp::ThreadPool<>>()) // thread-pool
{
#if defined(_WIN32) || defined(_WIN64)
// A windows DLL must call glewInit() from within the library (not the application layer)
CV_Assert(wglGetCurrentContext() != NULL && GLEW_OK == glewInit());
#endif
}

Context::Context(drishti::sdk::SensorModel& sensor)
{
impl = drishti::core::make_unique<Impl>(sensor);
updateGL();
}

Context::~Context() = default;

void Context::updateGL()
{
#if defined(_WIN32) || defined(_WIN64)
// A windows DLL must call glewInit() from within the library (not the application layer)
CV_Assert(wglGetCurrentContext() != NULL && GLEW_OK == glewInit());
#endif
}

void Context::setDoSingleFace(bool flag)
{
impl->doSingleFace = flag;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/drishti/drishti/Context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class DRISHTI_EXPORT Context

Impl* get() { return impl.get(); }

void updateGL();

void setDoSingleFace(bool flag);
bool getDoSingleFace() const;

Expand Down

0 comments on commit 2de6c84

Please sign in to comment.