Skip to content

Commit cb1cd90

Browse files
committed
Reset repo
0 parents  commit cb1cd90

File tree

7,302 files changed

+2782195
-0
lines changed

Some content is hidden

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

7,302 files changed

+2782195
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
third_party/** linguist-vendored
2+
cache/IBL/*.tex filter=lfs diff=lfs merge=lfs -text

.github/workflows/cmake_linux.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CMake Linux
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
env:
10+
BUILD_TYPE: Release
11+
12+
jobs:
13+
build_linux:
14+
name: build_linux
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: true
21+
22+
- name: Install OpenGL Library
23+
run: sudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev libglfw3 libglfw3-dev
24+
25+
- name: Configure CMake
26+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
27+
28+
- name: Build
29+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

.github/workflows/cmake_macos.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CMake MacOS
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
env:
10+
BUILD_TYPE: Release
11+
12+
jobs:
13+
build_macOS:
14+
name: build_macOS
15+
runs-on: macos-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: true
21+
22+
- name: Configure CMake
23+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
24+
25+
- name: Build
26+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

.github/workflows/cmake_windows.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CMake Windows
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
env:
10+
BUILD_TYPE: Release
11+
12+
jobs:
13+
build_windows:
14+
name: build_windows
15+
runs-on: windows-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
submodules: true
21+
22+
- name: Configure CMake
23+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
24+
25+
- name: Build
26+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
.idea/
3+
.vs/
4+
bin/
5+
out/
6+
build/
7+
cmake-build-*/
8+
CMakeSettings.json

