2020-02-06 18:00:41 +00:00
|
|
|
cmake_minimum_required(VERSION 3.11)
|
2019-12-21 10:50:15 +00:00
|
|
|
project(General)
|
2020-04-21 16:45:50 +00:00
|
|
|
set(MINGW_PATH $ENV{MINGW_TOOLCHAIN})
|
|
|
|
message("path is " ${MINGW_PATH})
|
2020-04-20 15:56:21 +00:00
|
|
|
message( "libevent path " ${CONAN_LIBEVENT_ROOT})
|
|
|
|
message( "current compiler " ${CMAKE_CXX_COMPILER_ID})
|
|
|
|
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
# using Clang
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
# using GCC
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|
|
|
# using Intel C++
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
|
# using Visual Studio C++
|
|
|
|
endif()
|
|
|
|
|
2019-12-21 10:50:15 +00:00
|
|
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/obj)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2020-02-06 18:00:41 +00:00
|
|
|
INCLUDE_DIRECTORIES (./)
|
2019-12-21 10:50:15 +00:00
|
|
|
INCLUDE_DIRECTORIES (inc)
|
2020-02-06 18:00:41 +00:00
|
|
|
INCLUDE_DIRECTORIES (encrypt)
|
|
|
|
INCLUDE_DIRECTORIES (pattern)
|
2020-04-20 15:56:21 +00:00
|
|
|
include_directories(third/include)
|
2019-12-21 10:50:15 +00:00
|
|
|
aux_source_directory(src DIRSRCS)
|
|
|
|
aux_source_directory(src/pattern PaternSrc)
|
|
|
|
|
2020-04-21 16:45:50 +00:00
|
|
|
|
2020-02-06 18:00:41 +00:00
|
|
|
add_library(General ${DIRSRCS} ${PaternSrc} src/pattern/signleton.h src/pattern/Observer.h src/pattern/stratergy.h src/pattern/adapter.h src/encrypt/base64.cpp src/encrypt/base64.h src/encrypt/aes.cpp src/encrypt/aes.h src/encrypt/rsa.cpp
|
2020-04-18 07:22:27 +00:00
|
|
|
src/math/BigInt.hpp src/net/TcpClient.cpp src/net/TcpClient.h src/net/PackageReceiver.cpp src/net/PackageReceiver.h)
|
2020-04-21 16:45:50 +00:00
|
|
|
set_target_properties(General PROPERTIES LINKER_LANGUAGE CXX)
|
|
|
|
target_link_libraries(General -Wl,--whole-archive third/lib/libevent.a third/lib/libevent_core.a)
|
|
|
|
|
2019-12-21 10:50:15 +00:00
|
|
|
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)
|
2020-04-20 15:56:21 +00:00
|
|
|
message("include dir " ${INCLUDES})
|
2019-12-21 10:50:15 +00:00
|
|
|
|
|
|
|
file(GLOB PatternINCLUDES ${PROJECT_SOURCE_DIR}/src/pattern/*.h)
|
|
|
|
file(COPY ${PatternINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
|
|
|
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
2020-02-10 13:46:47 +00:00
|
|
|
message( "copy pattern library" ${PatternINCLUDES})
|
2020-01-04 17:28:43 +00:00
|
|
|
file(GLOB EncryptINCLUDES ${PROJECT_SOURCE_DIR}/src/encrypt/*.h)
|
|
|
|
file(COPY ${EncryptINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc
|
2020-01-06 17:04:21 +00:00
|
|
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
2020-02-06 18:00:41 +00:00
|
|
|
file(GLOB MathINCLUDES ${PROJECT_SOURCE_DIR}/src/math/*.hpp)
|
2020-02-10 13:46:47 +00:00
|
|
|
message( "copy math library" ${MathINCLUDES})
|
|
|
|
file(COPY ${MathINCLUDES} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/
|
2020-02-06 18:00:41 +00:00
|
|
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
2020-02-10 13:46:47 +00:00
|
|
|
file(GLOB EIGENLIBS ${PROJECT_SOURCE_DIR}/src/math/eigin/*)
|
|
|
|
message( "copy eigen library" ${EIGENLIBS})
|
2020-04-20 17:15:13 +00:00
|
|
|
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)
|
2020-04-20 18:02:54 +00:00
|
|
|
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)
|
2020-04-20 15:56:21 +00:00
|
|
|
IF (WIN32)
|
|
|
|
|
2020-04-20 17:15:13 +00:00
|
|
|
ELSEIF (UNIX)
|
2020-02-10 13:46:47 +00:00
|
|
|
add_custom_command(
|
|
|
|
TARGET General PRE_BUILD
|
2020-04-20 15:56:21 +00:00
|
|
|
COMMAND cp.exe -r
|
2020-02-10 13:46:47 +00:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/math/Eigen
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/obj/inc/
|
|
|
|
)
|
2020-04-20 15:56:21 +00:00
|
|
|
ENDIF ()
|