WindowsでOpenEXR-2.2.0をビルド

cmake-3.2.2
VisualStudio2013

# Makefile
DEST_DIR := $(shell cygpath -ma libs)
DEVENV := "$(shell cygpath -ua "$(VS120COMNTOOLS)/../IDE/devenv.exe")"
CMAKE := "$(shell cygpath -ua "$(PROGRAMFILES)/CMake/bin/cmake.exe")"
CMAKE_TARGET := 'Visual Studio 12 Win64'

all:
	$(MAKE) zlib
	$(MAKE) ilmbase
	$(MAKE) openexr

download:
	curl -L \
		-O http://zlib.net/zlib-1.2.8.tar.gz \
		-O http://download.savannah.nongnu.org/releases/openexr/ilmbase-2.2.0.tar.gz \
		-O http://download.savannah.nongnu.org/releases/openexr/openexr-2.2.0.tar.gz

clean:
	$(RM) -fr */

zlib:
	$(RM) -fr zlib-1.2.8/
	/bin/tar xvf zlib-1.2.8.tar.gz
	/bin/mkdir -p build
	$(RM) -f build/CMakeCache.txt
	cd build; $(CMAKE) -G $(CMAKE_TARGET) '-DCMAKE_INSTALL_PREFIX=$(DEST_DIR)' ../zlib-1.2.8
	$(DEVENV) build/zlib.sln /out build/zlib_build.log /build "Release" /project "INSTALL"

ilmbase:
	$(RM) -fr ilmbase-2.2.0/
	/bin/tar xvf ilmbase-2.2.0.tar.gz
	/bin/mkdir -p build
	$(RM) -f build/CMakeCache.txt
	cd build; $(CMAKE) -G $(CMAKE_TARGET) '-DCMAKE_INSTALL_PREFIX=$(DEST_DIR)' ../ilmbase-2.2.0
	$(DEVENV) build/ilmbase.sln /out build/ilmbase_build.log /build "Release" /project "INSTALL"
	/bin/cp -f $(DEST_DIR)/lib/*.dll $(DEST_DIR)/bin/

openexr:
	$(RM) -fr openexr-2.2.0/
	/bin/tar xvf openexr-2.2.0.tar.gz
	/bin/mkdir -p build
	$(RM) -f build/CMakeCache.txt
	cd build; $(CMAKE) -G $(CMAKE_TARGET) '-DCMAKE_INSTALL_PREFIX=$(DEST_DIR)' \
		'-DZLIB_ROOT=$(DEST_DIR)' '-DILMBASE_PACKAGE_PREFIX=$(DEST_DIR)' \
		../openexr-2.2.0
	PATH="$$(cygpath -ua libs/bin):$$PATH" \
		$(DEVENV) build/openexr.sln /out build/openexr_build.log /build "Release" /project "INSTALL"
	/bin/cp -f $(DEST_DIR)/lib/*.dll $(DEST_DIR)/bin/
$ make download
$ make

これでmakeすればlibsフォルダ以下にzlib/ilmbase/openexrが出来上がる。