Skip to content

Commit 94d83c9

Browse files
authored
Adding support for Linux (#610)
* Adding initial support for Linux (#609) * Removed deprecated LinkTimeOptimization * Added missing includes * Fixed toolset filter * Sanitizing paths for POSIX/Windows interoperability (#611) * Added CTRL as a valid key to orbit * Added clang support and made it default on Linux * Added Linux scripts for gen_proj/build/make_release * Better project structure (#615) * Updated msbuild workflow and added linux workflow * Fixed broken linux linkoptions * Updated README * Fixing shader compilation on ARM64 (#616)
1 parent 6fd3bfa commit 94d83c9

File tree

710 files changed

+17088
-958
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

710 files changed

+17088
-958
lines changed

.github/workflows/linux.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Linux Clang
2+
3+
on:
4+
pull_request:
5+
types: [ready_for_review, synchronize]
6+
push:
7+
branches:
8+
- main
9+
10+
env:
11+
# Path to the solution file relative to the root of the project.
12+
SOLUTION_FILE_PATH: ./
13+
14+
# Configuration type to build.
15+
# You can convert this to a build matrix if you need coverage of multiple configuration types.
16+
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
17+
BUILD_CONFIGURATION: release
18+
BUILD_PLATFORM: x64
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v5
26+
27+
- name: Install Dependencies
28+
run: sudo apt-get update && sudo apt-get install -y libgl1-mesa-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev
29+
30+
- name: Generate premake5 solution
31+
working-directory: ${{env.SOLUTION_FILE_PATH}}
32+
run: ./gen_proj_linux.sh
33+
34+
- name: Build
35+
working-directory: ${{env.GITHUB_WORKSPACE}}
36+
# Add additional options to the MSBuild command line here (like platform or verbosity level).
37+
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
38+
run: make -j$(nproc) config=${{env.BUILD_CONFIGURATION}}_${{env.BUILD_PLATFORM}}

.github/workflows/msbuild.yml renamed to .github/workflows/windows.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
name: MSBuild
1+
name: Windows MSBuild
22

33
on:
44
pull_request:
5-
types: ready_for_review
5+
types: [ready_for_review, synchronize]
66
push:
77
branches:
88
- main
99

1010
env:
1111
# Path to the solution file relative to the root of the project.
12-
SOLUTION_FILE_PATH: Sources\Overload
12+
SOLUTION_FILE_PATH: .\
1313

1414
# Configuration type to build.
1515
# You can convert this to a build matrix if you need coverage of multiple configuration types.
@@ -21,11 +21,11 @@ jobs:
2121
runs-on: windows-latest
2222

2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525

2626
- name: Generate premake5 solution
2727
working-directory: ${{env.SOLUTION_FILE_PATH}}
28-
run: ..\..\Dependencies\premake5\bin\premake5.exe vs2022
28+
run: .\gen_proj_win32.bat
2929

3030
- name: Add MSBuild to PATH
3131
uses: microsoft/setup-msbuild@v2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ imgui.ini
88
*.vcxproj*
99
*.sln
1010
*.vcxitems*
11-
/Releases/
11+
/Releases/
12+
Makefile

Dependencies/assimp/contrib/zlib/gzguts.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
# include <stddef.h>
3636
#endif
3737

38+
#ifdef __unix__
39+
# include <unistd.h>
40+
#endif
41+
3842
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
3943
# include <io.h>
4044
#endif

Dependencies/glfw/premake5.lua

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,27 @@ project "glfw"
1717
"include"
1818
}
1919

20-
defines {
21-
"_GLFW_WIN32"
22-
}
20+
filter { "system:windows" }
21+
defines { "_GLFW_WIN32" }
22+
removefiles {
23+
"src/cocoa_*",
24+
"src/posix_time.h",
25+
"src/x11_*",
26+
"src/glx_*",
27+
"src/nsgl_*"
28+
}
29+
filter {}
30+
31+
filter { "system:linux" }
32+
defines { "_GLFW_X11", "_GNU_SOURCE" }
33+
removefiles {
34+
"src/win32_*",
35+
"src/cocoa_*",
36+
"src/posix_time.h",
37+
"src/wgl_*",
38+
"src/nsgl_*"
39+
}
40+
filter {}
2341

2442
filter { "configurations:Debug" }
2543
defines { "DEBUG" }

Dependencies/premake5/bin/premake5

2.54 MB
Binary file not shown.

Dependencies/sol/include/sol/function_types_stateless.hpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,13 @@ namespace sol { namespace function_detail {
320320
}
321321

322322
template <bool is_yielding, bool no_trampoline>
323-
static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v<T>) {
323+
static int call(lua_State* L)
324+
#if SOL_IS_ON(SOL_COMPILER_CLANG)
325+
// apparent regression in clang 18 - llvm/llvm-project#91362
326+
#else
327+
noexcept(std::is_nothrow_copy_assignable_v<T>)
328+
#endif
329+
{
324330
int nr;
325331
if constexpr (no_trampoline) {
326332
nr = real_call(L);
@@ -360,7 +366,13 @@ namespace sol { namespace function_detail {
360366
}
361367

362368
template <bool is_yielding, bool no_trampoline>
363-
static int call(lua_State* L) noexcept(std::is_nothrow_copy_assignable_v<T>) {
369+
static int call(lua_State* L)
370+
#if SOL_IS_ON(SOL_COMPILER_CLANG)
371+
// apparent regression in clang 18 - llvm/llvm-project#91362
372+
#else
373+
noexcept(std::is_nothrow_copy_assignable_v<T>)
374+
#endif
375+
{
364376
int nr;
365377
if constexpr (no_trampoline) {
366378
nr = real_call(L);

Dependencies/tracy/client/TracyFastVector.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define __TRACYFASTVECTOR_HPP__
33

44
#include <assert.h>
5+
#include <cstring>
56
#include <stddef.h>
67

78
#include "../common/TracyAlloc.hpp"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright (C) 2012-2016 Free Software Foundation, Inc.
2+
3+
# Redistribution and use in source and binary forms, with or without
4+
# modification, are permitted provided that the following conditions are
5+
# met:
6+
7+
# (1) Redistributions of source code must retain the above copyright
8+
# notice, this list of conditions and the following disclaimer.
9+
10+
# (2) Redistributions in binary form must reproduce the above copyright
11+
# notice, this list of conditions and the following disclaimer in
12+
# the documentation and/or other materials provided with the
13+
# distribution.
14+
15+
# (3) The name of the author may not be used to
16+
# endorse or promote products derived from this software without
17+
# specific prior written permission.
18+
19+
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20+
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24+
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+
# POSSIBILITY OF SUCH DAMAGE.
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
/* alloc.c -- Memory allocation without mmap.
2+
Copyright (C) 2012-2021 Free Software Foundation, Inc.
3+
Written by Ian Lance Taylor, Google.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are
7+
met:
8+
9+
(1) Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
(2) Redistributions in binary form must reproduce the above copyright
13+
notice, this list of conditions and the following disclaimer in
14+
the documentation and/or other materials provided with the
15+
distribution.
16+
17+
(3) The name of the author may not be used to
18+
endorse or promote products derived from this software without
19+
specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30+
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31+
POSSIBILITY OF SUCH DAMAGE. */
32+
33+
#include "config.h"
34+
35+
#include <errno.h>
36+
#include <stdlib.h>
37+
#include <sys/types.h>
38+
39+
#include "backtrace.hpp"
40+
#include "internal.hpp"
41+
42+
#include "../common/TracyAlloc.hpp"
43+
44+
namespace tracy
45+
{
46+
47+
/* Allocation routines to use on systems that do not support anonymous
48+
mmap. This implementation just uses malloc, which means that the
49+
backtrace functions may not be safely invoked from a signal
50+
handler. */
51+
52+
/* Allocate memory like malloc. If ERROR_CALLBACK is NULL, don't
53+
report an error. */
54+
55+
void *
56+
backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED,
57+
size_t size, backtrace_error_callback error_callback,
58+
void *data)
59+
{
60+
void *ret;
61+
62+
ret = tracy_malloc (size);
63+
if (ret == NULL)
64+
{
65+
if (error_callback)
66+
error_callback (data, "malloc", errno);
67+
}
68+
return ret;
69+
}
70+
71+
/* Free memory. */
72+
73+
void
74+
backtrace_free (struct backtrace_state *state ATTRIBUTE_UNUSED,
75+
void *p, size_t size ATTRIBUTE_UNUSED,
76+
backtrace_error_callback error_callback ATTRIBUTE_UNUSED,
77+
void *data ATTRIBUTE_UNUSED)
78+
{
79+
tracy_free (p);
80+
}
81+
82+
/* Grow VEC by SIZE bytes. */
83+
84+
void *
85+
backtrace_vector_grow (struct backtrace_state *state ATTRIBUTE_UNUSED,
86+
size_t size, backtrace_error_callback error_callback,
87+
void *data, struct backtrace_vector *vec)
88+
{
89+
void *ret;
90+
91+
if (size > vec->alc)
92+
{
93+
size_t alc;
94+
void *base;
95+
96+
if (vec->size == 0)
97+
alc = 32 * size;
98+
else if (vec->size >= 4096)
99+
alc = vec->size + 4096;
100+
else
101+
alc = 2 * vec->size;
102+
103+
if (alc < vec->size + size)
104+
alc = vec->size + size;
105+
106+
base = tracy_realloc (vec->base, alc);
107+
if (base == NULL)
108+
{
109+
error_callback (data, "realloc", errno);
110+
return NULL;
111+
}
112+
113+
vec->base = base;
114+
vec->alc = alc - vec->size;
115+
}
116+
117+
ret = (char *) vec->base + vec->size;
118+
vec->size += size;
119+
vec->alc -= size;
120+
return ret;
121+
}
122+
123+
/* Finish the current allocation on VEC. */
124+
125+
void *
126+
backtrace_vector_finish (struct backtrace_state *state,
127+
struct backtrace_vector *vec,
128+
backtrace_error_callback error_callback,
129+
void *data)
130+
{
131+
void *ret;
132+
133+
/* With this allocator we call realloc in backtrace_vector_grow,
134+
which means we can't easily reuse the memory here. So just
135+
release it. */
136+
if (!backtrace_vector_release (state, vec, error_callback, data))
137+
return NULL;
138+
ret = vec->base;
139+
vec->base = NULL;
140+
vec->size = 0;
141+
vec->alc = 0;
142+
return ret;
143+
}
144+
145+
/* Release any extra space allocated for VEC. */
146+
147+
int
148+
backtrace_vector_release (struct backtrace_state *state ATTRIBUTE_UNUSED,
149+
struct backtrace_vector *vec,
150+
backtrace_error_callback error_callback,
151+
void *data)
152+
{
153+
vec->alc = 0;
154+
155+
if (vec->size == 0)
156+
{
157+
/* As of C17, realloc with size 0 is marked as an obsolescent feature, use
158+
free instead. */
159+
tracy_free (vec->base);
160+
vec->base = NULL;
161+
return 1;
162+
}
163+
164+
vec->base = tracy_realloc (vec->base, vec->size);
165+
if (vec->base == NULL)
166+
{
167+
error_callback (data, "realloc", errno);
168+
return 0;
169+
}
170+
171+
return 1;
172+
}
173+
174+
}

0 commit comments

Comments
 (0)