Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake improvements #4578

Merged
merged 5 commits into from
May 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ if (CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif()

add_definitions(-DCMAKE_BUILD)

# We use libpng's static library and don't need to build the shared library and run the tests
set(PNG_SHARED OFF CACHE BOOL "Build shared lib." FORCE)
set(PNG_TESTS OFF CACHE BOOL "Build tests." FORCE)
Expand Down
17 changes: 12 additions & 5 deletions rpcs3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ if(USE_NATIVE_INSTRUCTIONS)
endif()

if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-pch -Wno-unused-command-line-argument -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-pch -fexceptions")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument")
endif()

# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
if(NOT APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL")
Expand All @@ -124,7 +128,7 @@ if(NOT MSVC)

add_compile_options(-msse -msse2 -mcx16)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# This fixes 'some' of the st11range issues. See issue #2516
if(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000")
Expand Down Expand Up @@ -165,7 +169,6 @@ elseif(NOT MSVC AND NOT CMAKE_CXX_FLAGS MATCHES "LIBICONV_PLUG")
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} "iconv")
endif()
if(UNIX AND NOT APPLE)
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} "X11")
find_package(Wayland)
if (WAYLAND_FOUND)
include_directories(${WAYLAND_INCLUDE_DIR})
Expand Down Expand Up @@ -403,6 +406,10 @@ add_dependencies(rpcs3 GitVersion)
if(NOT MSVC)
find_package(GLEW 1.13.0 REQUIRED)
target_link_libraries(rpcs3 GLEW::GLEW)

set(CMAKE_THREAD_PREFER_PTHREAD 1)
find_package(Threads REQUIRED)
target_link_libraries(rpcs3 Threads::Threads)
endif()

if(UNIX)
Expand All @@ -416,7 +423,7 @@ target_link_libraries(rpcs3 xxhash)
if(WIN32)
target_link_libraries(rpcs3 ws2_32.lib Winmm.lib Psapi.lib gdi32.lib VKstatic.1 glslang OSDependent OGLCompiler SPIRV HLSL setupapi.lib hidapi-hid Shlwapi.lib)
if(NOT MSVC)
target_link_libraries(rpcs3 ${OPENGL_LIBRARIES} opengl32.lib glu32.lib libpthread)
target_link_libraries(rpcs3 ${OPENGL_LIBRARIES} opengl32.lib glu32.lib)
else()
target_link_libraries(rpcs3 dxgi.lib d2d1.lib dwrite.lib)
endif()
Expand All @@ -435,7 +442,7 @@ else()
if(VULKAN_FOUND)
target_link_libraries(rpcs3 ${VULKAN_LIBRARIES})
endif()
target_link_libraries(rpcs3 ${CMAKE_DL_LIBS} -lpthread ZLIB::ZLIB ${ADDITIONAL_LIBS})
target_link_libraries(rpcs3 ${CMAKE_DL_LIBS} ZLIB::ZLIB ${ADDITIONAL_LIBS})
if(USE_SYSTEM_FFMPEG)
link_libraries(${FFMPEG_LIBRARY_DIR})
target_link_libraries(rpcs3 libavformat.so libavcodec.so libavutil.so libswscale.so)
Expand Down
3 changes: 0 additions & 3 deletions rpcs3/cmake_modules/ConfigureCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,4 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if(APPLE)
add_compile_options(-stdlib=libc++)
endif()
if(WIN32)
add_compile_options(-pthread)
endif()
endif()