|
1 |
| -cmake_minimum_required (VERSION 2.8.11) |
2 |
| -project (tic) |
3 |
| - |
4 |
| -set(POLOLU_BUILD FALSE CACHE BOOL |
5 |
| - "True if this software is being built by Pololu, and should use the Pololu logo.") |
6 |
| - |
7 |
| -set(ENABLE_GUI TRUE CACHE BOOL |
8 |
| - "True if you want to build the GUI, which depends on Qt 5.") |
9 |
| - |
10 |
| -set (CLI_NAME "ticcmd") |
11 |
| -set (GUI_NAME "ticgui") |
12 |
| -set (DOCUMENTATION_URL "https://www.pololu.com/docs/0J71") |
13 |
| - |
14 |
| -set (SOFTWARE_VERSION_MAJOR 1) |
15 |
| -set (SOFTWARE_VERSION_MINOR 0) |
16 |
| -set (SOFTWARE_VERSION_PATCH 0) |
17 |
| -set (SOFTWARE_VERSION ${SOFTWARE_VERSION_MAJOR}.${SOFTWARE_VERSION_MINOR}.${SOFTWARE_VERSION_PATCH}) |
18 |
| - |
19 |
| -string(TIMESTAMP YEAR "%Y") |
20 |
| - |
21 |
| -find_package(PkgConfig) |
22 |
| - |
23 |
| -if (NOT CMAKE_BUILD_TYPE) |
24 |
| - set (CMAKE_BUILD_TYPE "Release" CACHE STRING |
25 |
| - "Options are Debug Release RelWithDebInfo MinSizeRel" FORCE) |
26 |
| -endif () |
27 |
| - |
28 |
| -set(USE_SYSTEM_LIBYAML FALSE CACHE BOOL |
29 |
| - "True if you want to use libyaml from the system instead of the bundled one.") |
30 |
| - |
31 |
| -# Our C code uses features from the C99 standard. |
32 |
| -macro(use_c99) |
33 |
| - if (CMAKE_VERSION VERSION_LESS "3.1") |
34 |
| - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") |
35 |
| - set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}") |
36 |
| - endif () |
37 |
| - else () |
38 |
| - set (CMAKE_C_STANDARD 99) |
39 |
| - endif () |
40 |
| -endmacro(use_c99) |
41 |
| - |
42 |
| -# Our C++ code uses features from the C++11 standard. |
43 |
| -macro(use_cxx11) |
44 |
| - if (CMAKE_VERSION VERSION_LESS "3.1") |
45 |
| - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") |
46 |
| - set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}") |
47 |
| - endif () |
48 |
| - else () |
49 |
| - set (CMAKE_CXX_STANDARD 11) |
50 |
| - endif () |
51 |
| -endmacro(use_cxx11) |
52 |
| - |
53 |
| -# Put libraries and executables in the top level of the build directory |
54 |
| -# so that the executables can find the libraries and it is easy to run |
55 |
| -# everything. |
56 |
| -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
57 |
| -set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
58 |
| - |
59 |
| -if (WIN32) |
60 |
| - # Enable correct behavior for the return value of vsnprintf. |
61 |
| - add_definitions (-D__USE_MINGW_ANSI_STDIO=1) |
62 |
| - |
63 |
| - # Enable functions only available in Windows Vista and later. |
64 |
| - add_definitions (-D_WIN32_WINNT=0x0600 -DNTDDI_VERSION=0x06000000) |
65 |
| -endif () |
66 |
| - |
67 |
| -# Detect Linux. |
68 |
| -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") |
69 |
| - set (LINUX 1) |
70 |
| -endif () |
71 |
| - |
72 |
| -# Fix a warning on Mac OS X. |
73 |
| -if (NOT CMAKE_VERSION VERSION_LESS "3.0") |
74 |
| - cmake_policy(SET CMP0042 NEW) |
75 |
| -endif () |
76 |
| - |
77 |
| -include_directories ( |
78 |
| - "${CMAKE_SOURCE_DIR}/include" |
79 |
| - "${CMAKE_BINARY_DIR}/include" |
80 |
| -) |
81 |
| - |
82 |
| -configure_file ( |
83 |
| - "include/config.h.in" |
84 |
| - "include/config.h" |
85 |
| -) |
86 |
| - |
87 |
| -file(WRITE "${CMAKE_BINARY_DIR}/version.txt" "${SOFTWARE_VERSION}") |
88 |
| - |
89 |
| -add_subdirectory (lib) |
90 |
| -add_subdirectory (cli) |
91 |
| - |
92 |
| -if (ENABLE_GUI) |
93 |
| - # TODO: add_subdirectory (gui) |
94 |
| -endif () |
95 |
| - |
96 |
| -if (WIN32) |
97 |
| - # TODO: add_subdirectory (windows-installer) |
98 |
| -endif () |
99 |
| - |
100 |
| -if (APPLE) |
101 |
| - # TODO: add_subdirectory (mac-installer) |
102 |
| -endif () |
103 |
| - |
104 |
| -if (NOT USE_SYSTEM_LIBYAML) |
105 |
| - add_subdirectory (libyaml) |
106 |
| -endif () |
| 1 | +cmake_minimum_required (VERSION 2.8.11) |
| 2 | +project (tic) |
| 3 | + |
| 4 | +set(POLOLU_BUILD FALSE CACHE BOOL |
| 5 | + "True if this software is being built by Pololu, and should use the Pololu logo.") |
| 6 | + |
| 7 | +set(ENABLE_GUI TRUE CACHE BOOL |
| 8 | + "True if you want to build the GUI, which depends on Qt 5.") |
| 9 | + |
| 10 | +set (CLI_NAME "ticcmd") |
| 11 | +set (GUI_NAME "ticgui") |
| 12 | +set (DOCUMENTATION_URL "https://www.pololu.com/docs/0J71") |
| 13 | + |
| 14 | +set (SOFTWARE_VERSION_MAJOR 1) |
| 15 | +set (SOFTWARE_VERSION_MINOR 0) |
| 16 | +set (SOFTWARE_VERSION_PATCH 0) |
| 17 | +set (SOFTWARE_VERSION ${SOFTWARE_VERSION_MAJOR}.${SOFTWARE_VERSION_MINOR}.${SOFTWARE_VERSION_PATCH}) |
| 18 | + |
| 19 | +string(TIMESTAMP YEAR "%Y") |
| 20 | + |
| 21 | +find_package(PkgConfig) |
| 22 | + |
| 23 | +if (NOT CMAKE_BUILD_TYPE) |
| 24 | + set (CMAKE_BUILD_TYPE "Release" CACHE STRING |
| 25 | + "Options are Debug Release RelWithDebInfo MinSizeRel" FORCE) |
| 26 | +endif () |
| 27 | + |
| 28 | +set(USE_SYSTEM_LIBYAML FALSE CACHE BOOL |
| 29 | + "True if you want to use libyaml from the system instead of the bundled one.") |
| 30 | + |
| 31 | +# Our C code uses features from the C99 standard. |
| 32 | +macro(use_c99) |
| 33 | + if (CMAKE_VERSION VERSION_LESS "3.1") |
| 34 | + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 35 | + set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}") |
| 36 | + endif () |
| 37 | + else () |
| 38 | + set (CMAKE_C_STANDARD 99) |
| 39 | + endif () |
| 40 | +endmacro(use_c99) |
| 41 | + |
| 42 | +# Our C++ code uses features from the C++11 standard. |
| 43 | +macro(use_cxx11) |
| 44 | + if (CMAKE_VERSION VERSION_LESS "3.1") |
| 45 | + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 46 | + set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}") |
| 47 | + endif () |
| 48 | + else () |
| 49 | + set (CMAKE_CXX_STANDARD 11) |
| 50 | + endif () |
| 51 | +endmacro(use_cxx11) |
| 52 | + |
| 53 | +# Put libraries and executables in the top level of the build directory |
| 54 | +# so that the executables can find the libraries and it is easy to run |
| 55 | +# everything. |
| 56 | +set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
| 57 | +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
| 58 | + |
| 59 | +if (WIN32) |
| 60 | + # Enable correct behavior for the return value of vsnprintf. |
| 61 | + add_definitions (-D__USE_MINGW_ANSI_STDIO=1) |
| 62 | + |
| 63 | + # Enable functions only available in Windows Vista and later. |
| 64 | + add_definitions (-D_WIN32_WINNT=0x0600 -DNTDDI_VERSION=0x06000000) |
| 65 | +endif () |
| 66 | + |
| 67 | +# Detect Linux. |
| 68 | +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") |
| 69 | + set (LINUX 1) |
| 70 | +endif () |
| 71 | + |
| 72 | +# Fix a warning on Mac OS X. |
| 73 | +if (NOT CMAKE_VERSION VERSION_LESS "3.0") |
| 74 | + cmake_policy(SET CMP0042 NEW) |
| 75 | +endif () |
| 76 | + |
| 77 | +include_directories ( |
| 78 | + "${CMAKE_SOURCE_DIR}/include" |
| 79 | + "${CMAKE_BINARY_DIR}/include" |
| 80 | +) |
| 81 | + |
| 82 | +configure_file ( |
| 83 | + "include/config.h.in" |
| 84 | + "include/config.h" |
| 85 | +) |
| 86 | + |
| 87 | +file(WRITE "${CMAKE_BINARY_DIR}/version.txt" "${SOFTWARE_VERSION}") |
| 88 | + |
| 89 | +add_subdirectory (lib) |
| 90 | +add_subdirectory (cli) |
| 91 | + |
| 92 | +if (ENABLE_GUI) |
| 93 | + # TODO: add_subdirectory (gui) |
| 94 | +endif () |
| 95 | + |
| 96 | +if (WIN32) |
| 97 | + # TODO: add_subdirectory (windows-installer) |
| 98 | +endif () |
| 99 | + |
| 100 | +if (APPLE) |
| 101 | + # TODO: add_subdirectory (mac-installer) |
| 102 | +endif () |
| 103 | + |
| 104 | +if (NOT USE_SYSTEM_LIBYAML) |
| 105 | + add_subdirectory (libyaml) |
| 106 | +endif () |
0 commit comments