forked from tango-controls/pytango
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
204 lines (188 loc) · 7.24 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
cmake_minimum_required(VERSION 3.0.2)
set(CMP0048 NEW)
project(_tango LANGUAGES CXX)
# Set PROJECT_VERSION and PACKAGE_VERSION from git tags
include(cmake/project_version.cmake)
if(NOT WIN32)
message(FATAL_ERROR "This file is only targeting Windows builds - aborting!")
endif(NOT WIN32)
add_definitions(-DWIN32)
add_definitions(-DNDEBUG)
add_definitions(-D_WINSTATIC)
add_definitions(-DNPY_NO_DEPRECATED_API)
add_definitions(-DBOOST_PYTHON_STATIC_LIB)
add_definitions(-DBOOST_ALL_NO_LIB)
add_definitions(-DZMQ_STATIC)
add_definitions(-D__POSIX_NT__)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(PY_TARGET "64")
add_definitions(-D_64BITS)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(PY_TARGET "32")
add_definitions(-DJPG_USE_ASM)
else(CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR "Unknown architecture - aborting!")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(MSVC14)
add_definitions(-D_TIMERS_T_)
add_definitions(-DHAVE_STRUCT_TIMESPEC)
add_definitions(-D_TIMESPEC_DEFINED)
add_definitions(-DSTRUCT_TIMESPEC_HAS_TV_SEC)
add_definitions(-DSTRUCT_TIMESPEC_HAS_TV_NSEC)
endif(MSVC14)
set(SOURCES
ext/api_util.cpp
ext/archive_event_info.cpp
ext/server/attr.cpp
ext/attr_conf_event_data.cpp
ext/server/attribute.cpp
ext/server/auto_monitor.cpp
ext/attribute_alarm_info.cpp
ext/attribute_dimension.cpp
ext/attribute_event_info.cpp
ext/attribute_info.cpp
ext/attribute_info_ex.cpp
ext/attribute_proxy.cpp
ext/base_types.cpp
ext/callback.cpp
ext/change_event_info.cpp
ext/server/command.cpp
ext/command_info.cpp
ext/connection.cpp
ext/constants.cpp
ext/data_ready_event_data.cpp
ext/database.cpp
ext/db.cpp
ext/dev_command_info.cpp
ext/dev_error.cpp
ext/device_attribute.cpp
ext/device_attribute_config.cpp
ext/device_attribute_history.cpp
ext/server/device_class.cpp
ext/device_data.cpp
ext/device_data_history.cpp
ext/server/device_impl.cpp
ext/device_info.cpp
ext/device_pipe.cpp
ext/device_proxy.cpp
ext/devintr_change_event_data.cpp
ext/server/dserver.cpp
ext/server/encoded_attribute.cpp
ext/enums.cpp
ext/event_data.cpp
ext/exception.cpp
ext/from_py.cpp
ext/server/fwdAttr.cpp
ext/group.cpp
ext/group_reply.cpp
ext/group_reply_list.cpp
ext/locker_info.cpp
ext/locking_thread.cpp
ext/server/log4tango.cpp
ext/server/multi_attribute.cpp
ext/server/multi_class_attribute.cpp
ext/periodic_event_info.cpp
ext/server/pipe.cpp
ext/pipe_event_data.cpp
ext/pipe_info.cpp
ext/poll_device.cpp
ext/precompiled_header.cpp
ext/pytango.cpp
ext/pytgutils.cpp
ext/pyutils.cpp
ext/server/subdev.cpp
ext/server/tango_util.cpp
ext/time_val.cpp
ext/to_py.cpp
ext/server/user_default_attr_prop.cpp
ext/server/user_default_pipe_prop.cpp
ext/version.cpp
ext/server/wattribute.cpp)
set(HEADERS
ext/precompiled_header.hpp
ext/base_types_numpy.hpp
ext/fast_from_py_numpy.hpp
ext/server/wattribute_numpy.hpp
ext/device_attribute_numpy.hpp
ext/to_py_numpy.hpp
ext/server/attr.h
ext/server/attribute.h
ext/callback.h
ext/server/command.h
ext/defs.h
ext/device_attribute.h
ext/server/device_class.h
ext/server/device_impl.h
ext/device_pipe.h
ext/exception.h
ext/fast_from_py.h
ext/from_py.h
ext/server/pipe.h
ext/pytgutils.h
ext/pyutils.h
ext/tango_numpy.h
ext/tgutils.h
ext/to_py.h)
set(${PROJECT_NAME} INCLUDE_DIRS "$ENV{TANGO_ROOT}/include")
if(MSVC90)
set(VCSTR "90")
elseif(MSVC14)
set(VCSTR "140")
endif()
set(BOOST_VERSION_ "1_70")
set(ZMQ_VERSION_ "4_0_5")
set(RELEASE "Release_$ENV{PYTHON_VER}_${PY_TARGET}")
include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/ext")
include_directories(${PROJECT_NAME} PUBLIC "$ENV{BOOST_ROOT}/include/boost-${BOOST_VERSION_}")
include_directories(${PROJECT_NAME} PUBLIC "$ENV{PYTHON_ROOT}/include")
include_directories(${PROJECT_NAME} PUBLIC "$ENV{TANGO_ROOT}/include")
include_directories(${PROJECT_NAME} PUBLIC "$ENV{PYTHON_ROOT}/Lib/site-packages/numpy/core/include")
include_directories(${PROJECT_NAME} PUBLIC "$ENV{PTHREAD_WIN}/include")
link_directories("$ENV{TANGO_ROOT}/bin")
link_directories("$ENV{TANGO_ROOT}/lib")
link_directories("$ENV{PYTHON_ROOT}/libs")
link_directories("$ENV{BOOST_ROOT}/lib")
message("TANGO at: $ENV{TANGO_ROOT}")
message("BOOST at: $ENV{BOOST_ROOT}")
message("PYTHON at: $ENV{PYTHON_ROOT}")
message("Release at: ${CMAKE_CURRENT_SOURCE_DIR}/${RELEASE}")
add_compile_options(/MT)
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
target_compile_options(${PROJECT_NAME} PUBLIC "/MT")
set_target_properties( ${PROJECT_NAME}
PROPERTIES
SUFFIX ".pyd" )
set_target_properties(${PROJECT_NAME}
PROPERTIES
COMPILE_OPTIONS "MT" )
set_target_properties(${PROJECT_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/${RELEASE}/tango"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/${RELEASE}/tango"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/${RELEASE}/tango")
if(MSVC90 AND (CMAKE_SIZEOF_VOID_P EQUAL 8))
# resolve VC 9 64bits complains
set_source_files_properties(ext/base_types.cpp PROPERTIES COMPILE_FLAGS /bigobj)
endif()
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND "$ENV{PYTHON_ROOT}/python.exe" ARGS "${CMAKE_CURRENT_SOURCE_DIR}/winsetup.py" ${RELEASE} dist temp_dist $(ConfigurationName) $(PlatformName)
COMMENT "Building installer")
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin)
set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_OPTIONS "/bigobj")
set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_OPTIONS "/MT")
set_property(TARGET ${PROJECT_NAME} PROPERTY LINK_FLAGS "/LTCG /force:multiple /DYNAMICBASE:NO /OPT:REF /OPT:ICF /SUBSYSTEM:WINDOWS")
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} PUBLIC $ENV{TANGO_ROOT}/lib/libtango.lib
$ENV{TANGO_ROOT}/lib/omniORB4.lib
$ENV{TANGO_ROOT}/lib/omniDynamic4.lib
$ENV{TANGO_ROOT}/lib/COS4.lib
$ENV{TANGO_ROOT}/lib/omnithread.lib
$ENV{TANGO_ROOT}/lib/msvcstub.lib)
target_link_libraries(${PROJECT_NAME} PUBLIC ws2_32 mswsock advapi32 comctl32 odbc32)
target_link_libraries(${PROJECT_NAME} PUBLIC $ENV{TANGO_ROOT}/lib/pthreadVC2.lib)
target_link_libraries(${PROJECT_NAME} PUBLIC $ENV{TANGO_ROOT}/lib/libzmq-v${VCSTR}-mt-s-${ZMQ_VERSION_}.lib)
target_link_libraries(${PROJECT_NAME} PUBLIC $ENV{BOOST_ROOT}/lib/libboost_python$ENV{PYTHON_VER}-vc${VCSTR}-mt-s-x${PY_TARGET}-${BOOST_VERSION_}.lib)
target_link_libraries(${PROJECT_NAME} PUBLIC $ENV{PYTHON_ROOT}/libs/python$ENV{PYTHON_VER}.lib)