From 8d2f7d53aa28af09fb86324504056789fe753b4b Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Sun, 19 Nov 2017 12:59:28 +0100 Subject: Added a library with common tuner sources to speed-up compilation --- CMakeLists.txt | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f051e441..d7f30906 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -384,26 +384,33 @@ if(TUNERS) src/utilities/utilities.hpp src/tuning/configurations.hpp src/tuning/tuning.hpp) + set(TUNERS_COMMON ${TUNERS_COMMON} ${TUNERS_HEADERS}) + + # Creates a library with common sources for all tuners + if(MSVC) + # Visual Studio requires the sources of non-exported objects/libraries + else() + # Creates the common performance-tests objects (requires CMake 2.8.8) + add_library(tuners_common_library OBJECT ${TUNERS_COMMON}) + + # Adds CLBlast's interface include paths because we can't link to CLBlast here + target_include_directories(tuners_common_library PRIVATE + $ + ${clblast_SOURCE_DIR} ${API_INCLUDE_DIRS}) + set(TUNERS_COMMON $) + endif() # Adds tuning executables foreach(KERNEL ${KERNELS}) - add_executable(clblast_tuner_${KERNEL} ${TUNERS_COMMON} ${TUNERS_HEADERS} - src/tuning/kernels/${KERNEL}.cpp) - target_include_directories(clblast_tuner_${KERNEL} PUBLIC - $ - $ - ${API_INCLUDE_DIRS}) + add_executable(clblast_tuner_${KERNEL} ${TUNERS_COMMON} src/tuning/kernels/${KERNEL}.cpp) target_link_libraries(clblast_tuner_${KERNEL} ${API_LIBRARIES}) + target_include_directories(clblast_tuner_${KERNEL} PUBLIC $ ${API_INCLUDE_DIRS}) install(TARGETS clblast_tuner_${KERNEL} DESTINATION bin) endforeach() foreach(ROUTINE_TUNER ${ROUTINE_TUNERS}) - add_executable(clblast_tuner_routine_${ROUTINE_TUNER} ${TUNERS_COMMON} ${TUNERS_HEADERS} - src/tuning/routines/${ROUTINE_TUNER}.cpp) - target_include_directories(clblast_tuner_routine_${ROUTINE_TUNER} PUBLIC - $ - $ - ${API_INCLUDE_DIRS}) - target_link_libraries(clblast_tuner_routine_${ROUTINE_TUNER} ${API_LIBRARIES}) + add_executable(clblast_tuner_routine_${ROUTINE_TUNER} ${TUNERS_COMMON} src/tuning/routines/${ROUTINE_TUNER}.cpp) + target_link_libraries(clblast_tuner_routine_${ROUTINE_TUNER} clblast) + target_include_directories(clblast_tuner_routine_${ROUTINE_TUNER} PUBLIC $ ${API_INCLUDE_DIRS}) install(TARGETS clblast_tuner_routine_${ROUTINE_TUNER} DESTINATION bin) endforeach() -- cgit v1.2.3