Skip to content

Commit 07dbfd7

Browse files
Ryerohvani
authored andcommitted
Fix headless build setup for utilities
1 parent a9bd4d3 commit 07dbfd7

File tree

10 files changed

+85
-122
lines changed

10 files changed

+85
-122
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
libgl1-mesa-dev libglu1-mesa-dev libxinerama-dev \
138138
libxcursor-dev libxfixes-dev libgstreamer1.0-dev \
139139
libgstreamer-plugins-base1.0-dev ninja-build libxft-dev \
140-
llvm mold libpipewire-0.3-dev libdbus-1-dev
140+
llvm mold libpipewire-0.3-dev libosmesa6-dev libdbus-1-dev
141141
sudo locale-gen en_US.UTF-8
142142
sudo locale-gen en_GB.UTF-8
143143
sudo locale-gen fr_FR.UTF-8

autobuild.xml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,36 +1267,6 @@
12671267
<key>description</key>
12681268
<string>PNG Reference library</string>
12691269
</map>
1270-
<key>libuuid</key>
1271-
<map>
1272-
<key>platforms</key>
1273-
<map>
1274-
<key>linux64</key>
1275-
<map>
1276-
<key>archive</key>
1277-
<map>
1278-
<key>hash</key>
1279-
<string>fb89f1281dd54d8b99b339fc5b712b27</string>
1280-
<key>url</key>
1281-
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-libuuid/rev/314269/arch/Linux/installer/libuuid-1.6.2-linux64-314269.tar.bz2</string>
1282-
</map>
1283-
<key>name</key>
1284-
<string>linux64</string>
1285-
</map>
1286-
</map>
1287-
<key>license</key>
1288-
<string>UUID</string>
1289-
<key>license_file</key>
1290-
<string>LICENSES/uuid.txt</string>
1291-
<key>copyright</key>
1292-
<string>Copyright (c) 2004-2008 The OSSP Project &lt;http://www.ossp.org/&gt;</string>
1293-
<key>version</key>
1294-
<string>1.6.2</string>
1295-
<key>name</key>
1296-
<string>libuuid</string>
1297-
<key>description</key>
1298-
<string>OSSP uuid is a ISO-C:1999 application programming interface (API) and corresponding command line interface (CLI) for the generation of DCE 1.1, ISO/IEC 11578:1996 and RFC 4122 compliant Universally Unique Identifier (UUID). </string>
1299-
</map>
13001270
<key>libxml2</key>
13011271
<map>
13021272
<key>platforms</key>
@@ -1646,32 +1616,6 @@
16461616
<key>description</key>
16471617
<string>Luau is a fast, small, safe, gradually typed embeddable scripting language derived from Lua.</string>
16481618
</map>
1649-
<key>mesa</key>
1650-
<map>
1651-
<key>platforms</key>
1652-
<map>
1653-
<key>linux</key>
1654-
<map>
1655-
<key>archive</key>
1656-
<map>
1657-
<key>hash</key>
1658-
<string>22c50a5d362cad311b4f413cfcffbba2</string>
1659-
<key>url</key>
1660-
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/mesa_3p-update-mesa/rev/297294/arch/Linux/installer/mesa-7.11.1.297294-linux-297294.tar.bz2</string>
1661-
</map>
1662-
<key>name</key>
1663-
<string>linux</string>
1664-
</map>
1665-
</map>
1666-
<key>license</key>
1667-
<string>mesa</string>
1668-
<key>license_file</key>
1669-
<string>LICENSES/mesa.txt</string>
1670-
<key>version</key>
1671-
<string>7.11.1.297294</string>
1672-
<key>name</key>
1673-
<string>mesa</string>
1674-
</map>
16751619
<key>meshoptimizer</key>
16761620
<map>
16771621
<key>platforms</key>

indra/cmake/Variables.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
129129

