-
Notifications
You must be signed in to change notification settings - Fork 107
/
CMakeLists.txt
121 lines (101 loc) · 3.05 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
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(OpenscenegraphThirdParty)
# Only enable release and debug builds
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug Release)
set(CMAKE_CONFIGURATION_TYPES
"${CMAKE_CONFIGURATION_TYPES}"
CACHE STRING "Reset the configurations to what we need" FORCE)
endif()
# Generate folder name for install
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(BITS "x64")
elseif(${CMAKE_SIZEOF_VOID_P} EQUAL 4)
set(BITS "x86")
endif()
if(MSVC)
if(${MSVC_VERSION} EQUAL 1600)
set(TOOLSET "v100") # Visual Studio 2010
elseif(${MSVC_VERSION} EQUAL 1700)
set(TOOLSET "v110") # Visual Studio 2012
elseif(${MSVC_VERSION} EQUAL 1800)
set(TOOLSET "v120") # Visual Studio 2013
elseif(${MSVC_VERSION} EQUAL 1900)
set(TOOLSET "v140") # Visual Studio 2015
elseif(${MSVC_VERSION} GREATER 1910 AND ${MSVC_VERSION} LESS 1920)
set(TOOLSET "v141") # Visual Studio 2017
elseif(${MSVC_VERSION} GREATER 1919)
set(TOOLSET "v142") # Visual Studio 2019
endif()
endif()
if(MINGW)
set(TOOLSET "mingw")
endif()
set(dirname "${TOOLSET}-${BITS}")
# Set directories if not set explicitly
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
"${PROJECT_BINARY_DIR}/3rdParty/${dirname}"
CACHE "Force change of path" STRING FORCE)
endif()
set(ZLIB_SOURCE_DIR CACHE PATH "Path where to find ZLIB source")
set(LIBPNG_SOURCE_DIR CACHE PATH "Path where to find LIBPNG source")
set(LIBJPEG_SOURCE_DIR CACHE PATH "Path where to find LIBJPEG source")
set(LIBTIFF_SOURCE_DIR CACHE PATH "Path where to find LIBTIFF source")
set(FREETYPE_SOURCE_DIR CACHE PATH "Path where to find FREETYPE source")
set(GLUT_SOURCE_DIR CACHE PATH "Path where to find GLUT source")
set(GIFLIB_SOURCE_DIR CACHE PATH "Path where to find GIFLIB source")
set(CURL_SOURCE_DIR CACHE PATH "Path where to find cURL source")
# Check dependencies for LIBPNG
if(LIBPNG_SOURCE_DIR)
if(NOT ZLIB_SOURCE_DIR)
message(
FATAL_ERROR "Error: LIBPNG depends on ZLIB and no ZLIB path has been set")
endif()
endif()
# Check dependencies for LIBTIFF
if(LIBTIFF_SOURCE_DIR)
if(NOT ZLIB_SOURCE_DIR)
message(
FATAL_ERROR "Error: LIBTIFF depends on ZLIB and no ZLIB path has been set"
)
endif()
if(NOT LIBJPEG_SOURCE_DIR)
message(
FATAL_ERROR
"Error: LIBTIFF depends on LIBJPEG and no LIBJPEG path has been set")
endif()
endif()
# Check dependencies for MINIZIP
if(MINIZIP_SOURCE_DIR)
if(NOT ZLIB_SOURCE_DIR)
message(
FATAL_ERROR "Error: MINIZIP depends on ZLIB and no ZLIB path has been set"
)
endif()
endif()
# Add libraries
if(ZLIB_SOURCE_DIR)
add_subdirectory(zlib)
endif()
if(LIBPNG_SOURCE_DIR)
add_subdirectory(libpng)
endif()
if(LIBJPEG_SOURCE_DIR)
add_subdirectory(libjpeg)
endif()
if(LIBTIFF_SOURCE_DIR)
add_subdirectory(libtiff)
endif()
if(FREETYPE_SOURCE_DIR)
add_subdirectory(freetype)
endif()
if(GLUT_SOURCE_DIR)
add_subdirectory(glut)
endif()
if(GIFLIB_SOURCE_DIR)
add_subdirectory(giflib)
endif()
if(CURL_SOURCE_DIR)
add_subdirectory(curl)
endif()