diff options
author | Adrian Kummerlaender | 2018-10-10 22:46:12 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2018-10-10 22:46:12 +0200 |
commit | e720bbf4ead889a607a11513c4a64cc3ccb3e691 (patch) | |
tree | 3937d2b92e3b06c00dcd183cd71fdba65a9017e5 | |
parent | b4a61621fc1d2d6350c8f700ee3196950e476000 (diff) | |
download | boltzbub-e720bbf4ead889a607a11513c4a64cc3ccb3e691.tar boltzbub-e720bbf4ead889a607a11513c4a64cc3ccb3e691.tar.gz boltzbub-e720bbf4ead889a607a11513c4a64cc3ccb3e691.tar.bz2 boltzbub-e720bbf4ead889a607a11513c4a64cc3ccb3e691.tar.lz boltzbub-e720bbf4ead889a607a11513c4a64cc3ccb3e691.tar.xz boltzbub-e720bbf4ead889a607a11513c4a64cc3ccb3e691.tar.zst boltzbub-e720bbf4ead889a607a11513c4a64cc3ccb3e691.zip |
Improve build instructions
-rw-r--r-- | CMakeLists.txt | 43 | ||||
-rw-r--r-- | shell.nix | 4 | ||||
-rw-r--r-- | src/fluid_buffer.cc | 4 | ||||
-rw-r--r-- | src/fluid_buffer.h | 3 |
4 files changed, 37 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e5cbd03..29ad827 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,31 +1,48 @@ cmake_minimum_required(VERSION 3.10) -project(boltzbub) +project(boltzbub LANGUAGES CXX) -set( - CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -std=c++1z -W -Wall -Wextra -Winline -pedantic" +add_library( + boltzbub + src/lbm.cc + src/fluid_buffer.cc + src/boundary_conditions.cc ) -include_directories( - src/ +target_compile_features( + boltzbub + PUBLIC + cxx_std_17 ) -set( - BASE - src/lbm.cc - src/fluid_buffer.cc - src/boundary_conditions.cc +target_include_directories( + boltzbub + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/src +) + +target_link_libraries( + boltzbub + PRIVATE + stdc++fs ) add_executable( cavity2d cavity2d.cc - ${BASE} +) + +target_link_libraries( + cavity2d + boltzbub ) add_executable( cavity2d_with_obstacles cavity2d_with_obstacles.cc - ${BASE} src/box_obstacle.cc ) + +target_link_libraries( + cavity2d_with_obstacles + boltzbub +) @@ -1,12 +1,12 @@ with import <nixpkgs> {}; -stdenv.mkDerivation rec { +stdenvNoCC.mkDerivation rec { name = "boltzbub-env"; env = buildEnv { name = name; paths = buildInputs; }; buildInputs = [ git - gcc + gcc8 cmake ]; diff --git a/src/fluid_buffer.cc b/src/fluid_buffer.cc index 1f40d2f..9291fdd 100644 --- a/src/fluid_buffer.cc +++ b/src/fluid_buffer.cc @@ -32,7 +32,9 @@ Velocity& FluidBuffer::velocity(Vector<std::size_t> pos) { return velocity(pos[0], pos[1]); } -void FluidBuffer::writeAsVTK(const std::string& path) { +void FluidBuffer::writeAsVTK(const std::filesystem::path& path) { + std::filesystem::create_directories(path.parent_path()); + std::ofstream fout; fout.open(path.c_str()); diff --git a/src/fluid_buffer.h b/src/fluid_buffer.h index 72518bb..b0e0936 100644 --- a/src/fluid_buffer.h +++ b/src/fluid_buffer.h @@ -2,6 +2,7 @@ #include <memory> #include <string> +#include <filesystem> #include "vector.h" @@ -28,5 +29,5 @@ public: Velocity& velocity(std::size_t x, std::size_t y); Velocity& velocity(Vector<std::size_t> pos); - void writeAsVTK(const std::string& path); + void writeAsVTK(const std::filesystem::path& path); }; |