cmake object 项目不支持add_cuscom_command,因此将头文件拷贝外移到包装库的cmakefile.txt
parent
eec2be16ee
commit
86f198ffe8
|
@ -47,4 +47,38 @@ IF (WIN32)
|
|||
message("using msvc")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# copy header files
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/obj)
|
||||
|
||||
set(COPYITEM inc)
|
||||
file(GLOB INCLUDES ${PROJECT_SOURCE_DIR}/inc/*)
|
||||
file(COPY ${INCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
message("include dir " ${INCLUDES})
|
||||
|
||||
file(GLOB PatternINCLUDES ${PROJECT_SOURCE_DIR}/general/src/pattern/*)
|
||||
file(COPY ${PatternINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
message( "copy pattern library" ${PatternINCLUDES})
|
||||
file(GLOB EncryptINCLUDES ${PROJECT_SOURCE_DIR}/general/src/encrypt/*.h)
|
||||
file(COPY ${EncryptINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
file(GLOB MathINCLUDES ${PROJECT_SOURCE_DIR}/general/src/math/*.hpp)
|
||||
message( "copy math library" ${MathINCLUDES})
|
||||
add_custom_command(TARGET generallib PRE_LINK
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/general/src/math/eigen ${LIBRARY_OUTPUT_PATH}/inc/math/eigen)
|
||||
message( "copy third library")
|
||||
file(GLOB THIRD ${PROJECT_SOURCE_DIR}/general/third/include/*)
|
||||
file(COPY ${THIRD} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/third/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
message( "copy net ")
|
||||
|
||||
file(GLOB NET ${PROJECT_SOURCE_DIR}/general/src/net/*.h)
|
||||
file(COPY ${NET} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
|
||||
file(GLOB ALGORITHM ${PROJECT_SOURCE_DIR}/general/src/algorithm/*)
|
||||
file(COPY ${ALGORITHM} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
|
|
17
conanfile.py
17
conanfile.py
|
@ -2,6 +2,7 @@ from conans import ConanFile, CMake, tools
|
|||
from conans import tools
|
||||
|
||||
class GenerallibConan(ConanFile):
|
||||
source_folder = "pkgsrc"
|
||||
name = "generallib"
|
||||
version = "1.0"
|
||||
license = "GPL"
|
||||
|
@ -10,13 +11,21 @@ class GenerallibConan(ConanFile):
|
|||
description = "a simple cpp basic library"
|
||||
exports_sources = "general*", "test*"
|
||||
def source(self):
|
||||
git = tools.Git(folder="third_build/libevent")
|
||||
git.clone("https://gitee.com/mirrors/libevent.git")
|
||||
tools.rmdir("pkgsrc")
|
||||
git = tools.Git(folder=self.source_folder)
|
||||
git.clone("https://gitee.com/290198252/generallib.git")
|
||||
|
||||
def package(self):
|
||||
self.copy(pattern ="*.h", dst="include", src="general",keep_path=True)
|
||||
self.copy(pattern ="*.hpp", dst="include", src="general",keep_path=True)
|
||||
|
||||
def build(self):
|
||||
print("start build Dependency")
|
||||
|
||||
cmake = CMake(self)
|
||||
# same as cmake.configure(source_folder=self.source_folder, build_folder=self.build_folder)
|
||||
cmake.configure(source_folder="pkgsrc", build_folder="build")
|
||||
cmake.build()
|
||||
cmake.test()
|
||||
cmake.install()
|
||||
|
||||
def requirements(self):
|
||||
self.build_requires("tool_win/0.1@user/stable")
|
||||
|
|
|
@ -37,46 +37,3 @@ aux_source_directory(src/pattern PaternSrc)
|
|||
|
||||
add_library(General OBJECT ${DIRSRCS} ${PaternSrc} src/pattern/signleton.hpp src/pattern/cmd.hpp src/pattern/Observer.hpp src/pattern/stratergy.hpp "src/pattern/adapter.hpp" src/encrypt/base64.cpp src/encrypt/base64.h src/encrypt/aes.cpp src/encrypt/aes.h src/encrypt/rsa.cpp
|
||||
src/math/BigInt.hpp src/net/TcpClient.cpp src/net/TcpClient.h src/net/PackageReceiver.cpp src/net/PackageReceiver.h src/function/Timer.cpp src/function/btree.cpp src/function/btree.h src/algorithm/sorter.hpp)
|
||||
|
||||
set(COPYITEM inc)
|
||||
file(GLOB INCLUDES ${PROJECT_SOURCE_DIR}/inc/*)
|
||||
file(COPY ${INCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
message("include dir " ${INCLUDES})
|
||||
|
||||
file(GLOB PatternINCLUDES ${PROJECT_SOURCE_DIR}/src/pattern/*)
|
||||
file(COPY ${PatternINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
message( "copy pattern library" ${PatternINCLUDES})
|
||||
file(GLOB EncryptINCLUDES ${PROJECT_SOURCE_DIR}/src/encrypt/*.h)
|
||||
file(COPY ${EncryptINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
file(GLOB MathINCLUDES ${PROJECT_SOURCE_DIR}/src/math/*.hpp)
|
||||
message( "copy math library" ${MathINCLUDES})
|
||||
file(COPY ${MathINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
file(GLOB EIGENLIBS ${PROJECT_SOURCE_DIR}/src/math/eigin/*)
|
||||
message( "copy eigen library" ${EIGENLIBS})
|
||||
message( "copy third library")
|
||||
file(GLOB THIRD ${PROJECT_SOURCE_DIR}/third/include/*)
|
||||
file(COPY ${THIRD} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/third/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
message( "copy net ")
|
||||
|
||||
file(GLOB NET ${PROJECT_SOURCE_DIR}/src/net/*.h)
|
||||
file(COPY ${NET} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
|
||||
file(GLOB ALGORITHM ${PROJECT_SOURCE_DIR}/src/algorithm/*)
|
||||
file(COPY ${ALGORITHM} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
IF (WIN32)
|
||||
message("it is windows 32")
|
||||
ELSEIF (UNIX)
|
||||
add_custom_command(
|
||||
TARGET General PRE_BUILD
|
||||
COMMAND cp.exe -r
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/math/Eigen
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/obj/inc/
|
||||
)
|
||||
ENDIF ()
|
Loading…
Reference in New Issue