Skip to content

Commit

Permalink
Merge branch 'cmake' of github.com:boxbackup/boxbackup into cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
qris committed Aug 14, 2016
2 parents a7f2f84 + dff12e6 commit 1a0ca8f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
9 changes: 5 additions & 4 deletions infrastructure/cmake/CMakeLists.txt
Expand Up @@ -79,9 +79,6 @@ if(NOT old_version_define EQUAL new_version_define)
file(WRITE "${base_dir}/lib/common/BoxVersion.h" "${new_version_define}")
endif()
add_definitions(-DBOX_CMAKE -DNEED_BOX_VERSION_H)
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DBOX_RELEASE_BUILD)
endif()
if(WIN32)
add_definitions(-DWIN32)
endif()
Expand Down Expand Up @@ -315,6 +312,10 @@ foreach(module_dep
endif()
endforeach()

# We can't do anything conditional on CMAKE_BUILD_TYPE because that's not valid for multi-configuration
# generators such as MSVC. We need to use a generator expression instead.
target_compile_definitions(lib_common PUBLIC $<$<CONFIG:Release>:-DBOX_RELEASE_BUILD>)

# Detect platform features and write BoxConfig.h.in. Reuse code from
# infrastructure/m4/boxbackup_tests.m4 where possible

Expand Down Expand Up @@ -344,7 +345,7 @@ if(WIN32)
endif()

message(STATUS "Searching for Zlib in: ${ZLIB_ROOT}")
find_path(ZLIB_INCLUDE_DIR zlib.h PATHS ${ZLIB_ROOT}/include)
find_path(ZLIB_INCLUDE_DIR zlib.h PATHS ${ZLIB_ROOT}/include NO_DEFAULT_PATH)
include_directories(${ZLIB_INCLUDE_DIR})
message(STATUS "Found Zlib headers: ${ZLIB_INCLUDE_DIR}")

Expand Down
16 changes: 16 additions & 0 deletions infrastructure/cmake/windows/CMakeLists.txt
Expand Up @@ -9,14 +9,22 @@ set(install_dir ${CMAKE_SOURCE_DIR}/install)
# Automate the process of downloading, building and "installing" dependencies on Windows,
# as used by AppVeyor.
set(ZLIB_VERSION 1.2.8 CACHE STRING "Version of zlib to download, build, and compile Box Backup against")
set(ZLIB_HASH MD5=126f8676442ffbd97884eb4d6f32afb4
CACHE STRING "Hash of the zlib download file, to be verified after download")
set(OPENSSL_VERSION 1.0.2h CACHE STRING "Version of OpenSSL to download, build, and compile Box Backup against")
set(OPENSSL_HASH SHA256=1d4007e53aad94a5b2002fe045ee7bb0b3d98f1a47f8b2bc851dcd1c74332919
CACHE STRING "Hash of the OpenSSL download file, to be verified after download")
set(PCRE_VERSION 8.38 CACHE STRING "Version of PCRE to download, build, and compile Box Backup against")
set(OPENSSL_HASH SHA256=dbef7cf80258c29396d435804cd5dba34006a77548850bca8bad6db6a6eac110
CACHE STRING "Hash of the PCRE download file, to be verified after download")

include(ExternalProject)

string(REPLACE "." "" zlib_version_nodots ${ZLIB_VERSION})
ExternalProject_Add(zlib
URL "http://zlib.net/zlib${zlib_version_nodots}.zip"
URL_HASH ${ZLIB_HASH}
DOWNLOAD_NO_PROGRESS 1
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${install_dir}
# We need to build both versions, debug and release, because cmake requires both to be
# present to generate its multi-configuration project files for Visual Studio/MSBuild.
Expand All @@ -29,6 +37,8 @@ if(WIN32)
ExternalProject_Add(openssl
DEPENDS zlib
URL "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
URL_HASH ${OPENSSL_HASH}
DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND perl Configure debug-VC-WIN32 no-asm --prefix=${install_dir}
COMMAND cmd /c ms\\do_ms.bat
# You would expect us to use nt.mak to compile a static library here, but mk1mf.pl uses the /MT[d]
Expand All @@ -43,13 +53,17 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
ExternalProject_Add(openssl
DEPENDS zlib
URL "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
URL_HASH ${OPENSSL_HASH}
DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND perl Configure darwin64-x86_64-cc --prefix=${install_dir}
BUILD_IN_SOURCE 1
)
else()
ExternalProject_Add(openssl
DEPENDS zlib
URL "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
URL_HASH ${OPENSSL_HASH}
DOWNLOAD_NO_PROGRESS 1
CONFIGURE_COMMAND ./config --prefix=${install_dir}
BUILD_IN_SOURCE 1
)
Expand All @@ -58,6 +72,8 @@ endif()

ExternalProject_Add(pcre
URL "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${PCRE_VERSION}.zip"
URL_HASH ${PCRE_HASH}
DOWNLOAD_NO_PROGRESS 1
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${install_dir}
# We need to build both versions, debug and release, because cmake requires both to be
# present to generate its multi-configuration project files for Visual Studio/MSBuild.
Expand Down

0 comments on commit 1a0ca8f

Please sign in to comment.