-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
58 lines (47 loc) · 1.61 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
# Minimum required CMake version
cmake_minimum_required(VERSION 3.10)
# Project name and C++ standard
project(Crocodile)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_STANDARD 20)
# Enable compile_commands.json generation
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Find raylib via pkg-config
find_package(PkgConfig REQUIRED)
pkg_check_modules(RAYLIB REQUIRED raylib)
# Source files
file(GLOB_RECURSE SOURCES src/*.cpp)
# Include directories
include_directories(
${CMAKE_SOURCE_DIR}/include # Custom headers
${RAYLIB_INCLUDE_DIRS} # Raylib headers
/opt/homebrew/opt/llvm/include/c++/v1
/opt/homebrew/opt/llvm/include
)
# Link directories
link_directories(${CMAKE_SOURCE_DIR}/lib)
link_directories(${RAYLIB_LIBRARY_DIRS})
link_directories(/opt/homebrew/opt/llvm/lib)
# Set RPATH for runtime library resolution
#set(CMAKE_SKIP_BUILD_RPATH FALSE)
#set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
#set(CMAKE_INSTALL_RPATH "@loader_path")
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Create the executable
add_executable(build ${SOURCES})
# Add raygui include directory
#target_include_directories(${PROJECT_NAME} PRIVATE lib/raygui/src)
# Link libraries
target_link_libraries(build
${RAYLIB_LIBRARIES} # Link raylib from pkg-config
GLESv2 # Link libGLESv2
EGL # Link libEGL
)
# Set runtime search paths for libraries
set_target_properties(build PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin
INSTALL_RPATH "@executable_path/../lib"
BUILD_WITH_INSTALL_RPATH ON
LINK_FLAGS "-Wl,-rpath,@executable_path/../lib"
)