130130
if (INSTALL_PROPRIETARY)
131131
# Only turn on headless if we can find osmesa libraries.
132-
include(FindPkgConfig)
133-
#pkg_check_modules(OSMESA osmesa)
134-
#if (OSMESA_FOUND)
135-
# set(BUILD_HEADLESS ON CACHE BOOL "Build headless libraries.")
136-
#endif (OSMESA_FOUND)
132+
find_package(PkgConfig)
133+
pkg_check_modules(OSMESA osmesa IMPORTED_TARGET GLOBAL)
134+
if (OSMESA_FOUND)
135+
set(BUILD_HEADLESS ON CACHE BOOL "Build headless libraries.")
136+
endif (OSMESA_FOUND)
137137
endif (INSTALL_PROPRIETARY)
138138

139139
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")

indra/llappearance/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ if (BUILD_HEADLESS)
7676
llcharacter
7777
llinventory
7878
llimage
79+
llrenderheadless
7980
llfilesystem
8081
llmath
8182
llxml

indra/llappearanceutility/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ if (BUILD_HEADLESS)
7373
add_executable(appearance-utility-headless-bin ${appearance_utility_SOURCE_FILES})
7474

7575
target_link_libraries(appearance-utility-headless-bin
76-
${LLAPPEARANCE_HEADLESS_LIBRARIES}
77-
${LLWINDOW_HEADLESS_LIBRARIES}
78-
${BOOST_COROUTINE_LIBRARY}
79-
${BOOST_CONTEXT_LIBRARY}
80-
${BOOST_SYSTEM_LIBRARY}
81-
${TCMALLOC_LIBRARIES}
82-
)
76+
llcharacter
77+
llinventory
78+
llappearanceheadless
79+
llwindowheadless
80+
llrenderheadless
81+
llxml
82+
)
8383

8484
add_custom_target(appearance-utility-headless-bin-target ALL
8585
DEPENDS appearance-utility-headless-bin)

indra/llrender/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ if (BUILD_HEADLESS)
7272
add_library (llrenderheadless
7373
${llrender_SOURCE_FILES}
7474
)
75+
target_include_directories( llrenderheadless INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
7576

7677
set_property(TARGET llrenderheadless
7778
PROPERTY COMPILE_DEFINITIONS LL_MESA=1 LL_MESA_HEADLESS=1
@@ -81,9 +82,11 @@ if (BUILD_HEADLESS)
8182
llcommon
8283
llimage
8384
llmath
84-
llrender
8585
llxml
8686
llfilesystem
87+
llwindowheadless
88+
ll::freetype
89+
OpenGL::GL
8790
)
8891
endif (BUILD_HEADLESS)
8992

@@ -101,6 +104,5 @@ target_link_libraries(llrender
101104
llwindow
102105
ll::freetype
103106
OpenGL::GL
104-
OpenGL::GLU
105107
)
106108

indra/llwindow/CMakeLists.txt

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,6 @@ if (LINUX)
8080
llkeyboardsdl.h
8181
llwindowsdl.h
8282
)
83-
84-
if (BUILD_HEADLESS)
85-
set(llwindowheadless_LINK_LIBRARIES
86-
${LLCOMMON_LIBRARIES}
87-
${LLIMAGE_LIBRARIES}
88-
${LLMATH_LIBRARIES}
89-
${LLRENDER_HEADLESS_LIBRARIES}
90-
${LLFILESYSTEM_LIBRARIES}
91-
${LLWINDOW_HEADLESS_LIBRARIES}
92-
${LLXML_LIBRARIES}
93-
fontconfig # For FCInit and other FC* functions.
94-
)
95-
endif (BUILD_HEADLESS)
9683
endif (LINUX)
9784

9885
if (DARWIN)
@@ -141,32 +128,52 @@ if (WINDOWS)
141128
)
142129
endif (WINDOWS)
143130

