Skip to content
Open
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
24 changes: 24 additions & 0 deletions doc/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generate target to build the html documentation through CMake tool
# After having configured the project with the "build_doc" option you can run make doc
# to generate the html documentation in the doc/html repository of the build folder.
# Try to find the doxygen tool
doxygen_dep = dependency('Doxygen')
if doxygen_dep.found()
# Configure the doxygen config file with variable from CMake and move it
# configure_file([cmake_current_source_dir, '/Doxyfile.dox.cmake.in', cmake_binary_dir, '/doc/Doxyfile-html.dox', '@ONLY'])
# Configure the html mainpage file of the doxygen documentation with variable
# from CMake and move it
# configure_file([cmake_current_source_dir, '/mainpage.dox.in', cmake_binary_dir, '/doc/mainpage.dox', '@ONLY'])
# configure_file([cmake_current_source_dir, '/openjpip.dox.in', cmake_binary_dir, '/doc/openjpip.dox', '@ONLY'])
# copy png file to make local (binary tree) documentation valid:
# configure_file([cmake_current_source_dir, '/jpip_architect.png', cmake_binary_dir, '/doc/html/jpip_architect.png', 'COPYONLY'])
# configure_file([cmake_current_source_dir, '/jpip_protocol.png', cmake_binary_dir, '/doc/html/jpip_protocol.png', 'COPYONLY'])
# file(['GLOB', 'headers', openjpeg_source_dir, '/src/lib/openjp2/*.h', openjpeg_source_dir, '/src/lib/openjp2/*.c', openjpeg_source_dir, '/src/lib/openjpip/*.h', openjpeg_source_dir, '/src/lib/openjpip/*.c'])
# Generate new target to build the html documentation
# add_custom_command(['OUTPUT', cmake_current_binary_dir, '/html/index.html', 'COMMAND', doxygen_executable, cmake_binary_dir, '/doc/Doxyfile-html.dox', 'DEPENDS', cmake_binary_dir, '/doc/Doxyfile-html.dox', cmake_binary_dir, '/doc/mainpage.dox', cmake_binary_dir, '/doc/openjpip.dox', headers])
# add_custom_target(['doc', 'ALL', 'DEPENDS', cmake_binary_dir, '/doc/html/index.html', 'COMMENT', 'Building doxygen documentation'])
# install HTML documentation (install png files too):
# install(['DIRECTORY', cmake_binary_dir, '/doc/html', 'DESTINATION', 'share/doc', 'PATTERN', '.svn', 'EXCLUDE'])
else
message('STATUS: Doxygen not found, we cannot generate the documentation')
endif
150 changes: 150 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@

project('openjp2', 'c', 'cpp', version : '2.3.1',
meson_version : '>= 0.55.0',
default_options : [
'buildtype=debugoptimized',
'c_std=gnu89'
]
)

cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp')
host_system = host_machine.system()
host_cpu = host_machine.cpu_family()

fs = import('fs')

openjpeg_version_major = '2'
openjpeg_version_minor = '3'
openjpeg_version_build = '1'
openjpeg_package_version = '@0@.@1@.@2@'.format(openjpeg_version_major, openjpeg_version_minor, openjpeg_version_build)


m_dep = cc.find_library('m')
thread_dep = dependency('threads')


# clock_gettime might require -rt, or it might not. find out
if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
# XXX: untested
rt_dep = cc.find_library('rt')
else
rt_dep = []
endif

wxwidgets_dep = dependency('wxWidgets', required: get_option('build_viewer'))

subdir('thirdparty')

if host_system == 'windows'
if get_option('default_library') == 'static'
add_project_arguments(['-DOPJ_STATIC'], language: 'c')
else
add_project_arguments(['-DOPJ_EXPORTS'], language: 'c')
endif
endif

#-----------------------------------------------------------------------------
# Big endian test:
# test_big_endian('OPJ_BIG_ENDIAN')

