diff --git a/hw3-heat-fft/CMakeLists.txt b/hw3-heat-fft/CMakeLists.txt index 8d4c0991..ed7ededc 100644 --- a/hw3-heat-fft/CMakeLists.txt +++ b/hw3-heat-fft/CMakeLists.txt @@ -1,81 +1,93 @@ cmake_minimum_required (VERSION 3.1) project (Particles) cmake_policy(VERSION 3.3) set(CMAKE_CXX_STANDARD 14) +option (USE_FFTW "Use FFTW part of the code" ON) + ############################################################### # Include FFTW library and header files ############################################################### -# Not the most elegant way -set(FFTW_LIBRARIES "/usr/lib/x86_64-linux-gnu/libfftw3.so") -set(FFTW_INCLUDES "/usr/include") +if (USE_FFTW) + # Not the most elegant way, but it works! + set(FFTW_LIBRARIES "/usr/lib/x86_64-linux-gnu/libfftw3.so") + set(FFTW_INCLUDES "/usr/include") + + # Alternative way that does not currently work: + #set(FFTW_LIBRARIES CACHE PATH "library where to search libfftw3") + #find_library(FFTW_LIBRARY libfftw3 ${FFTW_LIBRARIES} /usr/lib) + #set(FFTW_INCLUDES CACHE PATH "path where to search fftw include files") + #find_path(FFTW_INCLUDE fftw3.h ${FFTW_INCLUDES} /usr/include/) -# Alternative way that does not currently work: -#set(FFTW_LIBRARIES CACHE PATH "library where to search libfftw3") -#find_library(FFTW_LIBRARY libfftw3 ${FFTW_LIBRARIES} /usr/lib) -#set(FFTW_INCLUDES CACHE PATH "path where to search fftw include files") -#find_path(FFTW_INCLUDE fftw3.h ${FFTW_INCLUDES} /usr/include/) + include_directories("${FFTW_INCLUDES}") -include_directories("${FFTW_INCLUDES}") -message("FFTW_LIBRARIES = ${FFTW_LIBRARIES}") -message("FFTW_INCLUDES = ${FFTW_INCLUDES}") + message("FFTW_LIBRARIES = ${FFTW_LIBRARIES}") + message("FFTW_INCLUDES = ${FFTW_INCLUDES}") +endif(USE_FFTW) ################################################################ # libpart ################################################################ add_library(part 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 ) add_executable(particles main.cc) target_link_libraries(particles part) ################################################################ # Google test ################################################################ add_subdirectory(googletest) add_executable(test_kepler test_kepler.cc) -add_executable(test_fft test_fft.cc) + +if (USE_FFTW) + add_executable(test_fft test_fft.cc) +endif(USE_FFTW) + target_link_libraries(test_kepler part gtest_main gtest pthread) -target_link_libraries(test_fft part gtest_main gtest ${FFTW_LIBRARIES} pthread) + +if (USE_FFTW) + 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)