jdk

Форк
0
/
CompileGtest.gmk 
159 строк · 6.2 Кб
1
#
2
# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
#
5
# This code is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License version 2 only, as
7
# published by the Free Software Foundation.  Oracle designates this
8
# particular file as subject to the "Classpath" exception as provided
9
# by Oracle in the LICENSE file that accompanied this code.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25

26
$(eval $(call IncludeCustomExtension, hotspot/lib/CompileGtest.gmk))
27

28
GTEST_TEST_SRC += $(TOPDIR)/test/hotspot/gtest
29

30
ifeq ($(ASAN_ENABLED), true)
31
  GTEST_LAUNCHER_EXTRA_FILES += $(TOPDIR)/make/data/asan/asan_default_options.cpp
32
endif
33

34
ifeq ($(LSAN_ENABLED), true)
35
  GTEST_LAUNCHER_EXTRA_FILES += $(TOPDIR)/make/data/lsan/lsan_default_options.cpp
36
endif
37

38
# On Windows, there are no internal debug symbols so must set copying to true
39
# to get any at all.
40
ifeq ($(call isTargetOs, windows), true)
41
  GTEST_COPY_DEBUG_SYMBOLS := true
42
else
43
  GTEST_COPY_DEBUG_SYMBOLS := false
44
endif
45

46
################################################################################
47
## Build libgtest
48
################################################################################
49

50
$(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \
51
    NAME := gtest, \
52
    TYPE := STATIC_LIBRARY, \
53
    LINK_TYPE := C++, \
54
    OUTPUT_DIR := $(JVM_OUTPUTDIR)/libgtest, \
55
    OBJECT_DIR := $(JVM_OUTPUTDIR)/libgtest/objs, \
56
    SRC := \
57
        $(GTEST_FRAMEWORK_SRC)/googletest/src \
58
        $(GTEST_FRAMEWORK_SRC)/googlemock/src, \
59
    INCLUDE_FILES := gtest-all.cc gmock-all.cc, \
60
    DISABLED_WARNINGS_gcc := undef unused-result format-nonliteral maybe-uninitialized, \
61
    DISABLED_WARNINGS_clang := undef unused-result format-nonliteral, \
62
    DEFAULT_CFLAGS := false, \
63
    CFLAGS := $(JVM_CFLAGS) \
64
        -I$(GTEST_FRAMEWORK_SRC)/googletest \
65
        -I$(GTEST_FRAMEWORK_SRC)/googletest/include \
66
        -I$(GTEST_FRAMEWORK_SRC)/googlemock \
67
        -I$(GTEST_FRAMEWORK_SRC)/googlemock/include, \
68
    CFLAGS_windows := -EHsc, \
69
    CFLAGS_macosx := -DGTEST_OS_MAC=1, \
70
    OPTIMIZATION := $(JVM_OPTIMIZATION), \
71
    COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
72
    ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
73
    STRIP_SYMBOLS := false, \
74
))
75

76
TARGETS += $(BUILD_GTEST_LIBGTEST)
77

78
################################################################################
79
## Build libjvm (for gtest)
80
################################################################################
81

82
# Additional disabled warnings are due to code in the test source.
83
$(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBJVM, \
84
    NAME := jvm, \
85
    LINK_TYPE := C++, \
86
    OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
87
    OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/objs, \
88
    SRC := $(GTEST_TEST_SRC), \
89
    EXCLUDES := $(JVM_EXCLUDES), \
90
    EXCLUDE_FILES := gtestLauncher.cpp, \
91
    EXCLUDE_PATTERNS := $(JVM_EXCLUDE_PATTERNS), \
92
    EXTRA_OBJECT_FILES := $(BUILD_LIBJVM_ALL_OBJS), \
93
    DEFAULT_CFLAGS := false, \
94
    CFLAGS := $(JVM_CFLAGS) \
95
        -I$(GTEST_FRAMEWORK_SRC)/googletest/include \
96
        -I$(GTEST_FRAMEWORK_SRC)/googlemock/include \
97
        $(addprefix -I,$(GTEST_TEST_SRC)), \
98
    CFLAGS_windows := -EHsc, \
99
    CFLAGS_macosx := -DGTEST_OS_MAC=1, \
100
    DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc) \
101
        undef stringop-overflow, \
102
    DISABLED_WARNINGS_gcc_test_threadCpuLoad.cpp := address, \
103
    DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang) \
104
        undef switch format-nonliteral tautological-undefined-compare \
105
        self-assign-overloaded, \
106
    DISABLED_WARNINGS_clang_test_g1ServiceThread.cpp := delete-abstract-non-virtual-dtor, \
107
    DISABLED_WARNINGS_clang_test_logDecorations.cpp := missing-field-initializers, \
108
    DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft), \
109
    LD_SET_ORIGIN := false, \
110
    DEFAULT_LDFLAGS := false, \
111
    LDFLAGS := $(JVM_LDFLAGS), \
112
    JDK_LIBS := gtest:libgtest, \
113
    LIBS := $(JVM_LIBS), \
114
    OPTIMIZATION := $(JVM_OPTIMIZATION), \
115
    COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
116
    ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
117
    STRIP_SYMBOLS := false, \
118
    PRECOMPILED_HEADER := $(JVM_PRECOMPILED_HEADER), \
119
    PRECOMPILED_HEADER_EXCLUDE := gtestMain.cpp, \
120
))
121

122
$(BUILD_GTEST_LIBJVM) : $(BUILD_GTEST_LIBGTEST)
123

124
ifeq ($(call isTargetOs, windows), true)
125
  $(BUILD_GTEST_LIBJVM_TARGET): $(WIN_EXPORT_FILE)
126
endif
127

128

129
TARGETS += $(BUILD_GTEST_LIBJVM)
130

131
################################################################################
132
## Build gtestLauncher
133
################################################################################
134

135
$(eval $(call SetupJdkExecutable, BUILD_GTEST_LAUNCHER, \
136
    NAME := gtestLauncher, \
137
    TYPE := EXECUTABLE, \
138
    LINK_TYPE := C++, \
139
    OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \
140
    SRC := $(TOPDIR)/test/hotspot/gtest, \
141
    INCLUDE_FILES := gtestLauncher.cpp, \
142
    EXTRA_FILES := $(GTEST_LAUNCHER_EXTRA_FILES), \
143
    OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \
144
    DEFAULT_CFLAGS := false, \
145
    CFLAGS := $(JVM_CFLAGS) \
146
        -I$(GTEST_FRAMEWORK_SRC)/googletest \
147
        -I$(GTEST_FRAMEWORK_SRC)/googletest/include \
148
        -I$(GTEST_FRAMEWORK_SRC)/googlemock \
149
        -I$(GTEST_FRAMEWORK_SRC)/googlemock/include, \
150
    LD_SET_ORIGIN := false, \
151
    LDFLAGS_unix := $(call SET_SHARED_LIBRARY_ORIGIN), \
152
    JDK_LIBS := gtest:libjvm, \
153
    COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \
154
    ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \
155
))
156

157
TARGETS += $(BUILD_GTEST_LAUNCHER)
158

159
################################################################################
160

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.