summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-10-20 17:08:26 -0400
committerGravatar Lioncash2018-10-20 17:36:31 -0400
commitc8beb665dcb9e681acdb0517b8fc50d02695cb39 (patch)
tree438465be4d1202d61508eb24a7f9cfd5fe65d016
parentMerge pull request #1535 from ReinUsesLisp/fixup-position (diff)
downloadyuzu-c8beb665dcb9e681acdb0517b8fc50d02695cb39.tar.gz
yuzu-c8beb665dcb9e681acdb0517b8fc50d02695cb39.tar.xz
yuzu-c8beb665dcb9e681acdb0517b8fc50d02695cb39.zip
CMakeLists: Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
This is more localized to what we want to enforce directory-wise with the project. CMAKE_SOURCE_DIR indicates the root of the source tree, but this would cause the wrong behavior if someone included yuzu as part of a larger buildsystem (for whatever reason). Instead, we want to use the directory where the "project(yuzu)" command was declared as the root path reference.
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt38
-rw-r--r--src/web_service/CMakeLists.txt2
-rw-r--r--src/yuzu/CMakeLists.txt8
3 files changed, 24 insertions, 24 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6021a8054..c1b1c086d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,21 +23,21 @@ option(ENABLE_CUBEB "Enables the cubeb audio backend" ON)
23 23
24option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF) 24option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
25 25
26if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit) 26if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/pre-commit)
27 message(STATUS "Copying pre-commit hook") 27 message(STATUS "Copying pre-commit hook")
28 file(COPY hooks/pre-commit 28 file(COPY hooks/pre-commit
29 DESTINATION ${CMAKE_SOURCE_DIR}/.git/hooks) 29 DESTINATION ${PROJECT_SOURCE_DIR}/.git/hooks)
30endif() 30endif()
31 31
32# Sanity check : Check that all submodules are present 32# Sanity check : Check that all submodules are present
33# ======================================================================= 33# =======================================================================
34 34
35function(check_submodules_present) 35function(check_submodules_present)
36 file(READ "${CMAKE_SOURCE_DIR}/.gitmodules" gitmodules) 36 file(READ "${PROJECT_SOURCE_DIR}/.gitmodules" gitmodules)
37 string(REGEX MATCHALL "path *= *[^ \t\r\n]*" gitmodules ${gitmodules}) 37 string(REGEX MATCHALL "path *= *[^ \t\r\n]*" gitmodules ${gitmodules})
38 foreach(module ${gitmodules}) 38 foreach(module ${gitmodules})
39 string(REGEX REPLACE "path *= *" "" module ${module}) 39 string(REGEX REPLACE "path *= *" "" module ${module})
40 if (NOT EXISTS "${CMAKE_SOURCE_DIR}/${module}/.git") 40 if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${module}/.git")
41 message(FATAL_ERROR "Git submodule ${module} not found. " 41 message(FATAL_ERROR "Git submodule ${module} not found. "
42 "Please run: git submodule update --init --recursive") 42 "Please run: git submodule update --init --recursive")
43 endif() 43 endif()
@@ -45,17 +45,17 @@ function(check_submodules_present)
45endfunction() 45endfunction()
46check_submodules_present() 46check_submodules_present()
47 47
48configure_file(${CMAKE_SOURCE_DIR}/dist/compatibility_list/compatibility_list.qrc 48configure_file(${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.qrc
49 ${CMAKE_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc 49 ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
50 COPYONLY) 50 COPYONLY)
51if (ENABLE_COMPATIBILITY_LIST_DOWNLOAD AND NOT EXISTS ${CMAKE_BINARY_DIR}/dist/compatibility_list/compatibility_list.json) 51if (ENABLE_COMPATIBILITY_LIST_DOWNLOAD AND NOT EXISTS ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
52 message(STATUS "Downloading compatibility list for yuzu...") 52 message(STATUS "Downloading compatibility list for yuzu...")
53 file(DOWNLOAD 53 file(DOWNLOAD
54 https://api.yuzu-emu.org/gamedb/ 54 https://api.yuzu-emu.org/gamedb/
55 "${CMAKE_BINARY_DIR}/dist/compatibility_list/compatibility_list.json" SHOW_PROGRESS) 55 "${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json" SHOW_PROGRESS)
56endif() 56endif()
57if (NOT EXISTS ${CMAKE_BINARY_DIR}/dist/compatibility_list/compatibility_list.json) 57if (NOT EXISTS ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
58 file(WRITE ${CMAKE_BINARY_DIR}/dist/compatibility_list/compatibility_list.json "") 58 file(WRITE ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json "")
59endif() 59endif()
60 60
61# Detect current compilation architecture and create standard definitions 61# Detect current compilation architecture and create standard definitions
@@ -189,13 +189,13 @@ find_package(Boost 1.63.0 QUIET)
189if (NOT Boost_FOUND) 189if (NOT Boost_FOUND)
190 message(STATUS "Boost 1.63.0 or newer not found, falling back to externals") 190 message(STATUS "Boost 1.63.0 or newer not found, falling back to externals")
191 191
192 set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost") 192 set(BOOST_ROOT "${PROJECT_SOURCE_DIR}/externals/boost")
193 set(Boost_NO_SYSTEM_PATHS OFF) 193 set(Boost_NO_SYSTEM_PATHS OFF)
194 find_package(Boost QUIET REQUIRED) 194 find_package(Boost QUIET REQUIRED)
195endif() 195endif()
196 196
197# Output binaries to bin/ 197# Output binaries to bin/
198set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 198set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
199 199
200# Prefer the -pthread flag on Linux. 200# Prefer the -pthread flag on Linux.
201set(THREADS_PREFER_PTHREAD_FLAG ON) 201set(THREADS_PREFER_PTHREAD_FLAG ON)
@@ -264,7 +264,7 @@ if (YUZU_USE_BUNDLED_UNICORN)
264 endif() 264 endif()
265 265
266 set(UNICORN_FOUND YES) 266 set(UNICORN_FOUND YES)
267 set(UNICORN_PREFIX ${CMAKE_SOURCE_DIR}/externals/unicorn) 267 set(UNICORN_PREFIX ${PROJECT_SOURCE_DIR}/externals/unicorn)
268 set(LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/${UNICORN_LIB_NAME}" CACHE PATH "Path to Unicorn library" FORCE) 268 set(LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/${UNICORN_LIB_NAME}" CACHE PATH "Path to Unicorn library" FORCE)
269 set(LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers" FORCE) 269 set(LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers" FORCE)
270 set(UNICORN_DLL_DIR "${UNICORN_PREFIX}/" CACHE PATH "Path to unicorn dynamic library" FORCE) 270 set(UNICORN_DLL_DIR "${UNICORN_PREFIX}/" CACHE PATH "Path to unicorn dynamic library" FORCE)
@@ -356,12 +356,12 @@ set(CLANG_FORMAT_POSTFIX "-6.0")
356find_program(CLANG_FORMAT 356find_program(CLANG_FORMAT
357 NAMES clang-format${CLANG_FORMAT_POSTFIX} 357 NAMES clang-format${CLANG_FORMAT_POSTFIX}
358 clang-format 358 clang-format
359 PATHS ${CMAKE_BINARY_DIR}/externals) 359 PATHS ${PROJECT_BINARY_DIR}/externals)
360# if find_program doesn't find it, try to download from externals 360# if find_program doesn't find it, try to download from externals
361if (NOT CLANG_FORMAT) 361if (NOT CLANG_FORMAT)
362 if (WIN32) 362 if (WIN32)
363 message(STATUS "Clang format not found! Downloading...") 363 message(STATUS "Clang format not found! Downloading...")
364 set(CLANG_FORMAT "${CMAKE_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe") 364 set(CLANG_FORMAT "${PROJECT_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe")
365 file(DOWNLOAD 365 file(DOWNLOAD
366 https://github.com/yuzu-emu/ext-windows-bin/raw/master/clang-format${CLANG_FORMAT_POSTFIX}.exe 366 https://github.com/yuzu-emu/ext-windows-bin/raw/master/clang-format${CLANG_FORMAT_POSTFIX}.exe
367 "${CLANG_FORMAT}" SHOW_PROGRESS 367 "${CLANG_FORMAT}" SHOW_PROGRESS
@@ -377,7 +377,7 @@ if (NOT CLANG_FORMAT)
377endif() 377endif()
378 378
379if (CLANG_FORMAT) 379if (CLANG_FORMAT)
380 set(SRCS ${CMAKE_SOURCE_DIR}/src) 380 set(SRCS ${PROJECT_SOURCE_DIR}/src)
381 set(CCOMMENT "Running clang format against all the .h and .cpp files in src/") 381 set(CCOMMENT "Running clang format against all the .h and .cpp files in src/")
382 if (WIN32) 382 if (WIN32)
383 add_custom_target(clang-format 383 add_custom_target(clang-format
@@ -450,10 +450,10 @@ endif()
450# http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html 450# http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
451# http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html 451# http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html
452if(ENABLE_QT AND UNIX AND NOT APPLE) 452if(ENABLE_QT AND UNIX AND NOT APPLE)
453 install(FILES "${CMAKE_SOURCE_DIR}/dist/yuzu.desktop" 453 install(FILES "${PROJECT_SOURCE_DIR}/dist/yuzu.desktop"
454 DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications") 454 DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications")
455 install(FILES "${CMAKE_SOURCE_DIR}/dist/yuzu.svg" 455 install(FILES "${PROJECT_SOURCE_DIR}/dist/yuzu.svg"
456 DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps") 456 DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps")
457 install(FILES "${CMAKE_SOURCE_DIR}/dist/yuzu.xml" 457 install(FILES "${PROJECT_SOURCE_DIR}/dist/yuzu.xml"
458 DESTINATION "${CMAKE_INSTALL_PREFIX}/share/mime/packages") 458 DESTINATION "${CMAKE_INSTALL_PREFIX}/share/mime/packages")
459endif() 459endif()
diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt
index 1c83e9c34..93878f8ab 100644
--- a/src/web_service/CMakeLists.txt
+++ b/src/web_service/CMakeLists.txt
@@ -10,7 +10,7 @@ add_library(web_service STATIC
10create_target_directory_groups(web_service) 10create_target_directory_groups(web_service)
11 11
12get_directory_property(OPENSSL_LIBS 12get_directory_property(OPENSSL_LIBS
13 DIRECTORY ${CMAKE_SOURCE_DIR}/externals/libressl 13 DIRECTORY ${PROJECT_SOURCE_DIR}/externals/libressl
14 DEFINITION OPENSSL_LIBS) 14 DEFINITION OPENSSL_LIBS)
15target_compile_definitions(web_service PUBLIC -DCPPHTTPLIB_OPENSSL_SUPPORT) 15target_compile_definitions(web_service PUBLIC -DCPPHTTPLIB_OPENSSL_SUPPORT)
16target_link_libraries(web_service PRIVATE common json-headers ${OPENSSL_LIBS} httplib lurlparser) 16target_link_libraries(web_service PRIVATE common json-headers ${OPENSSL_LIBS} httplib lurlparser)
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 04464ad5e..0d24e8eb0 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -82,10 +82,10 @@ set(UIS
82) 82)
83 83
84file(GLOB COMPAT_LIST 84file(GLOB COMPAT_LIST
85 ${CMAKE_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc 85 ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
86 ${CMAKE_BINARY_DIR}/dist/compatibility_list/compatibility_list.json) 86 ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
87file(GLOB_RECURSE ICONS ${CMAKE_SOURCE_DIR}/dist/icons/*) 87file(GLOB_RECURSE ICONS ${PROJECT_SOURCE_DIR}/dist/icons/*)
88file(GLOB_RECURSE THEMES ${CMAKE_SOURCE_DIR}/dist/qt_themes/*) 88file(GLOB_RECURSE THEMES ${PROJECT_SOURCE_DIR}/dist/qt_themes/*)
89 89
90qt5_wrap_ui(UI_HDRS ${UIS}) 90qt5_wrap_ui(UI_HDRS ${UIS})
91 91