-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
55 lines (39 loc) · 1.55 KB
/
CMakeLists.txt
File metadata and controls
55 lines (39 loc) · 1.55 KB
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
cmake_minimum_required(VERSION 3.10)
# Project Name and Language
project(Cryo C)
# 1. Enforce C11 Standard (Modern C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
# 2. Add 'src' to the include path
include_directories(${CMAKE_SOURCE_DIR}/src)
# 3. Define the Main Source File
set(SOURCE_FILES src/main.c)
# 4. Platform Detection & Linking
if(APPLE)
message(STATUS "Build System: Detected macOS (XNU Kernel)")
# --- FIX: Point to the correct file ---
list(APPEND SOURCE_FILES src/platform/mac_impl.c)
# Find Frameworks (Including IOKit for Day 15, AppKit for Day 2.5)
find_library(APP_SERVICES ApplicationServices)
find_library(CORE_FOUNDATION CoreFoundation)
find_library(IO_KIT IOKit)
find_library(APP_KIT AppKit)
# Create the Executable
add_executable(Cryo ${SOURCE_FILES})
# Link Mac Frameworks
target_link_libraries(Cryo ${APP_SERVICES} ${CORE_FOUNDATION} ${IO_KIT} ${APP_KIT})
add_custom_command(TARGET Cryo POST_BUILD
COMMAND codesign --force --sign - "Cryo"
COMMENT "Signing Cryo to keep macOS permissions happy..."
)
elseif(WIN32)
message(STATUS "Build System: Detected Windows (NT Kernel)")
# Add Windows-specific implementation
list(APPEND SOURCE_FILES src/platform/win_impl.c)
# Create the Executable
add_executable(Cryo ${SOURCE_FILES})
# Link Windows Libraries
target_link_libraries(Cryo kernel32 user32 psapi)
else()
message(FATAL_ERROR "OS not supported. This project only runs on macOS and Windows.")
endif()