Commit 70e767bf authored by Davis King's avatar Davis King

merged

parents 6d636ffb 802fc36d
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
project(dlib) project(dlib)
# Adhere to GNU filesystem layout conventions
include(GNUInstallDirs)
# default to a Release build (except if CMAKE_BUILD_TYPE is set) # default to a Release build (except if CMAKE_BUILD_TYPE is set)
include(cmake_utils/release_build_by_default) include(cmake_utils/release_build_by_default)
include(cmake_utils/use_cpp_11.cmake) include(cmake_utils/use_cpp_11.cmake)
...@@ -709,7 +712,6 @@ if (NOT TARGET dlib) ...@@ -709,7 +712,6 @@ if (NOT TARGET dlib)
# Install the library # Install the library
if (NOT DLIB_IN_PROJECT_BUILD) if (NOT DLIB_IN_PROJECT_BUILD)
set (LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries (e.g. lib32 or lib64 for multilib installations)")
cmake_minimum_required(VERSION 2.8.8) cmake_minimum_required(VERSION 2.8.8)
if(UNIX) if(UNIX)
set_target_properties(dlib_shared PROPERTIES set_target_properties(dlib_shared PROPERTIES
...@@ -717,34 +719,32 @@ if (NOT TARGET dlib) ...@@ -717,34 +719,32 @@ if (NOT TARGET dlib)
VERSION ${VERSION}) VERSION ${VERSION})
install(TARGETS dlib dlib_shared install(TARGETS dlib dlib_shared
EXPORT dlib EXPORT dlib
RUNTIME DESTINATION bin # Windows (including cygwin) considers .dll to be runtime artifacts RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # Windows (including cygwin) considers .dll to be runtime artifacts
LIBRARY DESTINATION "${LIB_INSTALL_DIR}" LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}") ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
else() else()
install(TARGETS dlib install(TARGETS dlib
EXPORT dlib EXPORT dlib
RUNTIME DESTINATION bin # Windows considers .dll to be runtime artifacts RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # Windows considers .dll to be runtime artifacts
LIBRARY DESTINATION lib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION include/dlib install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dlib
FILES_MATCHING PATTERN "*.h" PATTERN "*.cmake" FILES_MATCHING PATTERN "*.h" PATTERN "*.cmake"
REGEX "${CMAKE_CURRENT_BINARY_DIR}" EXCLUDE) REGEX "${CMAKE_CURRENT_BINARY_DIR}" EXCLUDE)
configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
# overwrite config.h with the configured one # overwrite config.h with the configured one
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/dlib) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dlib)
configure_file(${PROJECT_SOURCE_DIR}/revision.h.in ${CMAKE_CURRENT_BINARY_DIR}/revision.h) configure_file(${PROJECT_SOURCE_DIR}/revision.h.in ${CMAKE_CURRENT_BINARY_DIR}/revision.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/revision.h DESTINATION include/dlib) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/revision.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dlib)
install(FILES "LICENSE.txt" DESTINATION share/doc/dlib)
## Config.cmake generation and installation ## Config.cmake generation and installation
set(ConfigPackageLocation "${LIB_INSTALL_DIR}/cmake/dlib") set(ConfigPackageLocation "${CMAKE_INSTALL_LIBDIR}/cmake/dlib")
install(EXPORT dlib install(EXPORT dlib
NAMESPACE dlib:: NAMESPACE dlib::
DESTINATION ${ConfigPackageLocation}) DESTINATION ${ConfigPackageLocation})
...@@ -768,7 +768,7 @@ if (NOT TARGET dlib) ...@@ -768,7 +768,7 @@ if (NOT TARGET dlib)
configure_file("cmake_utils/dlib.pc.in" "dlib-1.pc" @ONLY) configure_file("cmake_utils/dlib.pc.in" "dlib-1.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dlib-1.pc" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dlib-1.pc"
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig") DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endif() endif()
......
...@@ -68,7 +68,7 @@ if (PYTHON3) ...@@ -68,7 +68,7 @@ if (PYTHON3)
if (NOT Boost_FOUND) if (NOT Boost_FOUND)
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python) FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
endif() endif()
set(Python_ADDITIONAL_VERSIONS 3.5) set(Python_ADDITIONAL_VERSIONS 3.5 3.6)
FIND_PACKAGE(PythonLibs 3.4 REQUIRED) FIND_PACKAGE(PythonLibs 3.4 REQUIRED)
else() else()
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python) FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
......
prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@
exec_prefix=${prefix} includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
libdir=${exec_prefix}/@LIB_INSTALL_DIR@
includedir=${prefix}/include
Name: @PROJECT_NAME@ Name: @PROJECT_NAME@
Description: Numerical and networking C++ library Description: Numerical and networking C++ library
......
...@@ -162,9 +162,9 @@ namespace dlib ...@@ -162,9 +162,9 @@ namespace dlib
g.set_label(sink_node, SINK_CUT); g.set_label(sink_node, SINK_CUT);
// used to indicate "no parent" // used to indicate "no parent"
const unsigned long nil = g.number_of_nodes(); const unsigned long no_parent = g.number_of_nodes();
parent.assign(g.number_of_nodes(), nil); parent.assign(g.number_of_nodes(), no_parent);
time = 1; time = 1;
dist.assign(g.number_of_nodes(), 0); dist.assign(g.number_of_nodes(), 0);
...@@ -194,14 +194,14 @@ namespace dlib ...@@ -194,14 +194,14 @@ namespace dlib
private: private:
unsigned long distance_to_origin ( unsigned long distance_to_origin (
const unsigned long nil, const unsigned long no_parent,
unsigned long p, unsigned long p,
unsigned long unsigned long
) const ) const
{ {
unsigned long start = p; unsigned long start = p;
unsigned long count = 0; unsigned long count = 0;
while (p != nil) while (p != no_parent)
{ {
if (ts[p] == time) if (ts[p] == time)
{ {
...@@ -237,7 +237,7 @@ namespace dlib ...@@ -237,7 +237,7 @@ namespace dlib
typedef typename flow_graph::in_edge_iterator in_edge_iterator; typedef typename flow_graph::in_edge_iterator in_edge_iterator;
// used to indicate "no parent" // used to indicate "no parent"
const unsigned long nil = g.number_of_nodes(); const unsigned long no_parent = g.number_of_nodes();
while (orphans.size() > 0) while (orphans.size() > 0)
{ {
...@@ -260,7 +260,7 @@ namespace dlib ...@@ -260,7 +260,7 @@ namespace dlib
if (g.get_label(id) != label_p || g.get_flow(q) <= 0 ) if (g.get_label(id) != label_p || g.get_flow(q) <= 0 )
continue; continue;
unsigned long temp = distance_to_origin(nil, id,source); unsigned long temp = distance_to_origin(no_parent, id,source);
if (temp < best_dist) if (temp < best_dist)
{ {
best_dist = temp; best_dist = temp;
...@@ -276,7 +276,7 @@ namespace dlib ...@@ -276,7 +276,7 @@ namespace dlib
} }
// if we didn't find a parent for p // if we didn't find a parent for p
if (parent[p] == nil) if (parent[p] == no_parent)
{ {
for(in_edge_iterator q = begin; q != end; ++q) for(in_edge_iterator q = begin; q != end; ++q)
{ {
...@@ -290,7 +290,7 @@ namespace dlib ...@@ -290,7 +290,7 @@ namespace dlib
if (parent[id] == p) if (parent[id] == p)
{ {
parent[id] = nil; parent[id] = no_parent;
orphans.push_back(id); orphans.push_back(id);
} }
} }
...@@ -309,7 +309,7 @@ namespace dlib ...@@ -309,7 +309,7 @@ namespace dlib
if (g.get_label(id) != label_p || g.get_flow(q) <= 0) if (g.get_label(id) != label_p || g.get_flow(q) <= 0)
continue; continue;
unsigned long temp = distance_to_origin(nil, id,sink); unsigned long temp = distance_to_origin(no_parent, id,sink);
if (temp < best_dist) if (temp < best_dist)
{ {
...@@ -326,7 +326,7 @@ namespace dlib ...@@ -326,7 +326,7 @@ namespace dlib
} }
// if we didn't find a parent for p // if we didn't find a parent for p
if (parent[p] == nil) if (parent[p] == no_parent)
{ {
for(out_edge_iterator q = begin; q != end; ++q) for(out_edge_iterator q = begin; q != end; ++q)
{ {
...@@ -340,7 +340,7 @@ namespace dlib ...@@ -340,7 +340,7 @@ namespace dlib
if (parent[id] == p) if (parent[id] == p)
{ {
parent[id] = nil; parent[id] = no_parent;
orphans.push_back(id); orphans.push_back(id);
} }
} }
...@@ -366,7 +366,7 @@ namespace dlib ...@@ -366,7 +366,7 @@ namespace dlib
typedef typename flow_graph::edge_type edge_type; typedef typename flow_graph::edge_type edge_type;
// used to indicate "no parent" // used to indicate "no parent"
const unsigned long nil = g.number_of_nodes(); const unsigned long no_parent = g.number_of_nodes();
unsigned long s = source_side; unsigned long s = source_side;
unsigned long t = sink_side; unsigned long t = sink_side;
...@@ -414,7 +414,7 @@ namespace dlib ...@@ -414,7 +414,7 @@ namespace dlib
g.adjust_flow(t,s, min_cap); g.adjust_flow(t,s, min_cap);
if (g.get_flow(s,t) <= 0) if (g.get_flow(s,t) <= 0)
{ {
parent[t] = nil; parent[t] = no_parent;
orphans.push_back(t); orphans.push_back(t);
} }
...@@ -429,7 +429,7 @@ namespace dlib ...@@ -429,7 +429,7 @@ namespace dlib
g.adjust_flow(t,s, min_cap); g.adjust_flow(t,s, min_cap);
if (g.get_flow(s,t) <= 0) if (g.get_flow(s,t) <= 0)
{ {
parent[s] = nil; parent[s] = no_parent;
orphans.push_back(s); orphans.push_back(s);
} }
s = t; s = t;
......
...@@ -42,12 +42,12 @@ namespace dlib ...@@ -42,12 +42,12 @@ namespace dlib
integer info = 0; integer info = 0;
char sort = 'N'; char sort = 'N';
L_fp fnil = 0; L_fp fnil = 0;
logical nil = 0; logical bwork = 0;
integer sdim = 0; integer sdim = 0;
DLIB_FORTRAN_ID(dgees)(&jobvs, &sort, fnil, &n, DLIB_FORTRAN_ID(dgees)(&jobvs, &sort, fnil, &n,
a, &lda, &sdim, wr, a, &lda, &sdim, wr,
wi, vs, &ldvs, work, wi, vs, &ldvs, work,
&lwork, &nil, &info); &lwork, &bwork, &info);
return info; return info;
} }
...@@ -61,12 +61,12 @@ namespace dlib ...@@ -61,12 +61,12 @@ namespace dlib
integer info = 0; integer info = 0;
char sort = 'N'; char sort = 'N';
L_fp fnil = 0; L_fp fnil = 0;
logical nil = 0; logical bwork = 0;
integer sdim = 0; integer sdim = 0;
DLIB_FORTRAN_ID(sgees)(&jobvs, &sort, fnil, &n, DLIB_FORTRAN_ID(sgees)(&jobvs, &sort, fnil, &n,
a, &lda, &sdim, wr, a, &lda, &sdim, wr,
wi, vs, &ldvs, work, wi, vs, &ldvs, work,
&lwork, &nil, &info); &lwork, &bwork, &info);
return info; return info;
} }
......
...@@ -378,7 +378,7 @@ namespace dlib ...@@ -378,7 +378,7 @@ namespace dlib
h(0,3) = h(0,3) + 8.0E+00 * f1 * f2 * df1dx1 * df2dx4; h(0,3) = h(0,3) + 8.0E+00 * f1 * f2 * df1dx1 * df2dx4;
h(1,0) = h(1,0) + 12.0E+00 * pow(f1,2) * df1dx2 * df1dx1 + 4.0E+00 * pow(f2,2) * df1dx2 * df1dx1; h(1,0) = h(1,0) + 12.0E+00 * pow(f1,2) * df1dx2 * df1dx1 + 4.0E+00 * pow(f2,2) * df1dx2 * df1dx1;
h(1,1) = h(1,1) + 12.0E+00 * pow(f1,2) * df1dx2 * df1dx2 + 4.0E+00 * pow(f2,2) * df1dx2 * df1dx1; h(1,1) = h(1,1) + 12.0E+00 * pow(f1,2) * df1dx2 * df1dx2 + 4.0E+00 * pow(f2,2) * df1dx2 * df1dx2;
h(1,2) = h(1,2) + 8.0E+00 * f1 * f2 * df1dx2 * df2dx3; h(1,2) = h(1,2) + 8.0E+00 * f1 * f2 * df1dx2 * df2dx3;
h(1,3) = h(1,3) + 8.0E+00 * f1 * f2 * df1dx2 * df2dx4; h(1,3) = h(1,3) + 8.0E+00 * f1 * f2 * df1dx2 * df2dx4;
......
...@@ -18,7 +18,7 @@ namespace ...@@ -18,7 +18,7 @@ namespace
logger dlog("test.tuple"); logger dlog("test.tuple");
struct nil struct s_nil
{ {
template <typename T> template <typename T>
void operator() ( void operator() (
...@@ -122,10 +122,10 @@ namespace ...@@ -122,10 +122,10 @@ namespace
b = a; b = a;
inc i; inc i;
nil n; s_nil n;
a.for_each(inc()); a.for_each(inc());
a.for_each(i); a.for_each(i);
const_cast<const T&>(a).for_each(nil()); const_cast<const T&>(a).for_each(s_nil());
const_cast<const T&>(a).for_each(n); const_cast<const T&>(a).for_each(n);
DLIB_TEST(a.get<0>() == b.get<0>()+2); DLIB_TEST(a.get<0>() == b.get<0>()+2);
...@@ -145,7 +145,7 @@ namespace ...@@ -145,7 +145,7 @@ namespace
a.for_index(i,0); a.for_index(i,0);
a.for_index(inc(),1); a.for_index(inc(),1);
const_cast<const T&>(a).for_index(n,2); const_cast<const T&>(a).for_index(n,2);
const_cast<const T&>(a).for_index(nil(),0); const_cast<const T&>(a).for_index(s_nil(),0);
DLIB_TEST(a.get<0>() == b.get<0>()+1); DLIB_TEST(a.get<0>() == b.get<0>()+1);
DLIB_TEST(a.get<1>() == b.get<1>()+1); DLIB_TEST(a.get<1>() == b.get<1>()+1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment