aca-tasks/task1/CMakeLists.txt

56 lines
2.1 KiB
CMake

# Find packages necessary for this application
find_package(Qt6 COMPONENTS Core REQUIRED)
find_package(fmt)
# Search for python to generate the test dataset
find_package(Python3 COMPONENTS Interpreter REQUIRED)
# Generate random dataset
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/dataset.dat
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dataset-gen.py
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dataset-gen.py
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating random dataset")
# Copy random dataset to binary dir
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dataset.dat
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dataset.dat
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/dataset.dat ${CMAKE_CURRENT_BINARY_DIR}/dataset.dat
COMMENT "Copying dataset")
add_custom_target(task1-dataset
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/dataset.dat
${CMAKE_CURRENT_BINARY_DIR}/dataset.dat)
# Add task1 automated target (Automatically loads generated dataset
add_executable(task1-auto)
add_dependencies(task1-auto task1-dataset)
target_sources(task1-auto PRIVATE
src/task1-auto.cpp)
target_include_directories(task1-auto PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(task1-auto PRIVATE
fmt::fmt)
# Add task1 target with an C++ written random data generator
add_executable(task1-randgen)
target_sources(task1-randgen PRIVATE
src/task1-randgen.cpp)
target_link_libraries(task1-randgen PRIVATE
Qt6::Core)
# Add task1 target with an C++ written QT-based mergesort
add_executable(task1-sorter)
target_sources(task1-sorter PRIVATE
src/task1-sorter.cpp)
target_include_directories(task1-sorter PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(task1-sorter PRIVATE
Qt6::Core)
# Define install options
install(TARGETS task1-auto DESTINATION bin)
install(TARGETS task1-randgen DESTINATION bin)
install(IMPORTED_RUNTIME_ARTIFACTS task1-auto DESTINATION lib)
install(IMPORTED_RUNTIME_ARTIFACTS task1-randgen DESTINATION lib)