-
Notifications
You must be signed in to change notification settings - Fork 33
Add building and container recipes #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| build |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| cmake_minimum_required(VERSION 3.16) | ||
| project(cmake_exercise) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Find Boost libraries | ||
| find_package(Boost REQUIRED COMPONENTS filesystem) | ||
|
|
||
| # Find deal.II | ||
| find_package(deal.II REQUIRED) | ||
|
|
||
| # Find yaml-cpp | ||
| find_package(yaml-cpp REQUIRED) | ||
|
|
||
| # deal.II setup macro | ||
| DEAL_II_INITIALIZE_CACHED_VARIABLES() | ||
|
|
||
| add_executable(main | ||
| main.cpp | ||
| flatset/flatset.cpp | ||
| filesystem/filesystem.cpp | ||
| fem/fem.cpp | ||
| yamlParser/yamlParser.cpp | ||
| ) | ||
|
|
||
| # deal.II setup macro for target | ||
| DEAL_II_SETUP_TARGET(main) | ||
|
|
||
| target_link_libraries(main | ||
| Boost::filesystem | ||
| yaml-cpp | ||
| ) | ||
|
|
||
| target_include_directories(main PRIVATE | ||
| ${CMAKE_CURRENT_SOURCE_DIR} | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| # Install dependencies | ||
| RUN rm -rf /var/lib/apt/lists/* \ | ||
| && apt-get update --fix-missing \ | ||
| && apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| cmake \ | ||
| wget \ | ||
| unzip \ | ||
| vim \ | ||
| libboost-all-dev \ | ||
| libdeal.ii-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Build and install yaml-cpp v0.6.3 from source | ||
| RUN wget --no-check-certificate https://github.com/jbeder/yaml-cpp/archive/refs/tags/yaml-cpp-0.6.3.tar.gz \ | ||
| && tar -xzf yaml-cpp-0.6.3.tar.gz \ | ||
| && cd yaml-cpp-yaml-cpp-0.6.3 \ | ||
| && mkdir build \ | ||
| && cd build \ | ||
| && cmake -DCMAKE_BUILD_TYPE=Release .. \ | ||
| && make \ | ||
| && make install \ | ||
| && cd ../.. \ | ||
| && rm -rf yaml-cpp-yaml-cpp-0.6.3 yaml-cpp-0.6.3.tar.gz | ||
|
|
||
|
|
||
| # Set LD_LIBRARY_PATH to include /usr/local/lib for yaml-cpp | ||
| ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, |
||
|
|
||
| WORKDIR /workdir | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is a |
||
|
|
||
| CMD ["/bin/bash"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,40 @@ | ||
| //#include "fem/fem.hpp" | ||
| //#include "flatset/flatset.hpp" | ||
| //#include "filesystem/filesystem.hpp" | ||
| //#include "yamlParser/yamlParser.hpp" | ||
| #include "fem/fem.hpp" | ||
| #include "flatset/flatset.hpp" | ||
| #include "filesystem/filesystem.hpp" | ||
| #include "yamlParser/yamlParser.hpp" | ||
| #include <iostream> | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| std::cout << "Let's fight with CMake, Docker, and some dependencies!" << std::endl << std::endl; | ||
|
|
||
| //std::cout << "Solve Poisson problem with FEM using deal.II" << std::endl; | ||
| //Fem fem; | ||
| //fem.run(); | ||
| //std::cout << std::endl; | ||
| std::cout << "Solve Poisson problem with FEM using deal.II" << std::endl; | ||
| Fem fem; | ||
| fem.run(); | ||
| std::cout << std::endl; | ||
|
|
||
| //std::cout << "Modify a flat set using boost container" << std::endl; | ||
| //modifyAndPrintSets(); | ||
| //std::cout << std::endl; | ||
| std::cout << "Modify a flat set using boost container" << std::endl; | ||
| modifyAndPrintSets(); | ||
| std::cout << std::endl; | ||
|
|
||
| //std::cout << "Inspect the current directory using boost filesystem" << std::endl; | ||
| //inspectDirectory(); | ||
| //std::cout << std::endl; | ||
| std::cout << "Inspect the current directory using boost filesystem" << std::endl; | ||
| inspectDirectory(); | ||
| std::cout << std::endl; | ||
|
|
||
|
|
||
| //if ( argc == 2 ) | ||
| //{ | ||
| // const std::string yamlFile( argv[1] ); | ||
| // std::cout << "Parse some yaml file with yaml-cpp" << std::endl; | ||
| // std::cout << " " << yamlFile << std::endl; | ||
| // parseConfig( yamlFile ); | ||
| //} | ||
| //else | ||
| //{ | ||
| // std::cout << "To parse a yaml file please specify file on command line" << std::endl; | ||
| // std::cout << " ./main YAMLFILE" << std::endl; | ||
| //} | ||
| if ( argc == 2 ) | ||
| { | ||
| const std::string yamlFile( argv[1] ); | ||
| std::cout << "Parse some yaml file with yaml-cpp" << std::endl; | ||
| std::cout << " " << yamlFile << std::endl; | ||
| parseConfig( yamlFile ); | ||
| } | ||
| else | ||
| { | ||
| std::cout << "To parse a yaml file please specify file on command line" << std::endl; | ||
| std::cout << " ./main YAMLFILE" << std::endl; | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, in CMake, lowercase and uppercase are equivalent.