-
Notifications
You must be signed in to change notification settings - Fork 296
/
CMakeLists.txt
99 lines (73 loc) · 3.55 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
PROJECT(OMCWrapper)
cmake_minimum_required(VERSION 3.0.0)
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_FIND_DEBUG_MODE ON)
OPTION(USE_ZEROMQ "USE zeromq and cppzmq" ON)
#set name for omc C- api library and omc zeromq server application
SET(OMCZeroMQName OMCZeroMQ)
#set include variable of omc C-api library
SET(OMCCAPI_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/omcCAPI/include")
INCLUDE(../CMake/CheckCXX11.cmake)
#set OpenModelica include directories
INCLUDE_DIRECTORIES(${OMC_PATH}/include/omc/c)
INCLUDE_DIRECTORIES(${OMC_PATH}/include/omc/)
IF(MSVC)
SET(ZeroMQ_DIR "${CMAKE_SOURCE_DIR}/../../../3rdParty/libzmq/build_msvc/share/cmake/ZeroMQ")
SET(cppzmq_DIR "${CMAKE_SOURCE_DIR}/../../../3rdParty/cppzmq/build_msvc/share/cmake/cppzmq")
ELSE(MSVC)
SET(ZeroMQ_DIR "${CMAKE_SOURCE_DIR}/../../../3rdParty/libzmq/build/share/cmake/ZeroMQ")
SET(cppzmq_DIR "${CMAKE_SOURCE_DIR}/../../../3rdParty/cppzmq/build/share/cmake/cppzmq")
ENDIF(MSVC)
find_package(ZeroMQ )
find_package(cppzmq )
#find gc library
#FIND_LIBRARY(OMCGC_LIB "gcmt-lib" NO_DEFAULT_PATH NO_SYSTEM_ENVIRONMENT_PATH PATHS "D:/temp/gc/Debug")
#IF(NOT OMCGC_LIB)
# MESSAGE(FATAL_ERROR "Could not find omcgc library!")
#ENDIF(NOT OMCGC_LIB)
# MESSAGE(STATUS "omcgc library: ${OMCGC_LIB}")
#include gc library header
#include_directories ("D:\\OpenModelica\\omc\\omc_x64_cloudsim\\build\\include\\omc\\c")
message (STATUS "zeromq and cppmq found: ${ZeroMQ_FOUND} ${cppzmq_FOUND} ")
IF(ZeroMQ_FOUND AND cppzmq_FOUND)
message (STATUS "zeromq type: ${CMAKE_BUILD_TYPE}")
IF((MSVC) AND (CMAKE_BUILD_TYPE MATCHES Debug))# workarround, find_package(ZeroMQ) fails because wrong filename under windows and VS projects
get_target_property(ZeroMQ_LIB libzmq IMPORTED_IMPLIB_DEBUG)
message (STATUS "Using workarround for ${ZeroMQ_LIB} " )
ELSE((MSVC) AND (CMAKE_BUILD_TYPE MATCHES Debug))
set(ZeroMQ_LIB ${ZeroMQ_LIBRARY})
ENDIF((MSVC) AND (CMAKE_BUILD_TYPE MATCHES Debug))
message (STATUS "Using ZMQ library ${ZeroMQ_LIBRARY} ${ZeroMQ_LIB} " )
message(STATUS "cppzmq version ${cppzmq_VERSION}")
message (STATUS "Using ZMQ Header ${ZeroMQ_INCLUDE_DIR}" )
message (STATUS "Using CPPZMQ Header ${cppzmq_INCLUDE_DIR}" )
ELSE(ZeroMQ_FOUND AND cppzmq_FOUND)
SET(USE_ZEROMQ OFF)
message (STATUS "zeromq was not found " )
ENDIF(ZeroMQ_FOUND AND cppzmq_FOUND)
#link pthread
IF (NOT WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
ENDIF(NOT WIN32)
#omc c-api library build is only supported for mingw on Windows.
#compatible importlibrary library of the mingw dll can build
#in Visual Studio command prompt:
#dumpbin /exports libOMCDLL.dll > libOMCDLL.def
#remove all symbols except the function names
#->EXPORTS
#->fun1
#->fun2
#lib /def:libOMCDLL.def /out:libOMCDLL.lib /machine:[x86,x64]
IF((NOT MSVC) AND (NOT ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") )))
message (STATUS "build omc C- api library" )
SET(OMCCAPIName OMCDLL)
add_subdirectory(omcCAPI)
ELSE((NOT MSVC) AND (NOT ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") )))
#link to the above descriped import library
SET(OMCAPI_ROOT "${CMAKE_SOURCE_DIR}/../Build_CAPI/tmp/")
message (STATUS "om c dll libary path ${OMCAPI_ROOT}" )
ENDIF((NOT MSVC) AND (NOT ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") )))
if(USE_ZEROMQ AND COMPILER_SUPPORTS_CXX11 AND (NOT ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") )))
message (STATUS "build omc zeromq application" )
add_subdirectory(omcZeroMQ)
endif(USE_ZEROMQ AND COMPILER_SUPPORTS_CXX11 AND (NOT ((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") )))