Second pass on the example dirs.

They are quite complex so I'm more hesitant to do major changes. Also it works pretty well. Noticed that I forgot one of the seperated files and added it into src/CMakeLists.txt.
This commit is contained in:
Hristo Stamenov 2021-01-06 16:57:19 +02:00
parent 128fb54cd9
commit 9954f010c5
2 changed files with 9 additions and 22 deletions

View File

@ -28,7 +28,6 @@ if (APPLE AND NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
add_definitions(-DGL_SILENCE_DEPRECATION)
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
endif()
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
include(CheckIncludeFile)
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H)
@ -119,19 +118,5 @@ foreach(example_source ${example_sources})
endif()
endforeach()
if (${PLATFORM} MATCHES "Desktop")
# rlgl_standalone can't be linked with raylib because of duplicate rlgl symbols
foreach (example_source "others/rlgl_standalone.c")
# Create the basename for the example
get_filename_component(example_name ${example_source} NAME)
string(REPLACE ".c" "" example_name ${example_name})
add_executable(${example_name} ${example_source})
add_dependencies(${example_name} raylib)
target_link_libraries(${example_name} ${raylib_LDFLAGS})
target_include_directories(${example_name} PRIVATE ${raylib_INCLUDE_DIRS})
endforeach()
endif()
# Copy all of the resource files to the destination
file(COPY ${example_resources} DESTINATION "resources/")

View File

@ -18,9 +18,6 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
include(GlfwImport)
# Get the sources together
set(raylib_public_headers
raylib.h
@ -39,6 +36,9 @@ set(raylib_sources
utils.c
)
include(GlfwImport)
if (USE_AUDIO)
MESSAGE(STATUS "Audio Backend: miniaudio")
list(APPEND raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/raudio.c)
@ -53,7 +53,7 @@ set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
if (STATIC)
MESSAGE(STATUS "Building raylib static library")
add_library(raylib STATIC ${raylib_sources})
add_library(raylib STATIC ${raylib_sources} ${raylib_public_headers})
add_library(raylib_static ALIAS raylib)
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
@ -62,7 +62,7 @@ endif (STATIC)
if (SHARED)
MESSAGE(STATUS "Building raylib shared library")
add_library(raylib SHARED ${raylib_sources})
add_library(raylib SHARED ${raylib_sources} ${raylib_public_headers})
if (MSVC)
target_compile_definitions(raylib
@ -100,7 +100,7 @@ target_compile_definitions(raylib
# Registering include directories
target_include_directories(raylib
PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
@ -111,7 +111,9 @@ target_include_directories(raylib
)
# Copy the header files to the build directory
file(COPY ${raylib_public_headers} DESTINATION ".")
#file(COPY ${raylib_public_headers} DESTINATION ".")
include(InstallConfigurations)
# Print the flags for the user
if (DEFINED CMAKE_BUILD_TYPE)