Skip to content

Commit 9bdbbf2

Browse files
committed
Merge branch 'angle-meld'
2 parents 8fb2045 + c3860c9 commit 9bdbbf2

Some content is hidden

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

59 files changed

+16223
-15336
lines changed

.github/workflows/main.yml

Lines changed: 67 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,70 @@
11
name: Build DLL
2-
on: push
2+
on: push
33
jobs:
44
build_dll:
5-
runs-on: windows-latest
6-
steps:
7-
- name: Checkout
8-
uses: actions/checkout@v2
9-
with:
10-
submodules: 'recursive'
11-
- name: run-vcpkg
12-
uses: lukka/[email protected]
13-
with:
14-
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
15-
vcpkgArguments: '@${{ github.workspace }}/vcpkg.txt'
16-
cleanAfterBuild: false
17-
- name: Setup MSBuild
18-
uses: microsoft/setup-msbuild@v1
19-
- name: Check dependencies
20-
run: 'ls ${{ github.workspace }}/vcpkg/installed/x86-windows-static'
21-
- name: Build DLL
22-
run: 'msbuild SimpleGraphic.vcxproj /p:configuration=release /p:platform=win32'
23-
- name: Archive DLL
24-
uses: actions/[email protected]
25-
with:
26-
name: SimpleGraphic.dll
27-
path: '${{ github.workspace }}/Release/SimpleGraphic.dll'
5+
strategy:
6+
matrix:
7+
include:
8+
- platform: x64
9+
os: windows-latest
10+
triplet: x64-windows
11+
runs-on: ${{ matrix.os }}
12+
env:
13+
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
14+
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed/
15+
DEPS_DIR: ${{ github.workspace }}/vcpkg_installed/${{ matrix.triplet }}
16+
INST_DIR: ${{ github.workspace }}/install-prefix
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
with:
21+
submodules: "recursive"
22+
23+
- name: run-vcpkg
24+
uses: lukka/run-vcpkg@v10
25+
with:
26+
vcpkgJsonGlob: "./vcpkg.json"
27+
runVcpkgInstall: true
28+
29+
- name: Setup MSBuild
30+
uses: microsoft/setup-msbuild@v1
31+
32+
- name: Obtain and run CMake
33+
uses: threeal/[email protected]
34+
with:
35+
source-dir: "."
36+
build-dir: "build"
37+
generator: "Visual Studio 17 2022"
38+
options: CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake CMAKE_INSTALL_PREFIX="${{ env.INST_DIR }}"
39+
40+
- name: Build DLL
41+
run: "cmake --build build --config Release -t INSTALL"
42+
43+
- name: Archive DLL
44+
uses: actions/upload-artifact@v3
45+
with:
46+
name: SimpleGraphic-${{ matrix.triplet }}.dll
47+
path: "${{ env.INST_DIR }}/SimpleGraphic.dll"
48+
49+
- name: Archive DLL symbols
50+
uses: actions/upload-artifact@v3
51+
with:
52+
name: SimpleGraphic-${{ matrix.triplet }}.pdb
53+
path: "${{ github.workspace }}/build/Release/SimpleGraphic.pdb"
54+
55+
- name: Archive dependency DLLs
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: SimpleGraphic-${{ matrix.triplet }}-deps.dll
59+
path: |
60+
${{ env.INST_DIR }}/*.dll
61+
!${{ env.INST_DIR }}/SimpleGraphic.dll
62+
63+
- name: Archive dependency DLL symbols
64+
uses: actions/upload-artifact@v3
65+
with:
66+
name: SimpleGraphic-${{ matrix.triplet }}-deps.pdb
67+
path: |
68+
${{ env.DEPS_DIR }}/bin/*.pdb
69+
${{ github.workspace }}/build/Release/lzip.pdb
70+
${{ github.workspace }}/build/Release/lcurl.pdb

.gitignore

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
/build/
2-
/dependencies/detect_compiler_x86-windows-static
3-
/dependencies/giflib_x86-windows-static
4-
/dependencies/libjpeg-turbo_x86-windows-static
5-
/dependencies/liblzma_x86-windows-static
6-
/dependencies/libpng_x86-windows-static
7-
/dependencies/luajit_x86-windows-static
8-
/dependencies/tiff_x86-windows-static
9-
/dependencies/zlib_x86-windows-static
10-
.vs
11-
/Debug/
12-
/Release/
13-
/SimpleGraphic.vcxproj.user
1+
/build/

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
[submodule "vcpkg"]
22
path = vcpkg
33
url = https://github.com/microsoft/vcpkg
4+
[submodule "libs/Lua-cURLv3"]
5+
path = libs/Lua-cURLv3
6+
url = https://github.com/Lua-cURL/Lua-cURLv3.git
7+
[submodule "dep/imgui"]
8+
path = dep/imgui
9+
url = https://github.com/ocornut/imgui.git

CMakeLists.txt

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
project(SimpleGraphic C CXX)
3+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
4+
set(CMAKE_CXX_STANDARD 17)
5+
6+
if (APPLE)
7+
enable_language(OBJCXX)
8+
endif ()
9+
10+
if (MSVC)
11+
add_compile_options("/Zi")
12+
add_link_options("/DEBUG:FULL")
13+
endif ()
14+
15+
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
16+
17+
include(${PROJECT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)
18+
19+
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".")
20+
include(InstallRequiredSystemLibraries)
21+
22+
set(SIMPLEGRAPHIC_SOURCES
23+
"config.h"
24+
"dep/stb/stb_image.h"
25+
"dep/stb/stb_image_write.h"
26+
"engine/common/common.cpp"
27+
"engine/common/console.cpp"
28+
"engine/common/console.h"
29+
"engine/common/keylist.h"
30+
"engine/common/memtrak3.cpp"
31+
"engine/common/memtrak3.h"
32+
"engine/common/streams.cpp"
33+
"engine/common/streams.h"
34+
"engine/core/core_config.cpp"
35+
"engine/core/core_config.h"
36+
"engine/core/core_image.cpp"
37+
"engine/core/core_image.h"
38+
"engine/core/core_main.cpp"
39+
"engine/core/core_main.h"
40+
"engine/core/core_video.cpp"
41+
"engine/core/core_video.h"
42+
"engine/render/r_font.cpp"
43+
"engine/render/r_font.h"
44+
"engine/render/r_main.cpp"
45+
"engine/render/r_main.h"
46+
"engine/render/r_texture.cpp"
47+
"engine/render/r_texture.h"
48+
# "engine/system/win/sys_console.cpp"
49+
"engine/system/win/sys_console_unix.cpp"
50+
"engine/system/win/sys_local.h"
51+
"engine/system/win/sys_main.cpp"
52+
"engine/system/win/sys_opengl.cpp"
53+
"engine/system/win/sys_video.cpp"
54+
"engine/system/sys_console.h"
55+
"engine/system/sys_main.h"
56+
"engine/system/sys_opengl.h"
57+
"engine/system/sys_video.h"
58+
"win/entry.cpp"
59+
"ui.h"
60+
"ui_api.cpp"
61+
"ui_console.cpp"
62+
"ui_console.h"
63+
"ui_debug.cpp"
64+
"ui_debug.h"
65+
"ui_local.h"
66+
"ui_main.cpp"
67+
"ui_main.h"
68+
"ui_subscript.cpp"
69+
"ui_subscript.h"
70+
)
71+
72+
set (SIMPLEGRAPHIC_PLATFORM_SOURCES)
73+
if (APPLE)
74+
set (SIMPLEGRAPHIC_PLATFORM_SOURCES
75+
"engine/system/win/sys_macos.mm"
76+
)
77+
endif()
78+
79+
add_library(SimpleGraphic SHARED
80+
${SIMPLEGRAPHIC_SOURCES}
81+
${SIMPLEGRAPHIC_PLATFORM_SOURCES}
82+
)
83+
target_compile_definitions(SimpleGraphic
84+
PRIVATE
85+
"UNICODE"
86+
"_CRT_SECURE_NO_DEPRECATE"
87+
"_CRT_SECURE_NO_WARNINGS"
88+
"_SCL_SECURE_NO_DEPRECATE"
89+
"_SCL_SECURE_NO_WARNINGS"
90+
"GLFW_INCLUDE_NONE"
91+
"GL_SILENCE_DEPRECATION"
92+
"SIMPLEGRAPHIC_EXPORTS"
93+
)
94+
95+
target_include_directories(SimpleGraphic
96+
PUBLIC
97+
"${CMAKE_CURRENT_SOURCE_DIR}"
98+
"${CMAKE_CURRENT_SOURCE_DIR}/engine"
99+
)
100+
101+
find_package(unofficial-angle CONFIG REQUIRED)
102+
find_package(CURL CONFIG REQUIRED)
103+
find_package(fmt CONFIG REQUIRED)
104+
find_package(glfw3 CONFIG REQUIRED)
105+
find_package(LuaJit REQUIRED)
106+
find_package(re2 CONFIG REQUIRED)
107+
find_package(unofficial-sodium CONFIG REQUIRED)
108+
find_package(Threads REQUIRED)
109+
find_package(ZLIB REQUIRED)
110+
111+
add_library(imgui STATIC
112+
dep/imgui/imconfig.h
113+
dep/imgui/imgui.cpp
114+
dep/imgui/imgui.h
115+
dep/imgui/imgui_demo.cpp
116+
dep/imgui/imgui_draw.cpp
117+
dep/imgui/imgui_internal.h
118+
dep/imgui/imgui_tables.cpp
119+
dep/imgui/imgui_widgets.cpp
120+
dep/imgui/imstb_rectpack.h
121+
dep/imgui/imstb_textedit.h
122+
dep/imgui/imstb_truetype.h
123+
dep/imgui/backends/imgui_impl_glfw.cpp
124+
dep/imgui/backends/imgui_impl_glfw.h
125+
dep/imgui/backends/imgui_impl_opengl3.cpp
126+
dep/imgui/backends/imgui_impl_opengl3.h
127+
dep/imgui/backends/imgui_impl_opengl3_loader.h
128+
dep/imgui/misc/cpp/imgui_stdlib.cpp
129+
dep/imgui/misc/cpp/imgui_stdlib.h
130+
)
131+
132+
target_compile_definitions(imgui PUBLIC
133+
"IMGUI_IMPL_OPENGL_ES2"
134+
)
135+
136+
target_include_directories(imgui PUBLIC
137+
dep/imgui
138+
dep/imgui/backends
139+
)
140+
141+
target_link_libraries(imgui PUBLIC
142+
unofficial::angle::libGLESv2
143+
glfw
144+
)
145+
146+
target_include_directories(SimpleGraphic
147+
PRIVATE
148+
${CMAKE_CURRENT_SOURCE_DIR}/dep/glad/include
149+
${CMAKE_CURRENT_SOURCE_DIR}/dep/stb
150+
${JPEG_INCLUDE_DIR}
151+
${LUAJIT_INCLUDE_DIR}
152+
)
153+
154+
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
155+
target_link_options(SimpleGraphic
156+
PRIVATE
157+
"-export-dynamic"
158+
)
159+
endif ()
160+
161+
if (WIN32)
162+
target_link_libraries(SimpleGraphic
163+
PRIVATE
164+
"winmm.lib"
165+
)
166+
endif ()
167+
168+
if (APPLE)
169+
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
170+
find_library(APPLICATION_SERVICES_LIBRARY ApplicationServices)
171+
target_link_libraries(SimpleGraphic
172+
PRIVATE
173+
${CORE_FOUNDATION_LIBRARY}
174+
${APPLICATION_SERVICES_LIBRARY}
175+
)
176+
endif ()
177+
178+
target_link_libraries(SimpleGraphic
179+
PRIVATE
180+
unofficial::angle::libEGL
181+
unofficial::angle::libGLESv2
182+
fmt::fmt
183+
glfw
184+
imgui
185+
${LUAJIT_LIBRARIES}
186+
re2::re2
187+
unofficial-sodium::sodium
188+
Threads::Threads
189+
ZLIB::ZLIB
190+
)
191+
192+
install(FILES $<TARGET_RUNTIME_DLLS:SimpleGraphic> DESTINATION ".")
193+
install(TARGETS SimpleGraphic RUNTIME DESTINATION ".")
194+
195+
if (WIN32)
196+
if (DEFINED ENV{DEPS_DIR})
197+
set(DEPS_BIN_DIR ${DEPS_DIR}/bin)
198+
else ()
199+
set(DEPS_BIN_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin")
200+
endif ()
201+
find_file(LUAJIT_DLL NAMES "lua51.dll" PATHS "${DEPS_BIN_DIR}" REQUIRED)
202+
find_file(ZLIB_DLL NAMES "zlib1.dll" PATHS "${DEPS_BIN_DIR}" REQUIRED)
203+
install(FILES ${LUAJIT_DLL} ${ZLIB_DLL} DESTINATION ".")
204+
endif ()
205+
206+
207+
# lcurl module
208+
209+
set(LCURL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libs/Lua-cURLv3)
210+
file(GLOB LCURL_SOURCES ${LCURL_SOURCE_DIR}/src/**.c)
211+
add_library(lcurl SHARED ${LCURL_SOURCES})
212+
213+
target_include_directories(lcurl
214+
PRIVATE
215+
${LCURL_SOURCE_DIR}/src
216+
${LUAJIT_INCLUDE_DIR}
217+
)
218+
219+
target_link_libraries(lcurl
220+
PRIVATE
221+
CURL::libcurl
222+
${LUAJIT_LIBRARIES}
223+
)
224+
225+
install(TARGETS lcurl RUNTIME DESTINATION ".")
226+
install(FILES $<TARGET_RUNTIME_DLLS:lcurl> DESTINATION ".")
227+
228+
229+
# lzip module
230+
231+
add_library(lzip SHARED libs/LZip/lzip.cpp)
232+
233+
target_include_directories(lzip
234+
PRIVATE
235+
${LUAJIT_INCLUDE_DIR}
236+
)
237+
238+
target_link_libraries(lzip
239+
PRIVATE
240+
${LUAJIT_LIBRARIES}
241+
ZLIB::ZLIB
242+
)
243+
244+
install(TARGETS lzip RUNTIME DESTINATION ".")
245+
install(FILES $<TARGET_RUNTIME_DLLS:lzip> DESTINATION ".")

0 commit comments

Comments
 (0)