-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
48 lines (36 loc) · 1.65 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(derm VERSION 1.0.0 LANGUAGES CXX)
set(EXECUTABLE_NAME derm)
set(CMAKE_CXX_STANDARD 14)
find_package(Torch REQUIRED PATHS ~/libtorch)
find_package(OpenCV REQUIRED PATHS)
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/check_files.cmake)
add_executable(${EXECUTABLE_NAME})
target_sources(${EXECUTABLE_NAME} PRIVATE main.cpp
include/trainer.tpp
src/dataset.cpp
include/trainer.h
include/dataset.h
)
target_include_directories(${EXECUTABLE_NAME} PRIVATE include)
target_link_libraries(${EXECUTABLE_NAME} ${TORCH_LIBRARIES} ${OpenCV_LIBS})
set_target_properties(${EXECUTABLE_NAME} PROPERTIES
CXX_STANDARD 14
CXX_STANDARD_REQUIRED YES
)
execute_process(COMMAND python ${CMAKE_CURRENT_LIST_DIR}/convert.py)
option(DOWNLOAD_DATASET "Download the dataset from the interwebs" OFF)
if(DOWNLOAD_DATASET)
file(MAKE_DIRECTORY ${DATA_DIR})
message(STATUS "Fetching dataset...")
execute_process( COMMAND python ${CMAKE_CURRENT_LIST_DIR}/download_dataset.py -d ${CMAKE_BINARY_DIR}/data ERROR_VARIABLE DOWNLOAD_ERROR)
if (DOWNLOAD_ERROR)
message(FATAL_ERROR "Error downloading dataset: ${DOWNLOAD_ERROR}")
endif()
endif()
if(MSVC)
set_target_properties(${EXECUTABLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${EXECUTABLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR})
include(copy_torch_dlls)
copy_torch_dlls(${EXECUTABLE_NAME})
endif(MSVC)