Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ugurkan-syntonym/40f3a7be23afdc86b1761772f24e84c2 to your computer and use it in GitHub Desktop.

Select an option

Save ugurkan-syntonym/40f3a7be23afdc86b1761772f24e84c2 to your computer and use it in GitHub Desktop.
cmakelists for vcam make
# Minimum CMake version
cmake_minimum_required(VERSION 3.20)
# Project name and C++ standard
project(SyntonymApp VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Define the executable target
add_executable(${PROJECT_NAME}
FaceDetector.cpp
FaceGenerator.cpp
LandmarkDetector.cpp
Log.cpp
main.cpp
syn.cpp
synlogger.cpp
syntonym.cpp
utils.cpp
)
# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE
include
include/ncnn
include/opencv
"C:/VulkanSDK/1.3.261.1/Include"
)
# Add preprocessor definitions
target_compile_definitions(${PROJECT_NAME} PRIVATE
NOMINMAX
_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
)
# Resource file for Windows
if(WIN32)
target_sources(${PROJECT_NAME} PRIVATE syntonym.ico)
endif()
# Link libraries for release and debug
if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_link_libraries(${PROJECT_NAME} PRIVATE
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_core480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_imgproc480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_videoio480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_imgcodecs480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_gapi480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/ncnn.lib"
)
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_libraries(${PROJECT_NAME} PRIVATE
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_world480d.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/ncnn.lib"
)
endif()
# Installation rules (example: for Unix systems)
if(UNIX)
install(TARGETS ${PROJECT_NAME}
DESTINATION "${CMAKE_INSTALL_PREFIX}/plugins/generic"
)
endif()
@ugurkan-syntonym
Copy link
Author

Minimum CMake version

cmake_minimum_required(VERSION 3.20)

Project name and C++ standard

