From a36427d452972078cc40d19232aaf508708ee2df Mon Sep 17 00:00:00 2001 From: Guillaume Dumont Date: Thu, 13 Oct 2016 22:34:32 -0400 Subject: [PATCH] Added prefixes for zlib and hdf5 to avoid conflicts with other python libraries --- build_v120_x64.cmd | 2 ++ build_v140_x64.cmd | 2 ++ packages/zlib/CMakeLists.txt | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build_v120_x64.cmd b/build_v120_x64.cmd index e6b7f0f..fb6a9e7 100644 --- a/build_v120_x64.cmd +++ b/build_v120_x64.cmd @@ -11,10 +11,12 @@ call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" amd64 :: Use shared libraries when possible cmake -G Ninja ^ -D CB_BUILD_ALL:BOOL=ON ^ + -D ZLIB_LIB_PREFIX:STRING=caffe ^ -D ZLIB_BUILD_SHARED_LIBS:BOOL=ON ^ -D GFLAGS_BUILD_SHARED_LIBS:BOOL=ON ^ -D GLOG_BUILD_SHARED_LIBS:BOOL=ON ^ -D HDF5_BUILD_SHARED_LIBS:BOOL=ON ^ + -D HDF5_LIB_PREFIX:STRING=caffe ^ -D BOOST_BUILD_SHARED_LIBS:BOOL=ON ^ -D LEVELDB_BUILD_SHARED_LIBS:BOOL=OFF ^ -D LMDB_BUILD_SHARED_LIBS:BOOL=OFF ^ diff --git a/build_v140_x64.cmd b/build_v140_x64.cmd index 3a85568..3cf2b29 100644 --- a/build_v140_x64.cmd +++ b/build_v140_x64.cmd @@ -11,10 +11,12 @@ call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" amd64 :: Use shared libraries when possible cmake -G Ninja ^ -D CB_BUILD_ALL:BOOL=ON ^ + -D ZLIB_LIB_PREFIX:STRING=caffe ^ -D ZLIB_BUILD_SHARED_LIBS:BOOL=ON ^ -D GFLAGS_BUILD_SHARED_LIBS:BOOL=ON ^ -D GLOG_BUILD_SHARED_LIBS:BOOL=ON ^ -D HDF5_BUILD_SHARED_LIBS:BOOL=ON ^ + -D HDF5_LIB_PREFIX:STRING=caffe ^ -D BOOST_BUILD_SHARED_LIBS:BOOL=ON ^ -D LEVELDB_BUILD_SHARED_LIBS:BOOL=OFF ^ -D LMDB_BUILD_SHARED_LIBS:BOOL=OFF ^ diff --git a/packages/zlib/CMakeLists.txt b/packages/zlib/CMakeLists.txt index 2831fc3..6bd38ca 100644 --- a/packages/zlib/CMakeLists.txt +++ b/packages/zlib/CMakeLists.txt @@ -6,7 +6,7 @@ string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER) option(BUILD_${PROJECT_NAME_UPPER} "Build ${PROJECT_NAME}" ${CB_BUILD_ALL}) option(${PROJECT_NAME_UPPER}_BUILD_SHARED_LIBS "Build shared libraries for ${PROJECT_NAME}" ${BUILD_SHARED_LIBS}) set(${PROJECT_NAME_UPPER}_LIB_PREFIX "" CACHE STRING "Library to prefix the binaries with to avoid name conflicts on windows") - +set(${PROJECT_NAME_UPPER}_CMAKE_ARGS -DZLIB_TARGET_NAME_PREFIX=${${PROJECT_NAME_UPPER}_LIB_PREFIX}) if(BUILD_${PROJECT_NAME_UPPER}) # TODO handle the case where we don't have release and debug @@ -34,14 +34,13 @@ set(ZLIB_LIBRARY_RELEASE \${CMAKE_CURRENT_LIST_DIR}/lib/${_rel_lib} CACHE FILEP include(ExternalProject) - message(WARNING "Add patch to allow specifying prefix") - ExternalProject_Add( ${PROJECT_NAME}_download URL https://github.com/madler/zlib/archive/v1.2.8.tar.gz URL_MD5 1eabf2698dc49f925ce0ffb81397098f DOWNLOAD_NAME ${PROJECT_NAME}-v1.2.8.tar.gz DOWNLOAD_DIR ${CB_DOWNLOAD_DIR} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/patches/CMakeLists.txt.in CMakeLists.txt CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" @@ -65,6 +64,7 @@ set(ZLIB_LIBRARY_RELEASE \${CMAKE_CURRENT_LIST_DIR}/lib/${_rel_lib} CACHE FILEP -DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_MODULE_PATH=${CB_CMAKE_MODULE_PATH} -DCMAKE_DEBUG_POSTFIX=d + ${${PROJECT_NAME_UPPER}_CMAKE_ARGS} BUILD_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${_config} ) list(APPEND ${PROJECT_NAME}_targets ${PROJECT_NAME}_${_config_lower})