Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.io.image
Commits
3511f06f
Commit
3511f06f
authored
May 21, 2015
by
Manuel Günther
Browse files
Removed the newly introduced config.h since this package does not provide a C-API
parent
45866d77
Changes
3
Hide whitespace changes
Inline
Side-by-side
bob/io/image/include/bob.io.image/config.h
deleted
100644 → 0
View file @
45866d77
/**
* @author Manuel Guenther <manuel.guenther@idiap.ch>
* @date Thu 21 May 16:23:42 CEST 2015
*
* @brief Versioning information for bob.io.image
*/
#ifndef BOB_IO_IMAGE_CONFIG_H
#define BOB_IO_IMAGE_CONFIG_H
#ifdef BOB_IMPORT_VERSION
/***************************************
* Here we define some functions that should be used to build version dictionaries in the version.cpp file
* There will be a compiler warning, when these functions are not used, so use them!
***************************************/
#include <Python.h>
#include <boost/preprocessor/stringize.hpp>
extern
"C"
{
#include <jpeglib.h>
#define PNG_SKIP_SETJMP_CHECK
// #define requires because of the problematic pngconf.h.
// Look at the thread here:
// https://bugs.launchpad.net/ubuntu/+source/libpng/+bug/218409
#include <png.h>
#include <gif_lib.h>
#include <tiffio.h>
}
/**
* LibJPEG version
*/
static
PyObject
*
libjpeg_version
()
{
boost
::
format
f
(
"%d (compiled with %d bits depth)"
);
f
%
LIBJPEG_VERSION
%
BITS_IN_JSAMPLE
;
return
Py_BuildValue
(
"s"
,
f
.
str
().
c_str
());
}
/**
* Libpng version
*/
static
PyObject
*
libpng_version
()
{
return
Py_BuildValue
(
"s"
,
PNG_LIBPNG_VER_STRING
);
}
/**
* Libtiff version
*/
static
PyObject
*
libtiff_version
()
{
static
const
std
::
string
beg_str
(
"LIBTIFF, Version "
);
static
const
size_t
beg_len
=
beg_str
.
size
();
std
::
string
vtiff
(
TIFFGetVersion
());
// Remove first part if it starts with "LIBTIFF, Version "
if
(
vtiff
.
compare
(
0
,
beg_len
,
beg_str
)
==
0
)
vtiff
=
vtiff
.
substr
(
beg_len
);
// Remove multiple (copyright) lines if any
size_t
end_line
=
vtiff
.
find
(
"
\n
"
);
if
(
end_line
!=
std
::
string
::
npos
)
vtiff
=
vtiff
.
substr
(
0
,
end_line
);
return
Py_BuildValue
(
"s"
,
vtiff
.
c_str
());
}
/**
* Version of giflib support
*/
static
PyObject
*
giflib_version
()
{
#ifdef GIF_LIB_VERSION
return
Py_BuildValue
(
"s"
,
GIF_LIB_VERSION
);
#else
boost
::
format
f
(
"%s.%s.%s"
);
f
%
BOOST_PP_STRINGIZE
(
GIFLIB_MAJOR
)
%
BOOST_PP_STRINGIZE
(
GIFLIB_MINOR
)
%
BOOST_PP_STRINGIZE
(
GIFLIB_RELEASE
);
return
Py_BuildValue
(
"s"
,
f
.
str
().
c_str
());
#endif
}
#endif // BOB_IMPORT_VERSION
#endif
/* BOB_IO_IMAGE_CONFIG_H */
bob/io/image/version.cpp
View file @
3511f06f
...
...
@@ -10,7 +10,69 @@
#include <bob.blitz/cleanup.h>
#include <bob.core/config.h>
#include <bob.io.base/config.h>
#include <bob.io.image/config.h>
#include <boost/preprocessor/stringize.hpp>
extern
"C"
{
#include <jpeglib.h>
#define PNG_SKIP_SETJMP_CHECK
// #define requires because of the problematic pngconf.h.
// Look at the thread here:
// https://bugs.launchpad.net/ubuntu/+source/libpng/+bug/218409
#include <png.h>
#include <gif_lib.h>
#include <tiffio.h>
}
/**
* LibJPEG version
*/
static
PyObject
*
libjpeg_version
()
{
boost
::
format
f
(
"%d (compiled with %d bits depth)"
);
f
%
LIBJPEG_VERSION
%
BITS_IN_JSAMPLE
;
return
Py_BuildValue
(
"s"
,
f
.
str
().
c_str
());
}
/**
* Libpng version
*/
static
PyObject
*
libpng_version
()
{
return
Py_BuildValue
(
"s"
,
PNG_LIBPNG_VER_STRING
);
}
/**
* Libtiff version
*/
static
PyObject
*
libtiff_version
()
{
static
const
std
::
string
beg_str
(
"LIBTIFF, Version "
);
static
const
size_t
beg_len
=
beg_str
.
size
();
std
::
string
vtiff
(
TIFFGetVersion
());
// Remove first part if it starts with "LIBTIFF, Version "
if
(
vtiff
.
compare
(
0
,
beg_len
,
beg_str
)
==
0
)
vtiff
=
vtiff
.
substr
(
beg_len
);
// Remove multiple (copyright) lines if any
size_t
end_line
=
vtiff
.
find
(
"
\n
"
);
if
(
end_line
!=
std
::
string
::
npos
)
vtiff
=
vtiff
.
substr
(
0
,
end_line
);
return
Py_BuildValue
(
"s"
,
vtiff
.
c_str
());
}
/**
* Version of giflib support
*/
static
PyObject
*
giflib_version
()
{
#ifdef GIF_LIB_VERSION
return
Py_BuildValue
(
"s"
,
GIF_LIB_VERSION
);
#else
boost
::
format
f
(
"%s.%s.%s"
);
f
%
BOOST_PP_STRINGIZE
(
GIFLIB_MAJOR
)
%
BOOST_PP_STRINGIZE
(
GIFLIB_MINOR
)
%
BOOST_PP_STRINGIZE
(
GIFLIB_RELEASE
);
return
Py_BuildValue
(
"s"
,
f
.
str
().
c_str
());
#endif
}
static
PyObject
*
build_version_dictionary
()
{
...
...
@@ -67,8 +129,7 @@ static PyObject* create_module (void) {
auto
m_
=
make_safe
(
m
);
///< protects against early returns
/* register version numbers and constants */
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddStringConstant
(
m
,
"module"
,
BOB_EXT_MODULE_VERSION
)
<
0
)
return
0
;
if
(
PyModule_AddObject
(
m
,
"externals"
,
build_version_dictionary
())
<
0
)
return
0
;
return
Py_BuildValue
(
"O"
,
m
);
...
...
setup.py
View file @
3511f06f
...
...
@@ -446,7 +446,7 @@ setup(
boost_modules
=
boost_modules
,
bob_packages
=
bob_packages
,
version
=
version
,
system_include_dirs
=
system_include_dirs
+
[
'bob/io/image/include'
]
,
system_include_dirs
=
system_include_dirs
,
library_dirs
=
library_dirs
,
libraries
=
libraries
,
define_macros
=
define_macros
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment