summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt18
-rw-r--r--src/citra/CMakeLists.txt16
-rw-r--r--src/citra_qt/CMakeLists.txt13
3 files changed, 14 insertions, 33 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2cba5e8a1..2711336fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 2.8.11)
project(citra)
if (NOT MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes")
- add_definitions(-pthread)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
else()
# Silence deprecation warnings
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
@@ -20,12 +20,11 @@ else()
# /MP - Multi-threaded compilation
# /MD - Multi-threaded runtime
# /Ox - Full optimization
- # /Oi - Use intrinsic functions
# /Oy- - Don't omit frame pointer
# /GR- - Disable RTTI
# /GS- - No stack buffer overflow checks
# /EHsc - C++-only exception handling semantics
- set(optimization_flags "/MP /MD /Ox /Oi /Oy- /DNDEBUG /GR- /GS- /EHsc")
+ set(optimization_flags "/MP /MD /Ox /Oy- /DNDEBUG /GR- /GS- /EHsc")
# /Zi - Output debugging information
# /Zo - enahnced debug info for optimized builds
set(CMAKE_C_FLAGS_RELEASE "${optimization_flags} /Zi" CACHE STRING "" FORCE)
@@ -107,10 +106,17 @@ if (ENABLE_GLFW)
endif()
IF (APPLE)
- # CoreFoundation is required only on OSX
- FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation)
+ FIND_LIBRARY(COCOA_LIBRARY Cocoa) # Umbrella framework for everything GUI-related
+ FIND_LIBRARY(IOKIT_LIBRARY IOKit) # GLFW dependency
+ FIND_LIBRARY(COREVIDEO_LIBRARY CoreVideo) # GLFW dependency
+ set(PLATFORM_LIBRARIES iconv ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY})
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
+ELSEIF(WIN32)
+ set(PLATFORM_LIBRARIES winmm ws2_32)
+ELSE()
+ set(PLATFORM_LIBRARIES rt)
ENDIF (APPLE)
option(ENABLE_QT "Enable the Qt frontend" ON)
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index bbb3374f2..713f49193 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -16,20 +16,6 @@ create_directory_groups(${SRCS} ${HEADERS})
add_executable(citra ${SRCS} ${HEADERS})
target_link_libraries(citra core common video_core)
target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih)
-
-if (UNIX)
- target_link_libraries(citra -pthread)
-endif()
-
-if (APPLE)
- target_link_libraries(citra iconv ${COREFOUNDATION_LIBRARY})
-elseif (WIN32)
- target_link_libraries(citra winmm wsock32 ws2_32)
- if (MINGW) # GCC does not support codecvt, so use iconv instead
- target_link_libraries(citra iconv)
- endif()
-else() # Unix
- target_link_libraries(citra rt)
-endif()
+target_link_libraries(citra ${PLATFORM_LIBRARIES})
#install(TARGETS citra RUNTIME DESTINATION ${bindir})
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index a0ba252b3..bbc521f8a 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -60,17 +60,6 @@ endif()
add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
target_link_libraries(citra-qt core common video_core qhexedit)
target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
-
-if (UNIX)
- target_link_libraries(citra-qt -pthread)
-endif()
-
-if (APPLE)
- target_link_libraries(citra-qt iconv ${COREFOUNDATION_LIBRARY})
-elseif (WIN32)
- target_link_libraries(citra-qt winmm wsock32 ws2_32)
-else() # Unix
- target_link_libraries(citra-qt rt)
-endif()
+target_link_libraries(citra-qt ${PLATFORM_LIBRARIES})
#install(TARGETS citra-qt RUNTIME DESTINATION ${bindir})