2020-06-13 21:26:28 +00:00
|
|
|
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
|
|
|
|
# Allow target_link_libraries with targets in other directories
|
2019-06-12 02:05:17 +00:00
|
|
|
cmake_policy(SET CMP0079 NEW)
|
2020-06-13 21:26:28 +00:00
|
|
|
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
|
|
|
|
cmake_policy(SET CMP0091 NEW)
|
2017-12-19 03:05:50 +00:00
|
|
|
|
2018-05-10 22:00:03 +00:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries)
|
|
|
|
|
2019-02-04 01:38:35 +00:00
|
|
|
if(APPLE)
|
|
|
|
# Shaddup Xcode
|
|
|
|
function(add_executable TARGET)
|
|
|
|
_add_executable(${TARGET} ${ARGN})
|
|
|
|
set_target_properties(${TARGET} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
|
|
|
endfunction()
|
|
|
|
function(add_library TARGET)
|
|
|
|
_add_library(${TARGET} ${ARGN})
|
|
|
|
list(GET ARGV 1 ARG1)
|
2019-08-31 20:40:07 +00:00
|
|
|
if(NOT ${ARG1} STREQUAL INTERFACE AND NOT ${ARG1} STREQUAL ALIAS)
|
2019-02-04 01:38:35 +00:00
|
|
|
set_target_properties(${TARGET} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
endif()
|
|
|
|
|
2017-12-19 03:05:50 +00:00
|
|
|
if(APPLE AND NOT CMAKE_OSX_SYSROOT)
|
|
|
|
# If the Xcode SDK is lagging behind system version, CMake needs this done first
|
2018-01-04 04:17:44 +00:00
|
|
|
execute_process(COMMAND xcrun --sdk macosx --show-sdk-path
|
2017-12-19 03:05:50 +00:00
|
|
|
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
endif()
|
|
|
|
|
2018-10-07 02:59:17 +00:00
|
|
|
option(URDE_CROSSCOMPILING "Don't build tools; attempt package import" OFF)
|
2017-12-28 02:07:58 +00:00
|
|
|
if (URDE_CROSSCOMPILING)
|
|
|
|
set(CMAKE_CROSSCOMPILING On)
|
|
|
|
endif()
|
|
|
|
|
2018-10-07 02:59:17 +00:00
|
|
|
if(CMAKE_CROSSCOMPILING)
|
|
|
|
set(HAVE_WORDS_BIGENDIAN_EXITCODE 0 CACHE INTEGER "Makes soxr happy" FORCE)
|
|
|
|
endif()
|
|
|
|
|
2019-06-12 02:05:17 +00:00
|
|
|
project(urde VERSION 0.1.0)
|
2018-10-07 02:59:17 +00:00
|
|
|
|
2020-04-07 11:28:43 +00:00
|
|
|
# MSVC has a "latest" flag, which always uses the newest standard
|
|
|
|
# when available. GCC and Clang posess no such flag, and must be
|
|
|
|
# manually enforced. CMake, curiously, also doesn't have a "latest"
|
|
|
|
# standard flag either.
|
2020-04-11 05:05:55 +00:00
|
|
|
if (NOT MSVC)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2020-04-07 11:28:43 +00:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif()
|
|
|
|
|
2017-07-03 04:48:19 +00:00
|
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Force shared libs off" FORCE)
|
|
|
|
set(BUILD_STATIC_LIBS ON CACHE BOOL "Force static libs on" FORCE)
|
2017-06-18 02:53:39 +00:00
|
|
|
|
2019-07-28 01:21:31 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/sanitizers-cmake/cmake")
|
2017-12-12 02:06:19 +00:00
|
|
|
find_package(Sanitizers)
|
2018-05-25 06:39:38 +00:00
|
|
|
|
2021-03-10 20:01:51 +00:00
|
|
|
if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64)
|
2021-03-02 02:36:10 +00:00
|
|
|
set(URDE_VECTOR_ISA "sse41" CACHE STRING "Vector ISA to build for (sse2, sse3, sse41, avx, avx2)")
|
|
|
|
endif ()
|
2017-12-12 02:06:19 +00:00
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
if(MSVC)
|
2017-12-27 22:23:21 +00:00
|
|
|
if(${URDE_VECTOR_ISA} STREQUAL "avx2")
|
2019-06-12 02:05:17 +00:00
|
|
|
add_compile_options(/arch:AVX2)
|
2019-06-12 02:14:39 +00:00
|
|
|
add_compile_definitions(__SSE4_1__=1)
|
2017-12-27 22:23:21 +00:00
|
|
|
message(STATUS "Building with AVX2 Vector ISA")
|
|
|
|
elseif(${URDE_VECTOR_ISA} STREQUAL "avx")
|
2019-06-12 02:05:17 +00:00
|
|
|
add_compile_options(/arch:AVX)
|
2019-06-12 02:14:39 +00:00
|
|
|
add_compile_definitions(__SSE4_1__=1)
|
2017-12-27 22:23:21 +00:00
|
|
|
message(STATUS "Building with AVX Vector ISA")
|
|
|
|
elseif(${URDE_VECTOR_ISA} STREQUAL "sse41")
|
2019-06-12 02:14:39 +00:00
|
|
|
add_compile_definitions(__SSE4_1__=1)
|
2021-03-02 02:36:10 +00:00
|
|
|
# clang-cl 10 requires -msse4.1, may be fixed in newer versions?
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL Clang)
|
|
|
|
add_compile_options(-msse4.1)
|
|
|
|
endif()
|
2017-12-27 22:23:21 +00:00
|
|
|
message(STATUS "Building with SSE4.1 Vector ISA")
|
|
|
|
else()
|
|
|
|
message(STATUS "Building with SSE2 Vector ISA")
|
2017-12-12 02:06:19 +00:00
|
|
|
endif()
|
|
|
|
|
2016-03-05 03:34:27 +00:00
|
|
|
if(${CMAKE_GENERATOR} MATCHES "Visual Studio*")
|
2019-06-12 02:14:39 +00:00
|
|
|
set(VS_OPTIONS "/MP")
|
2017-12-08 02:55:12 +00:00
|
|
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT urde)
|
2016-03-05 03:34:27 +00:00
|
|
|
endif()
|
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
# Shaddup MSVC
|
2019-06-12 02:14:39 +00:00
|
|
|
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
|
|
|
|
_CRT_SECURE_NO_WARNINGS=1 D_SCL_SECURE_NO_WARNINGS=1
|
|
|
|
_SCL_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1
|
2020-02-16 08:10:08 +00:00
|
|
|
_ENABLE_EXTENDED_ALIGNED_STORAGE=1 NOMINMAX=1)
|
2019-06-12 02:14:39 +00:00
|
|
|
add_compile_options(/IGNORE:4221 /wd4018 /wd4800 /wd4005 /wd4311 /wd4068
|
|
|
|
/wd4267 /wd4244 /wd4200 /wd4305 /wd4067 /wd4146 /wd4309 /wd4805 ${VS_OPTIONS})
|
2017-10-24 03:12:10 +00:00
|
|
|
|
2020-04-11 05:05:55 +00:00
|
|
|
add_compile_options(
|
|
|
|
# Disable exceptions
|
2020-04-17 20:40:46 +00:00
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/EHsc->
|
|
|
|
|
|
|
|
# Disable RTTI
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/GR->
|
2020-04-11 05:05:55 +00:00
|
|
|
|
|
|
|
# Enforce various standards compliant behavior.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
|
|
|
|
|
|
|
|
# Enable standard volatile semantics.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
|
2016-01-15 05:44:42 +00:00
|
|
|
|
2020-04-11 05:05:55 +00:00
|
|
|
# Reports the proper value for the __cplusplus preprocessor macro.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
|
|
|
|
|
|
|
|
# Use latest C++ standard.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
|
|
|
|
)
|
2020-04-17 20:40:46 +00:00
|
|
|
add_compile_definitions(FMT_EXCEPTIONS=0 _HAS_EXCEPTIONS=0)
|
2017-03-10 18:00:40 +00:00
|
|
|
|
2018-05-29 03:41:28 +00:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
2020-04-11 05:05:55 +00:00
|
|
|
# Flags for MSVC (not clang-cl)
|
2020-04-01 00:52:20 +00:00
|
|
|
add_compile_options(
|
2020-04-11 05:05:55 +00:00
|
|
|
# Allow constexpr variables to have explicit external linkage.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
|
|
|
|
|
|
|
|
# Assume that new throws exceptions, allowing better code generation.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
|
|
|
|
|
|
|
|
# Link-time Code Generation for Release builds
|
|
|
|
$<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>:/GL>
|
2020-04-01 00:52:20 +00:00
|
|
|
)
|
|
|
|
|
2020-04-11 05:05:55 +00:00
|
|
|
# Link-time Code Generation for Release builds
|
2018-05-25 06:39:38 +00:00
|
|
|
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
|
|
|
|
set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "/LTCG")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
2020-12-18 11:09:45 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup /Oy-")
|
2018-05-25 06:39:38 +00:00
|
|
|
endif()
|
2016-01-15 05:44:42 +00:00
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
else()
|
2021-01-07 01:47:25 +00:00
|
|
|
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL x86_64)
|
2019-12-01 04:37:47 +00:00
|
|
|
if(${URDE_VECTOR_ISA} STREQUAL "native")
|
|
|
|
add_compile_options(-march=native)
|
|
|
|
message(STATUS "Building with native ISA")
|
|
|
|
elseif(${URDE_VECTOR_ISA} STREQUAL "avx2")
|
2019-06-12 02:05:17 +00:00
|
|
|
add_compile_options(-mavx2)
|
2017-12-27 22:23:21 +00:00
|
|
|
message(STATUS "Building with AVX2 Vector ISA")
|
|
|
|
elseif(${URDE_VECTOR_ISA} STREQUAL "avx")
|
2019-06-12 02:05:17 +00:00
|
|
|
add_compile_options(-mavx)
|
2017-12-27 22:23:21 +00:00
|
|
|
message(STATUS "Building with AVX Vector ISA")
|
|
|
|
elseif(${URDE_VECTOR_ISA} STREQUAL "sse41")
|
2019-06-12 02:05:17 +00:00
|
|
|
add_compile_options(-msse4.1)
|
2017-12-27 22:23:21 +00:00
|
|
|
message(STATUS "Building with SSE4.1 Vector ISA")
|
|
|
|
elseif(${URDE_VECTOR_ISA} STREQUAL "sse3")
|
2019-06-12 02:05:17 +00:00
|
|
|
add_compile_options(-msse3)
|
2017-12-27 22:23:21 +00:00
|
|
|
message(STATUS "Building with SSE3 Vector ISA")
|
|
|
|
elseif(${URDE_VECTOR_ISA} STREQUAL "sse2")
|
2019-06-12 02:05:17 +00:00
|
|
|
add_compile_options(-msse2)
|
2017-12-27 22:23:21 +00:00
|
|
|
message(STATUS "Building with SSE2 Vector ISA")
|
|
|
|
else()
|
|
|
|
message(STATUS "Building with x87 Vector ISA")
|
2017-12-12 02:06:19 +00:00
|
|
|
endif()
|
2021-01-07 01:47:25 +00:00
|
|
|
endif()
|
2017-12-12 02:06:19 +00:00
|
|
|
|
2019-05-08 03:50:21 +00:00
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
check_cxx_compiler_flag(-fno-plt HAS_NO_PLT)
|
|
|
|
if (HAS_NO_PLT)
|
2019-06-12 02:05:17 +00:00
|
|
|
add_compile_options(-fno-plt)
|
2019-05-08 03:50:21 +00:00
|
|
|
endif()
|
2020-03-02 06:59:31 +00:00
|
|
|
check_cxx_compiler_flag(-fno-asynchronous-unwind-tables HAS_NO_ASYNC_UNWIND_TABLES)
|
2020-12-18 11:09:45 +00:00
|
|
|
if (HAS_NO_ASYNC_UNWIND_TABLES AND ${CMAKE_BUILD_TYPE} STREQUAL Release)
|
2020-03-02 06:59:31 +00:00
|
|
|
# Binary size reduction
|
|
|
|
add_compile_options(-fno-asynchronous-unwind-tables)
|
|
|
|
endif()
|
2019-05-08 03:50:21 +00:00
|
|
|
|
2019-04-07 05:14:48 +00:00
|
|
|
if(URDE_MSAN)
|
2020-04-11 05:05:55 +00:00
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-stdlib=libc++> -fsanitize=memory
|
|
|
|
-fsanitize-memory-track-origins -fsanitize-recover=all)
|
2019-04-07 05:14:48 +00:00
|
|
|
endif()
|
2020-04-11 05:05:55 +00:00
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>
|
2020-05-29 21:40:15 +00:00
|
|
|
-Wall -Wno-multichar -Werror=implicit-fallthrough
|
2020-05-31 04:21:35 +00:00
|
|
|
-Wno-unused-variable -Wno-unused-result
|
2019-08-31 20:40:07 +00:00
|
|
|
-Wno-unused-function -Wno-sign-compare -Wno-unknown-pragmas -Werror)
|
2020-05-31 04:21:35 +00:00
|
|
|
# doesn't work with generator expression in add_compile_options?
|
2020-06-01 06:51:31 +00:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
2020-05-31 04:21:35 +00:00
|
|
|
add_compile_options(-Wno-unknown-warning-option -Wno-unused-private-field)
|
|
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
2021-03-02 02:36:10 +00:00
|
|
|
add_compile_options(-Wno-lto-type-mismatch -Wno-maybe-uninitialized)
|
2020-05-31 04:21:35 +00:00
|
|
|
endif()
|
2019-08-31 20:40:07 +00:00
|
|
|
add_compile_definitions(FMT_EXCEPTIONS=0)
|
2016-01-15 05:44:42 +00:00
|
|
|
|
2016-01-16 06:11:57 +00:00
|
|
|
if(APPLE)
|
2020-04-11 05:05:55 +00:00
|
|
|
add_compile_options(-Wno-error=deprecated-declarations
|
|
|
|
$<$<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>:-flto=thin>)
|
2016-01-16 06:11:57 +00:00
|
|
|
endif()
|
|
|
|
|
2015-07-07 03:22:44 +00:00
|
|
|
endif()
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2015-09-27 05:29:31 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
2019-06-12 02:05:17 +00:00
|
|
|
include_directories(/usr/local/include)
|
|
|
|
link_directories(/usr/local/lib)
|
2015-09-13 03:43:22 +00:00
|
|
|
endif()
|
|
|
|
|
2019-12-01 04:01:38 +00:00
|
|
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
2020-12-18 11:09:45 +00:00
|
|
|
if(${CMAKE_BUILD_TYPE} STREQUAL Debug OR ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo)
|
2019-12-12 06:58:55 +00:00
|
|
|
# This is required to summarize std::string
|
2020-12-18 11:09:45 +00:00
|
|
|
add_compile_options(-fno-limit-debug-info -fno-omit-frame-pointer)
|
2019-12-12 06:58:55 +00:00
|
|
|
endif()
|
2019-12-01 04:01:38 +00:00
|
|
|
option(USE_LD_LLD "Link with LLD" ON)
|
|
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
option(USE_LD_GOLD "Link with GNU Gold" ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(CheckIPOSupported)
|
|
|
|
check_ipo_supported(RESULT LTO_SUPPORTED)
|
|
|
|
if(LTO_SUPPORTED AND ("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
|
|
|
|
option(USE_LTO "Enable LTO" ON)
|
|
|
|
else()
|
|
|
|
option(USE_LTO "Enable LTO" OFF)
|
|
|
|
endif()
|
2015-12-23 04:16:54 +00:00
|
|
|
else()
|
2019-12-01 04:01:38 +00:00
|
|
|
option(USE_LD_LLD "Link with LLD" OFF)
|
|
|
|
option(USE_LD_GOLD "Link with GNU Gold" OFF)
|
|
|
|
option(USE_LTO "Enable LTO" OFF)
|
2015-12-23 04:16:54 +00:00
|
|
|
endif()
|
2019-12-01 04:01:38 +00:00
|
|
|
if(USE_LD_LLD)
|
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=lld -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
|
|
|
if("${LD_VERSION}" MATCHES "LLD")
|
2020-03-02 06:59:31 +00:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld -Wl,--build-id=uuid")
|
2019-12-01 04:01:38 +00:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
|
|
|
|
if(USE_LTO)
|
|
|
|
add_compile_options(-flto=thin)
|
|
|
|
add_link_options(-flto=thin)
|
|
|
|
message(STATUS "LLD linker enabled with LTO.")
|
2015-12-23 04:16:54 +00:00
|
|
|
else()
|
2019-12-01 04:01:38 +00:00
|
|
|
message(STATUS "LLD linker enabled.")
|
2015-12-23 04:16:54 +00:00
|
|
|
endif()
|
2019-12-01 04:01:38 +00:00
|
|
|
set(USE_LD_GOLD OFF)
|
|
|
|
else()
|
|
|
|
message(WARNING "LLD linker isn't available, using the default system linker.")
|
|
|
|
set(USE_LD_LLD OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(USE_LD_GOLD)
|
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
|
|
|
if("${LD_VERSION}" MATCHES "GNU gold")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
|
|
|
if(USE_LTO)
|
2020-05-27 17:35:40 +00:00
|
|
|
add_compile_options(-flto)
|
|
|
|
add_link_options(-flto)
|
2019-12-01 04:01:38 +00:00
|
|
|
message(STATUS "GNU gold linker enabled with LTO.")
|
|
|
|
else()
|
|
|
|
message(STATUS "GNU gold linker enabled.")
|
|
|
|
endif()
|
|
|
|
set(USE_LD_LLD OFF)
|
|
|
|
else()
|
|
|
|
message(WARNING "GNU gold linker isn't available, using the default system linker.")
|
|
|
|
set(USE_LD_GOLD OFF)
|
|
|
|
endif()
|
2015-12-23 04:16:54 +00:00
|
|
|
endif()
|
|
|
|
|
2018-01-16 06:42:28 +00:00
|
|
|
# Add discord-rpc here
|
2018-10-07 02:59:17 +00:00
|
|
|
if(NOT GEKKO AND NOT NX)
|
|
|
|
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc)
|
|
|
|
if (NOT CMAKE_INSTALL_LIBDIR)
|
|
|
|
set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix)
|
|
|
|
endif()
|
|
|
|
add_subdirectory(discord-rpc/src)
|
2019-06-12 02:05:17 +00:00
|
|
|
target_include_directories(discord-rpc PRIVATE rapidjson/include PUBLIC discord-rpc/include)
|
2018-01-16 06:48:40 +00:00
|
|
|
endif()
|
2018-01-16 06:42:28 +00:00
|
|
|
|
2018-05-05 20:56:42 +00:00
|
|
|
add_subdirectory(nod)
|
|
|
|
|
2018-01-02 01:04:23 +00:00
|
|
|
set(HECL_DLPACKAGE ${URDE_DLPACKAGE})
|
|
|
|
|
2020-03-02 06:59:31 +00:00
|
|
|
set(DATA_SPEC_LIBS RetroDataSpec AssetNameMap)
|
2015-08-17 22:15:52 +00:00
|
|
|
set(HECL_DATASPEC_DECLS
|
|
|
|
"/* RetroCommon specs */
|
2016-02-13 09:02:47 +00:00
|
|
|
namespace DataSpec
|
2015-08-17 22:15:52 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP1;
|
2016-03-26 00:51:59 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP1PC;
|
2017-01-17 01:23:19 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP1ORIG;
|
2016-03-04 23:04:53 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP2;
|
2016-03-26 00:51:59 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP2PC;
|
2017-01-17 01:23:19 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP2ORIG;
|
2016-03-04 23:04:53 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP3;
|
2016-03-26 00:51:59 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP3PC;
|
2017-01-17 01:23:19 +00:00
|
|
|
extern hecl::Database::DataSpecEntry SpecEntMP3ORIG;
|
2015-08-17 22:15:52 +00:00
|
|
|
}")
|
|
|
|
set(HECL_DATASPEC_PUSHES
|
|
|
|
" /* RetroCommon */
|
2017-01-17 01:23:19 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.reserve(9);
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP1);
|
2016-03-26 00:51:59 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP1PC);
|
2017-01-17 01:23:19 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP1ORIG);
|
2016-03-04 23:04:53 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2);
|
2016-03-26 00:51:59 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2PC);
|
2017-01-17 01:23:19 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP2ORIG);
|
2016-03-26 00:51:59 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3);
|
2017-01-17 01:23:19 +00:00
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3PC);
|
|
|
|
hecl::Database::DATA_SPEC_REGISTRY.push_back(&DataSpec::SpecEntMP3ORIG);")
|
2019-06-12 02:05:17 +00:00
|
|
|
|
2018-10-07 02:59:17 +00:00
|
|
|
add_subdirectory(hecl/shaderc)
|
|
|
|
include(hecl/ApplicationTools.cmake)
|
|
|
|
add_subdirectory(specter/shaders)
|
|
|
|
add_subdirectory(Shaders)
|
2015-08-17 22:05:00 +00:00
|
|
|
add_subdirectory(hecl)
|
2019-06-12 02:05:17 +00:00
|
|
|
target_include_directories(hecl-full PRIVATE ${CMAKE_SOURCE_DIR})
|
|
|
|
target_include_directories(hecl-light PRIVATE ${CMAKE_SOURCE_DIR})
|
|
|
|
target_link_libraries(hecl-full PRIVATE zeus nod)
|
|
|
|
target_link_libraries(hecl-light PRIVATE zeus nod)
|
2016-12-08 04:55:44 +00:00
|
|
|
|
2017-12-07 04:13:12 +00:00
|
|
|
if(NOT TARGET bintoc)
|
|
|
|
# Use native if cross compiling
|
|
|
|
find_package(hecl-bintoc REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2019-05-08 03:50:21 +00:00
|
|
|
bintoc(CModelShaders.common.glsl.cpp Shaders/CModelShaders.common.glsl CMODELSHADERS_COMMON_GLSL)
|
|
|
|
bintoc(CModelShaders.vert.glsl.cpp Shaders/CModelShaders.vert.glsl CMODELSHADERS_VERT_GLSL)
|
|
|
|
bintoc(CModelShaders.frag.glsl.cpp Shaders/CModelShaders.frag.glsl CMODELSHADERS_FRAG_GLSL)
|
2019-05-10 04:09:01 +00:00
|
|
|
bintoc(CModelShaders.common.hlsl.cpp Shaders/CModelShaders.common.hlsl CMODELSHADERS_COMMON_HLSL)
|
|
|
|
bintoc(CModelShaders.vert.hlsl.cpp Shaders/CModelShaders.vert.hlsl CMODELSHADERS_VERT_HLSL)
|
|
|
|
bintoc(CModelShaders.frag.hlsl.cpp Shaders/CModelShaders.frag.hlsl CMODELSHADERS_FRAG_HLSL)
|
2019-05-10 23:08:58 +00:00
|
|
|
bintoc(CModelShaders.common.metal.cpp Shaders/CModelShaders.common.metal CMODELSHADERS_COMMON_METAL)
|
|
|
|
bintoc(CModelShaders.vert.metal.cpp Shaders/CModelShaders.vert.metal CMODELSHADERS_VERT_METAL)
|
|
|
|
bintoc(CModelShaders.frag.metal.cpp Shaders/CModelShaders.frag.metal CMODELSHADERS_FRAG_METAL)
|
2019-05-10 04:09:01 +00:00
|
|
|
add_library(CModelShaders
|
|
|
|
CModelShaders.common.glsl.cpp CModelShaders.vert.glsl.cpp CModelShaders.frag.glsl.cpp
|
2019-05-10 23:08:58 +00:00
|
|
|
CModelShaders.common.hlsl.cpp CModelShaders.vert.hlsl.cpp CModelShaders.frag.hlsl.cpp
|
|
|
|
CModelShaders.common.metal.cpp CModelShaders.vert.metal.cpp CModelShaders.frag.metal.cpp)
|
2019-06-12 02:05:17 +00:00
|
|
|
target_link_libraries(shader_CModelShaders PUBLIC CModelShaders)
|
2019-05-08 03:50:21 +00:00
|
|
|
|
2016-12-08 04:55:44 +00:00
|
|
|
if(NOT TARGET atdna)
|
2017-12-07 04:13:12 +00:00
|
|
|
# Import native atdna if cross-compiling
|
|
|
|
find_package(atdna REQUIRED)
|
|
|
|
if(NOT TARGET atdna)
|
|
|
|
message(FATAL_ERROR "atdna required for building URDE; please verify LLVM installation")
|
|
|
|
endif()
|
2016-12-08 04:55:44 +00:00
|
|
|
endif()
|
|
|
|
|
2016-05-03 01:23:09 +00:00
|
|
|
add_subdirectory(amuse)
|
2016-03-04 23:04:53 +00:00
|
|
|
add_subdirectory(specter)
|
2019-06-12 02:05:17 +00:00
|
|
|
target_include_directories(specter PRIVATE ${CMAKE_SOURCE_DIR})
|
|
|
|
target_link_libraries(specter PRIVATE nod)
|
2017-07-02 10:18:38 +00:00
|
|
|
add_subdirectory(assetnameparser)
|
2019-06-12 02:14:39 +00:00
|
|
|
add_compile_definitions(URDE_ZIP_INPUT_STREAM=1) # Enable CZipInputStream now that zlib header is known
|
2015-07-07 03:22:44 +00:00
|
|
|
add_subdirectory(DataSpec)
|
2016-06-28 18:54:55 +00:00
|
|
|
add_subdirectory(kabufuda)
|
2015-11-21 01:16:07 +00:00
|
|
|
add_subdirectory(Editor)
|
2016-06-28 18:54:55 +00:00
|
|
|
|
2017-01-08 02:52:49 +00:00
|
|
|
add_subdirectory(jbus)
|
|
|
|
set(JBUS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/jbus/include)
|
|
|
|
|
2016-04-24 04:03:30 +00:00
|
|
|
set(CLIENT_SOURCES
|
|
|
|
${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryBase.hpp
|
|
|
|
${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryBase.cpp
|
|
|
|
${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryMP1.hpp
|
|
|
|
${CMAKE_SOURCE_DIR}/Editor/ProjectResourceFactoryMP1.cpp)
|
2019-06-12 02:05:17 +00:00
|
|
|
add_subdirectory(NESEmulator)
|
2015-07-11 22:41:10 +00:00
|
|
|
add_subdirectory(Runtime)
|
2016-03-23 20:38:01 +00:00
|
|
|
add_subdirectory(mpcksum)
|
2017-01-02 05:27:39 +00:00
|
|
|
add_subdirectory(gbalink)
|
2017-02-24 08:28:44 +00:00
|
|
|
add_subdirectory(visigen)
|
2015-11-20 07:33:09 +00:00
|
|
|
|
2018-05-26 21:30:19 +00:00
|
|
|
add_dependencies(hecl visigen)
|
|
|
|
|
2018-10-07 02:59:17 +00:00
|
|
|
if (NOT WINDOWS_STORE AND NOT NX)
|
2021-02-21 18:25:52 +00:00
|
|
|
if(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
|
|
|
|
set(QT_HOMEBREW_PATH /usr/local/opt/qt)
|
|
|
|
elseif(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
|
|
|
|
set(QT_HOMEBREW_PATH /opt/homebrew/opt/qt)
|
|
|
|
else()
|
|
|
|
set(QT_HOMEBREW_PATH "")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
find_package(Qt6Widgets QUIET PATHS ${QT_HOMEBREW_PATH})
|
|
|
|
find_package(Qt5Widgets QUIET PATHS ${QT_HOMEBREW_PATH})
|
|
|
|
if (Qt6Widgets_FOUND)
|
2021-01-24 00:28:22 +00:00
|
|
|
message(STATUS "Qt6 found, hecl-gui will be built")
|
2017-12-06 03:36:31 +00:00
|
|
|
add_subdirectory(hecl-gui)
|
2021-02-21 18:25:52 +00:00
|
|
|
elseif(Qt5Widgets_FOUND)
|
|
|
|
message(STATUS "Qt5 found, hecl-gui will be built")
|
|
|
|
add_subdirectory(hecl-gui)
|
2018-10-07 02:59:17 +00:00
|
|
|
else()
|
2021-02-21 18:25:52 +00:00
|
|
|
message(STATUS "Qt5-6 not found, hecl-gui will not be built")
|
2018-10-07 02:59:17 +00:00
|
|
|
endif()
|
2017-12-04 09:55:33 +00:00
|
|
|
endif()
|
2017-12-06 03:36:31 +00:00
|
|
|
|
2015-12-25 01:10:39 +00:00
|
|
|
unset(GIT_EXECUTABLE CACHE)
|
2015-11-20 07:33:09 +00:00
|
|
|
find_package(Git)
|
|
|
|
if(GIT_FOUND)
|
|
|
|
# Get the current working branch
|
2019-06-15 00:39:20 +00:00
|
|
|
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
2016-07-16 19:21:12 +00:00
|
|
|
OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE )
|
2015-11-20 07:33:09 +00:00
|
|
|
|
|
|
|
# Get the latest abbreviated commit hash of the working branch
|
2016-07-16 19:21:12 +00:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%h WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE
|
|
|
|
GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE
|
|
|
|
GIT_COMMIT_HASH_FULL OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE
|
|
|
|
GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
2016-01-05 00:48:10 +00:00
|
|
|
else()
|
|
|
|
message(STATUS "Unable to find GIT, commit information will not be available")
|
|
|
|
set(GIT_BRANCH "")
|
|
|
|
set(GIT_COMMIT_HASH "")
|
|
|
|
set(GIT_COMMIT_HASH_FULL "")
|
|
|
|
set(GIT_COMMIT_DATE "")
|
2015-11-20 07:33:09 +00:00
|
|
|
endif()
|
2016-01-05 00:48:10 +00:00
|
|
|
|
2019-06-12 02:05:17 +00:00
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_BINARY_DIR}/version.h)
|