mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-12 02:41:14 +00:00
build
This commit is contained in:
parent
b06f05ccf9
commit
d8fe5f960f
83
3rdparty/CMakeLists.txt
vendored
83
3rdparty/CMakeLists.txt
vendored
@ -48,31 +48,33 @@ add_library(libsmacker STATIC
|
||||
)
|
||||
target_include_directories(libsmacker PUBLIC ${libsmacker_SOURCE_DIR})
|
||||
|
||||
if(DOWNLOAD_DEPENDENCIES)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
imgui
|
||||
GIT_REPOSITORY "https://github.com/ocornut/imgui"
|
||||
GIT_TAG f5befd2d29e66809cd1110a152e375a7f1981f06
|
||||
)
|
||||
FetchContent_MakeAvailable(imgui)
|
||||
else()
|
||||
set(imgui_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
|
||||
endif()
|
||||
if(ISLE_DEBUG)
|
||||
if(DOWNLOAD_DEPENDENCIES)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
imgui
|
||||
GIT_REPOSITORY "https://github.com/ocornut/imgui"
|
||||
GIT_TAG f5befd2d29e66809cd1110a152e375a7f1981f06
|
||||
)
|
||||
FetchContent_MakeAvailable(imgui)
|
||||
else()
|
||||
set(imgui_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
|
||||
endif()
|
||||
|
||||
add_library(imgui STATIC
|
||||
${imgui_SOURCE_DIR}/imgui.cpp
|
||||
${imgui_SOURCE_DIR}/imgui_draw.cpp
|
||||
${imgui_SOURCE_DIR}/imgui_tables.cpp
|
||||
${imgui_SOURCE_DIR}/imgui_widgets.cpp
|
||||
${imgui_SOURCE_DIR}/imgui_demo.cpp
|
||||
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp
|
||||
${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.cpp
|
||||
)
|
||||
target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
|
||||
target_link_libraries(imgui PUBLIC SDL3::Headers)
|
||||
target_link_libraries(imgui PRIVATE SDL3::SDL3)
|
||||
set_property(TARGET imgui PROPERTY CXX_CLANG_TIDY "")
|
||||
add_library(imgui STATIC
|
||||
${imgui_SOURCE_DIR}/imgui.cpp
|
||||
${imgui_SOURCE_DIR}/imgui_draw.cpp
|
||||
${imgui_SOURCE_DIR}/imgui_tables.cpp
|
||||
${imgui_SOURCE_DIR}/imgui_widgets.cpp
|
||||
${imgui_SOURCE_DIR}/imgui_demo.cpp
|
||||
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp
|
||||
${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.cpp
|
||||
)
|
||||
target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
|
||||
target_link_libraries(imgui PUBLIC SDL3::Headers)
|
||||
target_link_libraries(imgui PRIVATE SDL3::SDL3)
|
||||
set_property(TARGET imgui PROPERTY CXX_CLANG_TIDY "")
|
||||
endif()
|
||||
|
||||
if(DOWNLOAD_DEPENDENCIES)
|
||||
include(FetchContent)
|
||||
@ -93,3 +95,36 @@ add_library(libweaver STATIC
|
||||
${libweaver_SOURCE_DIR}/lib/sitypes.cpp
|
||||
)
|
||||
target_include_directories(libweaver PUBLIC ${libweaver_SOURCE_DIR}/lib)
|
||||
|
||||
if(USE_SDL2)
|
||||
if(DOWNLOAD_DEPENDENCIES)
|
||||
# include(FetchContent)
|
||||
# FetchContent_Declare(
|
||||
# SDL2
|
||||
# GIT_REPOSITORY "https://github.com/libsdl-org/SDL.git"
|
||||
# GIT_TAG 5d249570393f7a37e037abf22cd6012a4cc56a71
|
||||
# EXCLUDE_FROM_ALL
|
||||
# )
|
||||
# FetchContent_MakeAvailable(SDL2)
|
||||
# Find SDL2 normally
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
endif()
|
||||
|
||||
file(GLOB SDL2_HEADERS "${SDL2_INCLUDE_DIR}/*.h")
|
||||
foreach(header IN LISTS SDL2_HEADERS)
|
||||
get_filename_component(fname ${header} NAME)
|
||||
configure_file(${header} ${CMAKE_CURRENT_BINARY_DIR}/sdl3-shim/SDL3/${fname} COPYONLY)
|
||||
endforeach()
|
||||
|
||||
|
||||
add_library(SDL3_shim INTERFACE)
|
||||
target_link_libraries(SDL3_shim INTERFACE SDL2::SDL2)
|
||||
target_include_directories(SDL3_shim INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/sdl3-shim")
|
||||
target_include_directories(SDL3_shim INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/sdl3-shim/")
|
||||
|
||||
add_library(SDL3::SDL3 ALIAS SDL3_shim)
|
||||
|
||||
add_library(SDL3::Headers ALIAS SDL3_shim)
|
||||
|
||||
endif()
|
||||
|
||||
@ -55,6 +55,7 @@ cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROS
|
||||
option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON)
|
||||
option(ENABLE_CLANG_TIDY "Enable clang-tidy")
|
||||
option(DOWNLOAD_DEPENDENCIES "Download dependencies" ON)
|
||||
option(USE_SDL2 "Use SDL2 instead of SDL3 via a shim" ON)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE PATH "Directory where to put executables and dll")
|
||||
set(ISLE_EMSCRIPTEN_HOST "" CACHE STRING "Host URL for Emscripten streaming (e.g., https://test.com)")
|
||||
cmake_dependent_option(BUILD_SHARED_LIBS "Build lego1 as a shared library" ON "NOT EMSCRIPTEN" OFF)
|
||||
@ -74,6 +75,7 @@ if (DOWNLOAD_DEPENDENCIES)
|
||||
message(STATUS "Fetching SDL3 and iniparser. This might take a while...")
|
||||
include(FetchContent)
|
||||
|
||||
if(NOT USE_SDL2)
|
||||
if(ANDROID)
|
||||
# Built by Gradle
|
||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS Shared)
|
||||
@ -95,6 +97,7 @@ if (DOWNLOAD_DEPENDENCIES)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(SDL3)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
iniparser
|
||||
|
||||
@ -28,7 +28,9 @@ target_compile_definitions(miniwin PRIVATE
|
||||
)
|
||||
|
||||
list(APPEND GRAPHICS_BACKENDS USE_SOFTWARE_RENDER)
|
||||
list(APPEND GRAPHICS_BACKENDS USE_SDL_GPU)
|
||||
if(NOT USE_SDL2)
|
||||
list(APPEND GRAPHICS_BACKENDS USE_SDL_GPU)
|
||||
endif()
|
||||
|
||||
if(NOT WINDOWS_STORE)
|
||||
find_package(OpenGL)
|
||||
@ -116,11 +118,16 @@ endif()
|
||||
|
||||
target_compile_definitions(miniwin PUBLIC MINIWIN)
|
||||
|
||||
target_include_directories(miniwin PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/internal
|
||||
)
|
||||
|
||||
if(USE_SDL_GPU IN_LIST GRAPHICS_BACKENDS)
|
||||
target_include_directories(miniwin
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/internal
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/generated
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(miniwin PUBLIC miniwin-headers)
|
||||
|
||||
target_link_libraries(miniwin PRIVATE SDL3::SDL3)
|
||||
@ -129,7 +136,7 @@ target_compile_definitions(miniwin PUBLIC ${GRAPHICS_BACKENDS})
|
||||
|
||||
|
||||
# Shader stuff
|
||||
|
||||
if(USE_SDL_GPU IN_LIST GRAPHICS_BACKENDS)
|
||||
set(shader_src_dir "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/src")
|
||||
set(shader_gen_dir "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/generated")
|
||||
set(py_gencshadersource "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/gencshadersource.py")
|
||||
@ -213,7 +220,7 @@ endforeach()
|
||||
|
||||
set(index_cpp "${shader_gen_dir}/ShaderIndex.cpp")
|
||||
set(index_h "${shader_gen_dir}/ShaderIndex.h")
|
||||
|
||||
endif()
|
||||
if(ISLE_COMPILE_SHADERS)
|
||||
add_custom_command(OUTPUT "${index_h}" "${index_cpp}"
|
||||
COMMAND Python3::Interpreter "${py_gencshadersource}" "index"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user