LÖVR submodule improvements;

- Allow parent CMake projects to expose symbols more easily
- Allow for custom plugins folder
- Include directories are always relative to lovr's source dir

Co-authored-by: Ilya Chelyadin <ilya77105@gmail.com>
This commit is contained in:
bjorn 2022-11-09 22:42:50 -08:00
parent cacc5eae71
commit 7d3cc45cc2
2 changed files with 20 additions and 5 deletions

View File

@ -34,8 +34,7 @@ option(LOVR_SYSTEM_OPENXR "Use the system-provided OpenXR" OFF)
option(LOVR_BUILD_EXE "Build an executable (or an apk on Android)" ON)
option(LOVR_BUILD_SHARED "Build a shared library (takes precedence over LOVR_BUILD_EXE)" OFF)
option(LOVR_BUILD_BUNDLE "On macOS, build a .app bundle instead of a raw program" OFF)
set(LOVR_SYMBOL_VISIBILITY "hidden" CACHE STRING "What should the C symbol visibility be? hidden reduces binary size, default lets other binaries use this one.")
option(LOVR_BUILD_WITH_SYMBOLS "Build with C function symbols exposed" OFF)
# Setup
if(EMSCRIPTEN)
@ -299,7 +298,9 @@ endif()
# Plugins
set(LOVR 1)
link_libraries(${LOVR_LUA})
file(GLOB LOVR_PLUGINS ${CMAKE_SOURCE_DIR}/plugins/*)
if(NOT DEFINED LOVR_PLUGINS)
file(GLOB LOVR_PLUGINS ${CMAKE_SOURCE_DIR}/plugins/*)
endif()
foreach(PLUGIN_PATH ${LOVR_PLUGINS})
if(IS_DIRECTORY ${PLUGIN_PATH} AND EXISTS ${PLUGIN_PATH}/CMakeLists.txt)
get_filename_component(PLUGIN "${PLUGIN_PATH}" NAME)
@ -338,10 +339,22 @@ if(NOT LOVR_BUILD_EXE)
target_compile_definitions(lovr PUBLIC LOVR_OMIT_MAIN) # specifically for win32 WinMain
endif()
set_target_properties(lovr PROPERTIES C_VISIBILITY_PRESET ${LOVR_SYMBOL_VISIBILITY})
if(LOVR_BUILD_WITH_SYMBOLS)
set_target_properties(lovr PROPERTIES C_VISIBILITY_PRESET "default")
else()
set_target_properties(lovr PROPERTIES C_VISIBILITY_PRESET "hidden")
endif()
set_target_properties(lovr PROPERTIES C_STANDARD 11)
set_target_properties(lovr PROPERTIES C_STANDARD_REQUIRED ON)
target_include_directories(lovr PRIVATE src src/modules src/lib/stdatomic etc)
target_include_directories(lovr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/modules
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/stdatomic
${CMAKE_CURRENT_SOURCE_DIR}/etc
)
target_link_libraries(lovr
${LOVR_GLFW}
${LOVR_LUA}

View File

@ -2,6 +2,8 @@
#include <stdint.h>
#include <stddef.h>
#pragma once
typedef struct gpu_buffer gpu_buffer;
typedef struct gpu_texture gpu_texture;
typedef struct gpu_sampler gpu_sampler;