~inkscape.dev/inkscape/trunk

15002.1.4 by Sebastian Faubel
Added missing files.
1
# -----------------------------------------------------------------------------
2
# Set the paths in this file if you want to build Inkscape from a shell other than the 
3
# Windows built-in command line (i.e. MSYS) or IDEs such as CodeLite. These variables
4
# will be used as default if no environment variables are set.
5
# -----------------------------------------------------------------------------
6
7
# Directory containing the precompiled Inkscape libraries. Usually c:\devlibs or c:\devlibs64
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
8
set(ENV_DEVLIBS_PATH C:/devlibs64)
15002.1.4 by Sebastian Faubel
Added missing files.
9
10
# Directory containing the MinGW instance used for compilation. Usually c:\mingw or c:\mingw64
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
11
set(ENV_MINGW_PATH C:/mingw64)
15002.1.4 by Sebastian Faubel
Added missing files.
12
13
# Directory containing the (optional) Ghostscript installation.
14
set(ENV_GS_PATH C:/latex/gs/gs8.61)
15
16
# -----------------------------------------------------------------------------
17
# MinGW Configuration
18
# -----------------------------------------------------------------------------
19
message(STATUS "Configuring MinGW environment:")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
20
  
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
21
if("$ENV{DEVLIBS_PATH}" STREQUAL "")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
22
  message(STATUS "  Setting path to development libraries from mingwenv.cmake: ${ENV_DEVLIBS_PATH}")
23
  set(DEVLIBS_PATH ${ENV_DEVLIBS_PATH})
15002.1.4 by Sebastian Faubel
Added missing files.
24
else()
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
25
  message(STATUS "  Setting path to development libraries from environment: $ENV{DEVLIBS_PATH}")
26
  set(DEVLIBS_PATH $ENV{DEVLIBS_PATH})
15002.1.4 by Sebastian Faubel
Added missing files.
27
endif()
28
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
29
if("$ENV{MINGW_PATH}" STREQUAL "")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
30
  message(STATUS "  Setting path to MinGW from mingwenv.cmake: ${ENV_MINGW_PATH}")
31
  set(MINGW_PATH ${ENV_MINGW_PATH})
15002.1.4 by Sebastian Faubel
Added missing files.
32
else()
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
33
  message(STATUS "  Setting path to MinGW from environment: $ENV{MINGW_PATH}")
34
  set(MINGW_PATH $ENV{MINGW_PATH})
15002.1.4 by Sebastian Faubel
Added missing files.
35
endif()
36
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
37
if("$ENV{GS_PATH}" STREQUAL "")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
38
  message(STATUS "  Setting path to Ghostscript from mingwenv.cmake: ${ENV_GS_PATH}")
39
  set(GS_PATH ${ENV_GS_PATH})
15002.1.4 by Sebastian Faubel
Added missing files.
40
else()
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
41
  message(STATUS "  Setting path to Ghostscript from environment: $ENV{GS_PATH}")
42
  set(GS_PATH $ENV{GS_PATH})
15002.1.4 by Sebastian Faubel
Added missing files.
43
endif()
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
44
  
15002.1.4 by Sebastian Faubel
Added missing files.
45
# Normalize directory separator slashes.
46
string(REGEX REPLACE "\\\\" "/" DEVLIBS_PATH ${DEVLIBS_PATH})
47
string(REGEX REPLACE "\\\\" "/" MINGW_PATH ${MINGW_PATH})
48
string(REGEX REPLACE "\\\\" "/" GS_PATH ${GS_PATH})
49
50
# -----------------------------------------------------------------------------
51
# DEVLIBS CHECKS
52
# -----------------------------------------------------------------------------
53
54
# Directory containing the compile time .dll.a and .a files.
55
set(DEVLIBS_LIB "${DEVLIBS_PATH}/lib")
56
57
if(NOT EXISTS "${DEVLIBS_LIB}")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
58
  message(FATAL_ERROR "Inkscape development libraries directory does not exist: ${DEVLIBS_LIB}")