#-----------------------------------------------------------------------------
# OpenJPEG build configuration options.
#executable_output_path = [openjpeg_binary_dir, '/bin', 'CACHE', 'PATH', 'Single output directory for building all executables.']
#library_output_path = [openjpeg_binary_dir, '/bin', 'CACHE', 'PATH', 'Single output directory for building all libraries.']
# mark_as_advanced(['LIBRARY_OUTPUT_PATH', 'EXECUTABLE_OUTPUT_PATH'])
#-----------------------------------------------------------------------------
# configure name mangling to allow multiple libraries to coexist
# peacefully

#if fs.exists('openjpeg_mangle.h.in')
# mangle_prefix = openjpeg_library_name
# configure_file([cmake_current_source_dir, '/openjpeg_mangle.h.in', cmake_current_binary_dir, '/openjpeg_mangle.h', '@ONLY'])
#endif
#-----------------------------------------------------------------------------


#-----------------------------------------------------------------------------
# Build Library
if get_option('build_jpip_server')
curl_dep = dependency('libcurl', version : '>= 7.55.0', required : false)
fcgi_dep = dependency('fcgi')
threads_dep = dependency('threads')
endif

subdir('src/lib')

#-----------------------------------------------------------------------------
# Build Applications

if get_option('build_codec') or get_option('build_mj2')
# OFF: It will only build 3rd party libs if they are not found on the system
# ON: 3rd party libs will ALWAYS be build, and used
subdir('src/bin')
endif

subdir('wrapping')
#-----------------------------------------------------------------------------
# opj_config.h generation (2/2)
# configure_file([cmake_current_source_dir, '/src/lib/openjp2/opj_config.h.cmake.in', cmake_current_binary_dir, '/src/lib/openjp2/opj_config.h', '@ONLY'])
# configure_file([cmake_current_source_dir, '/src/lib/openjp2/opj_config_private.h.cmake.in', cmake_current_binary_dir, '/src/lib/openjp2/opj_config_private.h', '@ONLY'])
#-----------------------------------------------------------------------------

# build documentation in doc subdir(TODO)
#if get_option('build_doc')
# subdir('doc')
#endif

#-----------------------------------------------------------------------------
# Buld Testing
if get_option('build_testing')
if get_option('build_codec')
# Search openjpeg data needed for the tests
# They could be found via git on the OpenJPEG GitHub code project
# git clone https://github.com/uclouvain/openjpeg-data.git
# find_path(['OPJ_DATA_ROOT', 'README-OPJ-Data', 'PATHS', '$ENV{OPJ_DATA_ROOT}', cmake_source_dir, '/../data', 'NO_DEFAULT_PATH', 'NO_CMAKE_FIND_ROOT_PATH'])
# Add repository where to find tests
#subdir('tests')
else
# message('FATAL_ERROR: You need build codec to run the tests')
endif
endif

# install CHANGES and LICENSE
#if get_option('build_doc')
# if fs.exists('./CHANGES')
# # install(['FILES', 'CHANGES', 'DESTINATION', openjpeg_install_doc_dir])
# endif
# install(['FILES', 'LICENSE', 'DESTINATION', openjpeg_install_doc_dir])
#endif
#-----------------------------------------------------------------------------
# pkgconfig support

