Fun little calculator that uses Thrift, Imgui, Glad, and SDL. This is basically an extended version of the C++ Thrift Calculator tutorial to gain a better understanding of how to use thrift with a GUI appilication.
The client in this case is the Calculator, using ImGui, GLAD, and SDL to create the required buttons, window, etc. The server side does all the calculations.
When the =
is pushed, a call is made to the server to calculate the chosen numbers. The Server
and Client
are their own separate programs.
The server must be running in order to get the client to work.
The calculator is only a simple calculator and is only to demonstrate the client-server relationship using thrift. It can definitely be extended to add more functionalities, etc.
- GLAD
- ImGui
- SDL
- Thrift Libraries and Compiler
If you have vcpkg you can install the required thirft libraries with the following from the CMD LINE:
vcpkg install thrift:x64-windows
Or you can build them from source: Thrift Source
- You can get the thrift compiler from here: Thrift Download
- The thrift compiler will have the version in the name, I recommend renaming the file to
thrift.exe
for simplicity. - Once you have the
thrift.exe
, put in in a good location likeC:\thrift\thrift.exe
- Then you are going to want to set the path as a system variable so you can call thrift from any CMD Line
- If the path is not set, in Visual Studio the
Custom Build Tool
for the thrift files will have to be changed to accommodate where your thrift compiler is located. - Go to the properties of the
calculator.thrift
file and adjust the command line arguments to use the path where your thrift compiler is located
You can change the CMD Line arguments to something like below:
C:\thrift\thrift.exe -gen cpp -o . $(ProjectDir)thrift\%(Filename)%(Extension)
-- Use your filepath for thrift.
- Once the above requirements have been set, you should be able to build the VS sln.
- If everything builds successfully, go to the build folder and run the
Server.exe
. If the server is not running when trying to run the Client Calculator, the client will fail to run. - Once the server is running, you can now locally run the visual studio solution and use the calculator.