Skip to content

agile8118/prime-generator-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prime Generator CPP

A prime generation application written in C++ featured in the Multi-Threading section of the Understanding Node.js: Core Concepts course. This code is then used in this Node.js project as a native addon. The reason for doing this is to gain a significant performance boost in our Node.js application, and also to see Node.js Addons and native multi-threading in Node.js in action.

Getting Started

To get the project up and running after cloning the repository, follow these steps (instructions only for unix-based machines):

1. Download and Compile GMP

GMP is used to be able to generate arbitrarily large prime numbers. Run the following script to download and compile the GMP library:

./gmp.sh

This script will:

  • Download GMP version 6.3.0
  • Extract the source code to the deps/GMP directory
  • Configure and compile GMP with C++ support

2. Setup CMake

After GMP is set up, configure CMake by running:

./cmake.sh

This script will:

  • Create a build directory if it doesn't exist
  • Run CMake to generate the necessary build files

3. Compile and Run the Application

Finally, compile the code and run the application with:

./run.sh

This script will:

  • Compile the code in the build directory
  • Execute the prime_generator application

Notes

Ensure that your machine is properly setup for C++ development. The gmp.sh script takes care of GMP, but you need to have other tools like CMake and Make installed as well. Running sudo apt install m4 cmake autoconf automake libtool on Linux should get all these tools installed.

Unable to Build & Link GMP

On Linux, the ./gmp.sh file may not be able to properly setup the library. If that's the case, install GMP like this:

sudo apt install libgmp-dev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published