diff --git a/homework4/.gitignore b/homework4/.gitignore index cf28b91..da825a4 100644 --- a/homework4/.gitignore +++ b/homework4/.gitignore @@ -1,8 +1,7 @@ # Folder: # cmake-build-debug/ googletest/ html/ # Files: # -.idea/ -CMakeLists.txt \ No newline at end of file +.idea/ \ No newline at end of file diff --git a/homework4/CMakeLists.txt b/homework4/CMakeLists.txt new file mode 100644 index 0000000..197884a --- /dev/null +++ b/homework4/CMakeLists.txt @@ -0,0 +1,109 @@ +cmake_minimum_required (VERSION 3.1) +project (Particles) +cmake_policy(VERSION 3.3) + +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") + +################################################################ +# libpart +################################################################ + +add_library(part SHARED + compute_boundary.cc + compute_verlet_integration.cc + particle.cc + planet.cc + compute_gravity.cc + csv_reader.cc + particles_factory_interface.cc + planets_factory.cc + compute_contact.cc + compute_kinetic_energy.cc + csv_writer.cc + system.cc + compute_energy.cc + compute_potential_energy.cc + ping_pong_ball.cc + material_point.cc + system_evolution.cc + ping_pong_balls_factory.cc + compute_interaction.cc + compute_temperature.cc + material_points_factory.cc) + +################################################################ +# FFTW +################################################################ + +include_directories("/usr/local/Cellar/fftw/3.3.8_1/include") +option(USE_FFTW "Use fftw library" ON) + +if(USE_FFTW) + add_definitions(-DUSE_FFTW) + find_package(FFTW) + target_link_libraries(part ${FFTW_LIBRARIES}) +endif(USE_FFTW) + +################################################################ +# Particles executable +################################################################ + +add_executable(particles main.cc) +target_link_libraries(particles part) + +################################################################ +# Google test +################################################################ + +add_subdirectory(googletest) + +add_executable(test_kepler test_kepler.cc) +target_link_libraries(test_kepler part gtest_main gtest pthread) + +if(USE_FFTW) +add_executable(test_fft test_fft.cc) +target_link_libraries(test_fft part gtest_main gtest ${FFTW_LIBRARIES} pthread) +endif(USE_FFTW) + +################################################################ +# Doxygen +################################################################ + +#find_package(Doxygen) +#if (DOXYGEN_FOUND) +# +## to set other options, read: https://cmake.org/cmake/help/v3.9/module/FindDoxygen.html +#doxygen_add_docs( +# doxygen +# ${PROJECT_SOURCE_DIR} +# COMMENT "Generate html pages" +#) +#add_custom_target(doc DEPENDS doxygen) +#endif(DOXYGEN_FOUND) + +################################################################ +# Pybind +################################################################ + +include_directories("/usr/local/Cellar/pybind11/2.4.3/include") +#option (USE_PYTHON "Use pybind library" ON) + +##### CLion is not recognizing pypart.cc as linked to a target if we use the if option here below in the CMakeFile + +#if (USE_PYTHON) +find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11) + +add_library(pypart MODULE pypart.cc) +target_link_libraries(pypart PRIVATE pybind11::module part) +set_target_properties(pypart PROPERTIES + PREFIX "${PYTHON_MODULE_PREFIX}" + SUFFIX "${PYTHON_MODULE_EXTENSION}" + ) +file( + COPY ${CMAKE_CURRENT_SOURCE_DIR}/main.py + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ + ) + +#endif(USE_PYTHON)