2020-10-31 18:14:28 -04:00
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2020-12-06 07:54:06 -05:00
|
|
|
file(GLOB_RECURSE RE3_SOURCES "*.cpp" "*.h")
|
2020-10-31 18:14:28 -04:00
|
|
|
|
2020-12-06 07:54:06 -05:00
|
|
|
function(header_directories RETURN_LIST)
|
|
|
|
file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c)
|
|
|
|
set(RELDIRS)
|
|
|
|
foreach(SRC ${ALL_SRCS})
|
|
|
|
file(RELATIVE_PATH RELSRC "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}")
|
|
|
|
get_filename_component(RELDIR "${RELSRC}" DIRECTORY)
|
|
|
|
list(APPEND RELDIRS ${RELDIR})
|
|
|
|
endforeach()
|
|
|
|
list(REMOVE_DUPLICATES RELDIRS)
|
|
|
|
set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE)
|
|
|
|
endfunction()
|
2020-10-31 18:14:28 -04:00
|
|
|
|
2020-12-06 07:54:06 -05:00
|
|
|
header_directories(RE3_INCLUDES)
|
2020-10-31 18:14:28 -04:00
|
|
|
|
2020-12-06 09:42:15 -05:00
|
|
|
add_executable(re3 WIN32 ${RE3_SOURCES})
|
2020-12-06 07:54:06 -05:00
|
|
|
target_link_libraries(re3 PRIVATE
|
|
|
|
librw::librw
|
|
|
|
Threads::Threads
|
|
|
|
)
|
2020-10-31 18:14:28 -04:00
|
|
|
|
|
|
|
target_include_directories(re3
|
2020-12-06 09:42:15 -05:00
|
|
|
PRIVATE
|
2020-10-31 18:14:28 -04:00
|
|
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
2020-12-06 09:42:15 -05:00
|
|
|
$<BUILD_INTERFACE:${RE3_INCLUDES}>
|
|
|
|
)
|
2020-10-31 18:14:28 -04:00
|
|
|
|
|
|
|
target_compile_definitions(re3
|
|
|
|
PRIVATE
|
2020-12-06 09:42:15 -05:00
|
|
|
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
|
|
|
|
LIBRW
|
2020-12-06 13:10:37 -05:00
|
|
|
RE3_NO_AUTOLINK
|
2020-12-06 09:42:15 -05:00
|
|
|
)
|
|
|
|
|
2021-01-03 10:30:45 -05:00
|
|
|
if(LIBRW_PLATFORM_D3D9)
|
|
|
|
target_compile_definitions(re3
|
|
|
|
PUBLIC
|
|
|
|
USE_D3D9
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-12-06 09:42:15 -05:00
|
|
|
if(RE3_AUDIO STREQUAL "OAL")
|
|
|
|
find_package(OpenAL REQUIRED)
|
|
|
|
target_include_directories(re3 PRIVATE ${OPENAL_INCLUDE_DIR})
|
|
|
|
target_link_libraries(re3 PRIVATE ${OPENAL_LIBRARY})
|
2020-12-06 13:12:35 -05:00
|
|
|
target_compile_definitions(re3 PRIVATE ${OPENAL_DEFINITIONS})
|
2020-12-06 09:42:15 -05:00
|
|
|
target_compile_definitions(re3 PRIVATE AUDIO_OAL)
|
|
|
|
elseif(RE3_AUDIO STREQUAL "MSS")
|
2021-01-03 10:30:45 -05:00
|
|
|
find_package(MilesSDK REQUIRED)
|
2020-12-06 09:42:15 -05:00
|
|
|
target_compile_definitions(re3 PRIVATE AUDIO_MSS)
|
2021-01-03 10:30:45 -05:00
|
|
|
target_link_libraries(re3 PRIVATE MilesSDK::MilesSDK)
|
2020-12-06 09:42:15 -05:00
|
|
|
endif()
|
|
|
|
|
2021-01-10 19:29:43 -05:00
|
|
|
find_package(mpg123 REQUIRED)
|
|
|
|
target_link_libraries(re3 PRIVATE
|
|
|
|
MPG123::libmpg123
|
|
|
|
)
|
2020-12-06 09:42:15 -05:00
|
|
|
if(RE3_WITH_OPUS)
|
2020-12-06 13:12:35 -05:00
|
|
|
find_package(opusfile REQUIRED)
|
|
|
|
target_link_libraries(re3 PRIVATE
|
|
|
|
opusfile::opusfile
|
|
|
|
)
|
|
|
|
target_compile_definitions(re3 PRIVATE AUDIO_OPUS)
|
2021-01-10 19:29:43 -05:00
|
|
|
endif()
|
|
|
|
if(RE3_WITH_LIBSNDFILE)
|
2020-12-06 09:42:15 -05:00
|
|
|
find_package(SndFile REQUIRED)
|
|
|
|
target_link_libraries(re3 PRIVATE
|
|
|
|
SndFile::SndFile
|
2020-10-31 18:14:28 -04:00
|
|
|
)
|
2021-01-10 19:29:43 -05:00
|
|
|
target_compile_definitions(re3 PRIVATE AUDIO_OAL_USE_SNDFILE)
|
2020-12-06 09:42:15 -05:00
|
|
|
endif()
|
2020-10-31 18:14:28 -04:00
|
|
|
|
2020-12-06 09:42:15 -05:00
|
|
|
target_compile_definitions(re3 PRIVATE )
|
2020-10-31 18:14:28 -04:00
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
|
|
|
target_compile_options(re3
|
|
|
|
PRIVATE
|
|
|
|
"-Wall"
|
|
|
|
)
|
2020-12-06 07:54:06 -05:00
|
|
|
if (NOT LIBRW_PLATFORM_PS2)
|
2020-10-31 18:14:28 -04:00
|
|
|
target_compile_options(re3
|
|
|
|
PRIVATE
|
2020-12-06 09:42:15 -05:00
|
|
|
-Wextra
|
|
|
|
-Wdouble-promotion
|
|
|
|
-Wpedantic
|
2020-10-31 18:14:28 -04:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
|
|
target_compile_options(re3
|
|
|
|
PUBLIC
|
2020-12-06 09:42:15 -05:00
|
|
|
/Zc:sizedDealloc-
|
2020-10-31 18:14:28 -04:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(re3
|
|
|
|
PROPERTIES
|
|
|
|
C_STANDARD 11
|
|
|
|
C_EXTENSIONS OFF
|
|
|
|
C_STANDARD_REQUIRED ON
|
|
|
|
CXX_STANDARD 11
|
|
|
|
CXX_EXTENSIONS OFF
|
|
|
|
CXX_STANDARD_REQUIRED ON
|
|
|
|
)
|
|
|
|
|
|
|
|
if(RE3_INSTALL)
|
|
|
|
install(
|
|
|
|
TARGETS re3
|
|
|
|
EXPORT re3-targets
|
|
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
)
|
|
|
|
endif()
|