-
Notifications
You must be signed in to change notification settings - Fork 20
/
CMakeLists.txt
162 lines (132 loc) · 4.14 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
cmake_minimum_required (VERSION 2.6)
project (vss2svg)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
find_package(libemf2svg REQUIRED)
find_package(libwmf REQUIRED)
find_package(librevenge REQUIRED)
find_package(libvisio REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(Freetype REQUIRED)
# Project version (sematic versionning)
set(vss2svg_VERSION_MAJOR 0)
set(vss2svg_VERSION_MINOR 5)
set(vss2svg_VERSION_PATCH 5)
set(vss2svg_VERSION ${vss2svg_VERSION_MAJOR}.${vss2svg_VERSION_MINOR}.${vss2svg_VERSION_PATCH})
# set version as a definition
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DV2S_VERSION='\"${vss2svg_VERSION}\"'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DV2S_VERSION='\"${vss2svg_VERSION}\"'")
add_custom_target(tag
COMMAND git tag -a ${vss2svg_VERSION} -m "tagging version ${vss2svg_VERSION}"
COMMAND git push origin ${vss2svg_VERSION}
)
# Options
option(DEBUG "compile with debug symbol" OFF)
option(STATIC "compile statically" OFF)
option(USE_CLANG "build application with clang" OFF)
option(USE_GCC "build application with gcc" OFF)
option(UNSAFE_FILENAME "disable safe file naming (if your stdlib doesn't support regex)" OFF)
if(UNSAFE_FILENAME)
else(UNSAFE_FILENAME)
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DSAFE_FILENAME")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSAFE_FILENAME")
endif(UNSAFE_FILENAME)
if(USE_CLANG)
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_CC_COMPILER "clang" )
endif(USE_CLANG)
if(USE_GCC)
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_CC_COMPILER "gcc")
endif(USE_GCC)
# Build external dependancies if we are on OSX
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Mac OS X specific code
set(EXTERNAL_MEMSTREAM "memstream")
set(EXTERNAL_ARGP "argp")
add_definitions(-DDARWIN)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(DEBUG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -DDEBUG")
set(CMAKE_BUILD_TYPE Debug)
endif(DEBUG)
if(STATIC)
set(SHARED "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBRARIES OFF)
set(CMAKE_EXE_LINKER_FLAGS "-static")
else(STATIC)
set(SHARED "SHARED")
set(BUILD_SHARED_LIBRARIES ON)
endif(STATIC)
LINK_DIRECTORIES(
/usr/local/lib
/usr/lib/
)
include_directories(
inc/
${LIBEMF2SVG_INCLUDE_DIR}
${LIBWMF_INCLUDE_DIR}
${LIBREVENGE_INCLUDE_DIR}
${LIBVISIO_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIR_ft2build}
${FREETYPE_INCLUDE_DIR_freetype2}
${LIBXML2_INCLUDE_DIR}
)
add_executable(vss2svg-conv src/conv/vss2svg.cpp)
add_executable(vsd2svg-conv src/conv/vsd2svg.cpp)
add_library(TitleGenerator
${SHARED}
src/lib/visio2svg/TitleGenerator.cpp
)
add_library(Visio2Svg
${SHARED}
src/lib/visio2svg/Visio2Svg.cpp
)
set_target_properties(Visio2Svg
PROPERTIES
VERSION ${vss2svg_VERSION}
SOVERSION ${vss2svg_VERSION_MAJOR}
)
set_target_properties(TitleGenerator
PROPERTIES
VERSION ${vss2svg_VERSION}
SOVERSION ${vss2svg_VERSION_MAJOR}
)
target_link_libraries(TitleGenerator
${LIBREVENGE_LIBRARIES}
${LIBVISIO_LIBRARIES}
)
target_link_libraries(Visio2Svg
${LIBREVENGE_LIBRARIES}
${LIBVISIO_LIBRARIES}
${LIBEMF2SVG_LIBRARIES}
${LIBWMF_LIBRARIES}
${LIBWMFLITE_LIBRARIES}
${LIBREVENGE_STREAM_LIBRARY}
${LIBXML2_LIBRARIES}
TitleGenerator
${EXTERNAL_ARGP}
)
target_link_libraries(vss2svg-conv
Visio2Svg
)
target_link_libraries(vsd2svg-conv
Visio2Svg
)
if (NOT LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR lib)
endif ()
if (NOT BIN_INSTALL_DIR)
set(BIN_INSTALL_DIR bin)
endif ()
if (NOT INCLUDE_INSTALL_DIR)
set(INCLUDE_INSTALL_DIR include)
endif ()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
INSTALL(TARGETS vss2svg-conv vsd2svg-conv TitleGenerator Visio2Svg
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
INSTALL(DIRECTORY inc/visio2svg DESTINATION ${INCLUDE_INSTALL_DIR})