Commit 60dacd55 authored by Brian Sidebotham's avatar Brian Sidebotham

* Build OpenSSL from source using the OpenSSL-CMake project on Windows with...

* Build OpenSSL from source using the OpenSSL-CMake project on Windows with MinGW when no specifying OPENSSL_ROOT_DIR
parent 253b62a0
...@@ -29,52 +29,17 @@ ...@@ -29,52 +29,17 @@
#-----<configure>------------------------------------------------------------------------------------- #-----<configure>-------------------------------------------------------------------------------------
set( OPENSSL_RELEASE "1.0.1e" ) set( OPENSSL_RELEASE "1.0.1e" )
set( OPENSSL_MD5 66bf6f10f060d561929de96f9dfe5b8c ) # re-calc on every RELEASE change set( OPENSSL_MD5 08bec482fe1c4795e819bfcfcb9647b9 ) # re-calc on every RELEASE change
#-----</configure>----------------------------------------------------------------------------------- #-----</configure>-----------------------------------------------------------------------------------
unset( PIC_FLAG )
set( CFLAGS CFLAGS=${CMAKE_C_FLAGS} )
if( MINGW ) # either MINGW or cross compiling?
if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
set( MINGW32 true )
set( MACHINE x86_32 )
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( MINGW64 true )
set( MACHINE x86_64 )
endif()
if( MINGW32 )
set( HOST "--host=i586-pc-mingw32" )
elseif( MINGW64 )
set( HOST "--host=x86_64-pc-mingw32" )
endif()
set( CC "CC=${CMAKE_C_COMPILER}" )
set( RANLIB "RANLIB=${CMAKE_RANLIB}" )
set( AR "AR=${CMAKE_AR}" )
else()
set( PIC_FLAG -fPIC )
endif()
string( TOLOWER ${CMAKE_HOST_SYSTEM_NAME} build )
# Force some configure scripts into knowing this is a cross-compilation, if it is.
set( BUILD --build=${CMAKE_HOST_SYSTEM_PROCESSOR}-pc-${build} )
# http://www.blogcompiler.com/2011/12/21/openssl-for-windows/
# http://qt-project.org/wiki/Compiling-OpenSSL-with-MinGW
set( PREFIX ${DOWNLOAD_DIR}/openssl-${OPENSSL_RELEASE} ) set( PREFIX ${DOWNLOAD_DIR}/openssl-${OPENSSL_RELEASE} )
unset( CROSS ) # CMake barfs if we pass in an empty CMAKE_TOOLCHAIN_FILE, so we only set it up
if( MINGW32 ) # if it has a non-empty value
set( MW mingw ) unset( TOOLCHAIN )
set( CROSS "CROSS_COMPILE=${CROSS_COMPILE}" ) if( CMAKE_TOOLCHAIN_FILE )
elseif( MINGW64 ) set( TOOLCHAIN "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" )
set( MW mingw64 )
set( CROSS "CROSS_COMPILE=${CROSS_COMPILE}" )
endif() endif()
ExternalProject_Add( ExternalProject_Add(
...@@ -82,7 +47,7 @@ ExternalProject_Add( ...@@ -82,7 +47,7 @@ ExternalProject_Add(
DOWNLOAD_DIR ${DOWNLOAD_DIR} DOWNLOAD_DIR ${DOWNLOAD_DIR}
PREFIX ${PREFIX} PREFIX ${PREFIX}
TIMEOUT 60 TIMEOUT 60
URL http://www.openssl.org/source/openssl-${OPENSSL_RELEASE}.tar.gz URL http://launchpad.net/openssl-cmake/1.0.1e/1.0.1e-1/+download/openssl-cmake-1.0.1e-src.tar.gz
URL_MD5 ${OPENSSL_MD5} URL_MD5 ${OPENSSL_MD5}
# mingw uses msvcrt.dll's printf() which cannot handle %zd, so having # mingw uses msvcrt.dll's printf() which cannot handle %zd, so having
...@@ -97,17 +62,17 @@ ExternalProject_Add( ...@@ -97,17 +62,17 @@ ExternalProject_Add(
# this requires that perl be installed: # this requires that perl be installed:
CONFIGURE_COMMAND CONFIGURE_COMMAND
${CROSS} ${CMAKE_COMMAND}
<SOURCE_DIR>/Configure -G ${CMAKE_GENERATOR}
${MW} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
--prefix=<INSTALL_DIR> -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
${PIC_FLAG} # empty for MINGW -DBUILD_SHARED_LIBS=ON
shared ${TOOLCHAIN}
<SOURCE_DIR>
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND make depend BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
COMMAND make INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
INSTALL_COMMAND make install
) )
# In order to use "bzr patch", we have to have a bzr working tree, this means a bzr repo # In order to use "bzr patch", we have to have a bzr working tree, this means a bzr repo
...@@ -141,8 +106,8 @@ set( OPENSSL_INCLUDE_DIR ...@@ -141,8 +106,8 @@ set( OPENSSL_INCLUDE_DIR
) )
set( OPENSSL_LIBRARIES set( OPENSSL_LIBRARIES
${PREFIX}/lib/libssl.a ${PREFIX}/lib/libssl${CMAKE_IMPORT_LIBRARY_SUFFIX}
${PREFIX}/lib/libcrypto.a ${PREFIX}/lib/libcrypto${CMAKE_IMPORT_LIBRARY_SUFFIX}
CACHE STRING "OPENSSL libraries" CACHE STRING "OPENSSL libraries"
) )
set( OPENSSL_FOUND true ) set( OPENSSL_FOUND true )
......
...@@ -73,3 +73,8 @@ endif() ...@@ -73,3 +73,8 @@ endif()
add_dependencies( github_plugin boost ) add_dependencies( github_plugin boost )
add_dependencies( github_plugin avhttp ) add_dependencies( github_plugin avhttp )
if( MINGW AND NOT OPENSSL_ROOT_DIR )
add_dependencies( github_plugin openssl )
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment