-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
112 lines (91 loc) · 2.31 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
cmake_minimum_required(VERSION 3.5)
project(libembroidery VERSION 1.0.0 LANGUAGES C)
set(CMAKE_C_STANDARD 90)
set(CMAKE_C_STANDARD_REQUIRED True)
option( EMBROIDERY_BUILD_SHARED_LIBS "Build shared library." ON )
option( EMBROIDERY_BUILD_CLI "Build embroider command line tool." ON )
option( EMBROIDERY_TESTING "Run tests." ON )
if (WIN32)
#add_compile_options(
# -O2
#)
else (WIN32)
add_compile_options(
-g
-O2
-fPIC
-std=c99
# -pedantic
# -Wall
# -Wextra
# -Werror
)
endif (WIN32)
add_library(embroidery_static STATIC
src/embroidery.c
src/embroidery.h)
if(EMBROIDERY_BUILD_SHARED_LIBS)
add_library(embroidery SHARED
src/embroidery.c
src/embroidery.h)
target_compile_definitions(embroidery PUBLIC LIBEMBROIDERY_SHARED)
endif()
if(EMBROIDERY_BUILD_CLI)
add_executable(embroider
src/main.c
src/embroidery.c
src/embroidery.h)
target_compile_definitions(embroider PUBLIC LIBEMBROIDERY_CLI)
if (WIN32)
else (WIN32)
target_link_libraries(embroider PRIVATE m)
endif (WIN32)
endif()
if(EMBROIDERY_BUILD_SHARED_LIBS)
if(WIN32)
# TODO: Test this.
# https://cmake.org/cmake/help/book/mastering-cmake/chapter/Install.html
install(
FILES src/embroidery.h
DESTINATION "<SystemDrive>/Program Files/<Project Name>"
)
install(
TARGETS
embroidery
embroidery_static
embroider
EXPORT embroidery
LIBRARY DESTINATION "<SystemDrive>/Program Files/<Project Name>"
ARCHIVE DESTINATION "<SystemDrive>/Program Files/<Project Name>"
RUNTIME DESTINATION "<SystemDrive>/Program Files/<Project Name>"
)
else(WIN32)
include(GNUInstallDirs)
install(
FILES src/embroidery.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
TARGETS
embroidery
embroidery_static
embroider
EXPORT embroidery
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif(WIN32)
endif()
# https://cmake.org/cmake/help/book/mastering-cmake/chapter/Packaging%20With%20CPack.html
if(WIN32)
set(CPACK_GENERATOR "WIX")
set(CPACK_SOURCE_GENERATOR "WIX")
else(WIN32)
set(CPACK_GENERATOR "DEB")
set(CPACK_SOURCE_GENERATOR "DEB")
endif(WIN32)
set(CPACK_PACKAGE_DIRECTORY build)
set(CPACK_PACKAGE_VENDOR "The Embroidermodder Team")
set(CPACK_SOURCE_IGNORE_FILES .git .github)
include(CPack)