144-
if (SOLARIS)
145-
list(APPEND llwindow_SOURCE_FILES
146-
llwindowsolaris.cpp
147-
)
148-
list(APPEND llwindow_HEADER_FILES
149-
llwindowsolaris.h
150-
)
151-
endif (SOLARIS)
152-
153131
if (BUILD_HEADLESS)
154132
set(llwindowheadless_SOURCE_FILES
155-
llwindowmesaheadless.cpp
156-
llmousehandler.cpp
157-
)
133+
llcursortypes.cpp
134+
llkeyboard.cpp
135+
llkeyboardheadless.cpp
136+
llwindowheadless.cpp
137+
llwindowcallbacks.cpp
138+
llwindow.cpp
139+
llwindowmesaheadless.cpp
140+
llmousehandler.cpp
141+
)
142+
158143
set(llwindowheadless_HEADER_FILES
159-
llwindowmesaheadless.h
160-
llmousehandler.h
161-
)
144+
llcursortypes.h
145+
llkeyboard.h
146+
llkeyboardheadless.h
147+
llwindowheadless.h
148+
llwindowcallbacks.h
149+
llwindowmesaheadless.h
150+
llmousehandler.h
151+
)
152+
162153
add_library (llwindowheadless
163-
${llwindow_SOURCE_FILES}
164154
${llwindowheadless_SOURCE_FILES}
155+
${llwindowheadless_HEADER_FILES}
165156
)
157+
166158
set_property(TARGET llwindowheadless
167159
PROPERTY COMPILE_DEFINITIONS LL_MESA=1 LL_MESA_HEADLESS=1
168160
)
169-
target_link_libraries (llwindowheadless ${llwindowheadless_LINK_LIBRARIES} dl)
161+
162+
target_link_libraries (llwindowheadless
163+
llcommon
164+
llimage
165+
llmath
166+
llrenderheadless
167+
llfilesystem
168+
llxml
169+
ll::glm
170+
ll::glext
171+
ll::zlib-ng
172+
PkgConfig::OSMESA
173+
fontconfig
174+
dl
175+
)
176+
target_include_directories(llwindowheadless INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
170177
endif (BUILD_HEADLESS)
171178

172179
if (llwindow_HEADER_FILES)

indra/llwindow/llwindow.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ std::vector<std::string> LLWindow::getDynamicFallbackFontList()
264264
return LLWindowWin32::getDynamicFallbackFontList();
265265
#elif LL_DARWIN
266266
return LLWindowMacOSX::getDynamicFallbackFontList();
267-
#elif LL_LINUX
267+
#elif LL_LINUX && !defined(LL_MESA)
268268
return LLWindowSDL::getDynamicFallbackFontList();
269269
#else
270270
return std::vector<std::string>();
@@ -416,9 +416,9 @@ LLWindow* LLWindowManager::createWindow(
416416

417417
if (use_gl)
418418
{
419-
#ifndef LL_DARWIN
420-
// SDL2 is temporarily disabled on Mac
421-
init_sdl();
419+
// SDL2 is temporarily disabled on Mac
420+
#if !defined(LL_DARWIN) && !defined(LL_MESA_HEADLESS)
421+
init_sdl();
422422
#endif
423423

424424
#if LL_WINDOWS
@@ -468,7 +468,9 @@ bool LLWindowManager::destroyWindow(LLWindow* window)
468468
window->close();
469469

470470
sWindowList.erase(window);
471+
#ifndef LL_MESA_HEADLESS
471472
quit_sdl();
473+
#endif
472474

473475
delete window;
474476

indra/llwindow/llwindowmesaheadless.h

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ class LLWindowMesaHeadless : public LLWindow
3939
void show() override {};
4040
void hide() override {};
4141
void close() override {};
42-
bool getVisible() override {return false;};
43-
bool getMinimized() override {return false;};
44-
bool getMaximized() override {return false;};
42+
bool getVisible() const override {return false;};
43+
bool getMinimized() const override {return false;};
44+
bool getMaximized() const override {return false;};
4545
bool maximize() override {return false;};
4646
void minimize() override {};
4747
void restore() override {};
48-
bool getFullscreen() override {return false;};
49-
bool getPosition(LLCoordScreen *position) override {return false;};
50-
bool getSize(LLCoordScreen *size) override {return false;};
51-
bool getSize(LLCoordWindow *size) override {return false;};
48+
bool getFullscreen() const override {return false;};
49+
bool getPosition(LLCoordScreen *position) const override {return false;};
50+
bool getSize(LLCoordScreen *size) const override {return false;};
51+
bool getSize(LLCoordWindow *size) const override {return false;};
5252
bool setPosition(LLCoordScreen position) override {return false;};
5353
bool setSizeImpl(LLCoordScreen size) override {return false;};
5454
bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp = NULL) override {return false;};
@@ -68,24 +68,30 @@ class LLWindowMesaHeadless : public LLWindow
6868
bool pasteTextFromClipboard(LLWString &dst) override {return false; };
6969
bool copyTextToClipboard(const LLWString &src) override {return false; };
7070
void flashIcon(F32 seconds) override {};
71-
F32 getGamma() override {return 1.0f; };
71+
F32 getGamma() const override {return 1.0f; };
7272
bool setGamma(const F32 gamma) override {return false; }; // Set the gamma
7373
bool restoreGamma() override {return false; }; // Restore original gamma table (before updating gamma)
7474
void setFSAASamples(const U32 fsaa_samples) override { /* FSAA not supported yet on Mesa headless.*/ }
75-
U32 getFSAASamples() override { return 0; }
75+
U32 getFSAASamples() const override { return 0; }
7676
//ESwapMethod getSwapMethod() override { return mSwapMethod; }
7777
void gatherInput(bool app_has_focus) override {};
7878
void delayInputProcessing() override {};
7979
void swapBuffers() override;
80-
void restoreGLContext() override {};
80+
81+
void* createSharedContext()override{return nullptr;};
82+
void makeContextCurrent(void* context)override{};
83+
void destroySharedContext(void* context)override{};
84+
void toggleVSync(bool enable_vsync) override {};
85+
bool setSizeImpl(LLCoordWindow size) override { return false; };
86+
8187

8288
// handy coordinate space conversion routines
83-
bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override { return false; };
84-
bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override { return false; };
85-
bool convertCoords(LLCoordWindow from, LLCoordGL *to) override { return false; };
86-
bool convertCoords(LLCoordGL from, LLCoordWindow *to) override { return false; };
87-
bool convertCoords(LLCoordScreen from, LLCoordGL *to) override { return false; };
88-
bool convertCoords(LLCoordGL from, LLCoordScreen *to) override { return false; };
89+
bool convertCoords(LLCoordScreen from, LLCoordWindow *to) const override { return false; };
90+
bool convertCoords(LLCoordWindow from, LLCoordScreen *to) const override { return false; };
91+
bool convertCoords(LLCoordWindow from, LLCoordGL *to) const override { return false; };
92+
bool convertCoords(LLCoordGL from, LLCoordWindow *to) const override { return false; };
93+
bool convertCoords(LLCoordScreen from, LLCoordGL *to) const override { return false; };
94+
bool convertCoords(LLCoordGL from, LLCoordScreen *to) const override { return false; };
8995

9096
LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override { return NULL; };
9197
F32 getNativeAspectRatio() override { return 1.0f; };

indra/newview/viewer_manifest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,8 @@ def construct(self):
12341234
app_util = os.path.join(self.args['build'], '../llappearanceutility')
12351235
if os.path.isdir(app_util):
12361236
with self.prefix(app_util):
1237-
self.path("appearance-utility-bin", "appearance-utility-bin")
1237+
self.path("appearance-utility-bin")
1238+
self.path("appearance-utility-headless-bin")
12381239

12391240
# recurses, packaged again
12401241
self.path("res-sdl")

0 commit comments

Comments
 (0)