-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
112 lines (85 loc) · 3.62 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
# CMakeLists.txt for SDL_bgi
# GG, 2021-09-20
# --- Building, thanks to cmake
cmake_minimum_required (VERSION 3.5.0)
set (SDL_BGI_VERSION 2.6.0)
# Project name
project (SDL_bgi VERSION ${SDL_BGI_VERSION} LANGUAGES C)
# Strip the library after building
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s")
# Include SDL2 support for cmake
find_package (SDL2 REQUIRED)
# fix provided by Austin Hurst
include_directories (SDL_bgi ${SDL2_INCLUDE_DIRS})
# Default install directory variables
include (GNUInstallDirs)
# fix stupid bug on Linux
# string (STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
# Find source files
file (GLOB SOURCES src/SDL_bgi.c)
# Include header files
include_directories (src)
# Create shared library
add_library (${PROJECT_NAME} SHARED ${SOURCES})
# fix provided by Austin Hurst
target_link_libraries (SDL_bgi ${SDL2_LIBRARIES})
# Install library
install (TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # Windows
)
# Install library headers
file (GLOB HEADERS src/graphics.h)
install (FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
file (GLOB HEADERS src/SDL_bgi.h)
install (FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SDL2/)
# Install documentation files
install (FILES AUTHORS BUGS ChangeLog INSTALL_Linux.md INSTALL_macOS.md
INSTALL_Windows.md LICENSE README.md sdl_bgi.spec TODO VERSION
DESTINATION ${CMAKE_INSTALL_DOCDIR})
# Install documentation directory
file (GLOB docs doc/*)
install (FILES ${docs} DESTINATION ${CMAKE_INSTALL_DOCDIR}/doc)
# Install man page
file (GLOB man doc/graphics.3.gz)
install (FILES ${man} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
# Install test programs
install (DIRECTORY test/ DESTINATION ${CMAKE_INSTALL_DOCDIR}/test)
# --- Packaging, thanks to cpack
if (EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
include (InstallRequiredSystemLibraries)
if (WIN32)
set (CPACK_GENERATOR "ZIP")
else ()
set (CPACK_GENERATOR "RPM;DEB")
endif()
set (CPACK_PACKAGE_VERSION ${SDL_BGI_VERSION})
set (CPACK_PACKAGE_NAME ${PROJECT_NAME})
set (CONTACT "guido.gonzato@gmail.com")
# DEB (Debian, Ubuntu, Mint) package
set (CPACK_DEBIAN_PACKAGE_NAME "sdl_bgi")
set (CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
set (CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${ARCH_DEB})
set (CPACK_DEBIAN_PACKAGE_MAINTAINER ${CONTACT})
set (CPACK_DEBIAN_PACKAGE_DESCRIPTION "SDL2-based 'GRAPHICS.H' implementation")
set (CPACK_DEBIAN_PACKAGE_SECTION "libs")
set (CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
set (CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set (CPACK_DEBIAN_PACKAGE_DEPENDS "libsdl2-dev (>= 2.0.0)")
# RPM (Fedora) package
set (CPACK_RPM_PACKAGE_SUMMARY "SDL2-based 'GRAPHICS.H' implementation")
set (CPACK_RPM_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
set (CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
set (CPACK_PACKAGE_ARCHITECTURE ${ARCH_RPM})
set (CPACK_RPM_PACKAGE_RELEASE "1")
set (CPACK_RPM_PACKAGE_LICENSE "zlib")
set (CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
set (CPACK_RPM_PACKAGE_VENDOR "GG")
set (CPACK_RPM_PACKAGE_DESCRIPTION "SDL_bgi is a Borland Graphics Interface ('GRAPHICS.H') implementation based on SDL2. This library strictly emulates BGI functions, making it possible to compile SDL2 versions of programs written for Turbo C/Borland C++. ARGB colours, vector fonts, mouse support, and multiple
windows are also implemented; further, native SDL2 functions may be used in SDL_bgi programs.")
set (CPACK_RPM_PACKAGE_REQUIRES "SDL2-devel >= 2.0.0")
set (CPACK_PACKAGE_CONTACT ${CONTACT})
set (CPACK_COMPONENTS_ALL Libraries ApplicationData)
include (CPack)
endif (EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# End of file CMakeLists.txt