-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
62 lines (53 loc) · 1.89 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
cmake_minimum_required(VERSION 3.0)
project("nebula-gears" CXX ASM)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static-libgcc -no-pie")
add_compile_options(-O2)
add_compile_options(-s)
add_compile_options(-Wall)
add_compile_options(-Wextra)
add_compile_options(-Werror)
#add_compile_options(-fdebug-prefix-map=${PROJECT_SOURCE_DIR}/=)
include(GNUInstallDirs)
add_subdirectory(etc)
add_subdirectory(scripts)
add_subdirectory(share)
execute_process(
OUTPUT_VARIABLE FULL_VERSION
COMMAND git describe --tags --abbr=0
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(package_name nebula-gears)
configure_file(
${CMAKE_SOURCE_DIR}/aux/self-extractable.sh.in
${CMAKE_BINARY_DIR}/${package_name}-installer-meta.sh
@ONLY
)
set(stage_dir "${CMAKE_BINARY_DIR}/stage")
set(stage_install_prefix "${stage_dir}/${CMAKE_INSTALL_PREFIX}")
set(share_dir "share/nebula-gears")
set(installed_files_file "installed_files")
add_custom_target(
package
COMMAND
make -s
COMMAND
make -s install/strip DESTDIR=${stage_dir}
COMMAND
mkdir -p ${stage_install_prefix}/${share_dir}
COMMAND
find ${stage_install_prefix} -type f -fprint ${stage_install_prefix}/${share_dir}/${installed_files_file}
COMMAND
find ${stage_install_prefix} -type f -fprint ${stage_install_prefix}/${share_dir}/${installed_files_file}
COMMAND
sed -i "s#${stage_install_prefix}/##" ${stage_install_prefix}/${share_dir}/${installed_files_file}
COMMAND
cp -f ${CMAKE_BINARY_DIR}/${package_name}-installer-meta.sh ${package_name}-installer.sh
COMMAND
tar -cJf - -C ${stage_install_prefix} . >> ${CMAKE_BINARY_DIR}/${package_name}-installer.sh
COMMAND
chmod +x ${CMAKE_BINARY_DIR}/${package_name}-installer.sh
)