15002.1.4 by Sebastian Faubel
Added missing files.
59
endif()
60
61
# Add devlibs libraries to linker path.
62
link_directories(${DEVLIBS_LIB})
63
64
set(DEVLIBS_INCLUDE ${DEVLIBS_PATH}/include)
65
66
if(NOT EXISTS ${DEVLIBS_INCLUDE})
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
67
  message(FATAL_ERROR "Inkscape development libraries directory does not exist: ${DEVLIBS_INCLUDE}")
15002.1.4 by Sebastian Faubel
Added missing files.
68
endif()
69
70
# Add general MinGW headers to compiler include path.
71
#include_directories(${DEVLIBS_INCLUDE})
72
73
# Directory containing the precompiled .dll files.
74
set(DEVLIBS_BIN ${DEVLIBS_PATH}/bin)
75
76
if(NOT EXISTS ${DEVLIBS_BIN})
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
77
  message(FATAL_ERROR "Inkscape development binaries directory does not exist: ${DEVLIBS_BIN}")
15002.1.4 by Sebastian Faubel
Added missing files.
78
endif()
79
80
# Directory containing the pkgconfig .pc files.
81
set(PKG_CONFIG_PATH "${DEVLIBS_PATH}/lib/pkgconfig")
82
83
if(NOT EXISTS "${PKG_CONFIG_PATH}")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
84
  message(FATAL_ERROR "pkgconfig directory does not exist: ${PKG_CONFIG_PATH}")
15002.1.4 by Sebastian Faubel
Added missing files.
85
endif()
86
87
# Add the devlibs directories to the paths used to find libraries and programs.
88
list(APPEND CMAKE_PREFIX_PATH ${DEVLIBS_PATH})
89
90
# Eliminate error messages when not having mingw in the environment path variable.
91
list(APPEND CMAKE_PROGRAM_PATH  ${DEVLIBS_BIN})
92
93
# -----------------------------------------------------------------------------
94
# MINGW CHECKS
95
# -----------------------------------------------------------------------------
96
97
# We are in a MinGW environment.
98
set(HAVE_MINGW ON)
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
99
  
15002.1.4 by Sebastian Faubel
Added missing files.
100
# Try to determine the MinGW processor architecture.
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
101
if(EXISTS "${MINGW_PATH}/mingw32")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
102
  set(HAVE_MINGW64 OFF)
103
  set(MINGW_ARCH mingw32)
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
104
elseif(EXISTS "${MINGW_PATH}/x86_64-w64-mingw32")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
105
  set(HAVE_MINGW64 ON)
106
  set(MINGW_ARCH x86_64-w64-mingw32)
15002.1.4 by Sebastian Faubel
Added missing files.
107
else()
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
108
  message(FATAL_ERROR "Unable to determine MinGW processor architecture. Are you using an unsupported MinGW version?")
15002.1.4 by Sebastian Faubel
Added missing files.
109
endif()
110
111
# Path to processor architecture specific binaries and libs.
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
112
set(MINGW_ARCH_PATH "${MINGW_PATH}/${MINGW_ARCH}")
15002.1.4 by Sebastian Faubel
Added missing files.
113
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
114
set(MINGW_BIN "${MINGW_PATH}/bin")
15002.1.4 by Sebastian Faubel
Added missing files.
115
116
if(NOT EXISTS ${MINGW_BIN})
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
117
  message(FATAL_ERROR "MinGW binary directory does not exist: ${MINGW_BIN}")
15002.1.4 by Sebastian Faubel
Added missing files.
118
endif()
119
120
# Eliminate error messages when not having mingw in the environment path variable.
121
list(APPEND CMAKE_PROGRAM_PATH  ${MINGW_BIN})
122
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
123
set(MINGW_LIB "${MINGW_PATH}/lib")
15002.1.4 by Sebastian Faubel
Added missing files.
124
125
if(NOT EXISTS ${MINGW_LIB})
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
126
  message(FATAL_ERROR "MinGW library directory does not exist: ${MINGW_LIB}")
