diff options
| author | 2017-05-29 15:12:21 -0700 | |
|---|---|---|
| committer | 2017-05-29 15:12:21 -0700 | |
| commit | a4f88c7d7c94107df6bfada31617ff553bb5e89e (patch) | |
| tree | cb0d3adbbe115604051300ae451a22a4de751b27 | |
| parent | Merge pull request #2729 from yuriks/quaternion-fix (diff) | |
| parent | CMake: Re-organize root CMakeLists.txt file (diff) | |
| download | yuzu-a4f88c7d7c94107df6bfada31617ff553bb5e89e.tar.gz yuzu-a4f88c7d7c94107df6bfada31617ff553bb5e89e.tar.xz yuzu-a4f88c7d7c94107df6bfada31617ff553bb5e89e.zip | |
Merge pull request #2734 from yuriks/cmake-imported-libs
CMake: Use CMake target properties for all libraries
| -rwxr-xr-x | .travis-deps.sh | 2 | ||||
| -rw-r--r-- | CMakeLists.txt | 180 | ||||
| -rw-r--r-- | externals/CMakeLists.txt | 52 | ||||
| -rw-r--r-- | externals/cryptopp/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | externals/glad/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | externals/inih/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/audio_core/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/citra/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/citra_qt/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/common/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/core/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/input_common/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/tests/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 7 |
14 files changed, 160 insertions, 120 deletions
diff --git a/.travis-deps.sh b/.travis-deps.sh index 1404fe19f..451886984 100755 --- a/.travis-deps.sh +++ b/.travis-deps.sh | |||
| @@ -11,7 +11,7 @@ if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then | |||
| 11 | 11 | ||
| 12 | if [ ! -e $HOME/.local/bin/cmake ]; then | 12 | if [ ! -e $HOME/.local/bin/cmake ]; then |
| 13 | echo "CMake not found in the cache, get and extract it..." | 13 | echo "CMake not found in the cache, get and extract it..." |
| 14 | curl -L http://www.cmake.org/files/v3.2/cmake-3.2.0-Linux-i386.tar.gz \ | 14 | curl -L http://www.cmake.org/files/v3.6/cmake-3.6.3-Linux-x86_64.tar.gz \ |
| 15 | | tar -xz -C $HOME/.local --strip-components=1 | 15 | | tar -xz -C $HOME/.local --strip-components=1 |
| 16 | else | 16 | else |
| 17 | echo "Using cached CMake" | 17 | echo "Using cached CMake" |
diff --git a/CMakeLists.txt b/CMakeLists.txt index 121b0f2f8..1f0af2d41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -1,20 +1,25 @@ | |||
| 1 | # CMake 3.2 required for cmake to know the right flags for CXX standard on OSX | 1 | # CMake 3.6 required for FindBoost to define IMPORTED libs properly on unknown Boost versions |
| 2 | cmake_minimum_required(VERSION 3.2) | 2 | cmake_minimum_required(VERSION 3.6) |
| 3 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) | 3 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") |
| 4 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") | ||
| 4 | 5 | ||
| 5 | function(download_bundled_external remote_path lib_name prefix_var) | 6 | project(citra) |
| 6 | set(prefix "${CMAKE_BINARY_DIR}/externals/${lib_name}") | 7 | |
| 7 | if (NOT EXISTS "${prefix}") | 8 | option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) |
| 8 | message(STATUS "Downloading binaries for ${lib_name}...") | 9 | option(CITRA_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" OFF) |
| 9 | file(DOWNLOAD | 10 | |
| 10 | https://github.com/citra-emu/ext-windows-bin/raw/master/${remote_path}${lib_name}.7z | 11 | option(ENABLE_QT "Enable the Qt frontend" ON) |
| 11 | "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" SHOW_PROGRESS) | 12 | option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF) |
| 12 | execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" | 13 | |
| 13 | WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals") | 14 | if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit) |
| 14 | endif() | 15 | message(STATUS "Copying pre-commit hook") |
| 15 | message(STATUS "Using bundled binaries at ${prefix}") | 16 | file(COPY hooks/pre-commit |
| 16 | set(${prefix_var} "${prefix}" PARENT_SCOPE) | 17 | DESTINATION ${CMAKE_SOURCE_DIR}/.git/hooks) |
| 17 | endfunction() | 18 | endif() |
| 19 | |||
| 20 | |||
| 21 | # Detect current compilation architecture and create standard definitions | ||
| 22 | # ======================================================================= | ||
| 18 | 23 | ||
| 19 | include(CheckSymbolExists) | 24 | include(CheckSymbolExists) |
| 20 | function(detect_architecture symbol arch) | 25 | function(detect_architecture symbol arch) |
| @@ -33,20 +38,6 @@ function(detect_architecture symbol arch) | |||
| 33 | endif() | 38 | endif() |
| 34 | endfunction() | 39 | endfunction() |
| 35 | 40 | ||
| 36 | project(citra) | ||
| 37 | |||
| 38 | option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) | ||
| 39 | option(CITRA_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" OFF) | ||
| 40 | |||
| 41 | option(ENABLE_QT "Enable the Qt frontend" ON) | ||
| 42 | option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF) | ||
| 43 | |||
| 44 | if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit) | ||
| 45 | message(STATUS "Copying pre-commit hook") | ||
| 46 | file(COPY hooks/pre-commit | ||
| 47 | DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks) | ||
| 48 | endif() | ||
| 49 | |||
| 50 | if (MSVC) | 41 | if (MSVC) |
| 51 | detect_architecture("_M_AMD64" x86_64) | 42 | detect_architecture("_M_AMD64" x86_64) |
| 52 | detect_architecture("_M_IX86" x86) | 43 | detect_architecture("_M_IX86" x86) |
| @@ -63,6 +54,10 @@ if (NOT DEFINED ARCHITECTURE) | |||
| 63 | endif() | 54 | endif() |
| 64 | message(STATUS "Target architecture: ${ARCHITECTURE}") | 55 | message(STATUS "Target architecture: ${ARCHITECTURE}") |
| 65 | 56 | ||
| 57 | |||
| 58 | # Configure compilation flags | ||
| 59 | # =========================== | ||
| 60 | |||
| 66 | set(CMAKE_CXX_STANDARD 14) | 61 | set(CMAKE_CXX_STANDARD 14) |
| 67 | set(CMAKE_CXX_STANDARD_REQUIRED ON) | 62 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 68 | 63 | ||
| @@ -130,28 +125,44 @@ add_definitions(-DSINGLETHREADED) | |||
| 130 | set_property(DIRECTORY APPEND PROPERTY | 125 | set_property(DIRECTORY APPEND PROPERTY |
| 131 | COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>) | 126 | COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>) |
| 132 | 127 | ||
| 128 | |||
| 129 | # System imported libraries | ||
| 130 | # ====================== | ||
| 131 | |||
| 132 | # This function downloads a binary library package from our external repo. | ||
| 133 | # Params: | ||
| 134 | # remote_path: path to the file to download, relative to the remote repository root | ||
| 135 | # prefix_var: name of a variable which will be set with the path to the extracted contents | ||
| 136 | function(download_bundled_external remote_path lib_name prefix_var) | ||
| 137 | set(prefix "${CMAKE_BINARY_DIR}/externals/${lib_name}") | ||
| 138 | if (NOT EXISTS "${prefix}") | ||
| 139 | message(STATUS "Downloading binaries for ${lib_name}...") | ||
| 140 | file(DOWNLOAD | ||
| 141 | https://github.com/citra-emu/ext-windows-bin/raw/master/${remote_path}${lib_name}.7z | ||
| 142 | "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" SHOW_PROGRESS) | ||
| 143 | execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" | ||
| 144 | WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals") | ||
| 145 | endif() | ||
| 146 | message(STATUS "Using bundled binaries at ${prefix}") | ||
| 147 | set(${prefix_var} "${prefix}" PARENT_SCOPE) | ||
| 148 | endfunction() | ||
| 149 | |||
| 133 | find_package(PNG QUIET) | 150 | find_package(PNG QUIET) |
| 134 | if (PNG_FOUND) | 151 | if (NOT PNG_FOUND) |
| 135 | add_definitions(-DHAVE_PNG) | ||
| 136 | else() | ||
| 137 | message(STATUS "libpng not found. Some debugging features have been disabled.") | 152 | message(STATUS "libpng not found. Some debugging features have been disabled.") |
| 138 | endif() | 153 | endif() |
| 139 | 154 | ||
| 140 | find_package(Boost 1.57.0 QUIET) | 155 | find_package(Boost 1.63.0 QUIET) |
| 141 | if (NOT Boost_FOUND) | 156 | if (NOT Boost_FOUND) |
| 142 | message(STATUS "Boost 1.57.0 or newer not found, falling back to externals") | 157 | message(STATUS "Boost 1.63.0 or newer not found, falling back to externals") |
| 143 | set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost") | ||
| 144 | endif() | ||
| 145 | include_directories(${Boost_INCLUDE_DIR}) | ||
| 146 | |||
| 147 | # Include bundled CMake modules | ||
| 148 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules") | ||
| 149 | 158 | ||
| 150 | find_package(OpenGL REQUIRED) | 159 | set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost") |
| 151 | include_directories(${OPENGL_INCLUDE_DIR}) | 160 | set(Boost_NO_SYSTEM_PATHS OFF) |
| 161 | find_package(Boost QUIET REQUIRED) | ||
| 162 | endif() | ||
| 152 | 163 | ||
| 153 | # Prefer the -pthread flag on Linux. | 164 | # Prefer the -pthread flag on Linux. |
| 154 | set (THREADS_PREFER_PTHREAD_FLAG ON) | 165 | set(THREADS_PREFER_PTHREAD_FLAG ON) |
| 155 | find_package(Threads REQUIRED) | 166 | find_package(Threads REQUIRED) |
| 156 | 167 | ||
| 157 | if (ENABLE_SDL2) | 168 | if (ENABLE_SDL2) |
| @@ -174,10 +185,43 @@ if (ENABLE_SDL2) | |||
| 174 | else() | 185 | else() |
| 175 | find_package(SDL2 REQUIRED) | 186 | find_package(SDL2 REQUIRED) |
| 176 | endif() | 187 | endif() |
| 188 | |||
| 189 | if (SDL2_FOUND) | ||
| 190 | # TODO(yuriks): Make FindSDL2.cmake export an IMPORTED library instead | ||
| 191 | add_library(SDL2 INTERFACE) | ||
| 192 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") | ||
| 193 | target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") | ||
| 194 | endif() | ||
| 177 | else() | 195 | else() |
| 178 | set(SDL2_FOUND NO) | 196 | set(SDL2_FOUND NO) |
| 179 | endif() | 197 | endif() |
| 180 | 198 | ||
| 199 | if (ENABLE_QT) | ||
| 200 | if (CITRA_USE_BUNDLED_QT) | ||
| 201 | if (MSVC14 AND ARCHITECTURE_x86_64) | ||
| 202 | set(QT_VER qt-5.7-msvc2015_64) | ||
| 203 | else() | ||
| 204 | message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable CITRA_USE_BUNDLED_QT and provide your own.") | ||
| 205 | endif() | ||
| 206 | |||
| 207 | if (DEFINED QT_VER) | ||
| 208 | download_bundled_external("qt/" ${QT_VER} QT_PREFIX) | ||
| 209 | endif() | ||
| 210 | |||
| 211 | set(QT_PREFIX_HINT HINTS "${QT_PREFIX}") | ||
| 212 | else() | ||
| 213 | # Passing an empty HINTS seems to cause default system paths to get ignored in CMake 2.8 so | ||
| 214 | # make sure to not pass anything if we don't have one. | ||
| 215 | set(QT_PREFIX_HINT) | ||
| 216 | endif() | ||
| 217 | |||
| 218 | find_package(Qt5 REQUIRED COMPONENTS Widgets OpenGL ${QT_PREFIX_HINT}) | ||
| 219 | endif() | ||
| 220 | |||
| 221 | |||
| 222 | # Platform-specific library requirements | ||
| 223 | # ====================================== | ||
| 224 | |||
| 181 | IF (APPLE) | 225 | IF (APPLE) |
| 182 | FIND_LIBRARY(COCOA_LIBRARY Cocoa) # Umbrella framework for everything GUI-related | 226 | FIND_LIBRARY(COCOA_LIBRARY Cocoa) # Umbrella framework for everything GUI-related |
| 183 | set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) | 227 | set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY}) |
| @@ -206,28 +250,9 @@ if (UNIX OR MINGW) | |||
| 206 | endif() | 250 | endif() |
| 207 | endif() | 251 | endif() |
| 208 | 252 | ||
| 209 | if (ENABLE_QT) | ||
| 210 | if (CITRA_USE_BUNDLED_QT) | ||
| 211 | if (MSVC14 AND ARCHITECTURE_x86_64) | ||
| 212 | set(QT_VER qt-5.7-msvc2015_64) | ||
| 213 | else() | ||
| 214 | message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable CITRA_USE_BUNDLED_QT and provide your own.") | ||
| 215 | endif() | ||
| 216 | |||
| 217 | if (DEFINED QT_VER) | ||
| 218 | download_bundled_external("qt/" ${QT_VER} QT_PREFIX) | ||
| 219 | endif() | ||
| 220 | 253 | ||
| 221 | set(QT_PREFIX_HINT HINTS "${QT_PREFIX}") | 254 | # Include source code |
| 222 | else() | 255 | # =================== |
| 223 | # Passing an empty HINTS seems to cause default system paths to get ignored in CMake 2.8 so | ||
| 224 | # make sure to not pass anything if we don't have one. | ||
| 225 | set(QT_PREFIX_HINT) | ||
| 226 | endif() | ||
| 227 | |||
| 228 | find_package(Qt5 REQUIRED COMPONENTS Widgets OpenGL ${QT_PREFIX_HINT}) | ||
| 229 | set(CITRA_QT_LIBS Qt5::Widgets Qt5::OpenGL) | ||
| 230 | endif() | ||
| 231 | 256 | ||
| 232 | # This function should be passed a list of all files in a target. It will automatically generate | 257 | # This function should be passed a list of all files in a target. It will automatically generate |
| 233 | # file groups following the directory hierarchy, so that the layout of the files in IDEs matches the | 258 | # file groups following the directory hierarchy, so that the layout of the files in IDEs matches the |
| @@ -251,30 +276,13 @@ get_git_head_revision(GIT_REF_SPEC GIT_REV) | |||
| 251 | git_describe(GIT_DESC --always --long --dirty) | 276 | git_describe(GIT_DESC --always --long --dirty) |
| 252 | git_branch_name(GIT_BRANCH) | 277 | git_branch_name(GIT_BRANCH) |
| 253 | 278 | ||
| 254 | set(INI_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/externals/inih") | ||
| 255 | include_directories(${INI_PREFIX}) | ||
| 256 | add_subdirectory(${INI_PREFIX}) | ||
| 257 | |||
| 258 | add_subdirectory(externals) | 279 | add_subdirectory(externals) |
| 259 | 280 | add_subdirectory(src) | |
| 260 | option(DYNARMIC_TESTS OFF) | ||
| 261 | set(DYNARMIC_NO_BUNDLED_FMT ON) | ||
| 262 | add_subdirectory(externals/dynarmic) | ||
| 263 | |||
| 264 | add_subdirectory(externals/glad) | ||
| 265 | include_directories(externals/microprofile) | ||
| 266 | include_directories(externals/nihstro/include) | ||
| 267 | |||
| 268 | if (MSVC) | ||
| 269 | add_subdirectory(externals/getopt) | ||
| 270 | endif() | ||
| 271 | |||
| 272 | # process subdirectories | ||
| 273 | add_subdirectory(externals/soundtouch) | ||
| 274 | |||
| 275 | enable_testing() | 281 | enable_testing() |
| 276 | 282 | ||
| 277 | add_subdirectory(src) | 283 | |
| 284 | # Installation instructions | ||
| 285 | # ========================= | ||
| 278 | 286 | ||
| 279 | # Install freedesktop.org metadata files, following those specifications: | 287 | # Install freedesktop.org metadata files, following those specifications: |
| 280 | # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html | 288 | # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html |
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 57fc5d566..1e04931ee 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -1,12 +1,52 @@ | |||
| 1 | # Definitions for all external bundled libraries | ||
| 2 | |||
| 3 | # Catch | ||
| 4 | add_library(catch-single-include INTERFACE) | ||
| 5 | target_include_directories(catch-single-include INTERFACE catch/single_include) | ||
| 6 | |||
| 7 | # Crypto++ | ||
| 8 | add_subdirectory(cryptopp) | ||
| 9 | |||
| 10 | # Dynarmic | ||
| 11 | # Dynarmic will skip defining xbyak if it's already defined, we then define it below | ||
| 12 | add_library(xbyak INTERFACE) | ||
| 13 | option(DYNARMIC_TESTS OFF) | ||
| 14 | set(DYNARMIC_NO_BUNDLED_FMT ON) | ||
| 15 | add_subdirectory(dynarmic) | ||
| 16 | |||
| 17 | # libfmt | ||
| 18 | add_subdirectory(fmt) | ||
| 19 | |||
| 20 | # getopt | ||
| 21 | if (MSVC) | ||
| 22 | add_subdirectory(getopt) | ||
| 23 | endif() | ||
| 24 | |||
| 25 | # Glad | ||
| 26 | add_subdirectory(glad) | ||
| 27 | |||
| 28 | # inih | ||
| 29 | add_subdirectory(inih) | ||
| 30 | |||
| 31 | # MicroProfile | ||
| 32 | add_library(microprofile INTERFACE) | ||
| 33 | target_include_directories(microprofile INTERFACE ./microprofile) | ||
| 34 | |||
| 35 | # Nihstro | ||
| 36 | add_library(nihstro-headers INTERFACE) | ||
| 37 | target_include_directories(nihstro-headers INTERFACE ./nihstro/include) | ||
| 38 | |||
| 39 | # SoundTouch | ||
| 40 | add_subdirectory(soundtouch) | ||
| 41 | # The SoundTouch target doesn't export the necessary include paths as properties by default | ||
| 42 | target_include_directories(SoundTouch INTERFACE ./soundtouch/include) | ||
| 43 | |||
| 1 | # Xbyak | 44 | # Xbyak |
| 2 | if (ARCHITECTURE_x86_64) | 45 | if (ARCHITECTURE_x86_64) |
| 3 | add_library(xbyak INTERFACE) | 46 | # Defined before "dynarmic" above |
| 4 | target_include_directories(xbyak INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/xbyak/xbyak) | 47 | # add_library(xbyak INTERFACE) |
| 48 | target_include_directories(xbyak INTERFACE ./xbyak/xbyak) | ||
| 5 | if (NOT MSVC) | 49 | if (NOT MSVC) |
| 6 | target_compile_options(xbyak INTERFACE -fno-operator-names) | 50 | target_compile_options(xbyak INTERFACE -fno-operator-names) |
| 7 | endif() | 51 | endif() |
| 8 | endif() | 52 | endif() |
| 9 | |||
| 10 | add_subdirectory(cryptopp) | ||
| 11 | |||
| 12 | add_subdirectory(fmt) | ||
diff --git a/externals/cryptopp/CMakeLists.txt b/externals/cryptopp/CMakeLists.txt index 653af1e4b..864de18bb 100644 --- a/externals/cryptopp/CMakeLists.txt +++ b/externals/cryptopp/CMakeLists.txt | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | # - disabled installation | 10 | # - disabled installation |
| 11 | # - disabled documentation | 11 | # - disabled documentation |
| 12 | # - configured to build a static library only | 12 | # - configured to build a static library only |
| 13 | # - adds include directories to the library target | ||
| 13 | 14 | ||
| 14 | include(TestBigEndian) | 15 | include(TestBigEndian) |
| 15 | include(CheckCXXCompilerFlag) | 16 | include(CheckCXXCompilerFlag) |
| @@ -148,14 +149,15 @@ endif() | |||
| 148 | # Compile targets | 149 | # Compile targets |
| 149 | #============================================================================ | 150 | #============================================================================ |
| 150 | add_library(cryptopp STATIC ${cryptopp_SOURCES}) | 151 | add_library(cryptopp STATIC ${cryptopp_SOURCES}) |
| 152 | target_include_directories(cryptopp INTERFACE .) | ||
| 151 | 153 | ||
| 152 | #============================================================================ | 154 | #============================================================================ |
| 153 | # Third-party libraries | 155 | # Third-party libraries |
| 154 | #============================================================================ | 156 | #============================================================================ |
| 155 | 157 | ||
| 156 | if(WIN32) | 158 | if(WIN32) |
| 157 | target_link_libraries(cryptopp ws2_32) | 159 | target_link_libraries(cryptopp PRIVATE ws2_32) |
| 158 | endif() | 160 | endif() |
| 159 | 161 | ||
| 160 | find_package(Threads) | 162 | find_package(Threads) |
| 161 | target_link_libraries(cryptopp ${CMAKE_THREAD_LIBS_INIT}) | 163 | target_link_libraries(cryptopp PRIVATE ${CMAKE_THREAD_LIBS_INIT}) |
diff --git a/externals/glad/CMakeLists.txt b/externals/glad/CMakeLists.txt index a97d4aa73..6d35a844b 100644 --- a/externals/glad/CMakeLists.txt +++ b/externals/glad/CMakeLists.txt | |||
| @@ -9,6 +9,7 @@ set(HEADERS | |||
| 9 | create_directory_groups(${SRCS} ${HEADERS}) | 9 | create_directory_groups(${SRCS} ${HEADERS}) |
| 10 | add_library(glad STATIC ${SRCS} ${HEADERS}) | 10 | add_library(glad STATIC ${SRCS} ${HEADERS}) |
| 11 | target_include_directories(glad PUBLIC "include/") | 11 | target_include_directories(glad PUBLIC "include/") |
| 12 | |||
| 12 | if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") | 13 | if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") |
| 13 | target_link_libraries(glad dl) | 14 | target_link_libraries(glad PRIVATE dl) |
| 14 | endif() | 15 | endif() |
diff --git a/externals/inih/CMakeLists.txt b/externals/inih/CMakeLists.txt index c87f78bfc..cff36a581 100644 --- a/externals/inih/CMakeLists.txt +++ b/externals/inih/CMakeLists.txt | |||
| @@ -9,3 +9,4 @@ set(HEADERS | |||
| 9 | 9 | ||
| 10 | create_directory_groups(${SRCS} ${HEADERS}) | 10 | create_directory_groups(${SRCS} ${HEADERS}) |
| 11 | add_library(inih ${SRCS} ${HEADERS}) | 11 | add_library(inih ${SRCS} ${HEADERS}) |
| 12 | target_include_directories(inih INTERFACE .) | ||
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt index c571213fc..0ad86bb7a 100644 --- a/src/audio_core/CMakeLists.txt +++ b/src/audio_core/CMakeLists.txt | |||
| @@ -27,12 +27,9 @@ set(HEADERS | |||
| 27 | time_stretch.h | 27 | time_stretch.h |
| 28 | ) | 28 | ) |
| 29 | 29 | ||
| 30 | include_directories(../../externals/soundtouch/include) | ||
| 31 | |||
| 32 | if(SDL2_FOUND) | 30 | if(SDL2_FOUND) |
| 33 | set(SRCS ${SRCS} sdl2_sink.cpp) | 31 | set(SRCS ${SRCS} sdl2_sink.cpp) |
| 34 | set(HEADERS ${HEADERS} sdl2_sink.h) | 32 | set(HEADERS ${HEADERS} sdl2_sink.h) |
| 35 | include_directories(${SDL2_INCLUDE_DIR}) | ||
| 36 | endif() | 33 | endif() |
| 37 | 34 | ||
| 38 | create_directory_groups(${SRCS} ${HEADERS}) | 35 | create_directory_groups(${SRCS} ${HEADERS}) |
| @@ -42,6 +39,6 @@ target_link_libraries(audio_core PUBLIC common core) | |||
| 42 | target_link_libraries(audio_core PRIVATE SoundTouch) | 39 | target_link_libraries(audio_core PRIVATE SoundTouch) |
| 43 | 40 | ||
| 44 | if(SDL2_FOUND) | 41 | if(SDL2_FOUND) |
| 45 | target_link_libraries(audio_core PRIVATE ${SDL2_LIBRARY}) | 42 | target_link_libraries(audio_core PRIVATE SDL2) |
| 46 | target_compile_definitions(audio_core PRIVATE HAVE_SDL2) | 43 | target_compile_definitions(audio_core PRIVATE HAVE_SDL2) |
| 47 | endif() | 44 | endif() |
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 9eddb342b..d72d2b5f4 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt | |||
| @@ -15,15 +15,13 @@ set(HEADERS | |||
| 15 | 15 | ||
| 16 | create_directory_groups(${SRCS} ${HEADERS}) | 16 | create_directory_groups(${SRCS} ${HEADERS}) |
| 17 | 17 | ||
| 18 | include_directories(${SDL2_INCLUDE_DIR}) | ||
| 19 | |||
| 20 | add_executable(citra ${SRCS} ${HEADERS}) | 18 | add_executable(citra ${SRCS} ${HEADERS}) |
| 21 | target_link_libraries(citra PRIVATE common core input_common) | 19 | target_link_libraries(citra PRIVATE common core input_common) |
| 22 | target_link_libraries(citra PRIVATE ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad) | 20 | target_link_libraries(citra PRIVATE inih glad) |
| 23 | if (MSVC) | 21 | if (MSVC) |
| 24 | target_link_libraries(citra PRIVATE getopt) | 22 | target_link_libraries(citra PRIVATE getopt) |
| 25 | endif() | 23 | endif() |
| 26 | target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) | 24 | target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} SDL2 Threads::Threads) |
| 27 | 25 | ||
| 28 | if(UNIX AND NOT APPLE) | 26 | if(UNIX AND NOT APPLE) |
| 29 | install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | 27 | install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") |
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 809e0b938..4841cbf05 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt | |||
| @@ -92,7 +92,7 @@ else() | |||
| 92 | add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) | 92 | add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) |
| 93 | endif() | 93 | endif() |
| 94 | target_link_libraries(citra-qt PRIVATE audio_core common core input_common video_core) | 94 | target_link_libraries(citra-qt PRIVATE audio_core common core input_common video_core) |
| 95 | target_link_libraries(citra-qt PRIVATE ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS} glad) | 95 | target_link_libraries(citra-qt PRIVATE Boost::boost glad nihstro-headers Qt5::OpenGL Qt5::Widgets) |
| 96 | target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) | 96 | target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) |
| 97 | 97 | ||
| 98 | if(UNIX AND NOT APPLE) | 98 | if(UNIX AND NOT APPLE) |
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index a33a8cdbe..7e83e64b0 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -95,6 +95,7 @@ endif() | |||
| 95 | create_directory_groups(${SRCS} ${HEADERS}) | 95 | create_directory_groups(${SRCS} ${HEADERS}) |
| 96 | 96 | ||
| 97 | add_library(common STATIC ${SRCS} ${HEADERS}) | 97 | add_library(common STATIC ${SRCS} ${HEADERS}) |
| 98 | target_link_libraries(common PUBLIC Boost::boost microprofile) | ||
| 98 | if (ARCHITECTURE_x86_64) | 99 | if (ARCHITECTURE_x86_64) |
| 99 | target_link_libraries(common PRIVATE xbyak) | 100 | target_link_libraries(common PRIVATE xbyak) |
| 100 | endif() | 101 | endif() |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 7aa81e885..3cdb2b817 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -374,11 +374,7 @@ set(HEADERS | |||
| 374 | telemetry_session.h | 374 | telemetry_session.h |
| 375 | ) | 375 | ) |
| 376 | 376 | ||
| 377 | include_directories(../../externals/dynarmic/include) | ||
| 378 | include_directories(../../externals/cryptopp) | ||
| 379 | |||
| 380 | create_directory_groups(${SRCS} ${HEADERS}) | 377 | create_directory_groups(${SRCS} ${HEADERS}) |
| 381 | |||
| 382 | add_library(core STATIC ${SRCS} ${HEADERS}) | 378 | add_library(core STATIC ${SRCS} ${HEADERS}) |
| 383 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) | 379 | target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) |
| 384 | target_link_libraries(core PRIVATE cryptopp dynarmic) | 380 | target_link_libraries(core PUBLIC Boost::boost PRIVATE cryptopp dynarmic) |
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 5b306e42e..e3e36ada7 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -13,7 +13,6 @@ set(HEADERS | |||
| 13 | if(SDL2_FOUND) | 13 | if(SDL2_FOUND) |
| 14 | set(SRCS ${SRCS} sdl/sdl.cpp) | 14 | set(SRCS ${SRCS} sdl/sdl.cpp) |
| 15 | set(HEADERS ${HEADERS} sdl/sdl.h) | 15 | set(HEADERS ${HEADERS} sdl/sdl.h) |
| 16 | include_directories(${SDL2_INCLUDE_DIR}) | ||
| 17 | endif() | 16 | endif() |
| 18 | 17 | ||
| 19 | create_directory_groups(${SRCS} ${HEADERS}) | 18 | create_directory_groups(${SRCS} ${HEADERS}) |
| @@ -22,6 +21,6 @@ add_library(input_common STATIC ${SRCS} ${HEADERS}) | |||
| 22 | target_link_libraries(input_common PUBLIC core PRIVATE common) | 21 | target_link_libraries(input_common PUBLIC core PRIVATE common) |
| 23 | 22 | ||
| 24 | if(SDL2_FOUND) | 23 | if(SDL2_FOUND) |
| 25 | target_link_libraries(input_common PRIVATE ${SDL2_LIBRARY}) | 24 | target_link_libraries(input_common PRIVATE SDL2) |
| 26 | target_compile_definitions(input_common PRIVATE HAVE_SDL2) | 25 | target_compile_definitions(input_common PRIVATE HAVE_SDL2) |
| 27 | endif() | 26 | endif() |
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 85f2f2985..00d7c636a 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt | |||
| @@ -10,11 +10,9 @@ set(HEADERS | |||
| 10 | 10 | ||
| 11 | create_directory_groups(${SRCS} ${HEADERS}) | 11 | create_directory_groups(${SRCS} ${HEADERS}) |
| 12 | 12 | ||
| 13 | include_directories(../../externals/catch/single_include/) | ||
| 14 | |||
| 15 | add_executable(tests ${SRCS} ${HEADERS}) | 13 | add_executable(tests ${SRCS} ${HEADERS}) |
| 16 | target_link_libraries(tests PRIVATE common core) | 14 | target_link_libraries(tests PRIVATE common core) |
| 17 | target_link_libraries(tests PRIVATE glad) # To support linker work-around | 15 | target_link_libraries(tests PRIVATE glad) # To support linker work-around |
| 18 | target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) | 16 | target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} catch-single-include Threads::Threads) |
| 19 | 17 | ||
| 20 | add_test(NAME tests COMMAND $<TARGET_FILE:tests>) | 18 | add_test(NAME tests COMMAND tests) |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index e455f03bd..0961a3251 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -80,14 +80,13 @@ create_directory_groups(${SRCS} ${HEADERS}) | |||
| 80 | 80 | ||
| 81 | add_library(video_core STATIC ${SRCS} ${HEADERS}) | 81 | add_library(video_core STATIC ${SRCS} ${HEADERS}) |
| 82 | target_link_libraries(video_core PUBLIC common core) | 82 | target_link_libraries(video_core PUBLIC common core) |
| 83 | target_link_libraries(video_core PRIVATE glad) | 83 | target_link_libraries(video_core PRIVATE glad nihstro-headers) |
| 84 | 84 | ||
| 85 | if (ARCHITECTURE_x86_64) | 85 | if (ARCHITECTURE_x86_64) |
| 86 | target_link_libraries(video_core PRIVATE xbyak) | 86 | target_link_libraries(video_core PRIVATE xbyak) |
| 87 | endif() | 87 | endif() |
| 88 | 88 | ||
| 89 | if (PNG_FOUND) | 89 | if (PNG_FOUND) |
| 90 | target_link_libraries(video_core PRIVATE ${PNG_LIBRARIES}) | 90 | target_link_libraries(video_core PRIVATE PNG::PNG) |
| 91 | target_include_directories(video_core PRIVATE ${PNG_INCLUDE_DIRS}) | 91 | target_compile_definitions(video_core PRIVATE HAVE_PNG) |
| 92 | target_compile_definitions(video_core PRIVATE ${PNG_DEFINITIONS}) | ||
| 93 | endif() | 92 | endif() |