2015-07-07 03:22:44 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2015-12-25 01:10:39 +00:00
|
|
|
cmake_policy(SET CMP0054 NEW)
|
2015-08-22 06:08:28 +00:00
|
|
|
project(PathShagged)
|
2015-08-17 22:05:00 +00:00
|
|
|
if(MSVC)
|
|
|
|
# Shaddup MSVC
|
2015-11-10 20:12:43 +00:00
|
|
|
add_definitions(-DUNICODE=1 -D_UNICODE=1 -D__SSE__=1 -D_CRT_SECURE_NO_WARNINGS=1 -DD_SCL_SECURE_NO_WARNINGS=1 /wd4267 /wd4244 /wd4305)
|
2016-01-15 05:44:42 +00:00
|
|
|
|
|
|
|
# Link-time Code Generation for Release builds
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy /MD")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /Zi /O2 /Oy- /GL /Gy /MD")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
else()
|
2015-11-14 23:42:58 +00:00
|
|
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
|
|
|
|
message(WARNING "GCC needs -fpermissive for nested type redeclarations; expect lotsa warnings!!")
|
|
|
|
endif()
|
2015-10-20 01:16:06 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-multichar -fno-exceptions")
|
2016-01-15 05:44:42 +00:00
|
|
|
|
2016-01-16 06:11:57 +00:00
|
|
|
if(APPLE)
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
|
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -flto")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto")
|
|
|
|
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")
|
2015-09-13 03:43:22 +00:00
|
|
|
include_directories(/usr/local/include)
|
|
|
|
endif()
|
|
|
|
|
2016-01-16 06:11:57 +00:00
|
|
|
if(("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
|
|
|
AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
2015-12-23 04:16:54 +00:00
|
|
|
option(USE_LD_GOLD "Link with GNU Gold and enable LTO" ON)
|
|
|
|
else()
|
|
|
|
option(USE_LD_GOLD "Link with GNU Gold and enable LTO" OFF)
|
|
|
|
endif()
|
|
|
|
if(USE_LD_GOLD AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
|
|
|
|
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_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -flto")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
|
|
|
|
message(STATUS "GNU gold linker enabled.")
|
|
|
|
else()
|
|
|
|
message(WARNING "GNU gold linker isn't available, using the default system linker.")
|
|
|
|
set(USE_LD_GOLD OFF)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-11-21 01:16:07 +00:00
|
|
|
set(BOO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/extern/libBoo/include)
|
|
|
|
set(HECL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/hecl/include
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/hecl/blender)
|
2015-08-18 19:45:28 +00:00
|
|
|
|
2016-01-04 05:31:02 +00:00
|
|
|
set(DATA_SPEC_LIBS
|
|
|
|
RetroDataSpec
|
|
|
|
DNAMP3
|
|
|
|
DNAMP2
|
|
|
|
DNAMP1
|
|
|
|
DNACommon)
|
2015-08-17 22:15:52 +00:00
|
|
|
set(HECL_DATASPEC_DECLS
|
|
|
|
"/* RetroCommon specs */
|
|
|
|
namespace Retro
|
|
|
|
{
|
|
|
|
extern HECL::Database::DataSpecEntry SpecEntMP1;
|
|
|
|
extern HECL::Database::DataSpecEntry SpecEntMP2;
|
|
|
|
extern HECL::Database::DataSpecEntry SpecEntMP3;
|
|
|
|
}")
|
|
|
|
set(HECL_DATASPEC_PUSHES
|
|
|
|
" /* RetroCommon */
|
|
|
|
HECL::Database::DATA_SPEC_REGISTRY.push_back(&Retro::SpecEntMP1);
|
|
|
|
HECL::Database::DATA_SPEC_REGISTRY.push_back(&Retro::SpecEntMP2);
|
|
|
|
HECL::Database::DATA_SPEC_REGISTRY.push_back(&Retro::SpecEntMP3);")
|
2015-08-17 22:05:00 +00:00
|
|
|
add_subdirectory(hecl)
|
2015-11-21 01:16:07 +00:00
|
|
|
add_subdirectory(libSpecter)
|
2015-11-22 04:35:24 +00:00
|
|
|
set(SPECTER_INCLUDE_DIR libSpecter/include libSpecter/freetype2/include)
|
2015-08-17 22:05:00 +00:00
|
|
|
add_subdirectory(NODLib)
|
2015-08-18 05:54:43 +00:00
|
|
|
set(NODLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include)
|
2015-10-25 20:15:24 +00:00
|
|
|
add_definitions(-DZE_ATHENA_TYPES=1)
|
2015-11-25 02:15:47 +00:00
|
|
|
set(MATHLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/libSpecter/MathLib/include)
|
2015-08-17 22:05:00 +00:00
|
|
|
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR}
|
2015-11-10 02:07:15 +00:00
|
|
|
${NODLIB_INCLUDE_DIR} ${MATHLIB_INCLUDE_DIR} ${BOO_INCLUDE_DIR}
|
2015-11-21 01:16:07 +00:00
|
|
|
${SPECTER_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
2015-07-07 03:22:44 +00:00
|
|
|
add_subdirectory(DataSpec)
|
2015-09-13 03:43:22 +00:00
|
|
|
#disable Runtime on FreeBSD for now
|
|
|
|
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
2015-11-21 01:16:07 +00:00
|
|
|
add_subdirectory(Editor)
|
2015-07-11 22:41:10 +00:00
|
|
|
add_subdirectory(Runtime)
|
2015-09-13 03:43:22 +00:00
|
|
|
endif()
|
2015-11-20 07:33:09 +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)
|
2016-01-05 00:48:10 +00:00
|
|
|
message(STATUS "Found GIT: ${GIT_EXECUTABLE}")
|
2015-11-20 07:33:09 +00:00
|
|
|
# Get the current working branch
|
2015-12-25 01:10:39 +00:00
|
|
|
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" 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
|
|
|
|
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)
|
2015-12-13 21:01:32 +00:00
|
|
|
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
|
|
|
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_SOURCE_DIR}/version.h)
|