Skip to content

Commit

Permalink
zlib from pros.cmake
Browse files Browse the repository at this point in the history
issue #404
  • Loading branch information
Scott M Anderson committed Oct 8, 2024
1 parent 048647a commit ec97741
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
29 changes: 16 additions & 13 deletions projects/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(PRO_BOOST
DESC "libraries that give C++ a boost"
REPO "repo" ${REPO} "boost repo on github"
GRAPH GRAPH_NODE boost
BUILD_DEPS zlib bzip2
BUILD_DEPS bzip2
VER ${VER}
GIT_ORIGIN ${REPO}
GIT_TAG boost-${VER} # what to 'git checkout'
Expand Down Expand Up @@ -136,24 +136,27 @@ endfunction()
function(userConfigJam jamFile)
ExternalProject_Get_Property(${bl_PRO} TMP_DIR)
set(cfgFile ${TMP_DIR}/user-config.jam)
# TRICKY: need zlib, bzip2 include directories at cmake-time (before they're built)
xpFindPkg(PKGS zlib)
if(TARGET xpro::zlibstatic)
get_target_property(loc xpro::zlibstatic IMPORTED_LOCATION_RELEASE)
get_filename_component(libDir ${loc} DIRECTORY)
get_filename_component(libName ${loc} NAME)
string(REPLACE ${CMAKE_STATIC_LIBRARY_PREFIX} "" libName ${libName})
string(REPLACE ${CMAKE_STATIC_LIBRARY_SUFFIX} "" libName ${libName})
get_target_property(incDir xpro::zlibstatic INTERFACE_INCLUDE_DIRECTORIES)
list(FILTER incDir INCLUDE REGEX "zlib$") # include directory that ends with zlib
set(cfgContents "using zlib : ${ZLIB_VER} : <search>${libDir} <name>${libName} <include>${incDir} ;\n")
endif()
# TRICKY: need bzip2 include directory at cmake-time (before it's built)
# so can't use xpGetPkgVar, xpFindPkg, etc - this complicates having multiple versions
# of zlib and bzip2 (boost will have to choose a version here)
xpGetArgValue(${PRO_ZLIB} ARG VER VALUE zlibVer)
# of bzip2 (boost will have to choose a version here)
xpGetArgValue(${PRO_BZIP2} ARG VER VALUE bzip2Ver)
set(zlibInc ${STAGE_DIR}/include/zlib_${zlibVer}/zlib)
set(bzip2Inc ${STAGE_DIR}/include/bzip2_${bzip2Ver}/bzip2)
if(WIN32)
set(prefix lib)
endif()
include(${STAGE_DIR}/share/cmake/xpopts.cmake)
xpSetPostfix()
set(zlibName ${prefix}z${CMAKE_RELEASE_POSTFIX})
set(bzip2Name bz2${CMAKE_RELEASE_POSTFIX})
file(WRITE ${cfgFile}
"using zlib : ${zlibVer} : <search>${STAGE_DIR}/lib <name>${zlibName} <include>${zlibInc} ;\n"
"using bzip2 : ${bzip2Ver} : <search>${STAGE_DIR}/lib <name>${bzip2Name} <include>${bzip2Inc} ;\n"
)
set(cfgContents "${cfgContents}using bzip2 : ${bzip2Ver} : <search>${STAGE_DIR}/lib <name>${bzip2Name} <include>${bzip2Inc} ;\n")
file(WRITE ${cfgFile} "${cfgContents}")
# Boost.Python build
find_package(Python "3.6...<3.10" COMPONENTS Interpreter Development)
if(Python_Interpreter_FOUND AND Python_Development_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion projects/libssh2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(PRO_LIBSSH2
LICENSE "open" http://www.libssh2.org/license.html "BSD 3-Clause License - https://www.openhub.net/licenses/BSD-3-Clause"
DESC "client-side C library implementing SSH2 protocol"
REPO "repo" ${REPO} "libssh2 repo on github"
GRAPH BUILD_DEPS zlib openssl
GRAPH BUILD_DEPS openssl
VER ${VER}
GIT_ORIGIN ${FORK}
GIT_UPSTREAM ${REPO}
Expand Down
5 changes: 1 addition & 4 deletions projects/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ set(PRO_PROTOBUF
LICENSE "open" ${REPO}/blob/v${VER}/LICENSE "3-clause BSD license"
DESC "language-neutral, platform-neutral extensible mechanism for serializing structured data"
REPO "repo" ${REPO} "protobuf repo on github"
GRAPH BUILD_DEPS zlib
VER ${VER}
GIT_ORIGIN ${FORK}
GIT_UPSTREAM ${REPO}
Expand All @@ -28,14 +27,12 @@ function(build_protobuf)
if(NOT (XP_DEFAULT OR XP_PRO_PROTOBUF))
return()
endif()
xpBuildDeps(depTgts ${PRO_PROTOBUF})
xpGetArgValue(${PRO_PROTOBUF} ARG NAME VALUE NAME)
xpGetArgValue(${PRO_PROTOBUF} ARG VER VALUE VER)
set(XP_CONFIGURE
-DCMAKE_INSTALL_INCLUDEDIR=include/${NAME}_${VER}
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_INSTALL_CMAKEDIR=share/cmake/tgt-${NAME}
-DXP_MODULE_PATH=${CMAKE_DIR}
-DXP_NAMESPACE:STRING=xpro
-Dprotobuf_BUILD_TESTS=OFF # no gmock, unless switch to release tar ball
)
Expand All @@ -55,5 +52,5 @@ function(build_protobuf)
${STAGE_DIR}/share/cmake/usexp-${NAME}-config.cmake
@ONLY NEWLINE_STYLE LF
)
xpCmakeBuild(${NAME} "${depTgts}" "${XP_CONFIGURE}")
xpCmakeBuild(${NAME} "" "${XP_CONFIGURE}")
endfunction()

0 comments on commit ec97741

Please sign in to comment.