forked from MetalPhaeton/sayuri
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (58 loc) · 2.72 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
67
68
69
70
# CMakeLists.txt: CMake用設定ファイル。
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Ishibashi Hironori
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# コンパイラの設定。
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
cmake_minimum_required(VERSION 2.8)
# プロジェクト名。
project(SAYURI)
set(VERSION "2013.11.02")
# ソースとヘッダファイルのリスト。
file(GLOB SRCS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)
# デフォルトでリリース用のコンパイルに設定する。
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
# リリース用のコンパイラのオプション設定。
set(CMAKE_C_FLAGSE_RELEASE "-std=c++11 -Wall -g -O2 -march=native")
set(CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -Wall -g -O2 -march=native")
# デバッグ用のコンパイラオプションの設定
set(CMAKE_C_FLAGS_DEBUG "-std=c++11 -Wall -O0 -g -march=native")
set(CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -Wall -O0 -g -march=native")
# プロファイル用オプションの設定。
set(CMAKE_C_FLAGS_PROFILE "-std=c++11 -w -pg -march=native")
set(CMAKE_CXX_FLAGS_PROFILE "-std=c++11 -w -pg -march=native")
# ビルド設定。
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
add_executable(sayuri ${SRCS})
target_link_libraries(sayuri pthread)
add_dependencies(sayuri ${HEADERS})
# CPackの設定。
set(CPACK_SOURCE_PACKAGE_FILE_NAME "sayuri-${VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "/build/;/\\.git/;/\\.gitignore;~$;${CPACK_SOURCE_IGNORE_FILES}")
# CPackを実行。
include(CPack)
# make distで作るように設定を変える。
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)