With the following, I can’t build the project (compiles fine, but linking fails), but navigation seems to work fine mostly.

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
cmake_minimum_required(VERSION 3.15)
project(clion-jdk)

set(CMAKE_CXX_STANDARD 14)

set(CMAKE_CXX_FLAGS "-fpermissive -Wno-format-zero-length")

set(base_path ".")

set(build_path "./build")

include_directories(${build_path}/linux-x64-debug/hotspot/variant-server/gensrc/)
include_directories(${build_path}/linux-x64-debug/jdk/include/)
include_directories(${build_path}/linux-x64-debug/support/headers/java.base/)

include_directories(${base_path}/src/jdk.jpackage/share/native/common/)
include_directories(${base_path}/src/jdk.jpackage/share/native/applauncher/)
include_directories(${base_path}/src/jdk.jpackage/unix/native/common/)

include_directories(${base_path}/src/hotspot/share/)
include_directories(${base_path}/src/hotspot/share/include)
include_directories(${base_path}/src/hotspot/share/precompiled/)
include_directories(${base_path}/src/hotspot/cpu/x86/)
#include_directories(${base_path}/src/hotspot/os/bsd/)
include_directories(${base_path}/src/hotspot/os/linux/)
include_directories(${base_path}/src/hotspot/os/posix/)
include_directories(${base_path}/src/hotspot/os/posix/include)
include_directories(${base_path}/src/hotspot/os_cpu/linux_x86/)

include_directories(${base_path}/src/java.base/share/native/libjava/)
include_directories(${base_path}/src/java.base/share/native/include/)
include_directories(${base_path}/src/java.base/share/native/libjimage/)

include_directories(${base_path}/src/java.base/unix/native/include/)
include_directories(${base_path}/src/java.base/unix/native/libjava/)

include_directories(${base_path}/src/java.management/share/native/include/)

include_directories(${base_path}/src/jdk.pack/share/native/common-unpack/)

add_definitions(-D_XOPEN_SOURCE)
#add_definitions(-D_ALLBSD_SOURCE)
#add_definitions(-D_DARWIN_C_SOURCE)
#add_definitions(-DCHECK_UNHANDLED_OOPS)
add_definitions(-DLINUX)
add_definitions(-DSUPPORTS_CLOCK_MONOTONIC)

add_definitions(-DASSERT)
# add_definitions(-D_NMT_NOINLINE_)
add_definitions(-DDONT_USE_PRECOMPILED_HEADER)
add_definitions(-DAMD64)
add_definitions(-DHOTSPOT_LIB_ARCH="amd64")
add_definitions(-DTARGET_ARCH_x86)
add_definitions(-DINCLUDE_SUFFIX_OS=_linux)
add_definitions(-DINCLUDE_SUFFIX_CPU=_x86)
add_definitions(-DINCLUDE_SUFFIX_COMPILER=_gcc)
add_definitions(-DTARGET_COMPILER_gcc)

add_definitions(-DCOMPILER1)
add_definitions(-DCOMPILER2)
add_definitions(-DINCLUDE_AOT)

add_definitions(-DVERSION_MAJOR=16)
add_definitions(-DVERSION_MINOR=0)
add_definitions(-DVERSION_SECURITY=0)
add_definitions(-DVERSION_PATCH=0)
add_definitions(-DVERSION_FEATURE=16)
add_definitions(-DVERSION_INTERIM=0)
add_definitions(-DVERSION_UPDATE=0)

add_definitions(-DVERSION_BUILD=0)
add_definitions(-DVERSION_STRING="16-internal+0-adhoc.albert.vm")
add_definitions(-DHOTSPOT_VERSION_STRING="16-internal+0-adhoc.albert.vm")

add_definitions(-DDEBUG_LEVEL="fastdebug")
add_definitions(-DHOTSPOT_VM_DISTRO="OpenJDK")
add_definitions(-DHOTSPOT_BUILD_USER="albert")

file(GLOB_RECURSE SOURCE_FILES
${base_path}/src/*.c ${base_path}/src/*.cc ${base_path}/src/*.cpp
${base_path}/src/*.h ${base_path}/src/*.hpp
${base_path}/src/*.java
${build_path}/linux-x64-debug/hotspot/variant-server/gensrc/adfiles/*.cpp
)

# g1gc
# list(FILTER SOURCE_FILES EXCLUDE REGEX ".*/gc/g1.*")
# shenandoah
#list(FILTER SOURCE_FILES EXCLUDE REGEX ".*/gc/shenandoah.*")

list(FILTER SOURCE_FILES EXCLUDE REGEX ".*java.desktop.*")

list(FILTER SOURCE_FILES EXCLUDE REGEX ".*share/shark.*")

# cpu
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*aarch64.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*arm.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*ppc.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*s390.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*sparc.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*x86_32.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*zero.*")

# os
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*aix.*")
#list(FILTER SOURCE_FILES EXCLUDE REGEX ".*linux.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*bsd.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*macosx.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*solaris.*")
list(FILTER SOURCE_FILES EXCLUDE REGEX ".*windows.*")

list(FILTER SOURCE_FILES EXCLUDE REGEX ".*libadt/dict.*")

# message(${SOURCE_FILES})

add_executable(a.out ${SOURCE_FILES})