Skip to content

Commit

Permalink
Build for Linux with CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
kk-hainq committed Nov 10, 2020
1 parent 3f63434 commit 43a8a17
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
x64/
*.user
*.pt
*.mp4
*.mp4
build/
CMakeLists.txt~
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.18.4)

project(siam-trackers LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)

find_package(OpenCV REQUIRED)
find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

add_definitions(-DOPENCV)

add_executable(${PROJECT_NAME} main.cpp)

target_sources(${PROJECT_NAME} PRIVATE Tracker.cpp TrackerSiamMask.cpp TrackerSiamRPNPP.cpp)

target_link_libraries(${PROJECT_NAME} PRIVATE ${OpenCV_LIBS} ${TORCH_LIBRARIES})
5 changes: 5 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
#include <opencv2/opencv.hpp>
#include "TrackerSiamRPNPP.h"
#include "TrackerSiamMask.h"

#ifdef _WIN32
#include "windows.h"
#endif

const cv::Scalar COLOR_BLUE(255, 0, 0);

int main(int argc, char **argv) {
#ifdef _WIN32
_putenv_s("OMP_NUM_THREADS", "8");
LoadLibraryA("torch_cuda.dll");
#endif

// TODO: Should we `eval` these modules?
// SiamMask
Expand Down

0 comments on commit 43a8a17

Please sign in to comment.