diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..60de0f2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 3.15) +project(Atoms VERSION 1.0 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# required packages +find_package(OpenGL REQUIRED) +find_package(GLEW REQUIRED) +find_package(glfw3 REQUIRED) +find_package(glm REQUIRED) + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +add_executable(atom_2d src/wave_atom_2d.cpp) +target_link_libraries(atom_2d + OpenGL::GL + GLEW::GLEW + glfw + glm::glm +) + +add_executable(atom_realtime src/atom_realtime.cpp) +target_link_libraries(atom_realtime + OpenGL::GL + GLEW::GLEW + glfw + glm::glm +) + +add_executable(atom_raytracer src/atom_raytracer.cpp) +target_link_libraries(atom_raytracer + OpenGL::GL + GLEW::GLEW + glfw + glm::glm +) + +add_executable(atom src/atom.cpp) +target_link_libraries(atom + OpenGL::GL + GLEW::GLEW + glfw + glm::glm +) + +message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}") +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +message(STATUS "Output directory: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") diff --git a/README.md b/README.md index 2fa653b..367ec26 100644 --- a/README.md +++ b/README.md @@ -42,15 +42,24 @@ What the model does: ### Alternative: Debian/Ubuntu apt workaround -If you don't want to use vcpkg, or you just need a quick way to install the native development packages on Debian/Ubuntu, install these packages and then run the normal CMake steps above: +If you don't want to use vcpkg, or you just need a quick way to install the native development packages on Debian/Ubuntu, install these packages and build: ```bash sudo apt update sudo apt install build-essential cmake \ libglew-dev libglfw3-dev libglm-dev libgl1-mesa-dev ``` +This provides the GLEW, GLFW, GLM and OpenGL libraries so `find_package(...)` calls in `CMakeLists.txt` can locate the libraries without vcpkg. + +Then run: +``` +cmake -B build -S . +cmake --build build + +# run executables (located in build/bin/) e.g.: +./build/bin/atom_realtime +``` -This provides the GLEW, GLFW, GLM and OpenGL development files so `find_package(...)` calls in `CMakeLists.txt` can locate the libraries. After installing, run the `cmake -B build -S .` and `cmake --build build` commands as shown in the Build Instructions. ## **How the code works:** the 2D bohr model works is in atom.cpp, the raytracer and realtime models are right beside