2016-09-19 11:50:08 +08:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
project(openssl NONE)
|
|
|
|
|
|
|
|
include(vcpkg_execute_required_process)
|
2017-01-29 00:25:17 +08:00
|
|
|
set(SOURCE_PATH ${CMAKE_CURRENT_BINARY_DIR}/openssl-${OPENSSL_VERSION})
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
find_program(PERL perl)
|
|
|
|
find_program(NMAKE nmake)
|
|
|
|
|
2017-03-21 04:54:57 +08:00
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
file(COPY ${OPENSSL_SOURCE_MASTER_COPY} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
|
|
|
|
else()
|
|
|
|
file(COPY ${OPENSSL_SOURCE_MASTER_COPY} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
|
|
|
|
endif()
|
2016-10-19 12:20:16 +08:00
|
|
|
|
2016-09-19 11:50:08 +08:00
|
|
|
set(CONFIGURE_COMMAND ${PERL} Configure
|
2016-10-26 07:10:43 +08:00
|
|
|
enable-static-engine
|
|
|
|
enable-capieng
|
2016-09-19 11:50:08 +08:00
|
|
|
no-asm
|
2016-10-26 07:10:43 +08:00
|
|
|
no-ssl2
|
2016-09-19 11:50:08 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if(TARGET_TRIPLET MATCHES "x86-windows")
|
|
|
|
set(OPENSSL_ARCH VC-WIN32)
|
|
|
|
set(OPENSSL_DO "ms\\do_ms.bat")
|
|
|
|
elseif(TARGET_TRIPLET MATCHES "x64")
|
|
|
|
set(OPENSSL_ARCH VC-WIN64A)
|
|
|
|
set(OPENSSL_DO "ms\\do_win64a.bat")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unsupported target triplet: ${TARGET_TRIPLET}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
|
|
|
set(OPENSSLDIR ${CURRENT_PACKAGES_DIR}/debug)
|
|
|
|
list(APPEND CONFIGURE_COMMAND
|
|
|
|
debug-${OPENSSL_ARCH}
|
2016-10-26 07:10:43 +08:00
|
|
|
"--prefix=${OPENSSLDIR}"
|
2016-10-19 12:20:16 +08:00
|
|
|
"--openssldir=${OPENSSLDIR}"
|
2016-09-19 11:50:08 +08:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
set(OPENSSLDIR ${CURRENT_PACKAGES_DIR})
|
|
|
|
list(APPEND CONFIGURE_COMMAND
|
|
|
|
${OPENSSL_ARCH}
|
2016-10-26 07:10:43 +08:00
|
|
|
"--prefix=${OPENSSLDIR}"
|
2016-10-19 12:20:16 +08:00
|
|
|
"--openssldir=${OPENSSLDIR}"
|
2016-09-19 11:50:08 +08:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${CONFIGURE_COMMAND}
|
2017-03-09 01:53:04 +08:00
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH}
|
2016-09-19 11:50:08 +08:00
|
|
|
LOGNAME configure-perl-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}
|
|
|
|
)
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${OPENSSL_DO}
|
2017-03-09 01:53:04 +08:00
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH}
|
2016-09-19 11:50:08 +08:00
|
|
|
LOGNAME configure-do-${TARGET_TRIPLET}-${CMAKE_BUILD_TYPE}
|
|
|
|
)
|
|
|
|
|
2016-10-26 07:10:43 +08:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
add_custom_command(OUTPUT ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll
|
|
|
|
COMMAND ${NMAKE} -f ms\\ntdll.mak install
|
2017-03-09 01:53:04 +08:00
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH}
|
2016-10-26 07:10:43 +08:00
|
|
|
)
|
|
|
|
add_custom_target(openssl ALL DEPENDS ${OPENSSLDIR}/bin/ssleay32.dll ${OPENSSLDIR}/bin/libeay32.dll)
|
|
|
|
else()
|
|
|
|
add_custom_command(OUTPUT ${OPENSSLDIR}/bin/ssleay32.lib ${OPENSSLDIR}/bin/libeay32.lib
|
|
|
|
COMMAND ${NMAKE} -f ms\\nt.mak install
|
2017-03-09 01:53:04 +08:00
|
|
|
WORKING_DIRECTORY ${SOURCE_PATH}
|
2016-10-26 07:10:43 +08:00
|
|
|
)
|
|
|
|
add_custom_target(openssl ALL DEPENDS ${OPENSSLDIR}/bin/ssleay32.lib ${OPENSSLDIR}/bin/libeay32.lib)
|
|
|
|
endif()
|