2020-02-06 18:00:41 +00:00
|
|
|
cmake_minimum_required(VERSION 3.11)
|
2020-09-30 03:43:43 +00:00
|
|
|
enable_language(CXX)
|
2020-04-24 01:25:09 +00:00
|
|
|
project(generallib)
|
|
|
|
add_subdirectory(general)
|
2020-11-15 08:32:29 +00:00
|
|
|
|
2020-11-19 16:07:41 +00:00
|
|
|
SET(SRC_SDK sdk_main.c )#生成动态库需要至少包含一个源文件
|
2020-04-24 01:25:09 +00:00
|
|
|
add_library(generallib STATIC $<TARGET_OBJECTS:General> ${SRC_SDK})
|
2020-11-17 16:40:46 +00:00
|
|
|
|
2020-04-24 12:39:29 +00:00
|
|
|
message("current path is" ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
IF (WIN32)
|
2020-04-24 14:55:52 +00:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
2021-05-14 17:25:01 +00:00
|
|
|
message("clang compiler \r\n")
|
2020-04-24 14:55:52 +00:00
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
2021-05-14 17:25:01 +00:00
|
|
|
message("gcc compiler \r\n")
|
2020-04-24 14:55:52 +00:00
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|
|
|
message("using asm")
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
2021-05-14 17:25:01 +00:00
|
|
|
message("using msvc compiler")
|
2020-04-24 14:55:52 +00:00
|
|
|
endif()
|
2020-10-10 04:24:12 +00:00
|
|
|
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/*)
|
2020-11-19 15:28:05 +00:00
|
|
|
file(COPY ${PatternINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/pattern
|
2020-10-10 04:24:12 +00:00
|
|
|
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)
|
2020-11-19 15:28:05 +00:00
|
|
|
file(COPY ${EncryptINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/encrypt
|
2020-10-10 04:24:12 +00:00
|
|
|
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/*)
|
2021-03-10 14:21:52 +00:00
|
|
|
file(COPY ${THIRD} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/third/include/
|
2020-10-10 04:24:12 +00:00
|
|
|
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)
|