-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
49 lines (36 loc) · 1.84 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
cmake_minimum_required(VERSION 3.10)
project(pakcpp VERSION 1.0.2)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(UTILS_SOURCES
src/utils/compress.cpp
src/utils/filesys.cpp
)
set(ZOPFLI_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/lib/zopfli"
)
set(UTILS_INCLUDE_DIRS
"${CMAKE_CURRENT_SOURCE_DIR}/src/utils"
)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
#set(CMAKE_CXX_FLAGS "-Ofast -march=native -funroll-loops -finline-functions -fomit-frame-pointer -s -fdata-sections -ffunction-sections -Wl,--gc-sections")
set(CMAKE_C_FLAGS "-O3 -msse4.2 -mlzcnt -mbmi -static -fno-common -fno-record-gcc-switches -DNDEBUG -static -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-unwind-tables -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s")
set(CMAKE_CXX_FLAGS "-O3 -msse4.2 -mlzcnt -mbmi -static -fno-common -fno-record-gcc-switches -DNDEBUG -static -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fno-exceptions -fno-asynchronous-unwind-tables -fno-rtti -fno-unwind-tables -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-s")
set(CMAKE_BUILD_TYPE Release)
include_directories(${ZOPFLI_INCLUDE_DIRS})
include_directories(${UTILS_INCLUDE_DIRS})
add_subdirectory(lib/zopfli) # call zopfli cmakelist
add_library(utils STATIC ${UTILS_SOURCES})
add_executable(pakcpp src/main.cpp)
# target_link_options(pakcpp PRIVATE "-Wl,--gc-sections")
# target_link_options(pakcpp PRIVATE "-Wl,--strip-all")
target_include_directories(libzopfli PRIVATE ZOPFLI_INCLUDE_DIRS)
target_include_directories(utils PRIVATE UTILS_INCLUDE_DIRS)
target_link_libraries(utils PRIVATE libzopfli)
target_link_libraries(pakcpp PRIVATE utils)
#target_link_libraries(pakcpp PRIVATE mcfgthread)
add_custom_command(
TARGET pakcpp
POST_BUILD
COMMAND ${CMAKE_STRIP} --strip-all $<TARGET_FILE:pakcpp>
)