-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Thanks for the help with cmake configuration for those platforms, i been using your project slightly modified, this is a small improvement that can be added to all supported platforms.
- windows same copying the files to bin's directory
if(MSVC)
add_executable(${PROJECT_NAME} ${SOURCES})
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assets)
endif()
- here we can ask emscripten to load/mount the directory
if(EMSCRIPTEN)
set(CMAKE_EXECUTABLE_SUFFIX ".html")
add_executable(${PROJECT_NAME} ${SOURCES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++11-narrowing")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --preload-file ${CMAKE_SOURCE_DIR}/assets@/assets")
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assets)
endif()- android required me to link android/log ( GLESv2 is only required if willing to use opengles 2.0)
if(ANDROID)
add_library(${PROJECT_NAME} SHARED ${SOURCES})
target_link_libraries(${PROJECT_NAME} PUBLIC android log GLESv2)
endif()- android task to copy assets before building
tasks.register('copyDependencies') {
copy {
from '../../assets'
into 'src/main/res/drawable'
include 'icon.png'
}
copy {
from '../../../assets'
into 'src/main/assets'
}
}
preBuild.dependsOn copyDependencies- on ios/macosx we can add directly through resources the files instead 1 by 1 ( also works for source files )
set(RESOURCES "${CMAKE_SOURCE_DIR}/assets")
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${SOURCES} ${RESOURCES} )
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
RESOURCE "${RESOURCES}")
target_link_libraries(${PROJECT_NAME} PRIVATE objc stdc++)KorolevSoftware, JaxkDev, is-tg, elmarsan, martinstarkov and 1 more
Metadata
Metadata
Assignees
Labels
No labels