mirror of
https://github.com/punesemu/puNES.git
synced 2024-05-14 02:09:53 -04:00
CMake 3.22.1 does not correctly interpret the conditional generator expression inside target_link_libraries when the library list is multiline. I could have put everything on one line but I preferred to treat the list externally to be able to manage it better. Updated the README with instructions to successfully compile with Ubuntu.
This commit is contained in:
parent
3e09841b51
commit
45a55f4d8f
|
@ -76,6 +76,9 @@ set(CMAKE_AUTORCC ON)
|
|||
|
||||
set(CMAKE_AUTOUIC_SEARCH_PATHS gui/designer)
|
||||
|
||||
set(QT_LIBS_USED "")
|
||||
set(WIN_LIBS_USED "")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
find_package(ALSA REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
@ -151,6 +154,42 @@ if(ENABLE_FFMPEG)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(${QT_VERSION} VERSION_LESS "5.15.0")
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt5::Core)
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt5::Network)
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt5::Widgets)
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt5::Svg)
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt5::Gui)
|
||||
else()
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt::Core)
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt::Network)
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt::Widgets)
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt::Svg)
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt::Gui)
|
||||
if(${QT_VERSION} VERSION_GREATER_EQUAL "6.0.0")
|
||||
set(QT_LIBS_USED ${QT_LIBS_USED} Qt::OpenGLWidgets)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} ws2_32)
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} imm32)
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} cg)
|
||||
if(ENABLE_OPENGL)
|
||||
if(ENABLE_OPENGL_CG)
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} cgGL)
|
||||
endif()
|
||||
else()
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} cgD3D9)
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} d3d9)
|
||||
if(HOST_CPU STREQUAL "i386")
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} d3dx9)
|
||||
else()
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} d3dx9_41)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
# Install misc files
|
||||
|
|
|
@ -152,10 +152,10 @@ If you need the debug version then you need to replace the `cmake -B build -G Ni
|
|||
CFLAGS="-O0 -g -DDEBUG" CXXFLAGS="-O0 -g -DDEBUG" cmake -B build -G Ninja -DENABLE_RELEASE=OFF [...]
|
||||
```
|
||||
where `[...]` are the other necessary options.
|
||||
#### Example on how to compile on Ubuntu 21.10
|
||||
#### Example on how to compile on Ubuntu 22.04
|
||||
```bash
|
||||
sudo apt-get install git cmake ninja-build libtool build-essential pkg-config libudev-dev libasound2-dev
|
||||
sudo apt-get install qtbase5-dev qttools5-dev-tools libqt5svg5-dev nvidia-cg-toolkit libx11-dev libxrandr-dev
|
||||
sudo apt-get install qtbase5-dev qttools5-dev qttools5-dev-tools libqt5svg5-dev nvidia-cg-toolkit libx11-dev libxrandr-dev
|
||||
sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev
|
||||
git clone https://github.com/punesemu/puNES
|
||||
cd puNES
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
set(WIN_STATIC_QT_LIBS "")
|
||||
set(win_static_qt_libs_list
|
||||
plugins/platforms/libqwindows.a
|
||||
libQt5PlatformSupport.a
|
||||
|
@ -23,7 +22,7 @@ foreach(win_static_qt_lib ${win_static_qt_libs_list})
|
|||
message(STATUS "Looking for ${file_name}")
|
||||
if(EXISTS ${QT_LIB_LOC}/${win_static_qt_lib})
|
||||
message(STATUS "Looking for ${file_name} - found")
|
||||
set(WIN_STATIC_QT_LIBS ${WIN_STATIC_QT_LIBS} ${QT_LIB_LOC}/${win_static_qt_lib})
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} ${QT_LIB_LOC}/${win_static_qt_lib})
|
||||
|
||||
if(file_name STREQUAL "libqwindows.a")
|
||||
add_compile_definitions(QT5_PLUGIN_QWINDOWS)
|
||||
|
@ -36,7 +35,7 @@ foreach(win_static_qt_lib ${win_static_qt_libs_list})
|
|||
if(NOT USBHID_LIB)
|
||||
message(FATAL_ERROR "uxtheme library not found")
|
||||
endif()
|
||||
set(WIN_STATIC_QT_LIBS ${WIN_STATIC_QT_LIBS} ${UXTHEME_LIB})
|
||||
set(WIN_LIBS_USED ${WIN_LIBS_USED} ${UXTHEME_LIB})
|
||||
endif()
|
||||
elseif(file_name STREQUAL "libqgif.a")
|
||||
add_compile_definitions(QT_PLUGIN_QGIF)
|
||||
|
|
|
@ -648,40 +648,14 @@ target_link_options(punes
|
|||
)
|
||||
|
||||
target_link_libraries(punes
|
||||
$<IF:$<VERSION_LESS:${QT_VERSION},5.15.0>,
|
||||
Qt5::Core
|
||||
Qt5::Network
|
||||
Qt5::Widgets
|
||||
Qt5::Svg
|
||||
Qt5::Gui,
|
||||
Qt::Core
|
||||
Qt::Network
|
||||
Qt::Widgets
|
||||
Qt::Svg
|
||||
Qt::Gui
|
||||
$<IF:$<VERSION_GREATER_EQUAL:${QT_VERSION},6.0.0>,Qt::OpenGLWidgets,>
|
||||
>
|
||||
${QT_LIBS_USED}
|
||||
Threads::Threads
|
||||
$<$<BOOL:${ENABLE_FFMPEG}>:PkgConfig::LIBAV>
|
||||
$<$<PLATFORM_ID:FreeBSD,OpenBSD>:Sndio::Sndio>
|
||||
$<$<PLATFORM_ID:FreeBSD,OpenBSD>:UsbHid::UsbHid>
|
||||
$<$<PLATFORM_ID:Linux>:ALSA::ALSA>
|
||||
$<$<PLATFORM_ID:Linux>:PkgConfig::UDEV>
|
||||
$<$<PLATFORM_ID:Windows>:
|
||||
$<$<BOOL:${ENABLE_WIN_STATIC_QT}>:${WIN_STATIC_QT_LIBS}>
|
||||
ws2_32
|
||||
imm32
|
||||
cg
|
||||
$<IF:$<BOOL:${ENABLE_OPENGL}>,
|
||||
$<$<BOOL:${ENABLE_OPENGL_CG}>:cgGL>,
|
||||
cgD3D9
|
||||
d3d9
|
||||
$<IF:$<STREQUAL:${HOST_CPU},i386>,
|
||||
d3dx9,
|
||||
d3dx9_41
|
||||
>
|
||||
>
|
||||
>
|
||||
${WIN_LIBS_USED}
|
||||
$<$<BOOL:${X11_FOUND}>:X11::Xrandr>
|
||||
OpenGL::GL
|
||||
$<$<PLATFORM_ID:Linux>:OpenGL::GLX>
|
||||
|
|
Loading…
Reference in a new issue