Skip to content

Commit a160c09

Browse files
committed
Finished basic settings for deployment
1 parent 1ff791c commit a160c09

13 files changed

Lines changed: 72 additions & 88 deletions

File tree

‎.github/workflows/linux.yml‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build Linux
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-linux:
7+
runs-on: ubuntu latest
8+
9+
steps:
10+
- uses: action/checkout@v3
11+
- name: Install System Dependencies
12+
run: |
13+
sudo apt-get update
14+
sudo apt-get install build-essential cmake libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl1-mesa-dev
15+
- name: Configure CMake
16+
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
17+
- name: Build
18+
run: cmake --build build
19+
- name: Upload Linux Binary
20+
uses: actions/upload-artifact@v4
21+
with:
22+
name: complex-plotter-linux
23+
path: build/src/complex-plotter
24+

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.vs/
2+
.vscode/
23
out/
34
build/
45
CMakeSettings.json

‎CMakeLists.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ project ("complex-plotter")
55
set(CMAKE_CXX_STANDARD 20)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77

8+
if (MSVC)
9+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
10+
endif()
11+
12+
813
if (POLICY CMP0141)
914
cmake_policy(SET CMP0141 NEW)
1015
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")

‎CMakePresets.json‎

Lines changed: 0 additions & 61 deletions
This file was deleted.

‎dependencies/CMakeLists.txt‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
include(FetchContent)
22

