-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
CMakeLists.txt
67 lines (52 loc) · 2.54 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_minimum_required(VERSION 3.9)
project(Kiwipiepy)
set ( CMAKE_CXX_STANDARD 17 )
set ( CMAKE_VERBOSE_MAKEFILE true )
set ( CMAKE_SKIP_RPATH ON )
set ( CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version" )
add_subdirectory( Kiwi )
if(KIWI_USE_MIMALLOC)
message(STATUS "Use mimalloc allocators")
set ( ADDITIONAL_FLAGS "-DKIWI_USE_MIMALLOC" )
include_directories( Kiwi/third_party/mimalloc/include )
endif()
if(MSVC)
set ( CMAKE_C_FLAGS_DEBUG "-DDEBUG -DC_FLAGS -Zc:__cplusplus -Zi -Od ${ADDITIONAL_FLAGS}" )
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" )
set ( CMAKE_C_FLAGS_RELEASE "-DNDEBUG -DRELEASE -DC_FLAGS -Zc:__cplusplus -O2 -Oi -Gy -DKIWI_USE_BTREE ${ADDITIONAL_FLAGS}" )
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} -Zi /bigobj")
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
set ( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" )
else()
set ( CMAKE_C_FLAGS_DEBUG "-DDEBUG -DC_FLAGS -g3 -O0 ${ADDITIONAL_FLAGS}" )
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" )
set ( CMAKE_EXE_LINKER_FLAGS_DEBUG "-DDEBUG -DLINKER_FLAGS" )
set ( CMAKE_C_FLAGS_RELEASE "-DNDEBUG -DRELEASE -DC_FLAGS -O3 -DKIWI_USE_BTREE ${ADDITIONAL_FLAGS}" )
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" )
set ( CMAKE_EXE_LINKER_FLAGS_RELEASE "-DRELEASE -DLINKER_FLAGS" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} -g3")
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
set ( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" )
endif()
if (APPLE)
message(STATUS "Apple Clang: use undefined=dynamic_lookup")
set(CMAKE_OSX_ARCHITECTURES "${KIWI_CPU_ARCH}")
set ( CMAKE_C_FLAGS_DEBUG "-undefined dynamic_lookup ${CMAKE_C_FLAGS_DEBUG}" )
set ( CMAKE_CXX_FLAGS_DEBUG "-undefined dynamic_lookup ${CMAKE_CXX_FLAGS_DEBUG}" )
set ( CMAKE_C_FLAGS_RELEASE "-undefined dynamic_lookup ${CMAKE_C_FLAGS_RELEASE}" )
set ( CMAKE_CXX_FLAGS_RELEASE "-undefined dynamic_lookup ${CMAKE_CXX_FLAGS_RELEASE}" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "-undefined dynamic_lookup ${CMAKE_C_FLAGS_RELWITHDEBINFO}")
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-undefined dynamic_lookup ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
include_directories(${INCLUDE_DIRS}
Kiwi/include
)
link_directories(${LIBRARY_DIRS})
add_library("_kiwipiepy" SHARED
src/KiwiPy.cpp
)
target_link_libraries("_kiwipiepy" PRIVATE
kiwi_static
${LIBRARIES}
)