mirror of
https://github.com/aap/librw.git
synced 2025-12-19 00:49:50 +00:00
Add cmake config file
Big thanks for @madebr who made all work
This commit is contained in:
217
src/CMakeLists.txt
Normal file
217
src/CMakeLists.txt
Normal file
@@ -0,0 +1,217 @@
|
||||
if(LIBRW_PLATFORM_GL3)
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(glfw3 REQUIRED)
|
||||
endif()
|
||||
|
||||
add_library(librw
|
||||
"${PROJECT_SOURCE_DIR}/args.h"
|
||||
"${PROJECT_SOURCE_DIR}/rw.h"
|
||||
|
||||
anim.cpp
|
||||
base.cpp
|
||||
bmp.cpp
|
||||
camera.cpp
|
||||
charset.cpp
|
||||
clump.cpp
|
||||
engine.cpp
|
||||
error.cpp
|
||||
frame.cpp
|
||||
geometry.cpp
|
||||
geoplg.cpp
|
||||
hanim.cpp
|
||||
image.cpp
|
||||
light.cpp
|
||||
matfx.cpp
|
||||
pipeline.cpp
|
||||
plg.cpp
|
||||
png.cpp
|
||||
prim.cpp
|
||||
raster.cpp
|
||||
render.cpp
|
||||
rwanim.h
|
||||
rwengine.h
|
||||
rwerror.h
|
||||
rwobjects.h
|
||||
rwpipeline.h
|
||||
rwplg.h
|
||||
rwplugins.h
|
||||
rwrender.h
|
||||
rwuserdata.h
|
||||
skin.cpp
|
||||
texture.cpp
|
||||
tga.cpp
|
||||
tristrip.cpp
|
||||
userdata.cpp
|
||||
uvanim.cpp
|
||||
world.cpp
|
||||
|
||||
d3d/d3d8.cpp
|
||||
d3d/d3d8matfx.cpp
|
||||
d3d/d3d8render.cpp
|
||||
d3d/d3d8skin.cpp
|
||||
d3d/d3d9.cpp
|
||||
d3d/d3d9matfx.cpp
|
||||
d3d/d3d9render.cpp
|
||||
d3d/d3d9skin.cpp
|
||||
d3d/d3d.cpp
|
||||
d3d/d3ddevice.cpp
|
||||
d3d/d3dimmed.cpp
|
||||
d3d/d3drender.cpp
|
||||
d3d/rwd3d8.h
|
||||
d3d/rwd3d9.h
|
||||
d3d/rwd3d.h
|
||||
d3d/rwd3dimpl.h
|
||||
d3d/rwxbox.h
|
||||
d3d/rwxboximpl.h
|
||||
d3d/xbox.cpp
|
||||
d3d/xboxmatfx.cpp
|
||||
d3d/xboxskin.cpp
|
||||
d3d/xboxvfmt.cpp
|
||||
|
||||
gl/gl3.cpp
|
||||
gl/gl3device.cpp
|
||||
gl/gl3immed.cpp
|
||||
gl/gl3matfx.cpp
|
||||
gl/gl3pipe.cpp
|
||||
gl/gl3raster.cpp
|
||||
gl/gl3render.cpp
|
||||
gl/gl3shader.cpp
|
||||
gl/gl3skin.cpp
|
||||
gl/rwgl3.h
|
||||
gl/rwgl3impl.h
|
||||
gl/rwgl3plg.h
|
||||
gl/rwgl3shader.h
|
||||
gl/rwwdgl.h
|
||||
gl/wdgl.cpp
|
||||
|
||||
lodepng/lodepng.h
|
||||
lodepng/lodepng.cpp
|
||||
|
||||
ps2/pds.cpp
|
||||
ps2/ps2.cpp
|
||||
ps2/ps2device.cpp
|
||||
ps2/ps2matfx.cpp
|
||||
ps2/ps2raster.cpp
|
||||
ps2/ps2skin.cpp
|
||||
ps2/rwps2.h
|
||||
ps2/rwps2impl.h
|
||||
ps2/rwps2plg.h
|
||||
)
|
||||
|
||||
target_include_directories(librw
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
)
|
||||
|
||||
target_compile_definitions(librw
|
||||
PRIVATE
|
||||
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
|
||||
PUBLIC
|
||||
"RW_${LIBRW_PLATFORM}"
|
||||
)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
target_compile_options(librw
|
||||
PRIVATE
|
||||
"-Wall"
|
||||
)
|
||||
if (NOT LIBRW_PLATFORM_PS2)
|
||||
target_compile_options(librw
|
||||
PRIVATE
|
||||
"-Wextra"
|
||||
"-Wdouble-promotion"
|
||||
"-Wpedantic"
|
||||
)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(librw
|
||||
PUBLIC
|
||||
/wd4996 /wd4244
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(librw
|
||||
PROPERTIES
|
||||
C_STANDARD 11
|
||||
C_EXTENSIONS OFF
|
||||
C_STANDARD_REQUIRED ON
|
||||
CXX_STANDARD 11
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
PREFIX ""
|
||||
)
|
||||
|
||||
if(LIBRW_PLATFORM_GL3)
|
||||
target_link_libraries(librw
|
||||
PUBLIC
|
||||
glfw
|
||||
GLEW::GLEW
|
||||
OpenGL::GL
|
||||
)
|
||||
elseif(LIBRW_PLATFORM_D3D9)
|
||||
target_link_libraries(librw
|
||||
PUBLIC
|
||||
d3d9
|
||||
xinput
|
||||
)
|
||||
endif()
|
||||
|
||||
if(LIBRW_INSTALL)
|
||||
target_include_directories(librw
|
||||
INTERFACE
|
||||
$<INSTALL_INTERFACE:${LIBRW_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
"${PROJECT_SOURCE_DIR}/args.h"
|
||||
"${PROJECT_SOURCE_DIR}/rw.h"
|
||||
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
base.err
|
||||
rwbase.h
|
||||
rwerror.h
|
||||
rwplg.h
|
||||
rwrender.h
|
||||
rwengine.h
|
||||
rwpipeline.h
|
||||
rwobjects.h
|
||||
rwanim.h
|
||||
rwplugins.h
|
||||
rwuserdata.h
|
||||
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/src"
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
d3d/rwxbox.h
|
||||
d3d/rwd3d.h
|
||||
d3d/rwd3d8.h
|
||||
d3d/rwd3d9.h
|
||||
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/src/d3d"
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
ps2/rwps2.h
|
||||
ps2/rwps2plg.h
|
||||
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/src/ps2"
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
gl/rwwdgl.h
|
||||
gl/rwgl3.h
|
||||
gl/rwgl3shader.h
|
||||
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/src/gl"
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS librw
|
||||
EXPORT librw-targets
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
endif()
|
||||
Reference in New Issue
Block a user