-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathyup_dependencies.cmake
97 lines (78 loc) · 3.37 KB
/
yup_dependencies.cmake
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
# ==============================================================================
#
# This file is part of the YUP library.
# Copyright (c) 2024 - [email protected]
#
# YUP is an open source library subject to open-source licensing.
#
# The code included in this file is provided under the terms of the ISC license
# http://www.isc.org/downloads/software-support-policy/isc-license. Permission
# To use, copy, modify, and/or distribute this software for any purpose with or
# without fee is hereby granted provided that the above copyright notice and
# this permission notice appear in all copies.
#
# YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
# DISCLAIMED.
#
# ==============================================================================
#==============================================================================
function (_yup_fetch_sdl2)
if (TARGET sdl2::sdl2)
return()
endif()
FetchContent_Declare (SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-2.30.10
SOURCE_DIR ${CMAKE_BINARY_DIR}/externals/SDL2
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)
set (BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set (SDL_SHARED OFF CACHE BOOL "" FORCE)
set (SDL_STATIC ON CACHE BOOL "" FORCE)
set (SDL_STATIC_PIC ON CACHE BOOL "" FORCE)
set (SDL_TESTS OFF CACHE BOOL "" FORCE)
set (SDL_AUDIO_ENABLED_BY_DEFAULT OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable (SDL2)
if (APPLE)
target_compile_options (SDL2-static PRIVATE -Wno-deprecated-declarations)
endif()
set_target_properties (SDL2-static PROPERTIES
POSITION_INDEPENDENT_CODE ON
FOLDER "Thirdparty")
set_target_properties (SDL2main PROPERTIES FOLDER "Thirdparty")
set_target_properties (SDL2_test PROPERTIES FOLDER "Thirdparty")
set_target_properties (sdl_headers_copy PROPERTIES FOLDER "Thirdparty")
set_target_properties (uninstall PROPERTIES FOLDER "Thirdparty")
add_library (sdl2::sdl2 ALIAS SDL2-static)
endfunction()
#==============================================================================
function (_yup_fetch_perfetto)
if (TARGET perfetto::perfetto)
return()
endif()
FetchContent_Declare (Perfetto
GIT_REPOSITORY https://android.googlesource.com/platform/external/perfetto
GIT_TAG v42.0
SOURCE_DIR ${CMAKE_BINARY_DIR}/externals/Perfetto
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE)
FetchContent_MakeAvailable (Perfetto)
add_library (perfetto STATIC)
target_compile_features (perfetto PUBLIC cxx_std_17)
target_sources (perfetto
PRIVATE "$<BUILD_INTERFACE:${perfetto_SOURCE_DIR}/sdk/perfetto.cc>"
PUBLIC "$<BUILD_INTERFACE:${perfetto_SOURCE_DIR}/sdk/perfetto.h>")
target_include_directories (perfetto PUBLIC
"$<BUILD_INTERFACE:${perfetto_SOURCE_DIR}/sdk>")
set_target_properties (perfetto PROPERTIES
POSITION_INDEPENDENT_CODE ON
FOLDER "Thirdparty")
if (WIN32)
target_compile_definitions (perfetto PUBLIC NOMINMAX=1 WIN32_LEAN_AND_MEAN=1)
if (MSVC)
target_compile_options (perfetto PRIVATE /bigobj PUBLIC /Zc:__cplusplus /permissive-)
endif()
endif()
add_library (perfetto::perfetto ALIAS perfetto)
endfunction()