project(SyntonymApp VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Set Vulkan SDK paths manually

set(VULKAN_SDK "C:/VulkanSDK/1.3.261.1")
set(VULKAN_INCLUDE_DIR "${VULKAN_SDK}/Include")
set(VULKAN_LIB_DIR "${VULKAN_SDK}/Lib")

Debugging output to verify paths

message(STATUS "Vulkan Include Directory: ${VULKAN_INCLUDE_DIR}")
message(STATUS "Vulkan Library Directory: ${VULKAN_LIB_DIR}")

Include Vulkan headers and link libraries

include_directories(${VULKAN_INCLUDE_DIR})

Define the executable target

add_executable(${PROJECT_NAME}
FaceDetector.cpp
FaceGenerator.cpp
LandmarkDetector.cpp
Log.cpp
main.cpp
syn.cpp
synlogger.cpp
syntonym.cpp
utils.cpp
)

Include directories for the target

target_include_directories(${PROJECT_NAME} PRIVATE
include
include/ncnn
include/opencv
${VULKAN_INCLUDE_DIR} # Add Vulkan explicitly
)

Link Vulkan and other libraries

target_link_libraries(${PROJECT_NAME} PRIVATE
"${VULKAN_LIB_DIR}/vulkan-1.lib"
)

Add preprocessor definitions

target_compile_definitions(${PROJECT_NAME} PRIVATE
NOMINMAX
_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
)

Resource file for Windows

if(WIN32)
target_sources(${PROJECT_NAME} PRIVATE syntonym.ico)
endif()

Link libraries for release and debug

if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_link_libraries(${PROJECT_NAME} PRIVATE
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_core480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_imgproc480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_videoio480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_imgcodecs480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_gapi480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/ncnn.lib"
)
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_libraries(${PROJECT_NAME} PRIVATE
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/opencv_world480d.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace_withoutVULKAN_Gstreamer/SyntonymSelectedFace/lib/ncnn.lib"
)
endif()

@ugurkan-syntonym
Copy link
Author

cmake_minimum_required(VERSION 3.20)
project(SyntonymApp VERSION 1.0 LANGUAGES CXX)

Set the C++ standard

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Define source files

set(SOURCES
FaceDetector.cpp
FaceGenerator.cpp
LandmarkDetector.cpp
Log.cpp
main.cpp
syn.cpp
synlogger.cpp
syntonym.cpp
utils.cpp
)

Define header files

set(HEADERS
ErrorTypes.h
FaceDetector.h
FaceGenerator.h
FaceInfo.h
FacePreprocess.h
LandmarkDetector.h
Log.h
Syntonym.h
httplib.h
idsHiwell.h
lmsConstant.h
syn.h
synlogger.h
utils.h
)

Add the executable

add_executable(${PROJECT_NAME} ${SOURCES})

Define include directories

target_include_directories(${PROJECT_NAME} PRIVATE
include
include/ncnn
include/opencv
"C:/VulkanSDK/1.3.261.1/Include"
)

Define preprocessor macros

target_compile_definitions(${PROJECT_NAME} PRIVATE
NOMINMAX
_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
)

Link Vulkan libraries

set(VULKAN_SDK "C:/VulkanSDK/1.3.261.1")
target_link_libraries(${PROJECT_NAME} PRIVATE
"${VULKAN_SDK}/Lib/vulkan-1.lib"
)

Handle Debug and Release configurations

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Link debug libraries
target_link_libraries(${PROJECT_NAME} PRIVATE
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_world480d.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/ncnn.lib"
)

# Create a DLL for Debug configuration
add_library(opencv_world480d SHARED IMPORTED)
set_target_properties(opencv_world480d PROPERTIES
    IMPORTED_LOCATION "C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_world480d.lib"
    OUTPUT_NAME "opencv_world480d"
)

add_library(ncnn_debug SHARED IMPORTED)
set_target_properties(ncnn_debug PROPERTIES
    IMPORTED_LOCATION "C:/Users/User/Desktop/SyntonymSelectedFace/lib/ncnn.lib"
    OUTPUT_NAME "ncnn"
)

elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
# Link release libraries
target_link_libraries(${PROJECT_NAME} PRIVATE
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_core480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_imgproc480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_videoio480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_imgcodecs480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_gapi480.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/ncnn.lib"
)

# Create a DLL for Release configuration
add_library(opencv_world480 SHARED IMPORTED)
set_target_properties(opencv_world480 PROPERTIES
    IMPORTED_LOCATION "C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_world480.lib"
    OUTPUT_NAME "opencv_world480"
)

add_library(ncnn_release SHARED IMPORTED)
set_target_properties(ncnn_release PROPERTIES
    IMPORTED_LOCATION "C:/Users/User/Desktop/SyntonymSelectedFace/lib/ncnn.lib"
    OUTPUT_NAME "ncnn"
)

endif()

@ugurkan-syntonym
Copy link
Author

cmake_minimum_required(VERSION 3.20)
project(SyntonymApp VERSION 1.0 LANGUAGES CXX)

Set the C++ standard

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Define source files

set(SOURCES
FaceDetector.cpp
FaceGenerator.cpp
LandmarkDetector.cpp
Log.cpp
main.cpp
syn.cpp
synlogger.cpp
syntonym.cpp
utils.cpp
)

Define header files

set(HEADERS
ErrorTypes.h
FaceDetector.h
FaceGenerator.h
FaceInfo.h
FacePreprocess.h
LandmarkDetector.h
Log.h
Syntonym.h
httplib.h
idsHiwell.h
lmsConstant.h
syn.h
synlogger.h
utils.h
)

Add the executable

add_executable(${PROJECT_NAME} ${SOURCES})

Define include directories

target_include_directories(${PROJECT_NAME} PRIVATE
include
include\ncnn
include\opencv
"C:\VulkanSDK\1.3.261.1\Include"
)

Define preprocessor macros

target_compile_definitions(${PROJECT_NAME} PRIVATE
NOMINMAX
_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
)

Link Vulkan libraries

set(VULKAN_SDK "C:\VulkanSDK\1.3.261.1")
target_link_libraries(${PROJECT_NAME} PRIVATE
"${VULKAN_SDK}\Lib\vulkan-1.lib"
)

Handle Debug and Release configurations

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Link debug libraries
target_link_libraries(${PROJECT_NAME} PRIVATE
"C:\Users\User\Desktop\SyntonymSelectedFace\lib\opencv_world480d.lib"
"C:\Users\User\Desktop\SyntonymSelectedFace\lib\ncnn.lib"
)

# Create a DLL for Debug configuration
add_library(opencv_world480d SHARED IMPORTED)
set_target_properties(opencv_world480d PROPERTIES
    IMPORTED_LOCATION "C:\\Users\\User\\Desktop\\SyntonymSelectedFace\\lib\\opencv_world480d.lib"
    OUTPUT_NAME "opencv_world480d"
)

add_library(ncnn_debug SHARED IMPORTED)
set_target_properties(ncnn_debug PROPERTIES
    IMPORTED_LOCATION "C:\\Users\\User\\Desktop\\SyntonymSelectedFace\\lib\\ncnn.lib"
    OUTPUT_NAME "ncnn"
)

elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
# Link release libraries
target_link_libraries(${PROJECT_NAME} PRIVATE
"C:\Users\User\Desktop\SyntonymSelectedFace\lib\opencv_core480.lib"
"C:\Users\User\Desktop\SyntonymSelectedFace\lib\opencv_imgproc480.lib"
"C:\Users\User\Desktop\SyntonymSelectedFace\lib\opencv_videoio480.lib"
"C:\Users\User\Desktop\SyntonymSelectedFace\lib\opencv_imgcodecs480.lib"
"C:\Users\User\Desktop\SyntonymSelectedFace\lib\opencv_gapi480.lib"
"C:\Users\User\Desktop\SyntonymSelectedFace\lib\ncnn.lib"
)

# Create a DLL for Release configuration
add_library(opencv_world480 SHARED IMPORTED)
set_target_properties(opencv_world480 PROPERTIES
    IMPORTED_LOCATION "C:\\Users\\User\\Desktop\\SyntonymSelectedFace\\lib\\opencv_world480.lib"
    OUTPUT_NAME "opencv_world480"
)

add_library(ncnn_release SHARED IMPORTED)
set_target_properties(ncnn_release PROPERTIES
    IMPORTED_LOCATION "C:\\Users\\User\\Desktop\\SyntonymSelectedFace\\lib\\ncnn.lib"
    OUTPUT_NAME "ncnn"
)

endif()

@ugurkan-syntonym
Copy link
Author

Minimum CMake version

cmake_minimum_required(VERSION 3.20)

Project name and C++ standard

project(SyntonymApp VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if(MSVC)
target_link_libraries(${PROJECT_NAME} PRIVATE stdc++fs)
endif()

Define the executable target

add_executable(${PROJECT_NAME}
FaceDetector.cpp
FaceGenerator.cpp
LandmarkDetector.cpp
Log.cpp
main.cpp
syn.cpp
synlogger.cpp
syntonym.cpp
utils.cpp
)

Include directories for the target

target_include_directories(${PROJECT_NAME} PRIVATE
include/opencv
include/ncnn
"C:/VulkanSDK/1.3.261.1/Include"
)

Resource file for Windows

if(WIN32)
target_sources(${PROJECT_NAME} PRIVATE syntonym.ico)
endif()

target_link_libraries(${PROJECT_NAME} PRIVATE
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/opencv_world480d.lib"
"C:/Users/User/Desktop/SyntonymSelectedFace/lib/ncnn.lib"
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment