summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Depends.cmake69
1 files changed, 34 insertions, 35 deletions
diff --git a/Depends.cmake b/Depends.cmake
index 3af9102d..c3decd7a 100644
--- a/Depends.cmake
+++ b/Depends.cmake
@@ -7,9 +7,42 @@ find_package (PkgConfig)
7find_program (MESON_EXECUTABLE meson DOC "Meson build system") 7find_program (MESON_EXECUTABLE meson DOC "Meson build system")
8find_program (NINJA_EXECUTABLE ninja DOC "Ninja build tool") 8find_program (NINJA_EXECUTABLE ninja DOC "Ninja build tool")
9include (ExternalProject) 9include (ExternalProject)
10
11set (_dependsToBuild) 10set (_dependsToBuild)
12 11
12if (NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/the_Foundation/CMakeLists.txt)
13 set (INSTALL_THE_FOUNDATION YES)
14 find_package (the_Foundation 1.0.1 REQUIRED)
15else ()
16 if (EXISTS ${CMAKE_SOURCE_DIR}/lib/the_Foundation/.git)
17 # the_Foundation is checked out as a submodule, make sure it's up to date.
18 find_package (Git)
19 if (GIT_FOUND)
20 execute_process (
21 COMMAND ${GIT_EXECUTABLE} submodule update
22 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
23 OUTPUT_VARIABLE subout
24 OUTPUT_STRIP_TRAILING_WHITESPACE
25 )
26 if (subout)
27 message (FATAL_ERROR "'lib/the_Foundation' Git submodule has been updated, please re-run CMake.\n")
28 endif ()
29 endif ()
30 endif ()
31 set (INSTALL_THE_FOUNDATION OFF)
32 set (TFDN_STATIC_LIBRARY ON CACHE BOOL "")
33 set (TFDN_ENABLE_INSTALL OFF CACHE BOOL "")
34 set (TFDN_ENABLE_TESTS OFF CACHE BOOL "")
35 set (TFDN_ENABLE_WEBREQUEST OFF CACHE BOOL "")
36 add_subdirectory (lib/the_Foundation)
37 add_library (the_Foundation::the_Foundation ALIAS the_Foundation)
38 if (NOT OPENSSL_FOUND)
39 message (FATAL_ERROR "Lagrange requires OpenSSL for TLS. Please check if pkg-config can find 'openssl'.")
40 endif ()
41 if (NOT ZLIB_FOUND)
42 message (FATAL_ERROR "Lagrange requires zlib for reading compressed archives. Please check if pkg-config can find 'zlib'.")
43 endif ()
44endif ()
45
13if (ENABLE_HARFBUZZ AND EXISTS ${CMAKE_SOURCE_DIR}/lib/harfbuzz/CMakeLists.txt) 46if (ENABLE_HARFBUZZ AND EXISTS ${CMAKE_SOURCE_DIR}/lib/harfbuzz/CMakeLists.txt)
14 # Find HarfBuzz with pkg-config. 47 # Find HarfBuzz with pkg-config.
15 if (NOT ENABLE_HARFBUZZ_MINIMAL AND PKG_CONFIG_FOUND) 48 if (NOT ENABLE_HARFBUZZ_MINIMAL AND PKG_CONFIG_FOUND)
@@ -112,40 +145,6 @@ endif ()
112 145
113add_custom_target (ext-deps DEPENDS ${_dependsToBuild}) 146add_custom_target (ext-deps DEPENDS ${_dependsToBuild})
114 147
115if (NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/the_Foundation/CMakeLists.txt)
116 set (INSTALL_THE_FOUNDATION YES)
117 find_package (the_Foundation 1.0.0 REQUIRED)
118else ()
119 if (EXISTS ${CMAKE_SOURCE_DIR}/lib/the_Foundation/.git)
120 # the_Foundation is checked out as a submodule, make sure it's up to date.
121 find_package (Git)
122 if (GIT_FOUND)
123 execute_process (
124 COMMAND ${GIT_EXECUTABLE} submodule update
125 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
126 OUTPUT_VARIABLE subout
127 OUTPUT_STRIP_TRAILING_WHITESPACE
128 )
129 if (subout)
130 message (FATAL_ERROR "'lib/the_Foundation' Git submodule has been updated, please re-run CMake.\n")
131 endif ()
132 endif ()
133 endif ()
134 set (INSTALL_THE_FOUNDATION OFF)
135 set (TFDN_STATIC_LIBRARY ON CACHE BOOL "")
136 set (TFDN_ENABLE_INSTALL OFF CACHE BOOL "")
137 set (TFDN_ENABLE_TESTS OFF CACHE BOOL "")
138 set (TFDN_ENABLE_WEBREQUEST OFF CACHE BOOL "")
139 add_subdirectory (lib/the_Foundation)
140 add_library (the_Foundation::the_Foundation ALIAS the_Foundation)
141 if (NOT OPENSSL_FOUND)
142 message (FATAL_ERROR "Lagrange requires OpenSSL for TLS. Please check if pkg-config can find 'openssl'.")
143 endif ()
144 if (NOT ZLIB_FOUND)
145 message (FATAL_ERROR "Lagrange requires zlib for reading compressed archives. Please check if pkg-config can find 'zlib'.")
146 endif ()
147endif ()
148
149find_package (PkgConfig REQUIRED) 148find_package (PkgConfig REQUIRED)
150pkg_check_modules (SDL2 REQUIRED sdl2) 149pkg_check_modules (SDL2 REQUIRED sdl2)
151pkg_check_modules (MPG123 IMPORTED_TARGET libmpg123) 150pkg_check_modules (MPG123 IMPORTED_TARGET libmpg123)