Add cmake config file
Big thanks for @madebr who made all work
This commit is contained in:
parent
5e5a624681
commit
7ce4328601
15
CMakeCPack.cmake
Normal file
15
CMakeCPack.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A (partial) re-implementation of RenderWare Graphics")
|
||||
set(CPACK_PACKAGE_VENDOR "librw")
|
||||
|
||||
# FIXME: better description of the project
|
||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
|
||||
|
||||
# set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CMakeCPackOptions.cmake")
|
||||
|
||||
include(CPack)
|
57
CMakeLists.txt
Normal file
57
CMakeLists.txt
Normal file
@ -0,0 +1,57 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(librw C CXX)
|
||||
|
||||
if(PS2DEV AND EE)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/cmake/ee.cmake")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(LIBRW_PLATFORMS "NULL" "GL3" "D3D9")
|
||||
else()
|
||||
set(LIBRW_PLATFORMS "NULL" "GL3" "PS2")
|
||||
endif()
|
||||
set(LIBRW_PLATFORM "NULL" CACHE STRING "Platform")
|
||||
set_property(CACHE LIBRW_PLATFORM PROPERTY STRINGS ${LIBRW_PLATFORMS})
|
||||
message(STATUS "LIBRW_PLATFORM = ${LIBRW_PLATFORM} (choices=${LIBRW_PLATFORMS})")
|
||||
set("LIBRW_PLATFORM_${LIBRW_PLATFORM}" ON)
|
||||
if(NOT LIBRW_PLATFORM IN_LIST LIBRW_PLATFORMS)
|
||||
message(FATAL_ERROR "Illegal LIBRW_PLATFORM=${LIBRW_PLATFORM}")
|
||||
endif()
|
||||
|
||||
if(LIBRW_PLATFORM_PS2)
|
||||
enable_language(DSM)
|
||||
endif()
|
||||
|
||||
option(LIBRW_TOOLS "Build librw tools" ON)
|
||||
option(LIBRW_INSTALL "Install librw files" OFF)
|
||||
|
||||
if(LIBRW_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
set(LIBRW_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/librw")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if(LIBRW_TOOLS)
|
||||
add_subdirectory(skeleton)
|
||||
|
||||
add_subdirectory(tools)
|
||||
endif()
|
||||
|
||||
if(LIBRW_INSTALL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_package_config_file(librw-config.cmake.in librw-config.cmake
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||
)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/librw-config.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
install(
|
||||
EXPORT librw-targets
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}"
|
||||
)
|
||||
|
||||
include(CMakeCPack.cmake)
|
||||
endif()
|
16
cmake/CMakeDSMCompiler.cmake.in
Normal file
16
cmake/CMakeDSMCompiler.cmake.in
Normal file
@ -0,0 +1,16 @@
|
||||
set(CMAKE_DSM_COMPILER "@_CMAKE_DSM_COMPILER@")
|
||||
set(CMAKE_DSM_COMPILER_ARG1 "@_CMAKE_DSM_COMPILER_ARG1@")
|
||||
set(CMAKE_DSM_COMPILER_AR "@_CMAKE_DSM_COMPILER_AR@")
|
||||
set(CMAKE_RANLIB "@CMAKE_RANLIB@")
|
||||
set(CMAKE_DSM_COMPILER_RANLIB "@_CMAKE_DSM_COMPILER_RANLIB@")
|
||||
set(CMAKE_LINKER "@CMAKE_LINKER@")
|
||||
set(CMAKE_DSM_COMPILER_LOADED 1)
|
||||
set(CMAKE_DSM_COMPILER_ID "@_CMAKE_DSM_COMPILER_ID@")
|
||||
set(CMAKE_DSM_COMPILER_VERSION "@_CMAKE_DSM_COMPILER_VERSION@")
|
||||
set(CMAKE_DSM_COMPILER_ENV_VAR "@_CMAKE_DSM_COMPILER_ENV_VAR@")
|
||||
@_SET_CMAKE_DSM_COMPILER_ARCHITECTURE_ID@
|
||||
|
||||
set(CMAKE_DSM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_DSM_LINKER_PREFERENCE 0)
|
||||
|
||||
@CMAKE_DSM_COMPILER_CUSTOM_CODE@
|
79
cmake/CMakeDSMInformation.cmake
Normal file
79
cmake/CMakeDSMInformation.cmake
Normal file
@ -0,0 +1,79 @@
|
||||
if(UNIX)
|
||||
set(CMAKE_DSM_OUTPUT_EXTENSION .o)
|
||||
else()
|
||||
set(CMAKE_DSM_OUTPUT_EXTENSION .obj)
|
||||
endif()
|
||||
|
||||
set(CMAKE_INCLUDE_FLAG_DSM "-I")
|
||||
|
||||
set(CMAKE_DSM_FLAGS_INIT "$ENV{DSMFLAGS} ${CMAKE_DSM_FLAGS_INIT}")
|
||||
|
||||
# replace for CMake >= 3.11
|
||||
foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO)
|
||||
string(STRIP "${CMAKE_DSM_FLAGS${c}_INIT}" CMAKE_DSM_FLAGS${c}_INIT)
|
||||
endforeach()
|
||||
|
||||
set (CMAKE_DSM_FLAGS "${CMAKE_DSM_FLAGS_INIT}" CACHE STRING
|
||||
"Flags used by the assembler during all build types.")
|
||||
|
||||
if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
|
||||
get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
# default build type is none
|
||||
if(NOT _GENERATOR_IS_MULTI_CONFIG AND NOT CMAKE_NO_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
|
||||
"Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.")
|
||||
endif()
|
||||
unset(_GENERATOR_IS_MULTI_CONFIG)
|
||||
set (CMAKE_DSM_FLAGS_DEBUG "${CMAKE_DSM_FLAGS_DEBUG_INIT}" CACHE STRING
|
||||
"Flags used by the assembler during debug builds.")
|
||||
set (CMAKE_DSM_FLAGS_MINSIZEREL "${CMAKE_DSM_FLAGS_MINSIZEREL_INIT}" CACHE STRING
|
||||
"Flags used by the assembler during release minsize builds.")
|
||||
set (CMAKE_DSM_FLAGS_RELEASE "${CMAKE_DSM_FLAGS_RELEASE_INIT}" CACHE STRING
|
||||
"Flags used by the assembler during release builds.")
|
||||
set (CMAKE_DSM_FLAGS_RELWITHDEBINFO "${CMAKE_DSM_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
|
||||
"Flags used by the assembler during Release with Debug Info builds.")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(CMAKE_DSM_FLAGS
|
||||
CMAKE_DSM_FLAGS_DEBUG
|
||||
CMAKE_DSM_FLAGS_MINSIZEREL
|
||||
CMAKE_DSM_FLAGS_RELEASE
|
||||
CMAKE_DSM_FLAGS_RELWITHDEBINFO
|
||||
)
|
||||
# WITH: cmake_initialize_per_config_variable(CMAKE_DSM_FLAGS "Flags used by the DSM compiler")
|
||||
|
||||
if(NOT CMAKE_DSM_COMPILE_OBJECT)
|
||||
set(CMAKE_DSM_COMPILE_OBJECT "<CMAKE_DSM_COMPILER> <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_DSM_CREATE_STATIC_LIBRARY)
|
||||
set(CMAKE_DSM_CREATE_STATIC_LIBRARY
|
||||
"<CMAKE_DSM_COMPILER_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
|
||||
"<CMAKE_DSM_COMPILER_RANLIB> <TARGET>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_DSM_LINK_EXECUTABLE)
|
||||
set(CMAKE_DSM_LINK_EXECUTABLE
|
||||
"<CMAKE_DSM_COMPILER> <FLAGS> <CMAKE_DSM_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_DSM_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_DSM_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_DSM_FLAG})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RUNTIME_DSM_FLAG_SEP)
|
||||
set(CMAKE_EXECUTABLE_RUNTIME_DSM_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_DSM_FLAG_SEP})
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_EXECUTABLE_RPATH_LINK_DSM_FLAG)
|
||||
set(CMAKE_EXECUTABLE_RPATH_LINK_DSM_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_DSM_FLAG})
|
||||
endif()
|
||||
|
||||
# to be done
|
||||
if(NOT CMAKE_DSM_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_DSM_CREATE_SHARED_LIBRARY)
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_DSM_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_DSM_CREATE_SHARED_MODULE)
|
||||
endif()
|
87
cmake/CMakeDetermineDSMCompiler.cmake
Normal file
87
cmake/CMakeDetermineDSMCompiler.cmake
Normal file
@ -0,0 +1,87 @@
|
||||
include(${CMAKE_ROOT}/Modules/CMakeDetermineCompiler.cmake)
|
||||
|
||||
if (NOT CMAKE_DSM_COMPILER)
|
||||
message(FATAL_ERROR "Need CMAKE_DSM_COMPILER set")
|
||||
endif()
|
||||
|
||||
_cmake_find_compiler_path(DSM)
|
||||
mark_as_advanced(CMAKE_DSM_COMPILER)
|
||||
|
||||
if (NOT CMAKE_DSM_COMPILER_ID)
|
||||
# Table of per-vendor compiler id flags with expected output.
|
||||
list(APPEND CMAKE_DSM_COMPILER_ID_VENDORS GNU )
|
||||
set(CMAKE_DSM_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
|
||||
set(CMAKE_DSM_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)")
|
||||
|
||||
include(CMakeDetermineCompilerId)
|
||||
cmake_determine_compiler_id_vendor(DSM "")
|
||||
|
||||
endif()
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_LOCATION)
|
||||
get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_DSM_COMPILER}" PATH)
|
||||
endif()
|
||||
|
||||
if (CMAKE_DSM_COMPILER_ID)
|
||||
if (CMAKE_DSM_COMPILER_VERSION)
|
||||
set(_version " ${CMAKE_DSM_COMPILER_VERSION}")
|
||||
else()
|
||||
set(_version "")
|
||||
endif()
|
||||
message(STATUS "The DSM compiler identification is ${CMAKE_DSM_COMPILER_ID}${_version}")
|
||||
unset(_version)
|
||||
else()
|
||||
message(STATUS "The DSM compiler identification is unknown")
|
||||
endif()
|
||||
|
||||
if (NOT _CMAKE_TOOLCHAIN_PREFIX)
|
||||
get_filename_component(COMPILER_BASENAME "${CMAKE_DSM_COMPILER}" NAME)
|
||||
if (COMPILER_BASENAME MATCHES "^(.+1)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
|
||||
set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
set(_CMAKE_PROCESSING_LANGUAGE "DSM")
|
||||
find_program(CMAKE_DSM_COMPILER_AR NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ar HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_DSM_COMPILER_RANLIB NAMES ${_CMAKE_TOOLCHAIN_PREFIX}ranlib HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_DSM_COMPILER_STRIP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}strip HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_DSM_COMPILER_NM NAMES ${_CMAKE_TOOLCHAIN_PREFIX}nm HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_DSM_COMPILER_OBJDUMP NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objdump HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
find_program(CMAKE_DSM_COMPILER_OBJCOPY NAMES ${_CMAKE_TOOLCHAIN_PREFIX}objcopy HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
|
||||
|
||||
unset(_CMAKE_PROCESSING_LANGUAGE)
|
||||
|
||||
set(CMAKE_DSM_COMPILER_ENV_VAR "DSM")
|
||||
|
||||
if (CMAKE_DSM_COMPILER)
|
||||
message(STATUS "Found DSM assembler: ${CMAKE_DSM_COMPILER}")
|
||||
else()
|
||||
message(STATUS "Didn't find assembler")
|
||||
endif()
|
||||
|
||||
foreach(_var
|
||||
COMPILER
|
||||
COMPILER_ID
|
||||
COMPILER_ARG1
|
||||
COMPILER_ENV_VAR
|
||||
COMPILER_AR
|
||||
COMPILER_RANLIB
|
||||
COMPILER_VERSION
|
||||
)
|
||||
set(_CMAKE_DSM_${_var} "${CMAKE_DSM_${_var}}")
|
||||
endforeach()
|
||||
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeDSMCompiler.cmake.in"
|
||||
"${CMAKE_PLATFORM_INFO_DIR}/CMakeDSMCompiler.cmake" @ONLY)
|
||||
|
||||
foreach(_var
|
||||
COMPILER
|
||||
COMPILER_ID
|
||||
COMPILER_ARG1
|
||||
COMPILER_ENV_VAR
|
||||
COMPILER_AR
|
||||
COMPILER_VERSION
|
||||
)
|
||||
unset(_CMAKE_DSM_${_var})
|
||||
endforeach()
|
7
cmake/CMakeTestDSMCompiler.cmake
Normal file
7
cmake/CMakeTestDSMCompiler.cmake
Normal file
@ -0,0 +1,7 @@
|
||||
set(_ASM_COMPILER_WORKS 0)
|
||||
|
||||
if(CMAKE_DSM_COMPILER)
|
||||
set(_DSM_COMPILER_WORKS)
|
||||
endif()
|
||||
|
||||
set(CMAKE_DSM_COMPILER_WORKS ${_DSM_COMPILER_WORKS} CACHE INTERNAL "")
|
2
cmake/ee.cmake
Normal file
2
cmake/ee.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
include_directories(SYSTEM "${PS2SDK}/common/include")
|
||||
include_directories(SYSTEM "${PS2SDK}/ee/include")
|
64
cmake/toolchain_ps2_ee.cmake
Normal file
64
cmake/toolchain_ps2_ee.cmake
Normal file
@ -0,0 +1,64 @@
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
set(CMAKE_SYSTEM_NAME "Generic")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "ee")
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
|
||||
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
if(NOT DEFINED ENV{PS2DEV})
|
||||
message(FATAL_ERROR "Need environment variable PS2DEV set")
|
||||
endif()
|
||||
if(NOT DEFINED ENV{PS2SDK})
|
||||
message(FATAL_ERROR "Need environment variable PS2SDK set")
|
||||
endif()
|
||||
set(PS2DEV "$ENV{PS2DEV}")
|
||||
set(PS2SDK "$ENV{PS2SDK}")
|
||||
|
||||
#set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS "asm;dsm")
|
||||
|
||||
set(CMAKE_DSM_SOURCE_FILE_EXTENSIONS "dsm")
|
||||
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".erl")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
||||
|
||||
set(CMAKE_C_COMPILER "${PS2DEV}/ee/bin/ee-gcc")
|
||||
set(CMAKE_CXX_COMPILER "${PS2DEV}/ee/bin/ee-g++")
|
||||
set(CMAKE_ASM_COMPILER "${PS2DEV}/ee/bin/ee-g++")
|
||||
set(CMAKE_DSM_COMPILER "${PS2DEV}/dvp/bin/dvp-as")
|
||||
set(CMAKE_AR "${PS2DEV}/ee/bin/ee-ar" CACHE FILEPATH "archiver")
|
||||
set(CMAKE_LINKER "${PS2DEV}/ee/bin/ee-ld")
|
||||
set(CMAKE_RANLIB "${PS2DEV}/ee/bin/ee-ranlib" CACHE FILEPATH "ranlib")
|
||||
set(CMAKE_STRIP "${PS2DEV}/ee/bin/ee-strip" CACHE FILEPATH "strip")
|
||||
|
||||
set(EE_LDFLAGS "" CACHE STRING "EE linker flags")
|
||||
set(EE_ASFLAGS "-G0" CACHE STRING "EE assembler flags")
|
||||
|
||||
set(EE_CRT0 "${PS2SDK}/ee/startup/crt0.o" CACHE FILEPATH "EE crt0 file")
|
||||
set_source_files_properties("${EE_CRT0}" PROPERTIES EXTERNAL_OBJECT ON)
|
||||
|
||||
set(EE_LINKSCRIPT "${PS2SDK}/ee/startup/linkfile" CACHE FILEPATH "EE link script")
|
||||
|
||||
#set(EE_CFLAGS " -nostdlib -fno-common -D_EE" CACHE STRING "EE C/CXX compiler flags")
|
||||
set(EE_CFLAGS "-D_EE")
|
||||
set(CMAKE_C_FLAGS_INIT "${EE_CFLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${EE_CFLAGS}")
|
||||
#set(CMAKE_ASM_FLAGS_INIT "${EE_CFLAGS}")
|
||||
|
||||
set(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> cru <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_CXX_CREATE_STATIC_LIBRARY "${CMAKE_C_CREATE_STATIC_LIBRARY}")
|
||||
set(CMAKE_ASM_CREATE_STATIC_LIBRARY "${CMAKE_C_CREATE_STATIC_LIBRARY}")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "-mno-crt0 -T\"${PS2SDK}/ee/startup/linkfile\" \"${EE_CRT0}\" -L\"${PS2SDK}/ee/lib\"")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "${PS2DEV}/ee;${PS2SDK}/ee")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
set(PS2 1)
|
||||
set(EE 1)
|
12
librw-config.cmake.in
Normal file
12
librw-config.cmake.in
Normal file
@ -0,0 +1,12 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/librw-targets.cmake")
|
||||
|
||||
set(LIBRW_PLATFORM "@LIBRW_PLATFORM@")
|
||||
set(LIBRW_PLATFORMS "@LIBRW_PLATFORMS@")
|
||||
set(LIBRW_PLATFORM_@LIBRW_PLATFORM@ ON)
|
||||
|
||||
if(LIBRW_PLATFORM_GL3)
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(glfw3 REQUIRED)
|
||||
endif()
|
46
skeleton/CMakeLists.txt
Normal file
46
skeleton/CMakeLists.txt
Normal file
@ -0,0 +1,46 @@
|
||||
add_library(librw_skeleton
|
||||
glfw.cpp
|
||||
skeleton.cpp
|
||||
skeleton.h
|
||||
win.cpp
|
||||
)
|
||||
|
||||
set_target_properties(librw_skeleton
|
||||
PROPERTIES
|
||||
PREFIX ""
|
||||
)
|
||||
|
||||
target_link_libraries(librw_skeleton
|
||||
PUBLIC
|
||||
librw
|
||||
)
|
||||
|
||||
target_include_directories(librw_skeleton
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
)
|
||||
|
||||
if(NOT LIBRW_PLATFORM_PS2 AND NOT LIBRW_PLATFORM_NULL)
|
||||
add_subdirectory(imgui)
|
||||
endif()
|
||||
|
||||
if(LIBRW_INSTALL)
|
||||
target_include_directories(librw_skeleton
|
||||
INTERFACE
|
||||
$<INSTALL_INTERFACE:${LIBRW_INSTALL_INCLUDEDIR}/skeleton>
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
skeleton.h
|
||||
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/skeleton"
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS librw_skeleton
|
||||
EXPORT librw-targets
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
endif()
|
46
skeleton/imgui/CMakeLists.txt
Normal file
46
skeleton/imgui/CMakeLists.txt
Normal file
@ -0,0 +1,46 @@
|
||||
add_library(librw_skeleton_imgui
|
||||
imconfig.h
|
||||
imgui.cpp
|
||||
imgui_demo.cpp
|
||||
imgui_draw.cpp
|
||||
imgui.h
|
||||
imgui_impl_rw.cpp
|
||||
imgui_impl_rw.h
|
||||
imgui_internal.h
|
||||
ImGuizmo.cpp
|
||||
ImGuizmo.h
|
||||
stb_rect_pack.h
|
||||
stb_textedit.h
|
||||
stb_truetype.h
|
||||
)
|
||||
|
||||
set_target_properties(librw_skeleton_imgui
|
||||
PROPERTIES
|
||||
PREFIX ""
|
||||
)
|
||||
|
||||
target_link_libraries(librw_skeleton_imgui
|
||||
PUBLIC
|
||||
librw_skeleton
|
||||
)
|
||||
|
||||
if(LIBRW_INSTALL)
|
||||
install(
|
||||
FILES
|
||||
imconfig.h
|
||||
imgui.h
|
||||
imgui_impl_rw.h
|
||||
imgui_internal.h
|
||||
ImGuizmo.h
|
||||
stb_textedit.h
|
||||
DESTINATION "${LIBRW_INSTALL_INCLUDEDIR}/skeleton/imgui"
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS librw_skeleton_imgui
|
||||
EXPORT librw-targets
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
endif()
|
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()
|
11
tools/CMakeLists.txt
Normal file
11
tools/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
if(NOT LIBRW_PLATFORM_PS2)
|
||||
add_subdirectory(dumprwtree)
|
||||
endif()
|
||||
|
||||
if(TARGET librw_skeleton_imgui)
|
||||
add_subdirectory(imguitest)
|
||||
endif()
|
||||
|
||||
if(LIBRW_PLATFORM_PS2)
|
||||
add_subdirectory(ps2test)
|
||||
endif()
|
14
tools/dumprwtree/CMakeLists.txt
Normal file
14
tools/dumprwtree/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
add_executable(dumprwtree
|
||||
dumprwtree.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(dumprwtree
|
||||
PUBLIC
|
||||
librw
|
||||
)
|
||||
|
||||
if(LIBRW_INSTALL)
|
||||
install(TARGETS dumprwtree
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
)
|
||||
endif()
|
15
tools/imguitest/CMakeLists.txt
Normal file
15
tools/imguitest/CMakeLists.txt
Normal file
@ -0,0 +1,15 @@
|
||||
add_executable(imguitest WIN32
|
||||
main.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(imguitest
|
||||
PUBLIC
|
||||
librw
|
||||
librw_skeleton_imgui
|
||||
)
|
||||
|
||||
if(LIBRW_INSTALL)
|
||||
install(TARGETS imguitest
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
)
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user