Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 865ccf0

Browse files
committedJul 29, 2018
CMake: include rlgl_standalone in -DBUILD_EXAMPLES
With the recent CMake cleanup, getting raylib's dependencies for use when building rlgl_standalone is quite straight forward, so lets enable it again. Fixes #508, just properly this time. :)
1 parent 4e31732 commit 865ccf0

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed
 

‎examples/CMakeLists.txt

+20-3
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ foreach(example_dir ${example_dirs})
2525
endforeach()
2626

2727
include(CheckIncludeFiles)
28-
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
29-
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c) # see #588
3028
set(OUTPUT_EXT)
29+
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
3130

3231
if(${PLATFORM} MATCHES "Android")
3332
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
33+
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/standard_lighting.c)
3434
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_picking.c)
3535
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_vr_simulator.c)
3636
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/core/core_3d_camera_free.c)
@@ -49,12 +49,16 @@ if(${PLATFORM} MATCHES "Android")
4949
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_custom_uniform.c)
5050
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_model_shader.c)
5151
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/shaders/shaders_postprocessing.c)
52+
5253
elseif(${PLATFORM} MATCHES "Web")
5354
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1")
5455
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --shell-file ${CMAKE_SOURCE_DIR}/templates/web_shell/shell.html")
5556
set(OUTPUT_EXT ".html")
57+
5658
endif()
5759

60+
include_directories(BEFORE SYSTEM others/external/include)
61+
5862
if (NOT TARGET raylib)
5963
find_package(raylib 2.0 REQUIRED)
6064
endif()
@@ -68,9 +72,22 @@ foreach(example_source ${example_sources})
6872
# Setup the example
6973
add_executable(${example_name} ${example_source})
7074

71-
# Link the libraries
7275
target_link_libraries(${example_name} raylib)
7376
endforeach()
7477

78+
if (${PLATFORM} MATCHES "Desktop")
79+
# rlgl_standalone can't be linked with raylib because of duplicate rlgl symbols
80+
foreach (example_source "others/rlgl_standalone.c")
81+
# Create the basename for the example
82+
get_filename_component(example_name ${example_source} NAME)
83+
string(REPLACE ".c" "${OUTPUT_EXT}" example_name ${example_name})
84+
add_executable(${example_name} ${example_source})
85+
add_dependencies(${example_name} raylib)
86+
target_link_libraries(${example_name} ${raylib_LDFLAGS})
87+
target_include_directories(${example_name} PRIVATE ${raylib_INCLUDE_DIRS})
88+
89+
endforeach()
90+
endif()
91+
7592
# Copy all of the resource files to the destination
7693
file(COPY ${example_resources} DESTINATION "resources/")

0 commit comments

Comments
 (0)
Please sign in to comment.