|
1 | | -cmake_minimum_required(VERSION 3.14) |
| 1 | +cmake_minimum_required(VERSION 3.16) |
| 2 | +project(shotgun CXX) |
2 | 3 |
|
3 | | -project(shutoh VERSION 0.1) |
| 4 | +include(FetchContent) |
4 | 5 |
|
5 | | -set(CMAKE_CXX_STANDARD 20) |
6 | | -set(CMAKE_CXX_STANDARD_REQUIRED True) |
7 | | -set(CMAKE_POSITION_INDEPENDENT_CODE ON) |
8 | | -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) |
| 6 | +set(CMAKE_CXX_STANDARD 17) |
9 | 7 |
|
10 | | -include(FetchContent) |
11 | | -FetchContent_Declare( |
12 | | - argparse |
13 | | - GIT_REPOSITORY https://github.com/p-ranav/argparse.git |
| 8 | +# use onnxruntime 1.20.1 |
| 9 | +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") |
| 10 | + set(ORT_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-linux-x64-1.20.1.tgz") |
| 11 | +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") |
| 12 | + set(ORT_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-osx-arm64-1.20.1.tgz") |
| 13 | +elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") |
| 14 | + set(ORT_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.20.1/onnxruntime-osx-x86_64-1.20.1.tgz") |
| 15 | +else() |
| 16 | + message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}") |
| 17 | +endif() |
| 18 | + |
| 19 | +FetchContent_Declare(onnxruntime URL ${ORT_URL}) |
| 20 | +FetchContent_MakeAvailable(onnxruntime) |
| 21 | + |
| 22 | +add_executable(shotgun |
| 23 | + src/main.cpp |
| 24 | + src/transnetv2.cpp |
14 | 25 | ) |
15 | | -FetchContent_MakeAvailable(argparse) |
16 | 26 |
|
17 | | -include(FetchContent) |
18 | | -FetchContent_Declare( |
19 | | - pybind11 |
20 | | - GIT_REPOSITORY https://github.com/pybind/pybind11.git |
21 | | - GIT_TAG v2.11.1 |
| 27 | +target_include_directories(shotgun PRIVATE |
| 28 | + include/ |
| 29 | + ${onnxruntime_SOURCE_DIR}/include |
| 30 | +) |
| 31 | + |
| 32 | +target_link_directories(shotgun PRIVATE |
| 33 | + ${onnxruntime_SOURCE_DIR}/lib |
| 34 | +) |
| 35 | + |
| 36 | +target_link_libraries(shotgun PRIVATE |
| 37 | + onnxruntime |
22 | 38 | ) |
23 | | -FetchContent_MakeAvailable(pybind11) |
24 | 39 |
|
25 | | -find_package(OpenCV REQUIRED) |
26 | | -find_package(fmt REQUIRED) |
27 | | -find_package(Python3 REQUIRED COMPONENTS Interpreter Development) |
| 40 | + |
| 41 | +#cmake_minimum_required(VERSION 3.14) |
| 42 | + |
| 43 | +#project(shutoh VERSION 0.1) |
| 44 | + |
| 45 | +#set(CMAKE_CXX_STANDARD 20) |
| 46 | +#set(CMAKE_CXX_STANDARD_REQUIRED True) |
| 47 | +#set(CMAKE_POSITION_INDEPENDENT_CODE ON) |
| 48 | +#set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) |
| 49 | + |
| 50 | +#include(FetchContent) |
| 51 | +#FetchContent_Declare( |
| 52 | +# argparse |
| 53 | +# GIT_REPOSITORY https://github.com/p-ranav/argparse.git |
| 54 | +#) |
| 55 | +#FetchContent_MakeAvailable(argparse) |
| 56 | + |
| 57 | +#include(FetchContent) |
| 58 | +#FetchContent_Declare( |
| 59 | +# pybind11 |
| 60 | +# GIT_REPOSITORY https://github.com/pybind/pybind11.git |
| 61 | +# GIT_TAG v2.11.1 |
| 62 | +#) |
| 63 | +#FetchContent_MakeAvailable(pybind11) |
| 64 | + |
| 65 | +#find_package(OpenCV REQUIRED) |
| 66 | +#find_package(fmt REQUIRED) |
| 67 | +#find_package(Python3 REQUIRED COMPONENTS Interpreter Development) |
28 | 68 |
|
29 | 69 | # Library |
30 | | -if (EXISTS "${CMAKE_SOURCE_DIR}/src") |
31 | | - file(GLOB LIB_SOURCES |
32 | | - "${CMAKE_SOURCE_DIR}/src/*.cpp" |
33 | | - "${CMAKE_SOURCE_DIR}/src/detector/*.cpp" |
34 | | - "${CMAKE_SOURCE_DIR}/src/bindings/*.cpp") |
35 | | -else() |
36 | | - FetchContent_MakeAvailable(shutoh) |
37 | | - file(GLOB LIB_SOURCES |
38 | | - "${shutoh_SOURCE_DIR}/src/*.cpp" |
39 | | - "${shutoh_SOURCE_DIR}/src/detector/*.cpp" |
40 | | - "${shutoh_SOURCE_DIR}/src/bindings/*.cpp" |
41 | | - ) |
42 | | - set(SKIP_TESTS TRUE) |
43 | | -endif() |
44 | | -add_library(shutoh SHARED ${LIB_SOURCES}) |
45 | | -target_compile_options(shutoh PRIVATE -O3 -Wall) |
46 | | -target_include_directories(shutoh PUBLIC include ${OpenCV_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}) |
47 | | -target_link_libraries(shutoh PUBLIC ${OpenCV_LIBS} fmt::fmt argparse pybind11::module ${Python3_LIBRARIES}) |
| 70 | +#if (EXISTS "${CMAKE_SOURCE_DIR}/src") |
| 71 | +# file(GLOB LIB_SOURCES |
| 72 | +# "${CMAKE_SOURCE_DIR}/src/*.cpp" |
| 73 | +# "${CMAKE_SOURCE_DIR}/src/detector/*.cpp" |
| 74 | +# "${CMAKE_SOURCE_DIR}/src/bindings/*.cpp") |
| 75 | +#else() |
| 76 | +# FetchContent_MakeAvailable(shutoh) |
| 77 | +# file(GLOB LIB_SOURCES |
| 78 | +# "${shutoh_SOURCE_DIR}/src/*.cpp" |
| 79 | +# "${shutoh_SOURCE_DIR}/src/detector/*.cpp" |
| 80 | +# "${shutoh_SOURCE_DIR}/src/bindings/*.cpp" |
| 81 | +# ) |
| 82 | +# set(SKIP_TESTS TRUE) |
| 83 | +#endif() |
| 84 | +#add_library(shutoh SHARED ${LIB_SOURCES}) |
| 85 | +#target_compile_options(shutoh PRIVATE -O3 -Wall) |
| 86 | +#target_include_directories(shutoh PUBLIC include ${OpenCV_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}) |
| 87 | +#target_link_libraries(shutoh PUBLIC ${OpenCV_LIBS} fmt::fmt argparse pybind11::module ${Python3_LIBRARIES}) |
48 | 88 |
|
49 | 89 | # CLI |
50 | | -add_executable(shutoh_cli src/main.cpp) |
51 | | -set_target_properties(shutoh_cli PROPERTIES OUTPUT_NAME "shutoh") |
52 | | -target_link_libraries(shutoh_cli PRIVATE shutoh) |
| 90 | +#add_executable(shutoh_cli src/main.cpp) |
| 91 | +#set_target_properties(shutoh_cli PROPERTIES OUTPUT_NAME "shutoh") |
| 92 | +#target_link_libraries(shutoh_cli PRIVATE shutoh) |
53 | 93 |
|
54 | 94 | # Tests |
55 | | -if (NOT SKIP_TESTS) |
56 | | - enable_testing() |
57 | | - add_subdirectory(tests) |
| 95 | +#if (NOT SKIP_TESTS) |
| 96 | +# enable_testing() |
| 97 | +# add_subdirectory(tests) |
58 | 98 |
|
59 | 99 | # Install |
60 | | - install(TARGETS shutoh DESTINATION lib) |
61 | | - install(TARGETS shutoh_cli DESTINATION bin) |
62 | | - install(DIRECTORY include/ DESTINATION include) |
63 | | -endif() |
| 100 | + # install(TARGETS shutoh DESTINATION lib) |
| 101 | + #install(TARGETS shutoh_cli DESTINATION bin) |
| 102 | + #install(DIRECTORY include/ DESTINATION include) |
| 103 | + #endif() |
0 commit comments