How to compile OpenJPEG in MinGW?
2009-04-24 21:19
330 查看
How to compile OpenJPEG in
MinGW?
The “How to
compile and install external libs of FFMPEG?” has described the simple way
to compile OpenJPEG for FFMPEG. However, if readers need generate static and
dynamical libraries at the same time, how to handle this requirement?
As the mentioned before,
referring to “How to
generate DLL files by GCC in the MinGW?” and “How to
use GCC to build DLL by DEF file in MinGW?”, we can do it by DEF file to
build DLL library for the usage of Windows.
To ease to re-use by readers, I
have modified the Makefile encapsulated by openjpeg_v1_3.tar.gz.
Please refer to the following content, and readers can replace the original one
by making full use of it.
Summarization
1. To build correctly, please use the below
format.
WIN32 and OPJ_STATIC are MACROs, and denote
that it is WIN32 and static format.
2. Please can use dist tag
to store them in your locate folder after finishing compiling source codes..
3. The original Makefile
has not provided uninstall tag, and readers can add it in
the light of installing configuration.
MinGW?
The “How to
compile and install external libs of FFMPEG?” has described the simple way
to compile OpenJPEG for FFMPEG. However, if readers need generate static and
dynamical libraries at the same time, how to handle this requirement?
As the mentioned before,
referring to “How to
generate DLL files by GCC in the MinGW?” and “How to
use GCC to build DLL by DEF file in MinGW?”, we can do it by DEF file to
build DLL library for the usage of Windows.
To ease to re-use by readers, I
have modified the Makefile encapsulated by openjpeg_v1_3.tar.gz.
Please refer to the following content, and readers can replace the original one
by making full use of it.
# Linux makefile for OpenJPEG VER_MAJOR = 2 VER_MINOR = 1.3.0 SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_malloc.h ./libopenjpeg/opj_includes.h INCLUDE = -Ilibopenjpeg # General configuration variables: CC = gcc AR = ar PREFIX = /mingw INSTALL_LIBDIR = $(PREFIX)/lib INSTALL_INCLUDE = $(PREFIX)/include # Converts cr/lf to just lf DOS2UNIX = dos2unix COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC LIBRARIES = -lstdc++ MODULES = $(SRCS:.c=.o) CFLAGS = $(COMPILERFLAGS) $(INCLUDE) TARGET = openjpeg STATICLIB = lib$(TARGET).a SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dll LIBNAME = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dll.a default: all all: OpenJPEG dist: OpenJPEG install -d dist install -m 644 $(STATICLIB) dist install -m 755 $(SHAREDLIB) dist install -m 644 $(SHAREDLIB).lib dist ln -sf $(SHAREDLIB) dist/$(LIBNAME) install libopenjpeg/openjpeg.h dist dos2unix: @$(DOS2UNIX) $(SRCS) $(INCLS) OpenJPEG: $(STATICLIB) $(SHAREDLIB) .c.o: $(CC) $(CFLAGS) -c $< -o $@ $(STATICLIB): $(MODULES) $(AR) r $@ $(MODULES) $(SHAREDLIB): $(MODULES) $(CC) -s -shared -Wl,--output-def,$(SHAREDLIB).def -Wl,--out-implib,$(LIBNAME) -Wl,-Bsymbolic -o $@ $(MODULES) $(LIBRARIES) lib.exe /machine:i386 /def:$(SHAREDLIB).def /out:$(SHAREDLIB).lib install: OpenJPEG install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)' install -m 644 $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)' install -m 755 $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)' ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)' install -m 644 libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)' clean: rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME) osx: make -f Makefile.osx osxinstall: make -f Makefile.osx install osxclean: make -f Makefile.osx clean |
1. To build correctly, please use the below
format.
$ make CFLAGS="-DWIN32 -DOPJ_STATIC $CFLAGS" |
that it is WIN32 and static format.
2. Please can use dist tag
to store them in your locate folder after finishing compiling source codes..
$ make dist |
has not provided uninstall tag, and readers can add it in
the light of installing configuration.
相关文章推荐
- How to compile SDL in MINGW?
- How to compile opencore-amr in the MINGW
- How to compile openjdk 7 in RHEL5
- How To Open An URL In Android’s Web Browser
- 【摘录】How to compile mame in Ubuntu 10.04 Lucid Lynx
- How to install Open Source Java version in Ubantu
- How to open a web site with the default web browser in a NEW window
- how to compile and link static/dynamic library in linux
- ZZ: How to remove 'Open in Windows Explorer' from the 'Actions Menu'
- How to compile PortAudio in Visual Studio
- How to use libraries compiled with MingW in MSVC?
- How to use plugin audio codecs in OpenH323 and OPAL
- Silktest2011:How to get Browser type in openagent model?
- How to compile the IJG JPEG library (libjpeg) for Visual Studio 2010
- How to use GCC to build DLL by DEF file in MinGW?
- QT29 how to use QWebView and open web page in QWebView
- How to compile GCC-4.3.3 in the cygwin?
- how to open property manager in Visual C++ 2010 express edition
- How To Open An URL In Android’s Web Browser
- How To Open Block Material in SAP MM?