if get_option('build_pkgconfig_files')
pkgconfig = import('pkgconfig')
pkgconfig.generate(openjp2_lib, name: 'libopenjp2',
description: 'JPEG2000 library (Part 1 and 2)',
version: meson.project_version(),
libraries: openjp2_lib)
if get_option('build_jpwl')
pkgconfig.generate(openjpwl_lib, name: 'libopenjpwl',
description: 'JPEG2000 Wireless library (Part 11)',
version: meson.project_version(),
libraries: openjpwl_lib)
endif
if get_option('build_jpip')
pkgconfig.generate(openjpip_lib, name: 'libopenjpip',
description: 'JPEG2000 Interactivity tools, APIs and protocols (Part 9)',
version: meson.project_version(),
libraries: openjpip_lib)
endif
if get_option('build_jp3d')
pkgconfig.generate(openjp3d_lib, name: 'libopenjp3d',
description: 'JPEG2000 Extensions for three-dimensional data (Part 10)',
version: meson.project_version(),
libraries: openjp3d_lib)
endif
endif
#-----------------------------------------------------------------------------
# build our version of astyle
#with_astyle = ['FALSE', 'CACHE', 'BOOL', 'If you plan to contribute you should reindent with scripts/prepare-commit.sh (using 'our' astyle)']
18 changes: 18 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
option('build_doc', type : 'boolean', value : false, description : 'Build the HTML documentation (with doxygen if available).')
option('opj_use_dsymutil', type : 'boolean', value : false, description : 'Call dsymutil on binaries after build.')
option('opj_disable_tpsot_fix', type : 'boolean', value : false, description : 'Disable TPsot==TNsot fix. See https://github.com/uclouvain/openjpeg/issues/254.')
option('opj_use_thread', type : 'boolean', value : true, description : 'Build with thread/mutex support ')
option('build_luts_generator', type : 'boolean', value : false, description : 'Build utility to generate t1_luts.h')
option('build_unit_tests', type : 'boolean', value : false, description : 'Build unit tests (bench_dwt, test_sparse_array, etc..)')
option('build_codec', type : 'boolean', value : true, description : 'Build the CODEC executables')
option('build_mj2', type : 'boolean', value : false, description : 'Build the MJ2 executables.')
option('build_jpwl', type : 'boolean', value : false, description : 'Build the JPWL library and executables')
option('build_jpip', type : 'boolean', value : false, description : 'Build the JPIP library and executables.')
option('build_jpip_server', type : 'boolean', value : false, description : 'Build the JPIP server.')
option('build_viewer', type : 'boolean', value : false, description : 'Build the OPJViewer executable (C++)')
option('build_java', type : 'boolean', value : false, description : 'Build the openjpeg jar (Java)')
option('build_jp3d', type : 'boolean', value : false, description : 'Build the JP3D comp')
option('build_thirdparty', type : 'boolean', value : false, description : 'Build the thirdparty executables if it is needed')
option('build_testing', type : 'boolean', value : false, description : 'Build the tests.')
option('build_pkgconfig_files', type : 'boolean', value : true, description : 'Build and install pkg-config files')
option('with_astyle', type : 'boolean', value : false, description : 'Build with astyle')
14 changes: 14 additions & 0 deletions src/bin/common/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# opj_apps_config.h generation
configure_file(input : 'opj_apps_config.h.cmake.in', output : 'opj_apps_config.h', configuration : cappdata, format: 'cmake@')

common_srcs = [ 'color.c']


inc_dirs = include_directories('.','../../lib/openjp2')

common_lib = static_library('common', common_srcs,
include_directories : inc_dirs,
dependencies : [liblcms2_dep]
)
common_dep = declare_dependency(link_with : common_lib,
include_directories : inc_dirs)
45 changes: 45 additions & 0 deletions src/bin/jp2/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Build the demo app, small examples

# First thing define the common source:
common_srcs = ['convert.c'
, 'convertbmp.c'
, 'index.c'
, '../common/color.c'
, '../common/opj_getopt.c'
]

if libtiff_dep.found()
common_srcs += ['converttif.c']
endif

if libpng_dep.found()
common_srcs += ['convertpng.c']
endif

# Headers file are located here:
inc_dirs = include_directories('../../lib/openjp2', '../common')

openjp2_c_args = []

# Loop over all executables:
foreach exe : ['opj_decompress', 'opj_compress', 'opj_dump']
exe_c = exe + '.c'
exe_src = [exe_c] + common_srcs
exe_deps = [libopenjp2_dep, libpng_dep, libtiff_dep, liblcms2_dep, zlib_dep, rt_dep, m_dep]
exe_exe = executable (exe, exe_src
, c_args : openjp2_c_args
, include_directories : inc_dirs
, dependencies : exe_deps
, install : true
)
endforeach

#if get_option('opj_use_dsymutil')
# add_custom_command(['TARGET', exe, 'POST_BUILD', 'COMMAND', 'dsymutil', '$<TARGET_FILE:${exe}>', 'COMMENT', 'dsymutil $<TARGET_FILE:${exe}>', 'DEPENDS', exe])
#endif

#if get_option('build_doc')
# Install man pages
# install(['FILES', openjpeg_source_dir, '/doc/man/man1/opj_compress.1', openjpeg_source_dir, '/doc/man/man1/opj_decompress.1', openjpeg_source_dir, '/doc/man/man1/opj_dump.1', 'DESTINATION', openjpeg_install_man_dir, '/man1'])
#
#endif
21 changes: 21 additions & 0 deletions src/bin/jp3d/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Build the demo app, small examples
# First thing define the common source:
common_srcs = ['convert.c'
,'../common/opj_getopt.c']

inc_dirs = include_directories('../../lib/openjp2', '../../lib/openjp3d', '../common')

openjp3d_c_args = []

# Loop over all executables:
foreach exe : ['opj_jp3d_compress', 'opj_jp3d_decompress']
exe_c = exe + '.c'
exe_src = [exe_c] + common_srcs
exe_deps = [libopenjp3d_dep, zlib_dep, rt_dep, m_dep]
exe_exe = executable (exe, exe_src
, c_args : openjp3d_c_args
, include_directories : inc_dirs
, dependencies: exe_deps
, install: true
)
endforeach
83 changes: 83 additions & 0 deletions src/bin/jpip/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Headers file are located here:
inc_dirs = ['../../lib/openjp2',
'../common',
'../jp2',
'../../lib/openjpip']

# Tool to embed metadata into JP2 file
opj_jpip_addxml_exe = executable ('opj_jpip_addxml', ['opj_jpip_addxml.c'], install : true)

# Install exe
if get_option('build_jpip_server')
opj_server_srcs = ['opj_server.c']
# Build executable

# target_link_libraries(['opj_server', fcgi_libraries, 'openjpip_server'])
# set_property(['TARGET', 'opj_server', 'APPEND', 'PROPERTY', 'COMPILE_DEFINITIONS', 'SERVER', 'QUIT_SIGNAL=', 'quitJPIP'])
# On unix you need to link to the math library:

opj_server_exe = executable('opj_server', opj_server_srcs,
dependencies : [m_dep],
install : True)
endif

# Loop over all executables:
foreach exe : ['opj_dec_server', 'opj_jpip_transcode', 'opj_jpip_test']
exe_c = exe + '.c'
exe_c_args = []
exe_src = [exe_c] + common_srcs
exe_deps = [libopenjpip_dep, rt_dep, m_dep]
exe_exe = executable (exe, exe_src
, c_args : exe_c_args
, dependencies: exe_deps
, install: true
)
endforeach

message ('no java client')
# Build the two java clients:
#java_dep = dependency('Java')
# javac, jar
# User can override this:
#if 'NOT', 'DEFINED', 'JAVA_SOURCE_VERSION'
# java_source_version = '1.5'
#endif
#if 'NOT', 'DEFINED', 'JAVA_TARGET_VERSION'
# java_target_version = '1.5'
#endif

