Skip to content
Snippets Groups Projects
Commit 7384e2ea authored by Andrews Sobral's avatar Andrews Sobral
Browse files

Modified cmake to build all-in-one time

parent f1e770ea
Branches
Tags
No related merge requests found
...@@ -140,28 +140,25 @@ if(BGS_PYTHON_SUPPORT) ...@@ -140,28 +140,25 @@ if(BGS_PYTHON_SUPPORT)
message(STATUS "NUMPY_INCLUDE_DIR: ${NUMPY_INCLUDE_DIR}") message(STATUS "NUMPY_INCLUDE_DIR: ${NUMPY_INCLUDE_DIR}")
endif() endif()
#file(GLOB sources FrameProcessor.cpp PreProcessor.cpp VideoAnalysis.cpp VideoCapture.cpp)
file(GLOB main Main.cpp FrameProcessor.cpp PreProcessor.cpp VideoAnalysis.cpp VideoCapture.cpp) file(GLOB main Main.cpp FrameProcessor.cpp PreProcessor.cpp VideoAnalysis.cpp VideoCapture.cpp)
file(GLOB demo Demo.cpp) file(GLOB demo Demo.cpp)
file(GLOB demo2 Demo2.cpp) file(GLOB demo2 Demo2.cpp)
# list(REMOVE_ITEM sources ${demo} ${demo2})
file(GLOB_RECURSE analysis_src package_analysis/*.cpp) file(GLOB_RECURSE analysis_src package_analysis/*.cpp)
file(GLOB_RECURSE bgs_src package_bgs/*.cpp package_bgs/*.c)
file(GLOB_RECURSE bgs_include package_bgs/*.h)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${OpenCV_INCLUDE_DIRS})
if(BGS_PYTHON_SUPPORT) if(BGS_PYTHON_SUPPORT)
file(GLOB_RECURSE bgs_src package_bgs/*.cpp package_bgs/*.c wrapper_python/*.cpp) file(GLOB_RECURSE bgs_python_src wrapper_python/*.cpp)
file(GLOB_RECURSE bgs_include package_bgs/*.h wrapper_python/*.h) file(GLOB_RECURSE bgs_python_include wrapper_python/*.h)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/pybind11/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/pybind11/include)
include_directories(${OpenCV_INCLUDE_DIRS})
#include_directories(${Boost_INCLUDE_DIRS}) #include_directories(${Boost_INCLUDE_DIRS})
include_directories(${PYTHON_INCLUDE_DIRS}) include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${NUMPY_INCLUDE_DIR}) include_directories(${NUMPY_INCLUDE_DIR})
else()
file(GLOB_RECURSE bgs_src package_bgs/*.cpp package_bgs/*.c)
file(GLOB_RECURSE bgs_include package_bgs/*.h)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${OpenCV_INCLUDE_DIRS})
endif() endif()
# GMG is not available in older OpenCV versions # GMG is not available in older OpenCV versions
...@@ -170,25 +167,27 @@ if(${OpenCV_VERSION} VERSION_LESS 2.4.3) ...@@ -170,25 +167,27 @@ if(${OpenCV_VERSION} VERSION_LESS 2.4.3)
list(REMOVE_ITEM bgs_src ${gmg}) list(REMOVE_ITEM bgs_src ${gmg})
endif() endif()
add_library(bgslibrary_core STATIC ${bgs_src} ${analysis_src})
target_link_libraries(bgslibrary_core ${OpenCV_LIBS})
set_property(TARGET bgslibrary_core PROPERTY PUBLIC_HEADER ${bgs_include})
if(BGS_PYTHON_SUPPORT) if(BGS_PYTHON_SUPPORT)
#add_library(bgs_python SHARED ${sources} ${bgs_src} ${analysis_src})
#add_library(bgs_python SHARED ${bgs_src} ${analysis_src}) #add_library(bgs_python SHARED ${bgs_src} ${analysis_src})
pybind11_add_module(bgs_python ${bgs_src} ${analysis_src}) #pybind11_add_module(bgs_python ${bgs_src} ${analysis_src})
target_link_libraries(bgs_python PRIVATE ${OpenCV_LIBS} ${PYTHON_LIBRARY} pybind11::module) pybind11_add_module(bgs_python ${bgs_python_src})
target_link_libraries(bgs_python PRIVATE bgslibrary_core ${OpenCV_LIBS} ${PYTHON_LIBRARY} pybind11::module)
#target_link_libraries(bgs_python ${OpenCV_LIBS} ${Boost_LIBRARIES} ${PYTHON_LIBRARY}) #target_link_libraries(bgs_python ${OpenCV_LIBS} ${Boost_LIBRARIES} ${PYTHON_LIBRARY})
#target_link_libraries(bgs_python ${OpenCV_LIBS} ${PYTHON_LIBRARY} pybind11::module) #target_link_libraries(bgs_python ${OpenCV_LIBS} ${PYTHON_LIBRARY} pybind11::module)
#target_link_libraries(bgs_python PRIVATE ${OpenCV_LIBS} ${PYTHON_LIBRARY} pybind11::embed) #target_link_libraries(bgs_python PRIVATE ${OpenCV_LIBS} ${PYTHON_LIBRARY} pybind11::embed)
#set_target_properties(bgs_python PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}" SUFFIX "${PYTHON_MODULE_EXTENSION}") #set_target_properties(bgs_python PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}" SUFFIX "${PYTHON_MODULE_EXTENSION}")
set_target_properties(bgs_python PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}") set_target_properties(bgs_python PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}")
target_compile_definitions(bgs_python PRIVATE BGS_PYTHON_SUPPORT=1) target_compile_definitions(bgs_python PRIVATE BGS_PYTHON_SUPPORT=1)
install(TARGETS bgs_python DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
# Set the output library name to bgslibrary because that's what setup.py and distutils expects. # Set the output library name to bgslibrary because that's what setup.py and distutils expects.
set_property(TARGET bgs_python PROPERTY OUTPUT_NAME "bgs") set_property(TARGET bgs_python PROPERTY OUTPUT_NAME "bgs")
else()
#add_library(bgslibrary_core STATIC ${sources} ${bgs_src} ${analysis_src})
add_library(bgslibrary_core STATIC ${bgs_src} ${analysis_src})
target_link_libraries(bgslibrary_core ${OpenCV_LIBS})
set_property(TARGET bgslibrary_core PROPERTY PUBLIC_HEADER ${bgs_include})
endif() endif()
#if(WIN32) #if(WIN32)
...@@ -207,23 +206,25 @@ endif() ...@@ -207,23 +206,25 @@ endif()
# endif() # endif()
#endif() #endif()
if(NOT BGS_PYTHON_SUPPORT) add_executable(bgslibrary ${main})
add_executable(bgslibrary ${main}) target_link_libraries(bgslibrary ${OpenCV_LIBS} bgslibrary_core)
target_link_libraries(bgslibrary ${OpenCV_LIBS} bgslibrary_core) # set_target_properties(bgslibrary PROPERTIES OUTPUT_NAME bgs)
# set_target_properties(bgslibrary PROPERTIES OUTPUT_NAME bgs)
add_executable(bgs_demo ${demo})
add_executable(bgs_demo ${demo}) target_link_libraries(bgs_demo ${OpenCV_LIBS} bgslibrary_core)
target_link_libraries(bgs_demo ${OpenCV_LIBS} bgslibrary_core)
add_executable(bgs_demo2 ${demo2})
add_executable(bgs_demo2 ${demo2}) target_link_libraries(bgs_demo2 ${OpenCV_LIBS} bgslibrary_core)
target_link_libraries(bgs_demo2 ${OpenCV_LIBS} bgslibrary_core)
if(BGS_PYTHON_SUPPORT)
install(TARGETS bgslibrary_core install(TARGETS bgs_python DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
bgslibrary endif()
RUNTIME DESTINATION bin COMPONENT app
LIBRARY DESTINATION lib COMPONENT runtime install(TARGETS bgslibrary_core
ARCHIVE DESTINATION lib COMPONENT runtime bgslibrary
PUBLIC_HEADER DESTINATION include/package_bgs COMPONENT dev RUNTIME DESTINATION bin COMPONENT app
FRAMEWORK DESTINATION "/Library/Frameworks" LIBRARY DESTINATION lib COMPONENT runtime
) ARCHIVE DESTINATION lib COMPONENT runtime
endif() PUBLIC_HEADER DESTINATION include/package_bgs COMPONENT dev
\ No newline at end of file FRAMEWORK DESTINATION "/Library/Frameworks"
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment