2020-04-24 01:25:09 +00:00
|
|
|
cmake_minimum_required(VERSION 3.11)
|
|
|
|
project(General)
|
|
|
|
set(MINGW_PATH $ENV{MINGW_TOOLCHAIN})
|
|
|
|
message("path is " ${MINGW_PATH})
|
|
|
|
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")
|
2020-05-06 10:09:59 +00:00
|
|
|
add_compile_options(-Wall)
|
|
|
|
add_compile_options(-Wsign-compare)
|
|
|
|
add_compile_options(-Werror)
|
|
|
|
add_compile_options(-Wno-unused-function)
|
|
|
|
add_compile_options(-Wno-misleading-indentation)
|
|
|
|
add_compile_options(-Wno-format-overflow)
|
|
|
|
|
2020-04-24 01:25:09 +00:00
|
|
|
# using GCC
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|
|
|
# using Intel C++
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
2020-05-06 05:46:44 +00:00
|
|
|
add_compile_options("/std:c++17")
|
2020-04-24 01:25:09 +00:00
|
|
|
# using Visual Studio C++
|
|
|
|
endif()
|
|
|
|
|
|
|
|
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/obj)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
INCLUDE_DIRECTORIES (./)
|
|
|
|
INCLUDE_DIRECTORIES (inc)
|
|
|
|
INCLUDE_DIRECTORIES (encrypt)
|
|
|
|
INCLUDE_DIRECTORIES (pattern)
|
|
|
|
include_directories(third/include)
|
|
|
|
aux_source_directory(src DIRSRCS)
|
|
|
|
aux_source_directory(src/pattern PaternSrc)
|
|
|
|
|
|
|
|
|
2020-05-21 09:32:56 +00:00
|
|
|
add_library(General OBJECT ${DIRSRCS} ${PaternSrc} src/pattern/signleton.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
|
2020-05-22 03:17:38 +00:00
|
|
|
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)
|
2020-04-24 01:25:09 +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)
|
|
|
|
message("include dir " ${INCLUDES})
|
|
|
|
|
2020-05-05 14:30:14 +00:00
|
|
|
file(GLOB PatternINCLUDES ${PROJECT_SOURCE_DIR}/src/pattern/*)
|
2020-04-24 01:25:09 +00:00
|
|
|
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)
|
2020-05-09 13:20:50 +00:00
|
|
|
|
|
|
|
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)
|
2020-04-24 01:25:09 +00:00
|
|
|
IF (WIN32)
|
2020-05-06 05:46:44 +00:00
|
|
|
message("it is windows 32")
|
2020-04-24 01:25:09 +00:00
|
|
|
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 ()
|