Skip to content

Commit

Permalink
添加cmake编译
Browse files Browse the repository at this point in the history
  • Loading branch information
WallBreaker2 committed Jul 6, 2019
1 parent 46b7c17 commit 573dec1
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*.user
*.userosscache
*.sln.docstates
*.txt

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

Expand Down Expand Up @@ -62,7 +62,7 @@ artifacts/
*.pgd
*.rsp
*.sbr
*.tlb
tlb
*.tli
*.tlh
*.tmp
Expand Down
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# CMakeList.txt: 顶层 CMake 项目文件,在此处执行全局配置
# 并包含子项目。
#
cmake_minimum_required (VERSION 3.0)

SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_TOOLCHAIN_FILE "E:/git_pro/vcpkg/scripts/buildsystems/vcpkg.cmake")
SET(VCPKG_TARGET_TRIPLET x86-windows-static)
#SET(VcpkgConfiguration release)
message(warning ${VCPKG_TARGET_TRIPLET})

#FIND_PACKAGE(Opencv REQUIRED)

project ("op")

# 包含子项目。
add_subdirectory ("op")
99 changes: 99 additions & 0 deletions op/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# 1.cmake version
cmake_minimum_required(VERSION 3.0.0)



# 3.include path
#INCLUDE_DIRECTORIES(
# include
#)

if (MSVC_VERSION GREATER_EQUAL "1900")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("/std:c++latest" _cpp_latest_flag_supported)
if (_cpp_latest_flag_supported)
add_compile_options("/std:c++latest")
endif()
endif()

set(CMAKE_CXX_FLAGS_RELEASE "/MT")
set(CMAKE_CXX_FLAGS_DEBUG "/MTd")

if(MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEF:op.def /NODEFAULTLIB")
endif()

# set_target_properties(target PROPERTIES VcpkgEnabled "true")

# 4.source directory
AUX_SOURCE_DIRECTORY(src DIR_SRCS)

#LINK_DIRECTORIES("/3rd_party/lib/x86")
# 5.set environment variable
find_package(OpenCV REQUIRED)
include_directories(${PROJECT_NAME} ${OpenCV_INCLUDE_DIRS})

MESSAGE(STATUS ${Opencv})


find_library(BLACKBONE_LIB blackbone ./3rd_party/lib/x86 NO_DEFAULT_PATH)
find_library(minhook_lib libminhook.x86 ./3rd_party/lib/x86 NO_DEFAULT_PATH)
message(WARNING ${BLACKBONE_LIB})
message(WARNING ${minhook_lib})


SET(SRC_FILES
"bkbase.cpp"
"bkdisplay.cpp"
"bkdx_gl.cpp"
"bkgdi.cpp"
"bkkeypad.cpp"
"bkmouse.cpp"
"common.cpp"
"compreg.cpp"
"dllmain.cpp"
"imageloc.cpp"
"imageproc.cpp"
"injecter.cpp"
"ocr.cpp"
"op.cpp"
"opinterface.cpp"
"pipe.cpp"
"query_api.cpp"
"stdafx.cpp"
"tool.cpp"
"winapi.cpp"
"xhook.cpp"
"./3rd_party/kiero/kiero.cpp"
"op_i.c"
"op.def"
)

#SET(LIBS "blackbone.lib")

ADD_DEFINITIONS(-D WIN32)
ADD_DEFINITIONS(-D _WINDOWS)
ADD_DEFINITIONS(-D _USRDLL)
ADD_DEFINITIONS(-D _CRT_NON_CONFORMING_SWPRINTFS)
ADD_DEFINITIONS(-D _CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D _SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING)
ADD_DEFINITIONS(-D _WINDLL)
ADD_DEFINITIONS(-D _UNICODE)
ADD_DEFINITIONS(-D UNICODE)

# ADD_DEFINITIONS(-D APSTUDIO_INVOKED)

# 6.add executable file
add_library(${PROJECT_NAME} SHARED ${SRC_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/op.rc)

# 7.add link library
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${BLACKBONE_LIB})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${minhook_lib})
#target_link_libraries(${PROJECT_NAME} ${OPENCV_LIBRARIES})

target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
target_link_libraries(${PROJECT_NAME} msvcrt.lib)

SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"op.def\" /NODEFAULTLIB:\"mfc110d\"")


Binary file added op/op.tlb
Binary file not shown.

0 comments on commit 573dec1

Please sign in to comment.