vcpkg/ports/wxwidgets/portfile.cmake

106 lines
3.7 KiB
CMake
Raw Normal View History

2017-05-30 22:00:52 +08:00
# Common Ambient Variables:
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
# PORT = current port name (zlib, etc)
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
#
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO wxWidgets/wxWidgets
REF v3.1.0
SHA512 740f3c977526395f32c2da4ea7f5f2ddc9b9a4cfd8d2cd129f011ede8e427621461c551c648b5d7a8f9ce78477e30426b836b310cff09c427ca8f9b9a9532074
HEAD_REF master
2017-05-30 22:00:52 +08:00
)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
2017-05-30 22:00:52 +08:00
PATCHES "${CMAKE_CURRENT_LIST_DIR}/use-installed-libs.patch"
)
find_program(NMAKE nmake REQUIRED)
set(NMAKE_OPTIONS "")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
list(APPEND NMAKE_OPTIONS TARGET_CPU=X64)
set(LIB_SUB_PATH_PRE vc_x64)
else ()
set(LIB_SUB_PATH_PRE vc)
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
2017-05-30 22:00:52 +08:00
list(APPEND NMAKE_OPTIONS SHARED=1)
set(LIB_SUB_PATH_TYP dll)
else()
set(LIB_SUB_PATH_TYP lib)
endif()
if (VCPKG_CRT_LINKAGE STREQUAL "static")
list(APPEND NMAKE_OPTIONS RUNTIME_LIBS=static)
endif()
2017-05-30 22:00:52 +08:00
set(LIB_SUB_PATH ${LIB_SUB_PATH_PRE}_${LIB_SUB_PATH_TYP}${TARGET_TRIPLET})
list(APPEND NMAKE_OPTIONS VCPKG_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include)
set(NMAKE_OPTIONS_REL
${NMAKE_OPTIONS}
2017-05-30 22:00:52 +08:00
VCPKG_LIB_DIR=${CURRENT_INSTALLED_DIR}/lib
BUILD=release
CFG=${TARGET_TRIPLET}-rel
)
set(NMAKE_OPTIONS_DBG
${NMAKE_OPTIONS}
2017-05-30 22:00:52 +08:00
VCPKG_LIB_DIR=${CURRENT_INSTALLED_DIR}/debug/lib
CFG=${TARGET_TRIPLET}-dbg
)
file(REMOVE_RECURSE ${SOURCE_PATH}/lib/${LIB_SUB_PATH})
2017-05-30 22:00:52 +08:00
################
# Release build
################
message(STATUS "Building ${TARGET_TRIPLET}-rel")
set(ENV{_LINK_} ${CURRENT_INSTALLED_DIR}/lib/expat.lib)
2017-05-30 22:00:52 +08:00
vcpkg_execute_required_process(
COMMAND ${NMAKE} -f makefile.vc ${NMAKE_OPTIONS_REL}
2017-05-30 22:00:52 +08:00
WORKING_DIRECTORY ${SOURCE_PATH}/build/msw
LOGNAME nmake-build-${TARGET_TRIPLET}-release
)
message(STATUS "Building ${TARGET_TRIPLET}-rel done")
################
# Debug build
################
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
set(ENV{_LINK_} ${CURRENT_INSTALLED_DIR}/debug/lib/expat.lib)
2017-05-30 22:00:52 +08:00
vcpkg_execute_required_process(
COMMAND ${NMAKE} -f makefile.vc ${NMAKE_OPTIONS_DBG}
2017-05-30 22:00:52 +08:00
WORKING_DIRECTORY ${SOURCE_PATH}/build/msw
LOGNAME nmake-build-${TARGET_TRIPLET}-debug
)
message(STATUS "Building ${TARGET_TRIPLET}-dbg done")
# Install headers and libraries
file(INSTALL ${SOURCE_PATH}/include
DESTINATION ${CURRENT_PACKAGES_DIR})
file(INSTALL ${SOURCE_PATH}/lib/${LIB_SUB_PATH}-rel/mswu/wx/setup.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/wx)
file(INSTALL ${SOURCE_PATH}/lib/${LIB_SUB_PATH}-rel/mswu/wx/msw/rcdefs.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/wx/msw)
file(INSTALL ${SOURCE_PATH}/lib/${LIB_SUB_PATH}-rel/
DESTINATION ${CURRENT_PACKAGES_DIR}/lib FILES_MATCHING PATTERN "*.lib" PATTERN "*.pdb")
2017-05-30 22:00:52 +08:00
file(INSTALL ${SOURCE_PATH}/lib/${LIB_SUB_PATH}-dbg/
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib FILES_MATCHING PATTERN "*.lib" PATTERN "*.pdb")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/mswu ${CURRENT_PACKAGES_DIR}/debug/lib/mswud)
# Handle copyright
file(COPY ${SOURCE_PATH}/docs/licence.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/wxwidgets)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/wxWidgets/licence.txt ${CURRENT_PACKAGES_DIR}/share/wxwidgets/copyright)