-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
134 lines (112 loc) · 3.55 KB
/
Copy pathCMakeLists.txt
File metadata and controls
134 lines (112 loc) · 3.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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# SPDX-FileCopyrightText: 2026 Kushview, LLC
# SPDX-License-Identifier: ISC
cmake_minimum_required(VERSION 3.20)
project(lui
VERSION 0.0.1
LANGUAGES CXX C
DESCRIPTION "LUI - A Modern C++ UI Library"
)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Require C++20 and C99
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
# Add Objective-C/C++ support on macOS
if(APPLE)
enable_language(OBJCXX OBJC)
endif()
# Option for Node.js bindings compatibility
option(LUI_NODE "Build for Node.js bindings compatibility" OFF)
# Set macOS deployment target for Node.js compatibility
if(LUI_NODE AND APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "13.3" CACHE STRING "Minimum macOS deployment version for Node.js" FORCE)
message(STATUS "Building for Node.js: macOS deployment target set to ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
# Set default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Version info
set(LUI_ABI_VERSION "0.0")
set(LUI_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(LUI_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(LUI_VERSION_MICRO ${PROJECT_VERSION_PATCH})
# Find required packages
find_package(Threads REQUIRED)
# Use pkgconfig to find dependencies
include(FetchContent)
include(FindPkgConfig)
include(GNUInstallDirs)
include(cmake/SetupCairo.cmake)
# Find libepoxy for GL backend (Linux/cross-platform)
if(UNIX AND NOT APPLE)
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(LIBEPOXY epoxy)
endif()
# Find X11 and related libraries for Pugl
find_package(X11 REQUIRED)
endif()
# Python 3 for scripts
find_package(Python3 REQUIRED COMPONENTS Interpreter)
# Add subdirectories
add_subdirectory(src)
find_program(LUA_EXE lua)
if(LUA_EXE)
# Run `lua -v` extract version number
execute_process(
COMMAND ${LUA_EXE} -v
OUTPUT_VARIABLE LUA_VERSION_OUTPUT
ERROR_VARIABLE LUA_VERSION_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE
)
string(REGEX MATCH "Lua ([0-9]+\\.[0-9]+)" LUA_VERSION_MATCH "${LUA_VERSION_OUTPUT}")
if(LUA_VERSION_MATCH)
set(LUA_VERSION ${CMAKE_MATCH_1})
message(STATUS "Lua interpreter found: ${LUA_EXE} (version ${LUA_VERSION})")
else()
message(STATUS "Lua interpreter found, but does not report version: ${LUA_EXE}")
unset(LUA_EXE)
unset(LUA_VERSION)
endif()
endif()
if(CAIRO_FOUND AND LUA_EXE)
add_subdirectory(bindings/lua)
endif()
# Demo
option(LUI_BUILD_DEMO "Build the demo application" ON)
if(LUI_BUILD_DEMO)
add_subdirectory(demo)
endif()
# Tests
option(LUI_BUILD_TESTS "Build unit tests" ON)
if(LUI_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
# Documentation
option(LUI_BUILD_DOCS "Build documentation" ON)
if(LUI_BUILD_DOCS)
add_subdirectory(doc)
endif()
# Install headers
install(
DIRECTORY "${PROJECT_SOURCE_DIR}/include/lui"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/lui-${LUI_ABI_VERSION}"
)
# Print summary
message(STATUS "")
message(STATUS "LUI Build Configuration:")
message(STATUS " Version: ${PROJECT_VERSION}")
message(STATUS " Build Type: ${CMAKE_BUILD_TYPE}")
message(STATUS " Build Demo: ${LUI_BUILD_DEMO}")
message(STATUS " Build Tests: ${LUI_BUILD_TESTS}")
message(STATUS " Build Docs: ${LUI_BUILD_DOCS}")
message(STATUS " Cairo: ${CAIRO_FOUND}")
message(STATUS " Pugl: ${PUGL_FOUND}")
message(STATUS " Python3: ${Python3_EXECUTABLE}")
message(STATUS "")
message(STATUS " Build Type: ${CMAKE_BUILD_TYPE}")
message(STATUS "")