generallib/CMakeLists.txt

74 lines
3.2 KiB
CMake
Raw Normal View History

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)
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 )#生成动态库需要至少包含一个源文件
2022-03-24 16:07:03 +00:00
add_library(generallib STATIC $<TARGET_OBJECTS:General> ${SRC_SDK})
2020-11-17 16:40:46 +00:00
2022-03-24 16:07:03 +00:00
set_property(TARGET generallib PROPERTY
MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
message("current path is" ${CMAKE_CURRENT_SOURCE_DIR} "\r\n")
2020-04-24 12:39:29 +00:00
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\r\n")
2020-04-24 14:55:52 +00:00
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
message("using msvc compiler\r\n")
2020-04-24 14:55:52 +00:00
endif()
endif()
# copy header files
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/obj)
set(COPYITEM inc)
2021-05-25 14:20:08 +00:00
file(GLOB INCLUDES ${PROJECT_SOURCE_DIR}/general/inc/*)
file(COPY ${INCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
2021-05-25 14:20:08 +00:00
message("include dir \n" ${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
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
2021-05-25 14:20:08 +00:00
message( "copy pattern library \n" ${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
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)
2021-05-25 14:20:08 +00:00
message( "copy third library \n")
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/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
2021-05-25 14:20:08 +00:00
message( "copy net \n")
2021-07-25 16:28:56 +00:00
message( "copy function library \n")
file(GLOB FUNCTION ${PROJECT_SOURCE_DIR}/general/src/function/*.h)
message("function " ${FUNCTION})
file(COPY ${FUNCTION} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/function/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
message( "copy net \n")
file(GLOB NET ${PROJECT_SOURCE_DIR}/general/src/net/*.h)
2021-07-25 16:28:56 +00:00
file(COPY ${NET} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/net/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
2021-10-06 16:51:42 +00:00
message( "copy threadsafe library \n")
file(GLOB THREADSAFECODE ${PROJECT_SOURCE_DIR}/general/src/threadsafe/*.hpp)
message("threadsafe " ${THREADSAFECODE})
file(COPY ${THREADSAFECODE} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/threadsafe/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
file(GLOB ALGORITHM ${PROJECT_SOURCE_DIR}/general/src/algorithm/*)
2021-07-25 16:28:56 +00:00
file(COPY ${ALGORITHM} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/algorithm/
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)