summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMickael Savinaud <savmickael@users.noreply.github.com>2013-03-03 17:55:35 +0000
committerMickael Savinaud <savmickael@users.noreply.github.com>2013-03-03 17:55:35 +0000
commite7bc30b409fc864d7bcfec60254c4404a0c69c72 (patch)
treef4706818b6d1a7edc9859b311b23709114d1be81 /src
parentefaefa21fc6840df42894d746f314a6df899e3e1 (diff)
[trunk] split into two config files config options related to the lib and to the application.
Diffstat (limited to 'src')
-rw-r--r--src/bin/common/CMakeLists.txt7
-rw-r--r--src/bin/common/color.c6
-rw-r--r--src/bin/common/opj_apps_config.h.cmake.in13
-rw-r--r--src/bin/jp2/CMakeLists.txt1
-rw-r--r--src/bin/jp2/convert.c18
-rw-r--r--src/bin/jp2/opj_compress.c12
-rw-r--r--src/bin/jp2/opj_decompress.c12
-rw-r--r--src/lib/openjp2/opj_config.h.cmake.in8
8 files changed, 45 insertions, 32 deletions
diff --git a/src/bin/common/CMakeLists.txt b/src/bin/common/CMakeLists.txt
index e69de29b..bb07ba7c 100644
--- a/src/bin/common/CMakeLists.txt
+++ b/src/bin/common/CMakeLists.txt
@@ -0,0 +1,7 @@
+#-----------------------------------------------------------------------------
+# opj_apps_config.h generation
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/opj_apps_config.h.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/opj_apps_config.h
+ @ONLY
+ ) \ No newline at end of file
diff --git a/src/bin/common/color.c b/src/bin/common/color.c
index a71b7410..ce9ccde3 100644
--- a/src/bin/common/color.c
+++ b/src/bin/common/color.c
@@ -34,14 +34,14 @@
#include <stdlib.h>
#include <math.h>
-#include "opj_config.h"
+#include "opj_apps_config.h"
#include "openjpeg.h"
#include "color.h"
-#ifdef HAVE_LIBLCMS2
+#ifdef OPJ_HAVE_LIBLCMS2
#include <lcms2.h>
#endif
-#ifdef HAVE_LIBLCMS1
+#ifdef OPJ_HAVE_LIBLCMS1
#include <lcms.h>
#endif
diff --git a/src/bin/common/opj_apps_config.h.cmake.in b/src/bin/common/opj_apps_config.h.cmake.in
new file mode 100644
index 00000000..4ea1efa3
--- /dev/null
+++ b/src/bin/common/opj_apps_config.h.cmake.in
@@ -0,0 +1,13 @@
+/* create opj_apps_config.h for CMake */
+
+#cmakedefine OPJ_HAVE_LIBPNG @HAVE_LIBPNG@
+#cmakedefine OPJ_HAVE_PNG_H @HAVE_PNG_H@
+#cmakedefine OPJ_HAVE_LIBTIFF @HAVE_LIBTIFF@
+#cmakedefine OPJ_HAVE_TIFF_H @HAVE_TIFF_H@
+
+#cmakedefine OPJ_HAVE_LIBLCMS1
+#cmakedefine OPJ_HAVE_LIBLCMS2
+#cmakedefine OPJ_HAVE_LCMS1_H
+#cmakedefine OPJ_HAVE_LCMS2_H
+
+
diff --git a/src/bin/jp2/CMakeLists.txt b/src/bin/jp2/CMakeLists.txt
index aee330a5..43746317 100644
--- a/src/bin/jp2/CMakeLists.txt
+++ b/src/bin/jp2/CMakeLists.txt
@@ -11,6 +11,7 @@ set(common_SRCS
# Headers file are located here:
include_directories(
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
+ ${OPENJPEG_BINARY_DIR}/src/bin/common # opj_apps_config.h
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
${OPENJPEG_SOURCE_DIR}/src/bin/common
${LCMS_INCLUDE_DIRNAME}
diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c
index 98d900ad..1b6e688b 100644
--- a/src/bin/jp2/convert.c
+++ b/src/bin/jp2/convert.c
@@ -29,21 +29,21 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opj_config.h"
+#include "opj_apps_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#ifdef HAVE_LIBTIFF
+#ifdef OPJ_HAVE_LIBTIFF
#include <tiffio.h>
-#endif /* HAVE_LIBTIFF */
+#endif /* OPJ_HAVE_LIBTIFF */
-#ifdef HAVE_LIBPNG
+#ifdef OPJ_HAVE_LIBPNG
#include <zlib.h>
#include <png.h>
-#endif /* HAVE_LIBPNG */
+#endif /* OPJ_HAVE_LIBPNG */
#include "openjpeg.h"
#include "convert.h"
@@ -2074,7 +2074,7 @@ int imagetopnm(opj_image_t * image, const char *outfile)
return 0;
}/* imagetopnm() */
-#ifdef HAVE_LIBTIFF
+#ifdef OPJ_HAVE_LIBTIFF
/* -->> -->> -->> -->>
TIFF IMAGE FORMAT
@@ -2795,7 +2795,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
}/* tiftoimage() */
-#endif /* HAVE_LIBTIFF */
+#endif /* OPJ_HAVE_LIBTIFF */
/* -->> -->> -->> -->>
@@ -3085,7 +3085,7 @@ int imagetorawl(opj_image_t * image, const char *outfile)
return imagetoraw_common(image, outfile, OPJ_FALSE);
}
-#ifdef HAVE_LIBPNG
+#ifdef OPJ_HAVE_LIBPNG
#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a"
#define MAGIC_SIZE 8
@@ -3624,4 +3624,4 @@ fin:
return fails;
}/* imagetopng() */
-#endif /* HAVE_LIBPNG */
+#endif /* OPJ_HAVE_LIBPNG */
diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c
index 24217aa3..71e767b5 100644
--- a/src/bin/jp2/opj_compress.c
+++ b/src/bin/jp2/opj_compress.c
@@ -53,7 +53,7 @@
#include <strings.h>
#endif /* _WIN32 */
-#include "opj_config.h"
+#include "opj_apps_config.h"
#include "openjpeg.h"
#include "opj_getopt.h"
#include "convert.h"
@@ -1727,7 +1727,7 @@ int main(int argc, char **argv) {
}
break;
-#ifdef HAVE_LIBTIFF
+#ifdef OPJ_HAVE_LIBTIFF
case TIF_DFMT:
image = tiftoimage(parameters.infile, &parameters);
if (!image) {
@@ -1735,7 +1735,7 @@ int main(int argc, char **argv) {
return 1;
}
break;
-#endif /* HAVE_LIBTIFF */
+#endif /* OPJ_HAVE_LIBTIFF */
case RAW_DFMT:
image = rawtoimage(parameters.infile, &parameters, &raw_cp);
@@ -1761,7 +1761,7 @@ int main(int argc, char **argv) {
}
break;
-#ifdef HAVE_LIBPNG
+#ifdef OPJ_HAVE_LIBPNG
case PNG_DFMT:
image = pngtoimage(parameters.infile, &parameters);
if (!image) {
@@ -1769,11 +1769,11 @@ int main(int argc, char **argv) {
return 1;
}
break;
-#endif /* HAVE_LIBPNG */
+#endif /* OPJ_HAVE_LIBPNG */
}
/* Can happen if input file is TIFF or PNG
- * and HAVE_LIBTIF or HAVE_LIBPNG is undefined
+ * and HAVE_LIBTIF or OPJ_HAVE_LIBPNG is undefined
*/
if( !image) {
fprintf(stderr, "Unable to load file: got no image\n");
diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c
index 9e4f3103..3fced21d 100644
--- a/src/bin/jp2/opj_decompress.c
+++ b/src/bin/jp2/opj_decompress.c
@@ -31,7 +31,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "opj_config.h"
+#include "opj_apps_config.h"
#include <stdio.h>
#include <string.h>
@@ -888,7 +888,7 @@ int main(int argc, char **argv)
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
}
break;
-#ifdef HAVE_LIBTIFF
+#ifdef OPJ_HAVE_LIBTIFF
case TIF_DFMT: /* TIFF */
if(imagetotif(image, parameters.outfile)){
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
@@ -897,7 +897,7 @@ int main(int argc, char **argv)
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
}
break;
-#endif /* HAVE_LIBTIFF */
+#endif /* OPJ_HAVE_LIBTIFF */
case RAW_DFMT: /* RAW */
if(imagetoraw(image, parameters.outfile)){
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
@@ -924,7 +924,7 @@ int main(int argc, char **argv)
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
}
break;
-#ifdef HAVE_LIBPNG
+#ifdef OPJ_HAVE_LIBPNG
case PNG_DFMT: /* PNG */
if(imagetopng(image, parameters.outfile)){
fprintf(stdout,"Error generating png file. Outfile %s not generated\n",parameters.outfile);
@@ -933,9 +933,9 @@ int main(int argc, char **argv)
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
}
break;
-#endif /* HAVE_LIBPNG */
+#endif /* OPJ_HAVE_LIBPNG */
/* Can happen if output file is TIFF or PNG
- * and HAVE_LIBTIF or HAVE_LIBPNG is undefined
+ * and HAVE_LIBTIF or OPJ_HAVE_LIBPNG is undefined
*/
default:
fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
diff --git a/src/lib/openjp2/opj_config.h.cmake.in b/src/lib/openjp2/opj_config.h.cmake.in
index 6bc268ef..83f7009c 100644
--- a/src/lib/openjp2/opj_config.h.cmake.in
+++ b/src/lib/openjp2/opj_config.h.cmake.in
@@ -11,20 +11,12 @@
#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@
#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@
#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@
-#cmakedefine HAVE_LIBPNG @HAVE_LIBPNG@
-#cmakedefine HAVE_PNG_H @HAVE_PNG_H@
-#cmakedefine HAVE_LIBTIFF @HAVE_LIBTIFF@
-#cmakedefine HAVE_TIFF_H @HAVE_TIFF_H@
#cmakedefine _LARGEFILE_SOURCE
#cmakedefine _LARGE_FILES
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
#cmakedefine HAVE_FSEEKO @HAVE_FSEEKO@
-#cmakedefine HAVE_LIBLCMS1
-#cmakedefine HAVE_LIBLCMS2
-#cmakedefine HAVE_LCMS1_H
-#cmakedefine HAVE_LCMS2_H
/* Byte order. */
/* All compilers that support Mac OS X define either __BIG_ENDIAN__ or