CMakeLists.txt

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
project(SoftGLRender)
3+
4+
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
5+
set(CMAKE_CXX_STANDARD 11)
6+
7+
set(TARGET_NAME SoftGLRender)
8+
set(THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party")
9+
10+
# enable SIMD
11+
add_definitions("-DSOFTGL_SIMD_OPT")
12+
13+
# debug
14+
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
15+
add_definitions("-DDEBUG")
16+
endif ()
17+
18+
find_program(CCACHE "ccache")
19+
if (CCACHE)
20+
Message(STATUS "find ccache")
21+
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
22+
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
23+
endif (CCACHE)
24+
25+
include_directories(
26+
"${THIRD_PARTY_DIR}/glfw/include"
27+
"${THIRD_PARTY_DIR}/glad/include"
28+
"${THIRD_PARTY_DIR}/glm"
29+
"${THIRD_PARTY_DIR}/assimp/include"
30+
"${THIRD_PARTY_DIR}/assimp/contrib"
31+
"${CMAKE_CURRENT_BINARY_DIR}/third_party/assimp/include"
32+
"${THIRD_PARTY_DIR}/imgui"
33+
"${THIRD_PARTY_DIR}/json11"
34+
"${THIRD_PARTY_DIR}/md5"
35+
"${THIRD_PARTY_DIR}/stb/include"
36+
"${THIRD_PARTY_DIR}/vulkan/include"
37+
"${THIRD_PARTY_DIR}/glslang"
38+
"${THIRD_PARTY_DIR}/vma"
39+
"${CMAKE_CURRENT_SOURCE_DIR}/src"
40+
)
41+
42+
# assimp
43+
set(BUILD_SHARED_LIBS OFF)
44+
set(ASSIMP_NO_EXPORT ON)
45+
set(ASSIMP_BUILD_TESTS OFF)
46+
set(ASSIMP_INSTALL OFF)
47+
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF)
48+
set(ASSIMP_BUILD_ZLIB ON)
49+
50+
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT FALSE)
51+
set(ASSIMP_BUILD_OBJ_IMPORTER TRUE)
52+
set(ASSIMP_BUILD_GLTF_IMPORTER TRUE)
53+
54+
add_subdirectory(${THIRD_PARTY_DIR}/assimp)
55+
56+
57+
# glslang
58+
set(SKIP_GLSLANG_INSTALL ON)
59+
set(ENABLE_SPVREMAPPER OFF)
60+
set(ENABLE_GLSLANG_BINARIES OFF)
61+
set(ENABLE_CTEST OFF)
62+
set(BUILD_TESTING OFF)
63+
set(USE_CCACHE ON)
64+
add_subdirectory("${THIRD_PARTY_DIR}/glslang")
65+
66+
# main src
67+
file(GLOB SOFTGL_SRC
68+
${CMAKE_CURRENT_SOURCE_DIR}/src/Base/*.cpp
69+
${CMAKE_CURRENT_SOURCE_DIR}/src/Render/*.cpp
70+
${CMAKE_CURRENT_SOURCE_DIR}/src/Render/Software/*.cpp
71+
${CMAKE_CURRENT_SOURCE_DIR}/src/Render/OpenGL/*.cpp
72+
${CMAKE_CURRENT_SOURCE_DIR}/src/Render/Vulkan/*.cpp
73+
${CMAKE_CURRENT_SOURCE_DIR}/src/Render/Vulkan/SPIRV/*.cpp
74+
${CMAKE_CURRENT_SOURCE_DIR}/src/Viewer/*.cpp
75+
${CMAKE_CURRENT_SOURCE_DIR}/src/Viewer/Shader/GLSL/*.cpp
76+
${CMAKE_CURRENT_SOURCE_DIR}/src/Viewer/Shader/Software/*.cpp
77+
)
78+
79+
# imgui src
80+
file(GLOB IMGUI_SRC
81+
${THIRD_PARTY_DIR}/imgui/imgui/*.cpp
82+
)
83+
84+
add_executable(${TARGET_NAME}
85+
"${SOFTGL_SRC}"
86+
"${IMGUI_SRC}"
87+
"${THIRD_PARTY_DIR}/glad/src/glad.c"
88+
"${THIRD_PARTY_DIR}/json11/json11.cpp"
89+
"${THIRD_PARTY_DIR}/md5/md5.c"
90+
)
91+
92+
set(LINK_LIBS
93+
assimp
94+
glslang
95+
glslang-default-resource-limits
96+
SPIRV
97+
)
98+
99+
if (WIN32)
100+
set(LINK_LIBS ${LINK_LIBS}
101+
"${THIRD_PARTY_DIR}/vulkan/lib-win-x64/vulkan-1.lib"
102+
)
103+
if (MSVC)
104+
set(LINK_LIBS ${LINK_LIBS}
105+
"${THIRD_PARTY_DIR}/glfw/lib-vc2022/glfw3.lib"
106+
"${THIRD_PARTY_DIR}/glfw/lib-vc2022/glfw3dll.lib"
107+
)
108+
else ()
109+
set(LINK_LIBS ${LINK_LIBS}
110+
"${THIRD_PARTY_DIR}/glfw/lib-mingw-w64/libglfw3.a"
111+
"${THIRD_PARTY_DIR}/glfw/lib-mingw-w64/libglfw3dll.a"
112+
)
113+
endif ()
114+
endif ()
115+
116+
if (APPLE)
117+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework Cocoa -framework OpenGL -framework IOKit")
118+
add_compile_definitions(GL_SILENCE_DEPRECATION)
119+
set(LINK_LIBS ${LINK_LIBS}
120+
"${THIRD_PARTY_DIR}/vulkan/lib-macos-universal/libvulkan.1.dylib"
121+
"${THIRD_PARTY_DIR}/glfw/lib-macos-universal/libglfw3.a"
122+
)
123+
endif ()
124+
125+
if (UNIX AND NOT APPLE)
126+
find_package(OpenGL REQUIRED)
127+
set(LINK_LIBS ${LINK_LIBS}
128+
pthread
129+
glfw
130+
OpenGL::GL
131+
"${THIRD_PARTY_DIR}/vulkan/lib-linux-x64/libvulkan.so.1"
132+
${CMAKE_DL_LIBS}
133+
)
134+
endif ()
135+
136+
if (MSVC)
137+
target_compile_options(${TARGET_NAME} PRIVATE $<$<BOOL:${MSVC}>:/arch:AVX2 /std:c++11>)
138+
else ()
139+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma -O3")
140+
endif ()
141+
142+
target_link_libraries(${TARGET_NAME} ${LINK_LIBS})
143+
144+
# output dir
145+
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
146+
147+
# copy assets
148+
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
149+
COMMAND ${CMAKE_COMMAND} -E copy_directory
150+
${CMAKE_CURRENT_SOURCE_DIR}/assets $<TARGET_FILE_DIR:${TARGET_NAME}>/assets
151+
152+
COMMAND ${CMAKE_COMMAND} -E copy_directory
153+
${CMAKE_CURRENT_SOURCE_DIR}/src/Viewer/Shader/GLSL $<TARGET_FILE_DIR:${TARGET_NAME}>/shaders/GLSL
154+
155+
COMMAND ${CMAKE_COMMAND} -E copy_directory
156+
${CMAKE_CURRENT_SOURCE_DIR}/cache $<TARGET_FILE_DIR:${TARGET_NAME}>/cache
157+
)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 keith2018
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)