Make ReWindow build as a different shared object.

This commit is contained in:
2024-01-01 15:34:13 -05:00
parent 60178561e4
commit 879fb026ff

View File

@@ -28,12 +28,7 @@ file(GLOB_RECURSE ASSETS "assets/*")
include_directories("include")
add_library(SDL3D SHARED ${SOURCES}
src/engine/engine.cpp
src/types/entity.cpp
src/types/moby.cpp
src/types/camera.cpp
src/types/vector.cpp)
add_library(SDL3D SHARED ${SOURCES})
# Why god???
set_target_properties(SDL3D PROPERTIES LINKER_LANGUAGE CXX)
@@ -46,12 +41,14 @@ CPMAddPackage(
)
CPMAddPackage(
NAME ReWindow
URL https://git.redacted.cc/Redacted/ReWindow/archive/vA0.2.zip
NAME ReWindowLibrary
URL https://git.redacted.cc/Redacted/ReWindow/archive/vA0.3.zip
)
if(ReWindow_ADDED)
set(REWINDOW_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/_deps/rewindow-src/include)
if(ReWindowLibrary_ADDED)
set(REWINDOW_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/_deps/rewindowlibrary-src/include)
add_library(ReWindow SHARED IMPORTED)
set_target_properties(ReWindow PROPERTIES IMPORTED_LOCATION "${ReWindowLibrary_LIBRARIES}")
endif()
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
@@ -61,7 +58,7 @@ include_directories(${REWINDOW_INCLUDE_DIRS})
find_package(OpenGL REQUIRED)
include_directories({$OPENGL_INCLUDE_DIRS})
find_package(glm REQUIRED)
find_package(ReWindow REQUIRED)
target_link_libraries(SDL3D PUBLIC glm::glm SDL2::SDL2 ReWindow ${OPENGL_LIBRARIES})
find_package(ReWindowLibrary REQUIRED)
target_link_libraries(SDL3D PUBLIC glm::glm SDL2::SDL2 ReWindowLibrary ${OPENGL_LIBRARIES})
add_executable(SDL3D_Demo "include/demo/main.cpp")
target_link_libraries(SDL3D_Demo PUBLIC SDL3D)
target_link_libraries(SDL3D_Demo PUBLIC SDL3D ReWindowLibrary)