From 9954f010c50404570f582de2efb88eb8d1a32211 Mon Sep 17 00:00:00 2001 From: Hristo Stamenov Date: Wed, 6 Jan 2021 16:57:19 +0200 Subject: [PATCH] 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. --- examples/CMakeLists.txt | 15 --------------- src/CMakeLists.txt | 16 +++++++++------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 57ba74d47..e3ef3a0fc 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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/") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4df06e271..89c807c22 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 - $ + $ $ 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)