3+
4+
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
5+
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
6+
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
7+
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
8+
39
FetchContent_Declare(
410
imgui
511
GIT_REPOSITORY https://github.com/ocornut/imgui

‎devlog.md‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
Unfortunately, it's time to do our laundry.
1+
We've got a usable UI, and the good stuff that comes necessary for any good math program, now!
22

3-
With 3D rendering complete, all of the essential features of the _plotter_ are done. This means that, had we wanted to, we could ship this as a fully-fledged math engine and leave the job of actually turning it into an application to someone else. But we can't be doing that! Therefore, it's time for us to start making way to shipping the project.
3+
First, let's get the developer stuff out of the way. Before, if we wanted to add a new function, we'd have to write code in 6 distinct spots, as discussed in [Issue #31](https://url.jam06452.uk/lputto), a consequence of my `#ifndef` clauses black magic. This, now, is all done in load time,making my life far easier.
44

5-
First of all, I wanted this plotter to be complete, meaning that it implements _every_ elementary function (those being, in simple terms, a set of well-behaved functions that mathematicians use). This is simply a manner of writing the already existing real and imaginary components of these functions (and their derivatives), which are well-known and defined.
6-
Is this essentially just writing boilerplate? Yes! Thankfully, this is not my first rodeo implementing these functions, so I could port a good amount of code from an old project. This is all done now: all elementary functions and their derivatives have been implemented!
5+
Now, for the math stuff. I'll make a rare use of bullet points, I:
6+
- Added every elementary function to our constant-folding simplification step.
7+
- Added some (one) utility function: the modulo (%) operator!
78

8-
Now, for the engine-specific things: so far we have been writing shaders into files and reading them at runtime. This works, but adds unnecesary file I/O operations, and makes it impossible to port our entire project as one .exe file. So we had to remove that!
9-
One way to do this would be by writing our GLSL code in strings, but this removes linting. Instead, I implemented a dynamic source string builder at build time.
10-
11-
Attached, the new functions!
9+
Our most important addition is, by far, **hovering** to show a function's value. All our functions are calculated on shaders, so we'd either have to hard code a C++ counterpart for ever GLSL function, or find a way to send data from the shader to the main program.
10+
The problem is, while it's easy to send data _to_ shaders (through `uniform` variables), it's quite difficult to do the opposite. And even if there was an easy way to do this, remember: our fragment shader runs for _every_ pixel, so they all would be sending data to the CPU at the same time, which would be far too expensive.
11+
Instead, what we do is create a 1x1 pixel shader, and send it a copy of our function, plus the mouse coordinates. It then shares a single `vec4` variable that stores both `z` (the input) and `f(z)` (the output). Voilá, we can _get_ things from the shader, now!
1212

13+
Drawing the grid is just some additional math in the fragment shader, and the UI changes are, well, UI.
1314

1415
**Related Commits**
16+
[Commit 1d123a6](https://url.jam06452.uk/e1qeij): Automated interpreter shader creation
17+
[Commit ba3f299](https://url.jam06452.uk/1n8chst): UI and constant folder overhaul
18+
[Commit 5893ae0](https://url.jam06452.uk/t2uooa): Inspector done!
19+
[Commit 1ff791c](https://url.jam06452.uk/1kc13d6): Added grid
1520

16-
[Commit 7923ee3](https://url.jam06452.uk/1vzsu0m): File conversion to strings at build-time
17-
[Commit 5ba94c0](https://url.jam06452.uk/7erthk): Complete removal of file reading logic
18-
[Commit 0a56357](https://url.jam06452.uk/1g1lfwm): Finished implementing elementary functions
19-
[Commit 48d08fc](https://url.jam06452.uk/15x1axn): Derivatives of elementary functions
2021

2122
**Related Issues**
22-
[Issue #30](https://url.jam06452.uk/fvwf6y): Switch from shader files to strings
23+
[Issue #31](https://url.jam06452.uk/lputto)
24+

‎docs/manim/test.py‎

Whitespace-only changes.

‎src/CMakeLists.txt‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ set(SHADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/shaders")
66
set(HEADER_BUILD "${CMAKE_CURRENT_BINARY_DIR}/shaders/embedded_shaders.h")
77
set(HEADER_SRC "${CMAKE_CURRENT_SOURCE_DIR}/shaders/embedded_shaders.h")
88

9+
if(WIN32)
10+
list(APPEND SOURCE_FILES "app.rc")
11+
endif()
12+
913
file(GLOB_RECURSE SHADER_FILES CONFIGURE_DEPENDS
1014
"${CMAKE_CURRENT_SOURCE_DIR}/shaders/*.vert"
1115
"${CMAKE_CURRENT_SOURCE_DIR}/shaders/*.frag"
@@ -27,7 +31,7 @@ add_custom_command(
2731
)
2832

2933

30-
add_executable(complex-plotter ${SOURCE_FILES} ${HEADER_SRC} "main.cpp")
34+
add_executable(complex-plotter WIN32 ${SOURCE_FILES} ${HEADER_SRC} "main.cpp")
3135
find_package(OpenGL REQUIRED)
3236

3337
target_link_libraries(complex-plotter PRIVATE
@@ -38,12 +42,15 @@ target_link_libraries(complex-plotter PRIVATE
3842
learnopengl
3943
imgui
4044
)
41-
add_custom_target(copy-additional-folders ALL
42-
COMMAND ${CMAKE_COMMAND} -E copy_directory
43-
"${CMAKE_CURRENT_SOURCE_DIR}/shaders"
44-
"${CMAKE_CURRENT_BINARY_DIR}/shaders"
45-
COMMENT "[Custom] Copying additional folders to build directory..."
46-
)
4745

48-
add_dependencies(complex-plotter copy-additional-folders)
46+
if(UNIX AND NOT APPLE)
47+
target_link_libraries(complex-plotter PRIVATE pthread dl)
48+
endif()
49+
50+
if(MSVC)
51+
set_target_properties(complex-plotter PROPERTIES LINK_FLAGS "/ENTRY:mainCRTStartup")
52+
endif()
53+
54+
55+
add_dependencies(complex-plotter)
4956
target_include_directories(complex-plotter PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ".")

‎src/app.aps‎

98.2 KB
Binary file not shown.

‎src/app.rc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
101 ICON "favicon.ico"

0 commit comments

Comments
 (0)