Merge pull request #465 from steve-o/cmake-minor

Cmake minor version labeling and sync with 3.x
This commit is contained in:
Pieter Hintjens 2012-11-09 06:13:18 -08:00
commit 3eaf4a967c
2 changed files with 72 additions and 46 deletions

View File

@ -15,7 +15,32 @@ set(PYTHON_EXECUTABLE c:/cygwin/bin/python2.6.exe CACHE FILEPATH "Python interpr
# TODO: Replace with FindAsciidoc.cmake # TODO: Replace with FindAsciidoc.cmake
set(ASCIIDOC_EXECUTABLE c:/cygwin/bin/asciidoc CACHE FILEPATH "AsciiDoc executable") set(ASCIIDOC_EXECUTABLE c:/cygwin/bin/asciidoc CACHE FILEPATH "AsciiDoc executable")
set(OPENPGM_ROOT /libpgm/libpgm-5.1.118-1~dfsg/openpgm/pgm CACHE PATH "Location of OpenPGM") if (WITH_OPENPGM)
# set(OPENPGM_ROOT "" CACHE PATH "Location of OpenPGM")
set(OPENPGM_VERSION_MAJOR 5)
set(OPENPGM_VERSION_MINOR 2)
set(OPENPGM_VERSION_MICRO 121)
if (CMAKE_CL_64)
find_path(OPENPGM_ROOT include/pgm/pgm.h
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH
)
else (CMAKE_CL_64)
find_path(OPENPGM_ROOT include/pgm/pgm.h
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Miru\\OpenPGM ${OPENPGM_VERSION_MAJOR}.${OPENPGM_VERSION_MINOR}.${OPENPGM_VERSION_MICRO}]"
NO_DEFAULT_PATH
)
endif (CMAKE_CL_64)
message(STATUS "OpenPGM detected - ${OPENPGM_ROOT}")
set(OPENPGM_INCLUDE_DIRS ${OPENPGM_ROOT}/include)
set(OPENPGM_LIBRARY_DIRS ${OPENPGM_ROOT}/lib)
set(OPENPGM_LIBRARIES
optimized libpgm${_zmq_COMPILER}-mt-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib
debug libpgm${_zmq_COMPILER}-mt-gd-${OPENPGM_VERSION_MAJOR}_${OPENPGM_VERSION_MINOR}_${OPENPGM_VERSION_MICRO}.lib)
endif (WITH_OPENPGM)
mark_as_advanced(PYTHON_EXECUTABLE ASCIIDOC_EXECUTABLE) mark_as_advanced(PYTHON_EXECUTABLE ASCIIDOC_EXECUTABLE)
@ -108,6 +133,8 @@ set(cxx-sources
pull.cpp pull.cpp
push.cpp push.cpp
random.cpp random.cpp
raw_encoder.cpp
raw_decoder.cpp
reaper.cpp reaper.cpp
rep.cpp rep.cpp
req.cpp req.cpp
@ -160,28 +187,13 @@ if(WITH_OPENPGM)
add_definitions( add_definitions(
-DZMQ_HAVE_OPENPGM -DZMQ_HAVE_OPENPGM
) )
include_directories( include_directories(
${OPENPGM_ROOT}/include ${OPENPGM_INCLUDE_DIRS}
) )
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Win64
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(OPENPGM_LIBRARYDIR ${OPENPGM_ROOT}/debug64/lib)
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(OPENPGM_LIBRARYDIR ${OPENPGM_ROOT}/build64/lib)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Win32
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(OPENPGM_LIBRARYDIR ${OPENPGM_ROOT}/debug/lib)
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(OPENPGM_LIBRARYDIR ${OPENPGM_ROOT}/build/lib)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
link_directories( link_directories(
${OPENPGM_LIBRARYDIR} ${OPENPGM_LIBRARY_DIRS}
) )
set(OPTIONAL_LIBRARIES ${OPENPGM_LIBRARIES})
endif(WITH_OPENPGM) endif(WITH_OPENPGM)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -207,11 +219,11 @@ add_custom_command(
) )
list(APPEND sources ${CMAKE_BINARY_DIR}/platform.hpp) list(APPEND sources ${CMAKE_BINARY_DIR}/platform.hpp)
if (CMAKE_SIZEOF_VOID_P EQUAL 8) if (CMAKE_CL_64)
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template64.in) set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template64.in)
else (CMAKE_SIZEOF_VOID_P EQUAL 8) else (CMAKE_CL_64)
set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template32.in) set (nsis-template ${CMAKE_SOURCE_DIR}/cmake/NSIS.template32.in)
endif (CMAKE_SIZEOF_VOID_P EQUAL 8) endif (CMAKE_CL_64)
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/NSIS.template.in OUTPUT ${CMAKE_BINARY_DIR}/NSIS.template.in
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
@ -253,17 +265,20 @@ endforeach (txt ${docs})
# output # output
add_library(libzmq SHARED ${sources} ${html-docs} ${CMAKE_BINARY_DIR}/NSIS.template.in) add_library(libzmq SHARED ${sources} ${html-docs} ${CMAKE_BINARY_DIR}/NSIS.template.in)
target_link_libraries(libzmq ws2_32.lib rpcrt4.lib) target_link_libraries(libzmq ws2_32.lib rpcrt4.lib ${OPTIONAL_LIBRARIES})
set_target_properties(libzmq PROPERTIES
RELEASE_POSTFIX "${_zmq_COMPILER}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
DEBUG_POSTFIX "${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}")
set_target_properties(libzmq PROPERTIES RELEASE_POSTFIX "${_zmq_COMPILER}-mt" DEBUG_POSTFIX "${_zmq_COMPILER}-mt-gd") #-----------------------------------------------------------------------------
# installer
install (TARGETS libzmq ARCHIVE DESTINATION lib COMPONENT SDK)
if (CMAKE_BUILD_TYPE STREQUAL "Debug") if (CMAKE_BUILD_TYPE STREQUAL "Debug")
install (FILES ${CMAKE_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt-gd.dll DESTINATION bin COMPONENT SDK) install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT SDK)
install (FILES ${CMAKE_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt-gd.lib DESTINATION lib COMPONENT SDK) install (FILES ${CMAKE_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}.pdb DESTINATION lib COMPONENT SDK)
install (FILES ${CMAKE_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt-gd.pdb DESTINATION lib COMPONENT SDK)
else (CMAKE_BUILD_TYPE STREQUAL "Debug") else (CMAKE_BUILD_TYPE STREQUAL "Debug")
install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT Runtime) install (TARGETS libzmq RUNTIME DESTINATION bin COMPONENT Runtime)
install (FILES ${CMAKE_BINARY_DIR}/lib/libzmq${_zmq_COMPILER}-mt.lib DESTINATION lib COMPONENT SDK)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug") endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
install (FILES ${headers} DESTINATION include COMPONENT SDK) install (FILES ${headers} DESTINATION include COMPONENT SDK)
@ -296,18 +311,29 @@ endif (WITH_DOC)
include (InstallRequiredSystemLibraries) include (InstallRequiredSystemLibraries)
if (CMAKE_SIZEOF_VOID_P EQUAL 8) if (CMAKE_CL_64)
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH} (x64)")
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x64")
set (CPACK_INSTALL_CMAKE_PROJECTS set (CPACK_INSTALL_CMAKE_PROJECTS
"${CMAKE_SOURCE_DIR}/build64;ZeroMQ;ALL;/" "${CMAKE_SOURCE_DIR}/build/x64/v110;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/debug64;ZeroMQ;ALL;/" "${CMAKE_SOURCE_DIR}/debug/x64/v110;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/build/x64/v100;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/debug/x64/v100;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/build/x64/v90;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/debug/x64/v90;ZeroMQ;ALL;/"
) )
else (CMAKE_SIZEOF_VOID_P EQUAL 8) else (CMAKE_CL_64)
set (CPACK_NSIS_DISPLAY_NAME "ZeroMQ ${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}")
set (CPACK_PACKAGE_FILE_NAME "ZeroMQ-${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.${ZMQ_VERSION_PATCH}-x86")
set (CPACK_INSTALL_CMAKE_PROJECTS set (CPACK_INSTALL_CMAKE_PROJECTS
"${CMAKE_SOURCE_DIR}/build;ZeroMQ;ALL;/" "${CMAKE_SOURCE_DIR}/build/x86/v110;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/debug;ZeroMQ;ALL;/" "${CMAKE_SOURCE_DIR}/debug/x86/v110;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/build/x86/v100;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/debug/x86/v100;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/build/x86/v90;ZeroMQ;ALL;/"
"${CMAKE_SOURCE_DIR}/debug/x86/v90;ZeroMQ;ALL;/"
) )
endif (CMAKE_SIZEOF_VOID_P EQUAL 8) endif (CMAKE_CL_64)
set (CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}") set (CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel") set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "ZeroMQ lightweight messaging kernel")
set (CPACK_PACKAGE_VENDOR "Miru") set (CPACK_PACKAGE_VENDOR "Miru")

