re3/src/CMakeLists.txt

114 lines
2.8 KiB
Text
Raw Normal View History

2020-10-31 22:14:28 +00:00
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if(${RE3_AUDIO} STREQUAL "OAL")
find_package(OpenAL REQUIRED)
find_package(MPG123 REQUIRED)
find_package(SndFile REQUIRED)
endif()
file(GLOB_RECURSE Sources "*.cpp" "*.h")
MACRO(HEADER_DIRECTORIES return_list)
FILE(GLOB_RECURSE new_list *.cpp)
SET(dir_list "animation"
"audio"
"collision"
2020-10-31 22:14:28 +00:00
"control"
"core"
"entities"
"extras"
"fakerw"
"math"
"modelinfo"
"objects"
"peds"
"render"
"rw"
"save"
"skel"
"text"
"vehicles"
"weapons")
FOREACH(file_path ${new_list})
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
SET(dir_list ${dir_list} ${dir_path})
ENDFOREACH()
LIST(REMOVE_DUPLICATES dir_list)
SET(${return_list} ${dir_list})
ENDMACRO()
HEADER_DIRECTORIES(header_list)
include_directories(${header_list})
2020-12-19 00:21:04 +00:00
add_executable(reVC ${Sources})
target_link_libraries(reVC librw)
target_link_libraries(reVC Threads::Threads)
2020-10-31 22:14:28 +00:00
if(${RE3_AUDIO} STREQUAL "OAL")
2020-12-19 00:21:04 +00:00
target_link_libraries(reVC ${OPENAL_LIBRARY})
target_link_libraries(reVC ${MPG123_LIBRARIES})
target_link_libraries(reVC ${SNDFILE_LIBRARIES})
2020-10-31 22:14:28 +00:00
endif()
2020-12-19 00:21:04 +00:00
target_include_directories(reVC
2020-10-31 22:14:28 +00:00
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
)
2020-12-19 00:21:04 +00:00
target_compile_definitions(reVC
2020-10-31 22:14:28 +00:00
PRIVATE
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
PUBLIC
"RW_${RE3_PLATFORM}"
)
2020-12-19 00:21:04 +00:00
target_compile_definitions(reVC PRIVATE LIBRW=1 AUDIO_OAL=1)
2020-10-31 22:14:28 +00:00
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
2020-12-19 00:21:04 +00:00
target_compile_options(reVC
2020-10-31 22:14:28 +00:00
PRIVATE
"-Wall"
)
if (NOT RE3_PLATFORM_PS2)
2020-12-19 00:21:04 +00:00
target_compile_options(reVC
2020-10-31 22:14:28 +00:00
PRIVATE
"-Wextra"
"-Wdouble-promotion"
"-Wpedantic"
)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
2020-12-19 00:21:04 +00:00
target_compile_options(reVC
2020-10-31 22:14:28 +00:00
PUBLIC
/wd4996 /wd4244
)
endif()
2020-12-19 00:21:04 +00:00
set_target_properties(reVC
2020-10-31 22:14:28 +00:00
PROPERTIES
C_STANDARD 11
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
)
if(RE3_INSTALL)
2020-12-19 00:21:04 +00:00
target_include_directories(reVC
2020-10-31 22:14:28 +00:00
INTERFACE
$<INSTALL_INTERFACE:${RE3_INSTALL_INCLUDEDIR}>
)
install(
2020-12-19 00:21:04 +00:00
TARGETS reVC
EXPORT reVC-targets
2020-10-31 22:14:28 +00:00
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()