Add support for using a portable directory without special build flags. (#1956)

This commit is contained in:
Steveice10
2024-01-24 01:27:25 -08:00
committed by GitHub
parent 77274735d6
commit 4b576d066e
3 changed files with 45 additions and 49 deletions

View File

@ -166,11 +166,13 @@ target_link_libraries(melonDS PRIVATE ${QT_LINK_LIBS} ${CMAKE_DL_LIBS})
target_include_directories(melonDS PRIVATE "${Slirp_INCLUDE_DIRS}")
target_link_libraries(melonDS PRIVATE "${Slirp_LINK_LIBRARIES}")
if (UNIX)
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" OFF)
elseif (WIN32)
if (WIN32)
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" ON)
if (PORTABLE)
target_compile_definitions(melonDS PRIVATE WIN32_PORTABLE)
endif()
configure_file("${CMAKE_SOURCE_DIR}/res/melon.rc.in" "${CMAKE_BINARY_DIR}/res/melon.rc")
target_sources(melonDS PUBLIC "${CMAKE_BINARY_DIR}/res/melon.rc")
target_include_directories(melonDS PRIVATE "${CMAKE_BINARY_DIR}/res")
@ -189,10 +191,6 @@ elseif (WIN32)
set_target_properties(melonDS PROPERTIES LINK_FLAGS_DEBUG "-mconsole")
endif()
if (PORTABLE)
target_compile_definitions(melonDS PRIVATE PORTABLE)
endif()
if (APPLE)
target_sources(melonDS PRIVATE sem_timedwait.cpp)