Debian Codegraph @

CMakeLists.txt

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 cmake_minimum_required(VERSION 3.5)
2 project(pacman)
3 set(CMAKE_C_STANDARD 11)
4
5 # Linux -pthread shenanigans
6 if (CMAKE_SYSTEM_NAME STREQUAL Linux)
7 set(THREADS_PREFER_PTHREAD_FLAG ON)
8 find_package(Threads REQUIRED)
9 endif()
10
11 #=== LIBRARY: sokol
12 # add headers to the the file list because they are useful to have in IDEs
13 set(SOKOL_HEADERS
14 sokol/sokol_gfx.h
15 sokol/sokol_app.h
16 sokol/sokol_audio.h
17 sokol/sokol_glue.h)
18 add_library(sokol STATIC sokol/sokol.c ${SOKOL_HEADERS})
19 if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
20 # compile sokol.c as Objective-C
21 target_compile_options(sokol PRIVATE -x objective-c)
22 target_link_libraries(sokol
23 "-framework QuartzCore"
24 "-framework Cocoa"
25 "-framework MetalKit"
26 "-framework Metal"
27 "-framework OpenGL"
28 "-framework AudioToolbox")
29 else()
30 if (CMAKE_SYSTEM_NAME STREQUAL Linux)
31 target_link_libraries(sokol INTERFACE X11 Xi Xcursor GL asound dl m)
32 target_link_libraries(sokol PUBLIC Threads::Threads)
33 endif()
34 endif()
35 target_include_directories(sokol INTERFACE sokol)
36
37 #=== EXECUTABLE: pacman
38 if(CMAKE_SYSTEM_NAME STREQUAL Windows)
39 add_executable(pacman WIN32 pacman.c)
40 else()
41 add_executable(pacman pacman.c)
42 endif()
43 target_link_libraries(pacman sokol)
44 if (CMAKE_SYSTEM_NAME STREQUAL Emscripten)
45 set(CMAKE_EXECUTABLE_SUFFIX ".html")
46 target_link_options(pacman PUBLIC --shell-file ../sokol/shell.html)
47 target_link_options(pacman PUBLIC -sUSE_WEBGL2=1 -sNO_FILESYSTEM=1 -sASSERTIONS=0 -sMALLOC=emmalloc --closure=1)
48 endif()
49 if (MSVC)
50 target_compile_options(pacman PUBLIC /W3)
51 else()
52 target_compile_options(pacman PUBLIC -Wall -Wextra -Wsign-compare)
53 endif()
54
55 # explicitly strip dead code
56 if (CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_SYSTEM_NAME STREQUAL Emscripten)
57 target_link_options(pacman PRIVATE LINKER:-dead_strip)
58 endif()