mv resources etc;

This commit is contained in:
bjorn 2022-03-30 12:13:53 -07:00
parent 2ec5a1a9dd
commit faa42ee38b
25 changed files with 31 additions and 30 deletions

View File

@ -43,8 +43,8 @@ if(EMSCRIPTEN)
"-s FORCE_FILESYSTEM=1 "
"-s \"EXPORTED_FUNCTIONS=['_main','_lovrDestroy','_webxr_attach','_webxr_detach','_lovrCanvasCreateFromHandle','_lovrCanvasDestroy','_lovrGraphicsSetBackbuffer','_lovrGraphicsSetViewMatrix','_lovrGraphicsSetProjection']\" "
"-s \"EXTRA_EXPORTED_RUNTIME_METHODS=['getValue','setValue']\" "
"--js-library \"${CMAKE_CURRENT_SOURCE_DIR}/src/resources/webxr.js\" "
"--shell-file \"${CMAKE_CURRENT_SOURCE_DIR}/src/resources/lovr.html\""
"--js-library \"${CMAKE_CURRENT_SOURCE_DIR}/etc/webxr.js\" "
"--shell-file \"${CMAKE_CURRENT_SOURCE_DIR}/etc/lovr.html\""
)
if(LOVR_ENABLE_THREAD)
set(LOVR_EMSCRIPTEN_FLAGS "${LOVR_EMSCRIPTEN_FLAGS} -s USE_PTHREADS=1")
@ -321,7 +321,7 @@ endif()
set_target_properties(lovr PROPERTIES C_VISIBILITY_PRESET ${LOVR_SYMBOL_VISIBILITY})
set_target_properties(lovr PROPERTIES C_STANDARD 11)
target_include_directories(lovr PRIVATE src src/modules src/lib/stdatomic)
target_include_directories(lovr PRIVATE src src/modules src/lib/stdatomic etc)
target_link_libraries(lovr
${LOVR_GLFW}
${LOVR_LUA}
@ -430,8 +430,8 @@ if(LOVR_ENABLE_GRAPHICS)
src/api/l_graphics_shader.c
src/api/l_graphics_shaderBlock.c
src/api/l_graphics_texture.c
src/resources/shaders.c
src/lib/glad/glad.c
etc/shaders.c
)
else()
target_compile_definitions(lovr PRIVATE LOVR_DISABLE_GRAPHICS)
@ -517,10 +517,10 @@ else()
endif()
# Resources
file(GLOB LOVR_RESOURCES "src/resources/*.ttf" "src/resources/*.lua")
file(GLOB LOVR_RESOURCES "etc/*.ttf" "etc/*.lua")
foreach(path ${LOVR_RESOURCES})
# Turn the absolute path into a C variable like src_resources_boot_lua
# Turn the absolute path into a C variable like etc_boot_lua
file(RELATIVE_PATH identifier ${CMAKE_CURRENT_SOURCE_DIR} ${path})
string(MAKE_C_IDENTIFIER ${identifier} identifier)
@ -538,7 +538,7 @@ endforeach()
# Platforms
if(WIN32)
target_sources(lovr PRIVATE src/core/os_win32.c)
target_sources(lovr PRIVATE src/resources/lovr.rc)
target_sources(lovr PRIVATE etc/lovr.rc)
if (MSVC)
set_target_properties(lovr PROPERTIES COMPILE_FLAGS "/wd4244 /MP")
else()
@ -588,11 +588,11 @@ elseif(APPLE)
)
if(LOVR_BUILD_BUNDLE)
set(EXE_DIR ${CMAKE_CURRENT_BINARY_DIR}/lovr.app/Contents/MacOS)
target_sources(lovr PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/lovr.icns")
target_sources(lovr PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/etc/lovr.icns")
set_target_properties(lovr PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/Info.plist"
RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/lovr.icns"
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/etc/Info.plist"
RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/etc/lovr.icns"
)
else()
set(EXE_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin)
@ -628,7 +628,7 @@ elseif(APPLE)
elseif(EMSCRIPTEN)
target_sources(lovr PRIVATE src/core/os_wasm.c)
target_compile_definitions(lovr PRIVATE LOVR_WEBGL)
configure_file(src/resources/lovr.ico favicon.ico COPYONLY)
configure_file(etc/lovr.ico favicon.ico COPYONLY)
elseif(ANDROID)
target_sources(lovr PRIVATE src/core/os_android.c)
target_link_libraries(lovr log EGL GLESv3 android dl)
@ -646,7 +646,7 @@ elseif(ANDROID)
if(LOVR_BUILD_EXE)
set(ANDROID_JAR "${ANDROID_SDK}/platforms/${ANDROID_PLATFORM}/android.jar")
set(ANDROID_TOOLS "${ANDROID_SDK}/build-tools/${ANDROID_BUILD_TOOLS_VERSION}")
set(ANDROID_MANIFEST "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/AndroidManifest_${ANDROID_FLAVOR}.xml" CACHE STRING "The AndroidManifest.xml file to use")
set(ANDROID_MANIFEST "${CMAKE_CURRENT_SOURCE_DIR}/etc/AndroidManifest_${ANDROID_FLAVOR}.xml" CACHE STRING "The AndroidManifest.xml file to use")
# If assets are included in the apk then add '-A assets' to aapt, otherwise don't add any flags
if(ANDROID_ASSETS)
@ -677,7 +677,7 @@ elseif(ANDROID)
buildAPK ALL
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy "${ANDROID_MANIFEST}" AndroidManifest.xml
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/src/resources/Activity.java Activity.java
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/etc/Activity.java Activity.java
COMMAND ${Java_JAVAC_EXECUTABLE} -classpath "${ANDROID_JAR}" -d . Activity.java
COMMAND ${ANDROID_TOOLS}/d8 --min-api ${ANDROID_NATIVE_API_LEVEL} --output raw org/lovr/app/Activity.class
COMMAND
@ -755,7 +755,7 @@ elseif(UNIX)
endif()
endfunction()
function(move_app_image_file)
set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/${ARGV0}")
set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/etc/${ARGV0}")
set(DST "${CMAKE_BINARY_DIR}/bin/${ARGV0}")
add_custom_command(TARGET lovr POST_BUILD
DEPENDS ${SRC}

View File

@ -86,6 +86,7 @@ cflags = {
'-Isrc',
'-Isrc/modules',
'-Isrc/lib/stdatomic',
'-Ietc',
}
bin = target == 'android' and 'bin/apk/lib/arm64-v8a' or 'bin'
@ -144,9 +145,9 @@ if target == 'wasm' then
'_lovrGraphicsSetProjection'
]"]]):gsub('\n', '')
if config.headsets.webxr then
lflags += '--js-library src/resources/webxr.js'
lflags += '--js-library etc/webxr.js'
end
lflags += '--shell-file src/resources/lovr.html'
lflags += '--shell-file etc/lovr.html'
extra_outputs += { 'bin/lovr.js', 'bin/lovr.wasm' }
if config.modules.thread then
cflags += '-s USE_PTHREADS=1'
@ -399,12 +400,12 @@ src += (config.modules.audio or config.modules.data) and 'src/lib/miniaudio/*.c'
src += config.modules.data and 'src/lib/jsmn/*.c' or nil
src += config.modules.data and 'src/lib/minimp3/*.c' or nil
src += config.modules.graphics and 'src/lib/glad/*.c' or nil
src += config.modules.graphics and 'src/resources/shaders.c' or nil
src += config.modules.graphics and 'etc/shaders.c' or nil
src += config.modules.math and 'src/lib/noise/*.c' or nil
src += config.modules.thread and 'src/lib/tinycthread/*.c' or nil
res += 'src/resources/*.lua'
res += 'src/resources/*.ttf'
res += 'etc/*.lua'
res += 'etc/*.ttf'
for i = 1, #res do
src.extra_inputs += res[i] .. '.h'
@ -448,7 +449,7 @@ if target == 'android' then
unsigned = 'bin/.lovr.apk.unsigned'
apk = 'bin/lovr.apk'
manifest = config.android.manifest or ('src/resources/AndroidManifest_%s.xml'):format(config.android.flavor)
manifest = config.android.manifest or ('etc/AndroidManifest_%s.xml'):format(config.android.flavor)
package = #config.android.package > 0 and ('--rename-manifest-package ' .. config.android.package) or ''
project = config.android.project and #config.android.project > 0 and ('-A ' .. config.android.project) or ''
@ -459,7 +460,7 @@ if target == 'android' then
tools = config.android.sdk .. '/build-tools/' .. config.android.buildtools
copy(manifest, 'bin/AndroidManifest.xml')
copy('src/resources/Activity.java', java)
copy('etc/Activity.java', java)
tup.rule(java, '^ JAVAC %b^ javac -classpath $(androidjar) -d bin %f', binclass)
tup.rule(binclass, '^ JAR %b^ jar -cf %o -C bin $(class)', jar)
tup.rule(jar, '^ D8 %b^ $(tools)/d8 --min-api $(version) --output bin/apk %f', dex)

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -1,4 +1,4 @@
#include "resources/shaders.h"
#include "shaders.h"
const char* lovrShaderVertexPrefix = ""
"#define VERTEX VERTEX \n"

View File

@ -2,7 +2,7 @@
#include "data/modelData.h"
#include "core/maf.h"
#include "core/map.h"
#include "resources/shaders.h"
#include "shaders.h"
#include <lua.h>
#include <lauxlib.h>

View File

@ -1,8 +1,8 @@
#include "resources/boot.lua.h"
#include "api/api.h"
#include "event/event.h"
#include "core/os.h"
#include "util.h"
#include "boot.lua.h"
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
@ -81,7 +81,7 @@ int main(int argc, char** argv) {
lua_setglobal(L, "arg");
lua_pushcfunction(L, luax_getstack);
if (luaL_loadbuffer(L, (const char*) src_resources_boot_lua, src_resources_boot_lua_len, "@boot.lua") || lua_pcall(L, 0, 1, -2)) {
if (luaL_loadbuffer(L, (const char*) etc_boot_lua, etc_boot_lua_len, "@boot.lua") || lua_pcall(L, 0, 1, -2)) {
fprintf(stderr, "%s\n", lua_tostring(L, -1));
return 1;
}

View File

@ -1,8 +1,8 @@
#include "data/rasterizer.h"
#include "data/blob.h"
#include "data/image.h"
#include "resources/VarelaRound.ttf.h"
#include "util.h"
#include "VarelaRound.ttf.h"
#include "lib/stb/stb_truetype.h"
#include <msdfgen-c.h>
#include <stdlib.h>
@ -28,7 +28,7 @@ Rasterizer* lovrRasterizerCreate(Blob* blob, float size) {
rasterizer->ref = 1;
stbtt_fontinfo* font = &rasterizer->font;
const unsigned char* data = blob ? blob->data : src_resources_VarelaRound_ttf;
const unsigned char* data = blob ? blob->data : etc_VarelaRound_ttf;
if (!stbtt_InitFont(font, data, stbtt_GetFontOffsetForIndex(data, 0))) {
lovrThrow("Problem loading font");
}

View File

@ -2,7 +2,7 @@
#include "graphics/graphics.h"
#include "graphics/shader.h"
#include "graphics/texture.h"
#include "resources/shaders.h"
#include "shaders.h"
#include "util.h"
#include <stdlib.h>
#include <math.h>

View File

@ -4,8 +4,8 @@
#include "graphics/material.h"
#include "graphics/mesh.h"
#include "graphics/texture.h"
#include "resources/shaders.h"
#include "core/maf.h"
#include "shaders.h"
#include <stdlib.h>
#include <float.h>
#include <math.h>

View File

@ -5,10 +5,10 @@
#include "graphics/mesh.h"
#include "graphics/shader.h"
#include "graphics/texture.h"
#include "resources/shaders.h"
#include "data/blob.h"
#include "data/modelData.h"
#include "math/math.h"
#include "shaders.h"
#include <math.h>
#include <limits.h>
#include <string.h>