View File

@ -75,7 +75,7 @@ Var AR_RegFlags
ClearErrors ClearErrors
;Reading component status from registry ;Reading component status from registry
ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" "Installed" ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)\Components\${SecName}" "Installed"
IfErrors "default_${SecName}" IfErrors "default_${SecName}"
;Status will stay default if registry value not found ;Status will stay default if registry value not found
;(component was never installed) ;(component was never installed)
@ -108,13 +108,13 @@ Var AR_RegFlags
;Section is not selected: ;Section is not selected:
;Calling Section uninstall macro and writing zero installed flag ;Calling Section uninstall macro and writing zero installed flag
!insertmacro "Remove_${${SecName}}" !insertmacro "Remove_${${SecName}}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)\Components\${SecName}" \
"Installed" 0 "Installed" 0
Goto "exit_${SecName}" Goto "exit_${SecName}"
"leave_${SecName}:" "leave_${SecName}:"
;Section is selected: ;Section is selected:
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@\Components\${SecName}" \ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)\Components\${SecName}" \
"Installed" 1 "Installed" 1
"exit_${SecName}:" "exit_${SecName}:"
@ -494,7 +494,7 @@ Function ConditionalAddToRegisty
Pop $0 Pop $0
Pop $1 Pop $1
StrCmp "$0" "" ConditionalAddToRegisty_EmptyString StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" \ WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)" \
"$1" "$0" "$1" "$0"
;MessageBox MB_OK "Set Registry: '$1' to '$0'" ;MessageBox MB_OK "Set Registry: '$1' to '$0'"
DetailPrint "Set install registry entry: '$1' to '$0'" DetailPrint "Set install registry entry: '$1' to '$0'"
@ -810,17 +810,17 @@ FunctionEnd
Section "Uninstall" Section "Uninstall"
ReadRegStr $START_MENU SHCTX \ ReadRegStr $START_MENU SHCTX \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "StartMenu" "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)" "StartMenu"
;MessageBox MB_OK "Start menu is in: $START_MENU" ;MessageBox MB_OK "Start menu is in: $START_MENU"
ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "DoNotAddToPath" "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)" "DoNotAddToPath"
ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathAllUsers" "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)" "AddToPathAllUsers"
ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "AddToPathCurrentUser" "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)" "AddToPathCurrentUser"
;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
ReadRegStr $INSTALL_DESKTOP SHCTX \ ReadRegStr $INSTALL_DESKTOP SHCTX \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" "InstallToDesktop" "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)" "InstallToDesktop"
;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP " ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ @CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
@ -837,7 +837,7 @@ Section "Uninstall"
;Remove the uninstaller itself. ;Remove the uninstaller itself.
Delete "$INSTDIR\Uninstall.exe" Delete "$INSTDIR\Uninstall.exe"
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@" DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_NAME@ (x64)"
;Remove the installation directory if it is empty. ;Remove the installation directory if it is empty.
RMDir "$INSTDIR" RMDir "$INSTDIR"