Behold: My Cmakelists.txt file
project(facedetectlib)
cmake_minimum_required(VERSION 2.8)
include (GenerateExportHeader)
SET(CMAKE_VERBOSE_MAKEFILE TRUE)
file(GLOB HEADER_LIST ./include/*.h)
include_directories(./include)
aux_source_directory(. SRC_LIST)
find_package(OpenCV REQUIRED )
# Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
# Set the LIB_TYPE variable to STATIC
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
# User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED'
SET (LIB_TYPE SHARED)
ENDIF (BUILD_SHARED_LIBS)
add_library(ocvfacedetectlib ${LIB_TYPE} ${SRC_LIST} ${HEADER_LIST})
target_link_libraries(ocvfacedetectlib ${OpenCV_LIBS})
GENERATE_EXPORT_HEADER( ocvfacedetectlib
BASE_NAME ocvfacedetectlib
EXPORT_MACRO_NAME ocvfacedetectlib_EXPORT
EXPORT_FILE_NAME ocvfacedetectlib_Export.h
STATIC_DEFINE ocvfacedetectlib_BUILT_AS_STATIC
)
Using this cmake file and piecing together some instructions from here:
I am trying to figure out if the DLL is getting built correctly. My header file for my little library has the following in it:
#include "ocvfacedetectlib_Export.h"
typedef unsigned char uint8_t;
extern "C" {
ocvfacedetectlib_EXPORT uint8_t * facedetect( uint8_t *imageData, long buffsize, unsigned char *retbuffer );
}
And then I have in my .cpp file this:
ocvfacedetectlib_EXPORT uint8_t * facedetect( uint8_t *imageData, long buffsize, unsigned char *retbuffer )
{ ..do stuff using OpenCV
...}
This seems to be enough to generate a DLL but I am not sure if it is being built correctly - I am unable to load it use js.ctypes() which is what I am trying to do as my end goal.
For what it's worth - my .cpp has a main() method as well and when I build the code to an .exe it runs.
Aucun commentaire:
Enregistrer un commentaire