|
| 1 | + |
| 2 | +project('openjp2', 'c', 'cpp', version : '2.3.1', |
| 3 | + meson_version : '>= 0.55.0', |
| 4 | + default_options : [ |
| 5 | + 'buildtype=debugoptimized', |
| 6 | + 'c_std=gnu89' |
| 7 | + ] |
| 8 | + ) |
| 9 | + |
| 10 | +cc = meson.get_compiler('c') |
| 11 | +cxx = meson.get_compiler('cpp') |
| 12 | +host_system = host_machine.system() |
| 13 | +host_cpu = host_machine.cpu_family() |
| 14 | + |
| 15 | +fs = import('fs') |
| 16 | + |
| 17 | +openjpeg_version_major = '2' |
| 18 | +openjpeg_version_minor = '3' |
| 19 | +openjpeg_version_build = '1' |
| 20 | +openjpeg_package_version = '@0@.@1@.@2@'.format(openjpeg_version_major, openjpeg_version_minor, openjpeg_version_build) |
| 21 | + |
| 22 | + |
| 23 | +m_dep = cc.find_library('m') |
| 24 | +thread_dep = dependency('threads') |
| 25 | + |
| 26 | + |
| 27 | +# clock_gettime might require -rt, or it might not. find out |
| 28 | +if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>') |
| 29 | + # XXX: untested |
| 30 | + rt_dep = cc.find_library('rt') |
| 31 | +else |
| 32 | + rt_dep = [] |
| 33 | +endif |
| 34 | + |
| 35 | +wxwidgets_dep = dependency('wxWidgets') |
| 36 | + |
| 37 | +subdir('thirdparty') |
| 38 | + |
| 39 | +if host_system == 'windows' |
| 40 | + if get_option('default_library') == 'static' |
| 41 | + add_project_arguments(['-DOPJ_STATIC'], language: 'c') |
| 42 | + else |
| 43 | + add_project_arguments(['-DOPJ_EXPORTS'], language: 'c') |
| 44 | + endif |
| 45 | +endif |
| 46 | + |
| 47 | +#----------------------------------------------------------------------------- |
| 48 | +# Big endian test: |
| 49 | +# test_big_endian('OPJ_BIG_ENDIAN') |
| 50 | + |
| 51 | +#----------------------------------------------------------------------------- |
| 52 | +# OpenJPEG build configuration options. |
| 53 | +#executable_output_path = [openjpeg_binary_dir, '/bin', 'CACHE', 'PATH', 'Single output directory for building all executables.'] |
| 54 | +#library_output_path = [openjpeg_binary_dir, '/bin', 'CACHE', 'PATH', 'Single output directory for building all libraries.'] |
| 55 | +# mark_as_advanced(['LIBRARY_OUTPUT_PATH', 'EXECUTABLE_OUTPUT_PATH']) |
| 56 | +#----------------------------------------------------------------------------- |
| 57 | +# configure name mangling to allow multiple libraries to coexist |
| 58 | +# peacefully |
| 59 | + |
| 60 | +#if fs.exists('openjpeg_mangle.h.in') |
| 61 | +# mangle_prefix = openjpeg_library_name |
| 62 | + # configure_file([cmake_current_source_dir, '/openjpeg_mangle.h.in', cmake_current_binary_dir, '/openjpeg_mangle.h', '@ONLY']) |
| 63 | +#endif |
| 64 | +#----------------------------------------------------------------------------- |
| 65 | + |
| 66 | + |
| 67 | +#----------------------------------------------------------------------------- |
| 68 | +# Build Library |
| 69 | +if get_option('build_jpip_server') |
| 70 | + curl_dep = dependency('libcurl', version : '>= 7.55.0', required : false) |
| 71 | + fcgi_dep = dependency('fcgi') |
| 72 | + threads_dep = dependency('threads') |
| 73 | +endif |
| 74 | + |
| 75 | +subdir('src/lib') |
| 76 | + |
| 77 | +#----------------------------------------------------------------------------- |
| 78 | +# Build Applications |
| 79 | + |
| 80 | +if get_option('build_codec') or get_option('build_mj2') |
| 81 | + # OFF: It will only build 3rd party libs if they are not found on the system |
| 82 | + # ON: 3rd party libs will ALWAYS be build, and used |
| 83 | + subdir('src/bin') |
| 84 | +endif |
| 85 | + |
| 86 | +subdir('wrapping') |
| 87 | +#----------------------------------------------------------------------------- |
| 88 | +# opj_config.h generation (2/2) |
| 89 | +# 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']) |
| 90 | +# 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']) |
| 91 | +#----------------------------------------------------------------------------- |
| 92 | + |
| 93 | +# build documentation in doc subdir(TODO) |
| 94 | +#if get_option('build_doc') |
| 95 | +# subdir('doc') |
| 96 | +#endif |
| 97 | + |
| 98 | +#----------------------------------------------------------------------------- |
| 99 | +# Buld Testing |
| 100 | +if get_option('build_testing') |
| 101 | + if get_option('build_codec') |
| 102 | + # Search openjpeg data needed for the tests |
| 103 | + # They could be found via git on the OpenJPEG GitHub code project |
| 104 | + # git clone https://github.com/uclouvain/openjpeg-data.git |
| 105 | + # 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']) |
| 106 | + # Add repository where to find tests |
| 107 | + #subdir('tests') |
| 108 | + else |
| 109 | + # message('FATAL_ERROR: You need build codec to run the tests') |
| 110 | + endif |
| 111 | +endif |
| 112 | + |
| 113 | +# install CHANGES and LICENSE |
| 114 | +#if get_option('build_doc') |
| 115 | +# if fs.exists('./CHANGES') |
| 116 | +# # install(['FILES', 'CHANGES', 'DESTINATION', openjpeg_install_doc_dir]) |
| 117 | +# endif |
| 118 | + # install(['FILES', 'LICENSE', 'DESTINATION', openjpeg_install_doc_dir]) |
| 119 | +#endif |
| 120 | +#----------------------------------------------------------------------------- |
| 121 | +# pkgconfig support |
| 122 | + |
| 123 | +if get_option('build_pkgconfig_files') |
| 124 | + pkgconfig = import('pkgconfig') |
| 125 | + pkgconfig.generate(openjp2_lib, name: 'libopenjp2', |
| 126 | + description: 'JPEG2000 library (Part 1 and 2)', |
| 127 | + version: meson.project_version(), |
| 128 | + libraries: openjp2_lib) |
| 129 | + if get_option('build_jpwl') |
| 130 | + pkgconfig.generate(openjpwl_lib, name: 'libopenjpwl', |
| 131 | + description: 'JPEG2000 Wireless library (Part 11)', |
| 132 | + version: meson.project_version(), |
| 133 | + libraries: openjpwl_lib) |
| 134 | + endif |
| 135 | + if get_option('build_jpip') |
| 136 | + pkgconfig.generate(openjpip_lib, name: 'libopenjpip', |
| 137 | + description: 'JPEG2000 Interactivity tools, APIs and protocols (Part 9)', |
| 138 | + version: meson.project_version(), |
| 139 | + libraries: openjpip_lib) |
| 140 | + endif |
| 141 | + if get_option('build_jp3d') |
| 142 | + pkgconfig.generate(openjp3d_lib, name: 'libopenjp3d', |
| 143 | + description: 'JPEG2000 Extensions for three-dimensional data (Part 10)', |
| 144 | + version: meson.project_version(), |
| 145 | + libraries: openjp3d_lib) |
| 146 | + endif |
| 147 | +endif |
| 148 | +#----------------------------------------------------------------------------- |
| 149 | +# build our version of astyle |
| 150 | +#with_astyle = ['FALSE', 'CACHE', 'BOOL', 'If you plan to contribute you should reindent with scripts/prepare-commit.sh (using 'our' astyle)'] |
0 commit comments