aca-tasks/task1/CMakeLists.txt

56 lines
2.1 KiB
CMake
Raw Permalink Normal View History

2023-11-07 20:24:24 +00:00
# Find packages necessary for this application
find_package(Qt6 COMPONENTS Core REQUIRED)
2023-11-07 10:33:16 +00:00
find_package(fmt)
2023-10-31 14:06:08 +00:00
2023-11-07 20:24:24 +00:00
# Search for python to generate the test dataset
find_package(Python3 COMPONENTS Interpreter REQUIRED)
# Generate random dataset
2023-10-31 14:06:08 +00:00
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")
2023-11-07 20:24:24 +00:00
# Copy random dataset to binary dir
2023-10-31 14:06:08 +00:00
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dataset.dat
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dataset.dat
2023-11-07 11:09:36 +00:00
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/dataset.dat ${CMAKE_CURRENT_BINARY_DIR}/dataset.dat
2023-10-31 14:06:08 +00:00
COMMENT "Copying dataset")
2023-11-07 20:24:24 +00:00
add_custom_target(task1-dataset
2023-10-31 14:06:08 +00:00
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/dataset.dat
${CMAKE_CURRENT_BINARY_DIR}/dataset.dat)
2023-11-07 10:33:16 +00:00
2023-11-07 20:24:24 +00:00
# Add task1 automated target (Automatically loads generated dataset
add_executable(task1-auto)
add_dependencies(task1-auto task1-dataset)
target_sources(task1-auto PRIVATE
2023-11-07 20:59:50 +00:00
src/task1-auto.cpp)
2023-11-07 20:24:24 +00:00
target_include_directories(task1-auto PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(task1-auto PRIVATE
fmt::fmt)
2023-11-07 10:33:16 +00:00
2023-11-07 20:59:50 +00:00
# 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
2023-11-09 19:46:19 +00:00
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
2023-12-02 15:04:12 +00:00
${CMAKE_CURRENT_SOURCE_DIR}/include)
2023-11-09 19:46:19 +00:00
target_link_libraries(task1-sorter PRIVATE
2023-11-07 20:59:50 +00:00
Qt6::Core)
2023-10-31 14:06:08 +00:00
2023-11-07 20:59:50 +00:00
# Define install options
2023-11-07 20:24:24 +00:00
install(TARGETS task1-auto DESTINATION bin)
2023-11-07 20:59:50 +00:00
install(TARGETS task1-randgen DESTINATION bin)
install(IMPORTED_RUNTIME_ARTIFACTS task1-auto DESTINATION lib)
install(IMPORTED_RUNTIME_ARTIFACTS task1-randgen DESTINATION lib)