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:
parent
128fb54cd9
commit
9954f010c5
|
|
@ -28,7 +28,6 @@ if (APPLE AND NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
|
||||||
add_definitions(-DGL_SILENCE_DEPRECATION)
|
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||||
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
||||||
endif()
|
endif()
|
||||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H)
|
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H)
|
||||||
|
|
@ -119,19 +118,5 @@ foreach(example_source ${example_sources})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
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
|
# Copy all of the resource files to the destination
|
||||||
file(COPY ${example_resources} DESTINATION "resources/")
|
file(COPY ${example_resources} DESTINATION "resources/")
|
||||||
|
|
|
||||||
|
|
@ -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")
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
include(GlfwImport)
|
|
||||||
|
|
||||||
# Get the sources together
|
# Get the sources together
|
||||||
set(raylib_public_headers
|
set(raylib_public_headers
|
||||||
raylib.h
|
raylib.h
|
||||||
|
|
@ -39,6 +36,9 @@ set(raylib_sources
|
||||||
utils.c
|
utils.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include(GlfwImport)
|
||||||
|
|
||||||
|
|
||||||
if (USE_AUDIO)
|
if (USE_AUDIO)
|
||||||
MESSAGE(STATUS "Audio Backend: miniaudio")
|
MESSAGE(STATUS "Audio Backend: miniaudio")
|
||||||
list(APPEND raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/raudio.c)
|
list(APPEND raylib_sources ${CMAKE_CURRENT_SOURCE_DIR}/raudio.c)
|
||||||
|
|
@ -53,7 +53,7 @@ set(LIBS_PRIVATE ${LIBS_PRIVATE} ${OPENAL_LIBRARY})
|
||||||
if (STATIC)
|
if (STATIC)
|
||||||
MESSAGE(STATUS "Building raylib static library")
|
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_library(raylib_static ALIAS raylib)
|
||||||
|
|
||||||
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
|
add_test("pkg-config--static" ${PROJECT_SOURCE_DIR}/../cmake/test-pkgconfig.sh --static)
|
||||||
|
|
@ -62,7 +62,7 @@ endif (STATIC)
|
||||||
|
|
||||||
if (SHARED)
|
if (SHARED)
|
||||||
MESSAGE(STATUS "Building raylib shared library")
|
MESSAGE(STATUS "Building raylib shared library")
|
||||||
add_library(raylib SHARED ${raylib_sources})
|
add_library(raylib SHARED ${raylib_sources} ${raylib_public_headers})
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_compile_definitions(raylib
|
target_compile_definitions(raylib
|
||||||
|
|
@ -100,7 +100,7 @@ target_compile_definitions(raylib
|
||||||
# Registering include directories
|
# Registering include directories
|
||||||
target_include_directories(raylib
|
target_include_directories(raylib
|
||||||
PUBLIC
|
PUBLIC
|
||||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
$<INSTALL_INTERFACE:include>
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
|
@ -111,7 +111,9 @@ target_include_directories(raylib
|
||||||
)
|
)
|
||||||
|
|
||||||
# Copy the header files to the build directory
|
# 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
|
# Print the flags for the user
|
||||||
if (DEFINED CMAKE_BUILD_TYPE)
|
if (DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user