15002.1.4 by Sebastian Faubel
Added missing files.
127
endif()
128
129
# Add MinGW libraries to linker path.
130
link_directories(${MINGW_LIB})
131
15002.1.5 by Sebastian Faubel
Fixed config.h defines to point to the right locations for data (icons) and locales.
132
set(MINGW_INCLUDE "${MINGW_PATH}/include")
15002.1.4 by Sebastian Faubel
Added missing files.
133
134
if(NOT EXISTS ${MINGW_INCLUDE})
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
135
  message(FATAL_ERROR "MinGW include directory does not exist: ${MINGW_INCLUDE}")
15002.1.4 by Sebastian Faubel
Added missing files.
136
endif()
137
138
# Add general MinGW headers to compiler include path.
139
include_directories(SYSTEM ${MINGW_INCLUDE})
140
141
if(HAVE_MINGW64)
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
142
  set(MINGW64_LIB "${MINGW_ARCH_PATH}/lib")
143
  
144
  if(NOT EXISTS ${MINGW64_LIB})
145
    message(FATAL_ERROR "MinGW 64-Bit libraries directory does not exist: ${MINGW64_LIB}")
146
  endif()
147
148
  # Add 64-Bit libraries to linker path.
149
  link_directories(${MINGW64_LIB})
150
  
151
  set(MINGW64_INCLUDE "${MINGW_ARCH_PATH}/include")
152
  
153
  if(NOT EXISTS ${MINGW64_INCLUDE})
154
    message(FATAL_ERROR "MinGW 64-Bit include directory does not exist: ${MINGW64_INCLUDE}")
155
  endif()
156
157
  # Add 64-Bit MinGW headers to compiler include path.
158
  include_directories(${MINGW64_INCLUDE})
15002.1.4 by Sebastian Faubel
Added missing files.
159
endif()
160
161
# -----------------------------------------------------------------------------
15023.1.1 by Sebastian Faubel
CMake on Windows produces same output as btool.
162
# MSYS CHECKS
163
# -----------------------------------------------------------------------------
164
165
# Somehow the MSYS variable does not work as documented..
166
if("${CMAKE_GENERATOR}" STREQUAL "MSYS Makefiles")
167
  set(HAVE_MSYS ON)
168
else()
169
  set(HAVE_MSYS OFF)
170
endif()
171
172
# Set the path to the 'ar' utility for the MSYS shell as it fails to detect it properly.
173
if(HAVE_MSYS)
174
  message(STATUS "Configuring MSYS environment:")
175
  
176
  if(NOT EXISTS ${CMAKE_AR})
177
	set(MINGW_AR ${MINGW_BIN}/ar.exe)
178
  
179
	if(EXISTS ${MINGW_AR})
180
		set(CMAKE_AR ${MINGW_AR} CACHE FILEPATH "Archive Utility")
181
	else()
182
		message(FATAL_ERROR "ar.exe not found.")
183
	endif()
184
	
185
	message(STATUS "  Setting path to ar.exe: ${CMAKE_AR}")
186
  endif()
187
endif()
188
189
# -----------------------------------------------------------------------------
15002.1.4 by Sebastian Faubel
Added missing files.
190
# GHOSTSCRIPT CHECKS
191
# -----------------------------------------------------------------------------
192
193
# Check for Ghostscript.
194
set(GS_BIN "${GS_PATH}/bin")
195
196
if(EXISTS "${GS_BIN}")
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
197
  set(HAVE_GS_BIN ON)
15002.1.4 by Sebastian Faubel
Added missing files.
198
else()
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
199
  set(HAVE_GS_BIN OFF)
15002.1.4 by Sebastian Faubel
Added missing files.
200
endif()
201
202
# -----------------------------------------------------------------------------
203
# LIBRARY AND LINKER SETTINGS
204
# -----------------------------------------------------------------------------
205
206
# Tweak CMake into using Unix-style library names.
207
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
208
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".dll")
209
210
if(NOT HAVE_MINGW64)
15002.1.7 by Sebastian Faubel
Fixing build for Linux.
211
  list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".a")
15002.1.4 by Sebastian Faubel
Added missing files.
212
endif()