[zeromq-dev] CMake for ØMQ part x+1
Steven McCoy
steven.mccoy at miru.hk
Mon Oct 3 23:12:26 CEST 2011
Well, CPack is useful for creating packages. Hopefully someone will find
these useful.
Known Issues:
- x64 version displays "C:\Program Files (x86)\" on install because it is
an x86 installer.
- Manual hack to hard code the OpenPGM include and library path.
- Manual hack to hard code the ØMQ version.
To use:
- Bring up a Windows SDK 7.1 Command Prompt
- Change environment, e.g.
setenv /release /x86 /xp
or, for 64-bit Windows 7:
setenv /release /release /x64 /win7
- Create build directory, e.g.
cd \zeromq\zeromq-2.1.10
mkdir build
cd build
- Create initial build environment, e.g.
cmake -G "NMake Makefiles" ..
- Set release build as CMake appears broken with its build detection on
Windows,
cmake-gui .
- Change CMAKE_BUILD_TYPE to "Release".
- Hit "*Configure*" and "*Generate*".
- Build the package.
nmake package
--
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111003/5268bfe7/attachment.htm>
-------------- next part --------------
# CMake build script for ØMQ on Windows
cmake_minimum_required (VERSION 2.8)
project (ZeroMQ)
#-----------------------------------------------------------------------------
# force off-tree build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "CMake generation is not allowed within the source directory!
Remove the CMakeCache.txt file and try again from another folder, e.g.:
del CMakeCache.txt
mkdir cmake-make
cd cmake-make
cmake ..
")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
#-----------------------------------------------------------------------------
# default to Release build
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
#-----------------------------------------------------------------------------
# platform specifics
add_definitions(
-DWIN32
-DDLL_EXPORT
-DFD_SETSIZE=1024
)
#-----------------------------------------------------------------------------
# source files
set(cxx-sources
clock.cpp
command.cpp
connect_session.cpp
ctx.cpp
decoder.cpp
device.cpp
devpoll.cpp
dist.cpp
encoder.cpp
epoll.cpp
err.cpp
fq.cpp
io_object.cpp
io_thread.cpp
ip.cpp
kqueue.cpp
lb.cpp
mailbox.cpp
named_session.cpp
object.cpp
options.cpp
own.cpp
pair.cpp
pgm_receiver.cpp
pgm_sender.cpp
pgm_socket.cpp
pipe.cpp
poll.cpp
poller_base.cpp
pub.cpp
pull.cpp
push.cpp
reaper.cpp
rep.cpp
req.cpp
select.cpp
session.cpp
signaler.cpp
socket_base.cpp
sub.cpp
swap.cpp
tcp_connecter.cpp
tcp_listener.cpp
tcp_socket.cpp
thread.cpp
transient_session.cpp
trie.cpp
uuid.cpp
xpub.cpp
xpub.cpp
xreq.cpp
xrep.cpp
xsub.cpp
zmq.cpp
zmq_connecter.cpp
zmq_engine.cpp
zmq_init.cpp
zmq_listener.cpp
)
include_directories(
include
${CMAKE_CURRENT_BINARY_DIR}
)
set(headers
include/zmq.h
include/zmq.hpp
include/zmq_utils.h
)
#-----------------------------------------------------------------------------
# optional modules
add_definitions(
-DZMQ_HAVE_OPENPGM
)
include_directories(
/libpgm/release-5-1-118/openpgm/pgm/include
)
link_directories(
/libpgm/release-5-1-118/openpgm/pgm/build/lib
# /libpgm/release-5-1-118/openpgm/pgm/build64/lib
)
#-----------------------------------------------------------------------------
# source generators
foreach (source ${cxx-sources})
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/src/${source})
endforeach()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp
COMMAND ${CMAKE_COMMAND}
ARGS -E
copy
${CMAKE_CURRENT_SOURCE_DIR}/builds/msvc/platform.hpp
${CMAKE_CURRENT_BINARY_DIR}/platform.hpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/builds/msvc/platform.hpp
)
list(APPEND sources ${CMAKE_CURRENT_BINARY_DIR}/platform.hpp)
#-----------------------------------------------------------------------------
# output
add_library(libzmq SHARED ${sources})
target_link_libraries(libzmq ws2_32.lib rpcrt4.lib)
set(docs
AUTHORS
COPYING
COPYING.LESSER
ChangeLog
INSTALL
MAINTAINERS
NEWS
README
)
install (TARGETS libzmq DESTINATION lib)
install (FILES ${headers} DESTINATION include)
install (FILES ${docs} DESTINATION doc)
include (InstallRequiredSystemLibraries)
set (CPACK_PACKAGE_VENDOR "Miru Limited")
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set (CPACK_PACKAGE_VERSION_MAJOR "2")
set (CPACK_PACKAGE_VERSION_MINOR "1")
set (CPACK_PACKAGE_VERSION_PATCH "10")
include (CPack)
# end of file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zeromq-3.0.2.patch
Type: application/octet-stream
Size: 1413 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111003/5268bfe7/attachment.obj>
More information about the zeromq-dev
mailing list