# Only build the java viewer if dev is found:
#if 'Java_Development_FOUND' and 'Java_JAVAC_EXECUTABLE'
#jflags = '$ENV{JFLAGS}'
# search for package org.apache.xerces.parsers
# find_file(['APACHE_XERCES_JAR', 'NAMES', 'xerces-j2.jar', 'xercesImpl.jar', 'PATHS', '/usr/share/java/', 'NO_DEFAULT_PATH'])
# mark_as_advanced('APACHE_XERCES_JAR')
# Decide to build the simple viewer or the xerces one:
#if 'EXISTS', apache_xerces_jar
# configure_file([cmake_current_source_dir, '/opj_viewer_xerces/dist/manifest.txt.in', cmake_current_binary_dir, '/opj_viewer_xerces/dist/manifest.txt', '@ONLY'])
# build dep list:
# file(['GLOB', 'java2_srcs', 'opj_viewer_xerces/src/*.java'])
# Need some common files:
# list(['APPEND', 'java2_srcs', cmake_current_source_dir, '/opj_viewer/src/ImageManager.java', cmake_current_source_dir, '/opj_viewer/src/ImgdecClient.java', cmake_current_source_dir, '/opj_viewer/src/JPIPHttpClient.java', cmake_current_source_dir, '/opj_viewer/src/MML.java', cmake_current_source_dir, '/opj_viewer/src/PnmImage.java', cmake_current_source_dir, '/opj_viewer/src/RegimViewer.java', cmake_current_source_dir, '/opj_viewer/src/ResizeListener.java'])
# make sure target javac dir exists:
# file(['MAKE_DIRECTORY', cmake_current_binary_dir, '/classes2'])
# Build java
# add_custom_command(['OUTPUT', library_output_path, '/opj_jpip_viewer.jar', 'COMMAND', java_javac_executable, jflags, '-source', java_source_version, '-target', java_target_version, '-classpath', apache_xerces_jar, java2_srcs, '-d', cmake_current_binary_dir, '/classes2', 'COMMAND', java_jar_executable, 'cfm', library_output_path, '/opj_jpip_viewer.jar', cmake_current_binary_dir, '/opj_viewer_xerces/dist/manifest.txt', '-C', cmake_current_binary_dir, '/classes2', '.', 'DEPENDS', java2_srcs, cmake_current_source_dir, '/opj_viewer_xerces/dist/manifest.txt.in', 'COMMENT', 'javac *.java; jar cvf -> opj_viewer_xerces.jar'])
# name the target
# add_custom_target(['OPJViewerXercesJar', 'ALL', 'DEPENDS', library_output_path, '/opj_jpip_viewer.jar', 'COMMENT', 'building opj_jpip_viewer.jar (xerces)'])
# install(['FILES', library_output_path, '/opj_jpip_viewer.jar', 'DESTINATION', openjpeg_install_share_dir, 'COMPONENT', 'JavaModule'])
#else
# opj_viewer (simple, no xerces)
# build dep list:
# file(['GLOB', 'java1_srcs', 'opj_viewer/src/*.java'])
# make sure target javac dir exists:
# file(['MAKE_DIRECTORY', cmake_current_binary_dir, '/classes1'])
# Build java
# add_custom_command(['OUTPUT', library_output_path, '/opj_jpip_viewer.jar', 'COMMAND', java_javac_executable, jflags, '-source', java_source_version, '-target', java_target_version, java1_srcs, '-d', cmake_current_binary_dir, '/classes1', 'COMMAND', java_jar_executable, 'cfm', library_output_path, '/opj_jpip_viewer.jar', cmake_current_source_dir, '/opj_viewer/dist/manifest.txt', '-C', cmake_current_binary_dir, '/classes1', '.', 'DEPENDS', java1_srcs, cmake_current_source_dir, '/opj_viewer/dist/manifest.txt', 'COMMENT', 'javac *.java; jar cvf -> opj_jpip_viewer.jar'])
# name the target
# add_custom_target(['OPJViewerJar', 'ALL', 'DEPENDS', library_output_path, '/opj_jpip_viewer.jar', 'COMMENT', 'building opj_jpip_viewer.jar (no xerces found)'])
# install(['FILES', library_output_path, '/opj_jpip_viewer.jar', 'DESTINATION', openjpeg_install_share_dir, 'COMPONENT', 'JavaModule'])
#endif
#else
# message(['WARNING', 'No java compiler found. Wont be able to build java viewer'])
#endif
27 changes: 27 additions & 0 deletions src/bin/jpwl/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# jpwl apps
# First thing define the common source:
common_srcs = ['convert.c'
, 'index.c'
, '../common/color.c'
, '../common/opj_getopt.c']
# Headers file are located here:
inc_dirs = include_directories('../../lib/openmj2', '../../lib/openjp2', '../common')

openjpwl_c_args = []


openjpwl_c_args += ['-DOPJ_USE_LEGACY', '-DUSE_JPWL']


foreach exe : ['decompress', 'compress']
jpwl_exe = 'opj_jpwl_' + exe
exe_c = jpwl_exe + '.c'
exe_src = [exe_c] + common_srcs
exe_deps = [libopenjpwl_dep, libpng_dep, libtiff_dep, liblcms2_dep, m_dep, zlib_dep ]
exe_exe = executable (exe, exe_src
, c_args : openjpwl_c_args
, include_directories : inc_dirs
, dependencies: exe_deps
, install: true
)
endforeach
Loading