-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
634 lines (606 loc) · 26.5 KB
/
CMakeLists.txt
File metadata and controls
634 lines (606 loc) · 26.5 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
cmake_minimum_required(VERSION 3.15)
project(raylib_module_c LANGUAGES C CXX)
# set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_POLICY_VERSION_MINIMUM 3.5) #need for ode
# if(NOT EXISTS "${CMAKE_BINARY_DIR}/cmake/CPM.cmake")
# file(DOWNLOAD
# "https://github.com/cpm-cmake/CPM.cmake/releases/latest/download/CPM.cmake"
# "${CMAKE_BINARY_DIR}/cmake/CPM.cmake"
# )
# endif()
# include(${CMAKE_BINARY_DIR}/cmake/CPM.cmake)
include(FetchContent)
# Find OpenGL
find_package(OpenGL REQUIRED)
#================================================
# ODE physics 3d
#================================================
FetchContent_Declare(
ode
GIT_REPOSITORY https://bitbucket.org/odedevs/ode.git
GIT_TAG 0.16.6
# EXCLUDE_FROM_ALL #this disable build?
# GIT_SHALLOW TRUE
# USES_TERMINAL_DOWNLOAD TRUE
)
set(ODE_WITH_DEMOS OFF CACHE BOOL "" FORCE)
set(ODE_WITH_TESTS OFF CACHE BOOL "" FORCE)
set(ODE_DOUBLE_PRECISION ON CACHE BOOL "" FORCE) # Explicitly enable double precision
set(ODE_SHARED ON CACHE BOOL "" FORCE) # Build as shared library (DLL)
FetchContent_MakeAvailable(ode)
# Modified (safer)
target_link_options(ODE PRIVATE
-static-libgcc # GNU Compiler Collection
-static-libstdc++ # Uncomment if C++ code is used
-static # Avoid full static linking to prevent issues with system libraries
)
#================================================
# Fetch raylib
#================================================
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 5.5
GIT_SHALLOW TRUE
USES_TERMINAL_DOWNLOAD TRUE
)
FetchContent_MakeAvailable(raylib)
#================================================
# raygui
#================================================
FetchContent_Declare(
raygui
GIT_REPOSITORY https://github.com/raysan5/raygui.git
GIT_TAG 4.0
GIT_SHALLOW TRUE
USES_TERMINAL_DOWNLOAD TRUE
)
FetchContent_MakeAvailable(raygui)
#================================================
# Lua
#================================================
FetchContent_Declare(
lua
GIT_REPOSITORY https://github.com/lua/lua.git
GIT_TAG v5.4.8
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(lua)
#================================================
# Lua doesn't have a CMake build, so we manually compile it
# List Lua source files (core and libraries, excluding lua.c and luac.c)
#================================================
set(LUA_SRC
${lua_SOURCE_DIR}/lapi.c
${lua_SOURCE_DIR}/lauxlib.c
${lua_SOURCE_DIR}/lbaselib.c
${lua_SOURCE_DIR}/lcode.c
${lua_SOURCE_DIR}/lcorolib.c
${lua_SOURCE_DIR}/lctype.c
${lua_SOURCE_DIR}/ldblib.c
${lua_SOURCE_DIR}/ldebug.c
${lua_SOURCE_DIR}/ldo.c
${lua_SOURCE_DIR}/ldump.c
${lua_SOURCE_DIR}/lfunc.c
${lua_SOURCE_DIR}/lgc.c
${lua_SOURCE_DIR}/linit.c
${lua_SOURCE_DIR}/liolib.c
${lua_SOURCE_DIR}/llex.c
${lua_SOURCE_DIR}/lmathlib.c
${lua_SOURCE_DIR}/lmem.c
${lua_SOURCE_DIR}/loadlib.c
${lua_SOURCE_DIR}/lobject.c
${lua_SOURCE_DIR}/lopcodes.c
${lua_SOURCE_DIR}/loslib.c
${lua_SOURCE_DIR}/lparser.c
${lua_SOURCE_DIR}/lstate.c
${lua_SOURCE_DIR}/lstring.c
${lua_SOURCE_DIR}/lstrlib.c
${lua_SOURCE_DIR}/ltable.c
${lua_SOURCE_DIR}/ltablib.c
${lua_SOURCE_DIR}/ltm.c
${lua_SOURCE_DIR}/lundump.c
${lua_SOURCE_DIR}/lvm.c
${lua_SOURCE_DIR}/lzio.c
${lua_SOURCE_DIR}/lutf8lib.c
)
# Create a static Lua library
add_library(lua STATIC ${LUA_SRC})
target_include_directories(lua PUBLIC ${lua_SOURCE_DIR})
#================================================
# ENET
#================================================
FetchContent_Declare(
enet
GIT_REPOSITORY https://github.com/zpl-c/enet.git
GIT_TAG v2.6.5
GIT_SHALLOW TRUE
)
set(ENET_TEST OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(enet)
#================================================
# FLECS
#================================================
FetchContent_Declare(
flecs
GIT_REPOSITORY https://github.com/SanderMertens/flecs.git
GIT_TAG v4.1.1
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(flecs)
#================================================
# CGLM
#================================================
FetchContent_Declare(
cglm
GIT_REPOSITORY https://github.com/recp/cglm.git
GIT_TAG v0.9.6
GIT_PROGRESS TRUE
)
set(CGLM_SHARED OFF CACHE BOOL "" FORCE)
set(CGLM_STATIC ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(cglm)
#================================================
# libevent
#================================================
FetchContent_Declare(
libevent
GIT_REPOSITORY https://github.com/libevent/libevent.git
GIT_TAG release-2.1.12-stable
GIT_PROGRESS TRUE
)
set(EVENT__DISABLE_OPENSSL ON)
set(EVENT__DISABLE_BENCHMARK ON)
set(EVENT__DISABLE_TESTS ON)
set(EVENT__DISABLE_REGRESS ON)
set(EVENT__DISABLE_THREAD_SUPPORT ON)
set(EVENT__DISABLE_SAMPLES ON)
FetchContent_MakeAvailable(libevent)
#================================================
# STB
#================================================
FetchContent_Declare(
stb
GIT_REPOSITORY https://github.com/nothings/stb.git
GIT_TAG master
EXCLUDE_FROM_ALL #this disable build?
GIT_SHALLOW TRUE
USES_TERMINAL_DOWNLOAD TRUE
)
FetchContent_MakeAvailable(stb)
#================================================
# Application
#================================================
set(EXAMPLE_APP ON) #ON OFF bool
# set(EXAMPLE_APP OFF) #ON OFF bool
if(${EXAMPLE_APP})
message(STATUS "EXPORT APP")
set(APP_NAME ril)
set(SRC_FILES
# src/module_cimgui.c # cimgui
# src/module_lua.c # lua
# src/module_enet.c # enet
# src/module_raylib.c # raylib
# src/drawcube.c # raylib
)
add_executable(${APP_NAME}
icon.rc
# ${SRC_FILES}
# src/main.c
# src/example_raygui.c
# src/example_flecs.c
# src/raylib_flecs.c
# src/raylib_raycast.c
# examples/flecs_id.c
# examples/example_window.c
# examples/rl_flecs_test01.c
# examples/rl_flecs_test02.c
# examples/rl_flecs_test03.c
# examples/rl_flecs_test02.c
# examples/raylib3d_flecs_transform_hierarchy07_gui.c
# examples/raylib3d_flecs_transform_hierarchy08_gui.c
# examples/raylib3d_flecs_transform_hierarchy09_gui.c # clean up to simple.
# examples/raylib3d_flecs_transform_hierarchy07.c
# examples/raylib3d_flecs_transform_hierarchy08.c
# examples/raylib3d_flecs_transform_hierarchy10.c
# examples/raylib3d_flecs_transform_hierarchy11.c
# examples/rl_flecs_camera3d.c
# examples/raylib_raycast_picking01.c
# examples/c/raylib_atlas_texture.c
# examples/c/raylib_noise_texture.c
# examples/c/raylib_flecs_models.c
# examples/c/raylib_raycast_picking_hit.c
# examples/c/raylib_third_person.c
# examples/c/raylib_camera_model.c
# examples/c/raylib_text3d.c
# examples/c/raylib_camera_move.c
# examples/c/raylib_camera_model.c
# examples/c/flecs_onload.c
examples/c/flecs_onstart.c
# examples/c/raylib_ode_static_box.c
)
# Link application with custom_cimgui
target_link_libraries(${APP_NAME} PRIVATE
raylib # raylib
# custom_cimgui # cimgui
# lua # lua
flecs # flecs
cglm # cglm
)
# Include directories for the application
target_include_directories(${APP_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/include # include
${lua_SOURCE_DIR} # lua
# ${cimgui_SOURCE_DIR} # imgui
# ${cimgui_SOURCE_DIR}/imgui # imgui
${raylib_SOURCE_DIR}/src # raylib include
${raylib_SOURCE_DIR}/src/external/glfw/include # glfw
# ${enet_SOURCE_DIR}/include # enet
${stb_SOURCE_DIR} # stb
${raygui_SOURCE_DIR}/src # raygui
${cglm_SOURCE_DIR}/include # clgm
)
# Set compile definitions for the application
# this will enable for cimgui windows and graphics defines
target_compile_definitions(${APP_NAME} PRIVATE
# CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1 # cimgui
# IMGUI_DISABLE_OBSOLETE_FUNCTIONS=1 # imgui
# CIMGUI_USE_GLFW=1 # cimgui glfw
# CIMGUI_USE_OPENGL3=1 # cimgui opengl 330
# ENET_IMPLEMENTATION=1 #enet
)
# Windows-specific settings
if(WIN32)
# ws2_32 # network
target_link_libraries(${APP_NAME} PRIVATE ws2_32 gdi32 user32 shell32)
# target_link_options(${APP_NAME} PRIVATE -static-libgcc)
target_link_options(${APP_NAME} PRIVATE
-static-libgcc
-static-libstdc++ # Uncomment if C++ code is used
-static # Avoid full static linking to prevent issues with system libraries
)
endif()
endif()
# set(EXPORT_FLECS_APP ON)
set(EXPORT_FLECS_APP OFF)
if(${EXPORT_FLECS_APP})
set(SRC_FLECS_MODULES
src/ecs_components.c
src/module_dev.c
src/module_enet.c # not there no define...
src/module_ode.c
src/module_libevent.c
src/raygui_impl.c # define RAYGUI_IMPLEMENTATION
src/enet_impl.c # define ENET_IMPLEMENTATION
)
message(STATUS "EXPORT FLECS APP")
set(APP_FLECS_NAME1 rlm)
add_executable(${APP_FLECS_NAME1}
${SRC_FLECS_MODULES}
# src/main_camera_capsule.c
# src/main_raylib_shape_wires.c
# src/main_camera_picking.c
# src/main_camera_test01.c
# src/main_camera_test02.c
# src/main_editor_test.c
# src/main_enet_test.c
# src/main_ode_gui_test.c
# src/main_ode_test.c
# src/main_ode_controller_test.c
# src/main_raylib_libevent_test.c
# src/main_editor_test.c
src/main_editor_test.c
# src/main_transform_3d_hierarchy_test.c
# src/main_transform_3d_hierarchy_test01.c
# src/main_transform_3d_hierarchy_test02.c
# src/main.c
# examples/module/main_transform_3d_hierarchy_test01.c
# examples/module/main_transform_3d_hierarchy_test02.c
)
target_compile_definitions(${APP_FLECS_NAME1} PRIVATE
# RAYGUI_IMPLEMENTATION=1
)
# Link application with custom_cimgui
target_link_libraries(${APP_FLECS_NAME1} PRIVATE
raylib # raylib
# lua # lua
flecs # flecs
cglm # cglm
ODE # ode must be cap from ode repo cmake config
event_shared
# event_core_shared
)
# Include directories for the application
target_include_directories(${APP_FLECS_NAME1} PUBLIC
${PROJECT_SOURCE_DIR}/include # include
${lua_SOURCE_DIR} # lua
${raylib_SOURCE_DIR}/src # raylib include
${raylib_SOURCE_DIR}/src/external/glfw/include # glfw
${enet_SOURCE_DIR}/include # enet
# ${stb_SOURCE_DIR} # stb
${raygui_SOURCE_DIR}/src # raygui
${cglm_SOURCE_DIR}/include # clgm
# ${ode_SOURCE_DIR}/include #
${ode_BINARY_DIR}/include #
${libevent_SOURCE_DIR}/include #
${libevent_BINARY_DIR}/include # event2/event-config.h
)
# Windows-specific settings
if(WIN32)
# ws2_32 # network
target_link_libraries(${APP_FLECS_NAME1} PRIVATE
ws2_32 # Winsock 2
gdi32 # Graphics Device Interface
user32 # Windows user interface
shell32 # Windows
ws2_32 # network socket
)
# target_link_options(${APP_NAME} PRIVATE -static-libgcc)
target_link_options(${APP_FLECS_NAME1} PRIVATE
-static-libgcc # GNU Compiler Collection
-static-libstdc++ # Uncomment if C++ code is used
-static # Avoid full static linking to prevent issues with system libraries
)
endif()
endif()
set(EXPORT_BE_APP OFF)
# set(EXPORT_FLECS_APP OFF)
if(${EXPORT_BE_APP})
message(STATUS "EXPORT LIBEVENT APP")
set(APP_LEVENT_NAME rl_lev)
add_executable(${APP_LEVENT_NAME}
examples/c/raylib_event_base_dispatch.c
)
target_compile_definitions(${APP_LEVENT_NAME} PRIVATE
# RAYGUI_IMPLEMENTATION=1
)
# Link application with custom_cimgui
target_link_libraries(${APP_LEVENT_NAME} PRIVATE
raylib # raylib
# Libevent::core
# libevent::core
event_shared
event_core_shared
# libevent
# lua # lua
# flecs # flecs
# cglm # cglm
# ODE # ode must be cap from ode repo cmake config
)
# Include directories for the application
target_include_directories(${APP_LEVENT_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/include # include
# ${lua_SOURCE_DIR} # lua
${raylib_SOURCE_DIR}/src # raylib include
# ${raylib_SOURCE_DIR}/src/external/glfw/include # glfw
# ${enet_SOURCE_DIR}/include # enet
# ${stb_SOURCE_DIR} # stb
${raygui_SOURCE_DIR}/src # raygui
# ${cglm_SOURCE_DIR}/include # clgm
# ${ode_SOURCE_DIR}/include #
# ${ode_BINARY_DIR}/include #
${libevent_SOURCE_DIR}/include #
${libevent_BINARY_DIR}/include # event2/event-config.h
)
# Windows-specific settings
if(WIN32)
# ws2_32 # network
target_link_libraries(${APP_LEVENT_NAME} PRIVATE
ws2_32 # Winsock 2
gdi32 # Graphics Device Interface
user32 # Windows user interface
shell32 # Windows
ws2_32 # network socket
)
# target_link_options(${APP_NAME} PRIVATE -static-libgcc)
target_link_options(${APP_LEVENT_NAME} PRIVATE
-static-libgcc # GNU Compiler Collection
-static-libstdc++ # Uncomment if C++ code is used
-static # Avoid full static linking to prevent issues with system libraries
)
endif()
endif()
set(EXPORT_ENET_APP OFF)
# set(EXPORT_FLECS_APP OFF)
if(${EXPORT_ENET_APP})
message(STATUS "EXPORT ENET APP")
set(APP_ENET_CLIENT_NAME enet_client)
add_executable(${APP_ENET_CLIENT_NAME}
src/enet_client.c
)
# Link application with custom_cimgui
target_link_libraries(${APP_ENET_CLIENT_NAME} PRIVATE
raylib # raylib
flecs # flecs
# cglm # cglm
# ODE # ode must be cap from ode repo cmake config
)
# Include directories for the application
target_include_directories(${APP_ENET_CLIENT_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/include # include
${lua_SOURCE_DIR} # lua
${raylib_SOURCE_DIR}/src # raylib include
${raylib_SOURCE_DIR}/src/external/glfw/include # glfw
${enet_SOURCE_DIR}/include # enet
# ${stb_SOURCE_DIR} # stb
${raygui_SOURCE_DIR}/src # raygui
${cglm_SOURCE_DIR}/include # clgm
# ${ode_SOURCE_DIR}/include #
# ${ode_BINARY_DIR}/include #
)
# Windows-specific settings
if(WIN32)
target_link_libraries(${APP_ENET_CLIENT_NAME} PRIVATE
ws2_32 # Winsock 2
gdi32 # Graphics Device Interface
user32 # Windows user interface
shell32 # Windows
ws2_32 # network socket
)
target_link_options(${APP_ENET_CLIENT_NAME} PRIVATE
-static-libgcc # GNU Compiler Collection
-static-libstdc++ # Uncomment if C++ code is used
-static # Avoid full static linking to prevent issues with system libraries
)
endif()
set(APP_ENET_SERVER_NAME enet_server)
add_executable(${APP_ENET_SERVER_NAME}
src/enet_server.c
)
# Link application with custom_cimgui
target_link_libraries(${APP_ENET_SERVER_NAME} PRIVATE
raylib # raylib
flecs # flecs
# cglm # cglm
# ODE # ode must be cap from ode repo cmake config
)
# Include directories for the application
target_include_directories(${APP_ENET_SERVER_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/include # include
${lua_SOURCE_DIR} # lua
${raylib_SOURCE_DIR}/src # raylib include
${raylib_SOURCE_DIR}/src/external/glfw/include # glfw
${enet_SOURCE_DIR}/include # enet
# ${stb_SOURCE_DIR} # stb
${raygui_SOURCE_DIR}/src # raygui
${cglm_SOURCE_DIR}/include # clgm
# ${ode_SOURCE_DIR}/include #
# ${ode_BINARY_DIR}/include #
)
# Windows-specific settings
if(WIN32)
target_link_libraries(${APP_ENET_SERVER_NAME} PRIVATE
ws2_32 # Winsock 2
gdi32 # Graphics Device Interface
user32 # Windows user interface
shell32 # Windows
ws2_32 # network socket
)
target_link_options(${APP_ENET_SERVER_NAME} PRIVATE
-static-libgcc # GNU Compiler Collection
-static-libstdc++ # Uncomment if C++ code is used
-static # Avoid full static linking to prevent issues with system libraries
)
endif()
endif()
# set(EXPORT_ODE_APP ON)
set(EXPORT_FLECS_APP OFF)
if(${EXPORT_ODE_APP})
set(APP_ODE_NAME rl_flecs_ode)
add_executable(${APP_ODE_NAME}
# examples/c/raylib_flecs_ode_gui03.c
# examples/c/raylib_flecs_ode_controller.c
# examples/c/raylib_ode_static_box.c
# examples/c/raylib_ode_capsule_mesh.c
examples/c/raylib_ode_capsule_controller.c
# examples/c/raylib_physics_ode_simple.c
# examples/c/raylib_physics_ode_collision_sensor.c
)
# Link application with custom_cimgui
target_link_libraries(${APP_ODE_NAME} PRIVATE
raylib # raylib
flecs # flecs
# cglm # cglm
ODE # ode must be cap from ode repo cmake config
)
# Include directories for the application
target_include_directories(${APP_ODE_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/include # include
${lua_SOURCE_DIR} # lua
${raylib_SOURCE_DIR}/src # raylib include
${raylib_SOURCE_DIR}/src/external/glfw/include # glfw
${enet_SOURCE_DIR}/include # enet
# ${stb_SOURCE_DIR} # stb
${raygui_SOURCE_DIR}/src # raygui
${cglm_SOURCE_DIR}/include # clgm
# ${ode_SOURCE_DIR}/include #
${ode_BINARY_DIR}/include #
)
# Windows-specific settings
if(WIN32)
target_link_libraries(${APP_ODE_NAME} PRIVATE
ws2_32 # Winsock 2
gdi32 # Graphics Device Interface
user32 # Windows user interface
shell32 # Windows
ws2_32 # network socket
)
target_link_options(${APP_ODE_NAME} PRIVATE
-static-libgcc # GNU Compiler Collection
-static-libstdc++ # Uncomment if C++ code is used
-static # Avoid full static linking to prevent issues with system libraries
)
endif()
endif()
set(EXPORT_EXAMPLES_APP OFF) #ON OFF bool
# set(EXPORT_EX_APP ON) #ON OFF bool
if(${EXPORT_EXAMPLES_APP})
# Define the list of example source files
set(examples
# src/main01.c
# src/main02.c
# examples/c/raylib_physics_ode.c # Include your physics test file
# examples/c/rl_flecs_camera3d_cube_picking03.c #
examples/c/raylib_camera_move.c #
)
set(SRC_MODULES
src/raygui_impl.c # define RAYGUI_IMPLEMENTATION
# src/ecs_components.c
# src/module_dev.c
# src/module_enet.c # not there no define...
# src/module_ode.c
)
# Loop over each example to create separate executables
foreach(example ${examples})
# Extract the filename without extension to use as the executable name
get_filename_component(example_name ${example} NAME_WE)
set(APP_FLECS_NAME "ex_${example_name}") # e.g., ex_main01, ex_main02
# Create executable for the current example
add_executable(${APP_FLECS_NAME}
${SRC_MODULES}
${example}
)
# target_compile_definitions(${APP_FLECS_NAME} PRIVATE
# RAYGUI_IMPLEMENTATION # src/raygui_impl.c
# )
# Link application with libraries
target_link_libraries(${APP_FLECS_NAME} PRIVATE
raylib # raylib
flecs # flecs
cglm # cglm
ODE # ode
)
# Include directories for the application
target_include_directories(${APP_FLECS_NAME} PUBLIC
${PROJECT_SOURCE_DIR}/include # include
${lua_SOURCE_DIR} # lua
${raylib_SOURCE_DIR}/src # raylib include
${raylib_SOURCE_DIR}/src/external/glfw/include # glfw
${enet_SOURCE_DIR}/include # enet
# ${stb_SOURCE_DIR} # stb
${raygui_SOURCE_DIR}/src # raygui
${cglm_SOURCE_DIR}/include # clgm
# ${ode_SOURCE_DIR}/include #
${ode_BINARY_DIR}/include #
)
# Windows-specific settings
if(WIN32)
target_link_libraries(${APP_FLECS_NAME} PRIVATE
ws2_32 # Winsock 2
gdi32 # Graphics Device Interface
user32 # Windows user interface
shell32 # Windows
ws2_32 # network socket
)
target_link_options(${APP_FLECS_NAME} PRIVATE
-static-libgcc # GNU Compiler Collection
-static-libstdc++ # Uncommented since you might use C++ with cglm/flecs
-static # Avoid full static linking
)
endif()
endforeach()
message(STATUS "EXPORT FLECS APPS")
endif()