Merge pull request #88 from scribam/cmake

CMake refactoring
This commit is contained in:
flyinghead 2020-05-07 12:06:30 +02:00 committed by GitHub
commit 02f38267a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 923 additions and 1614 deletions

8
.cirrus.yml Normal file
View File

@ -0,0 +1,8 @@
freebsd_instance:
image_family: freebsd-12-1
task:
install_script: pkg install -y alsa-lib cmake evdev-proto flac git libao libudev-devd libzip mesa-libs pkgconf png pulseaudio sdl2
script:
- cmake -B build -DCMAKE_BUILD_TYPE=Release
- cmake --build build --config Release --parallel 2

48
.github/workflows/c-cpp.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: C/C++ CI
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {name: i686-pc-windows-msvc, os: windows-latest, cmakeArgs: -G "Visual Studio 16 2019" -A Win32}
- {name: x86_64-apple-darwin, os: macos-latest, setup: brew install flac libao libzip libomp libpng pulseaudio sdl2 zlib, cmakeArgs: -G "Xcode"}
- {name: x86_64-pc-linux-gnu, os: ubuntu-latest, setup: sudo apt-get update && sudo apt-get -y install libao-dev libasound2-dev libevdev-dev libflac-dev libgl1-mesa-dev libpulse-dev libsdl2-dev libudev-dev libzip-dev}
- {name: x86_64-pc-windows-msvc, os: windows-latest, cmakeArgs: -G "Visual Studio 16 2019" -A x64}
- {name: x86_64-w64-mingw32, os: windows-latest, cmakeArgs: -G "MinGW Makefiles"}
steps:
- name: Set up build environment
run: ${{ matrix.config.setup }}
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: git fetch origin +refs/tags/*:refs/tags/*
- name: Unit Tests
run: |
mkdir -p build/tests
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=tests -DENABLE_CTEST=ON ${{ matrix.config.cmakeArgs }}
cmake --build build --config Release --parallel 2
./build/tests/flycast
if: matrix.config.name == 'x86_64-pc-linux-gnu'
- name: Create artifact directory
run: mkdir -p build/artifact
- name: CMake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=artifact ${{ matrix.config.cmakeArgs }}
cmake --build build --config Release --parallel 2
- uses: actions/upload-artifact@v2
with:
name: flycast-${{ matrix.config.name }}
path: build/artifact

File diff suppressed because it is too large Load Diff

View File

@ -1,220 +0,0 @@
{
"environments": [
{
"environment": "toolchain.generic",
"TOOLCHAIN_FILE": "ps4sdk.cmake"
}
],
"configurations": [
{
"name": "win-x86-Debug",
"generator": "Ninja",
"description": "TemplateDescription_Localize_x86Debug",
"configurationType": "Debug",
"inheritEnvironments": [
"msvc_x86"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "win-x86-Release",
"generator": "Ninja",
"description": "TemplateDescription_Localize_x86Release",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x86"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "win-x64-Debug",
"generator": "Ninja",
"description": "TemplateDescription_Localize_x64Debug",
"configurationType": "Debug",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "-DNINJA=1",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "win-x64-Release",
"generator": "Ninja",
"description": "TemplateDescription_Localize_x64Release",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "-DNINJA=1",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "win-x64-Clang-RelWithDebInfo",
"generator": "Ninja",
"description": "TemplateDescription_Localize_x64Release",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_C_COMPILER",
"value": "clang-cl.exe"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "clang-cl.exe"
}
]
},
// Console SDK's
{
"name": "PS4 SDK",
"generator": "Ninja",
"description": "TemplateDescription_Localize_PS4SDK",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"toolchain.generic"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=${projectDir}\\cmake\\ps4sdk.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
{
"name": "NSW SDK",
"generator": "Ninja",
"description": "TemplateDescription_Localize_PS4SDK",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"toolchain.generic"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "-DCMAKE_TOOLCHAIN_FILE=${projectDir}\\cmake\\devkitA64.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
},
// UWP and VS Gen (temp?)
{
"name": "uwp-x64-Release",
"generator": "Visual Studio 15 2017 Win64",
"description": "TemplateDescription_Localize_x64Release",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "win-x64-MSBuild-Release",
"generator": "Visual Studio 15 2017 Win64",
"description": "TemplateDescription_Localize_x64Release",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"msvc_x64_x64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"environments": [
{
//"MINGW64_ROOT": "C:\\msys64\\mingw64",
"BIN_ROOT": "${env.MINGW64_ROOT}\\bin",
"FLAVOR": "x86_64-w64-mingw32",
"TOOLSET_VERSION": "7.3.0",
"PATH": "${env.MINGW64_ROOT}\\bin;${env.MINGW64_ROOT}\\..\\usr\\local\\bin;${env.MINGW64_ROOT}\\..\\usr\\bin;${env.MINGW64_ROOT}\\..\\bin;${env.PATH}",
"INCLUDE": "${env.INCLUDE};${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION};${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION}\\tr1;${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION}\\${env.FLAVOR}",
"environment": "mingw_64"
}
],
"name": "Mingw64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [
"mingw_64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"intelliSenseMode": "linux-gcc-x64",
"variables": [
{
"name": "CMAKE_C_COMPILER",
"value": "${env.BIN_ROOT}\\gcc.exe"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "${env.BIN_ROOT}\\g++.exe"
}
]
},
{
"environments": [
{
//"MINGW64_ROOT": "C:\\msys64\\mingw64",
"BIN_ROOT": "${env.MINGW64_ROOT}\\bin",
"FLAVOR": "x86_64-w64-mingw32",
"TOOLSET_VERSION": "7.3.0",
"PATH": "${env.MINGW64_ROOT}\\bin;${env.MINGW64_ROOT}\\..\\usr\\local\\bin;${env.MINGW64_ROOT}\\..\\usr\\bin;${env.MINGW64_ROOT}\\..\\bin;${env.PATH}",
"INCLUDE": "${env.INCLUDE};${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION};${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION}\\tr1;${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION}\\${env.FLAVOR}",
"environment": "mingw_64"
}
],
"name": "Mingw64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [
"mingw_64"
],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}\\install",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"intelliSenseMode": "linux-gcc-x64",
"variables": [
{
"name": "CMAKE_C_COMPILER",
"value": "${env.BIN_ROOT}\\gcc.exe"
},
{
"name": "CMAKE_CXX_COMPILER",
"value": "${env.BIN_ROOT}\\g++.exe"
}
]
}
]
}

View File

@ -161,55 +161,24 @@
//automatic
#ifndef CMAKE_BUILD
#if defined(_WIN32) && !defined(TARGET_WIN86) && !defined(TARGET_WIN64)
#if !defined(_M_AMD64) && !defined(__x86_64__)
#define TARGET_WIN86
#else
#define TARGET_WIN64
#endif
#if defined(__x86_64__) || defined(_M_X64)
#define HOST_CPU CPU_X64
#elif defined(__i386__) || defined(_M_IX86)
#define HOST_CPU CPU_X86
#elif defined(__arm__) || defined (_M_ARM)
#define HOST_CPU CPU_ARM
#elif defined(__aarch64__) || defined(_M_ARM64)
#define HOST_CPU CPU_ARM64
#elif defined(__mips__)
#define HOST_CPU CPU_MIPS
#else
#define HOST_CPU CPU_GENERIC
#endif
//Targets
#if defined(TARGET_WIN86)
#define HOST_OS OS_WINDOWS
#define HOST_CPU CPU_X86
#elif defined(TARGET_WIN64)
#define HOST_OS OS_WINDOWS
#define HOST_CPU CPU_X64
#elif defined(TARGET_PANDORA)
#if defined(__APPLE__)
#define HOST_OS OS_DARWIN
#elif defined(__unix__)
#define HOST_OS OS_LINUX
#define HOST_CPU CPU_ARM
#elif defined(TARGET_LINUX_ARMELv7)
#define HOST_OS OS_LINUX
#define HOST_CPU CPU_ARM
#elif defined(TARGET_LINUX_ARMv8)
#define HOST_OS OS_LINUX
#define HOST_CPU CPU_ARM64
#elif defined(TARGET_LINUX_x86)
#define HOST_OS OS_LINUX
#define HOST_CPU CPU_X86
#elif defined(TARGET_LINUX_x64)
#define HOST_OS OS_LINUX
#define HOST_CPU CPU_X64
#elif defined(TARGET_LINUX_MIPS)
#define HOST_OS OS_LINUX
#define HOST_CPU CPU_MIPS
#elif defined(TARGET_GCW0)
#define HOST_OS OS_LINUX
#define HOST_CPU CPU_MIPS
#elif defined(TARGET_IPHONE)
#define HOST_OS OS_DARWIN
#define HOST_CPU CPU_ARM
#elif defined(TARGET_OSX)
#define HOST_OS OS_DARWIN
#define HOST_CPU CPU_X86
#elif defined(TARGET_OSX_X64)
#define HOST_OS OS_DARWIN
#define HOST_CPU CPU_X64
#else
#error Invalid Target: TARGET_* not defined
#endif
#if defined(TARGET_NO_REC)
@ -230,9 +199,6 @@
#define FEAT_DSPREC DYNAREC_NONE
#endif
#endif // !CMAKE_BUILD
#if defined(TARGET_NO_NIXPROF)
#define FEAT_HAS_NIXPROF 0
#endif
@ -244,7 +210,11 @@
//defaults
#ifndef FEAT_SHREC
#define FEAT_SHREC DYNAREC_JIT
#if HOST_CPU == CPU_MIPS
#define FEAT_SHREC DYNAREC_NONE
#else
#define FEAT_SHREC DYNAREC_JIT
#endif
#endif
#ifndef FEAT_AREC

View File

@ -5,4 +5,4 @@
#define REICAST_VERSION "@GIT_VERSION@"
#define GIT_HASH "@GIT_HASH@"
#define BUILD_DATE __DATE__
#define BUILD_DATE "@BUILD_TIMESTAMP@"

View File

@ -1,198 +0,0 @@
# A cmake file (currently only working on Linux).
# Currently not doing library detection because it's a pain.
cmake_minimum_required (VERSION 2.6)
project(reicast)
enable_language(C)
enable_language(CXX)
enable_language(ASM)
set(base ../..)
function(add_directory dir)
file(GLOB _f ${base}/${dir}/*.h ${base}/${dir}/*.c ${base}/${dir}/*.cpp ${base}/${dir}/*.hpp ${base}/${dir}/*.S)
set(source ${source} ${_f} PARENT_SCOPE)
endfunction()
# Options
option(USE_SDL "Use SDL" OFF)
option(USE_OSS "Use OSS" ON)
option(USE_ALSA "Use ALSA" ON)
option(USE_LIBAO "Use LibAO" OFF)
option(USE_GLES "Use GL ES" OFF)
option(USE_PULSEAUDIO "Use PulseAudio" OFF)
option(USE_REND "Use some rendering" ON)
option(USE_EVDEV "Use EVDEV" ON)
option(USE_JOYSTICK "Use Joystick" ON)
# Flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fno-rtti -fno-operator-names")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frename-registers -fno-strict-aliasing -fsingle-precision-constant")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -ftree-vectorize")
if("${CMAKE_BUILD_TYPE}" STREQUAL Release OR "${CMAKE_BUILD_TYPE}" STREQUAL RelWithDebInfo)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -Wl,-O3 -Wl,--sort-common")
# TODO, -Map,$(notdir $@).map
endif()
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
set(arch "x86_64")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686")
set(arch "x86")
else()
set(arch "${CMAKE_SYSTEM_PROCESSOR}")
endif()
add_definitions(-DUSES_HOMEDIR)
add_definitions(-DTARGET_NO_AREC)
if(WINDOWS)
add_definitions(-DTARGET_WIN86)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL Linux)
if("${arch}" STREQUAL x86)
add_definitions(-DTARGET_LINUX_x86)
elseif("${arch}" STREQUAL x86_64)
add_definitions(-DTARGET_LINUX_x64)
elseif("${arch}" STREQUAL arm)
add_definitions(-DTARGET_LINUX_ARMELv7)
elseif("${arch}" STREQUAL mips)
add_definitions(-DTARGET_LINUX_MIPS)
else()
message(FATAL_ERROR "Unknown processor")
endif()
else()
message(FATAL_ERROR "Unknown target")
# TODO, TARGET_GCW0
# TODO, TARGET_IPHONE
# TODO, TARGET_PANDORA
endif()
# TODO, Android
# TODO, Pandora
# Temp stuff:
# TODO: -frename-registers -fno-strict-aliasing -fsingle-precision-constant -ffast-math -ftree-vectorize
# TODO: -fno-exceptions -fno-rtti
# TODO: -fno-exceptions -fno-rtti -std=gnu++11
include_directories(${base}/deps)
include_directories(${base}/core)
include_directories(${base}/core/khronos/)
include_directories(${base}/core/deps/stb)
add_directory(core/cfg/)
add_directory(core/hw/aica)
add_directory(core/hw/arm7)
add_directory(core/hw/flashrom)
add_directory(core/hw/gdrom)
add_directory(core/hw/holly)
add_directory(core/hw/maple)
add_directory(core/hw/mem)
add_directory(core/hw/pvr)
add_directory(core/hw/sh4)
add_directory(core/hw/sh4/dyna)
add_directory(core/hw/sh4/modules)
add_directory(core/hw/sh4/interpr/)
add_directory(core/profiler)
add_directory(core/oslib)
add_directory(core/arm_emitter)
add_directory(core/rend)
add_directory(core/reios)
add_directory(core/imgread)
add_directory(core/deps/libelf)
add_directory(core)
add_directory(core/deps/chdr)
add_directory(core/deps/coreio)
add_directory(core/deps/crypto)
add_directory(core/deps/chdpsr)
add_directory(core/deps/stb)
# add_directory(core/khronos/GL3)
# Core stuff:
list(APPEND libs GL z)
if(NOT WINDOWS AND NOT APPLE)
add_definitions(-DSUPPORT_X11)
endif()
if("${CMAKE_SYSTEM_NAME}" STREQUAL Linux)
# TODO, do some proper detection for this
list(APPEND libs m rt dl pthread X11)
if(USE_ALSA)
add_definitions(-DUSE_ALSA)
list(APPEND libs asound)
endif()
endif()
# Processor-specific recompiler:
if("${arch}" STREQUAL x86)
add_directory(core/rec-x86)
add_directory(core/emitter)
elseif("${arch}" STREQUAL x86_64)
add_directory(core/rec-x64)
elseif("${ARCH}" STREQUAL arm)
add_directory(core/rec-ARM)
endif()
# Audio backends:
if(UNIX AND USE_OSS)
add_definitions(-DUSE_OSS)
endif()
if(USE_PULSEAUDIO)
add_definitions(-DUSE_PULSEAUDIO)
list(APPEND libs pulse-simple)
endif()
if(USE_LIBAO)
add_definitions(-DUSE_LIBAO)
list(APPEND libs ao)
endif()
# Graphic stuffs:
if(USE_REND)
add_directory(core/rend/gles)
else()
add_directory(core/rend/norend)
endif()
if(USE_GLES)
add_definitions(-DGLES)
list(APPEND libs EGL GLESv2)
else()
list(APPEND libs dl GL)
endif()
if(USE_SDL)
list(APPEND source core/sdl/main.cpp)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL Linux)
add_directory(core/linux-dist)
endif()
if(WINDOWS)
add_directory(core/rend/d3d11)
add_directory(core/rend/norend)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL Linux)
add_directory(core/linux)
add_directory(core/linux/nixprof)
else()
message(FATAL_ERROR "Which OS?")
endif()
# Optional features
if(USE_EVDEV)
add_definitions(-DUSE_EVDEV)
endif()
if(USE_JOYSTICK)
add_definitions(-DUSE_JOYSTICK)
endif()
# Executable
add_executable(reicast ${source})
target_link_libraries(reicast ${libs})

View File

@ -1,168 +0,0 @@
# - Returns a version string from Git
#
# These functions force a re-configure on each git commit so that you can
# trust the values of the variables in your build system.
#
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe on the source tree, and adjusting
# the output so that it tests false if an error occurs.
#
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
#
# Returns the results of git describe --exact-match on the source tree,
# and adjusting the output so that it tests false if there was no exact
# matching tag.
#
# git_local_changes(<var>)
#
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
# Uses the return code of "git diff-index --quiet HEAD --".
# Does not regard untracked files.
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
if(__get_git_revision_description)
return()
endif()
set(__get_git_revision_description YES)
# We must run the following at "include" time, not at function call time,
# to find the path to this module rather than the path to a calling list file
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
function(get_git_head_revision _refspecvar _hashvar)
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
# We have reached the root directory, we are not in git
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
return()
endif()
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
endwhile()
# check if this is a submodule
if(NOT IS_DIRECTORY ${GIT_DIR})
file(READ ${GIT_DIR} submodule)
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
endif()
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
if(NOT EXISTS "${GIT_DATA}")
file(MAKE_DIRECTORY "${GIT_DATA}")
endif()
if(NOT EXISTS "${GIT_DIR}/HEAD")
return()
endif()
set(HEAD_FILE "${GIT_DATA}/HEAD")
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
"${GIT_DATA}/grabRef.cmake"
@ONLY)
include("${GIT_DATA}/grabRef.cmake")
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
endfunction()
function(git_describe _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
# TODO sanitize
#if((${ARGN}" MATCHES "&&") OR
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")
execute_process(COMMAND
"${GIT_EXECUTABLE}"
describe
${hash}
${ARGN}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res EQUAL 0)
set(out "${out}-${res}-NOTFOUND")
endif()
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_get_exact_tag _var)
git_describe(out --exact-match ${ARGN})
set(${_var} "${out}" PARENT_SCOPE)
endfunction()
function(git_local_changes _var)
if(NOT GIT_FOUND)
find_package(Git QUIET)
endif()
get_git_head_revision(refspec hash)
if(NOT GIT_FOUND)
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
return()
endif()
if(NOT hash)
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
return()
endif()
execute_process(COMMAND
"${GIT_EXECUTABLE}"
diff-index --quiet HEAD --
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
RESULT_VARIABLE
res
OUTPUT_VARIABLE
out
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(res EQUAL 0)
set(${_var} "CLEAN" PARENT_SCOPE)
else()
set(${_var} "DIRTY" PARENT_SCOPE)
endif()
endfunction()

View File

@ -1,41 +0,0 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
else()
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View File

@ -1,101 +0,0 @@
## android.cmake
#
function(TestPathNDK ndkPath)
#
file(TO_CMAKE_PATH "${ndkPath}" testPath)
if(NOT NDK AND EXISTS "${testPath}")
if(EXISTS "${testPath}/ndk-bundle")
set(NDK ${testPath}/ndk-bundle PARENT_SCOPE)
elseif(EXISTS "${testPath}/sysroot")
set(NDK ${testPath} PARENT_SCOPE)
endif()
endif()
#
endfunction(TestPathNDK)
TestPathNDK("$ENV{ANDROID_HOME}")
TestPathNDK("$ENV{NDK}")
TestPathNDK("$ENV{NDK_ROOT}")
if(NOT NDK)
message("Failed to find NDK !")
endif()
### option for ARM || ARM64 ? HOST isn't useful it's a cross ...
#set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_SYSTEM_NAME Android)
set(CMAKE_SYSTEM_VERSION 22) # API level
set(CMAKE_ANDROID_NDK ${NDK})
set(CMAKE_ANDROID_ARCH_ABI armeabi-v7a) #arm64-v8a , armeabi-v7a , armeabi
set(CMAKE_ANDROID_STL_TYPE c++_static) #gnustl_static libc++ will allow C++17, if you use _shared you must include in apk !
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
#arm $TOOLCHAIN/ arm-linux-androideabi /lib/
#arm64 $TOOLCHAIN/ aarch64-linux-android /lib/
#x86 $TOOLCHAIN/ i686-linux-android /lib/
#x86_64 $TOOLCHAIN/ x86_64-linux-android /lib/
#include(${NDK}/build/cmake/android.toolchain.cmake)
set(ANDROID ON)
add_definitions(-D_ANDROID -DANDROID)
add_definitions(-DANDROID_STL=c++_static)
add_definitions(-DTARGET_ANDROID)
add_definitions(-DGLES)
## FML
#[[
CMAKE_ANDROID_ANT_ADDITIONAL_OPTIONS
CMAKE_ANDROID_API
CMAKE_ANDROID_API_MIN
CMAKE_ANDROID_ARCH
CMAKE_ANDROID_ARCH_ABI
CMAKE_ANDROID_ARM_MODE
CMAKE_ANDROID_ARM_NEON
CMAKE_ANDROID_ASSETS_DIRECTORIES
CMAKE_ANDROID_GUI
CMAKE_ANDROID_JAR_DEPENDENCIES
CMAKE_ANDROID_JAR_DIRECTORIES
CMAKE_ANDROID_JAVA_SOURCE_DIR
CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES
CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES
CMAKE_ANDROID_NDK
CMAKE_ANDROID_NDK_DEPRECATED_HEADERS
CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG
CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION
CMAKE_ANDROID_PROCESS_MAX
CMAKE_ANDROID_PROGUARD
CMAKE_ANDROID_PROGUARD_CONFIG_PATH
CMAKE_ANDROID_SECURE_PROPS_PATH
CMAKE_ANDROID_SKIP_ANT_STEP
CMAKE_ANDROID_STANDALONE_TOOLCHAIN
CMAKE_ANDROID_STL_TYPE
#]]

View File

@ -1,382 +0,0 @@
## config module
#
# get luserx0 to doc this shit or something, vars in all caps are to be exported as defs if they aren't in build.h already
# handle options for FEAT per platform, so rec isn't built for targets w.o one...
# *TODO* fix Android for build system in emu too, OS_LINUX is hardly fitting: prob works better as PLATFORM_ANDROID_{S,N}DK or something
# *TODO* setup git version like it's done in VS/make and configure header so --version works still
# *TODO* lots of other shit to improve build, add enabling/disabling libs/features, setting 3rd party libs as either built in static, dynamic or shared/system
#
#
set(ZBUILD Off)
set(BUILD_LIBS OFF) ## Scope:Local If set will build libs { dreamcast, osd, ... }
set(BUILD_LIB_TYPE STATIC) ## Scope:Local If BUILD_LIBS is set, will use this as type of lib to use { STATIC, SHARED, MODULE (plugin) } *TODO*
set(BUILD_SHARED_LIBS OFF) ## Scope:CMAKE If type is not specified in add_library, use SHARED
## Build flags ##
#
set(DC_PLATFORM_MASK 7) # Z: Uh, not a bitset
set(DC_PLATFORM_DREAMCAST 0) # /* Works, for the most part */
set(DC_PLATFORM_DEV_UNIT 1) # /* This is missing hardware */
set(DC_PLATFORM_NAOMI 2) # /* Works, for the most part */
set(DC_PLATFORM_NAOMI2 3) # /* Needs to be done, 2xsh4 + 2xpvr + custom TNL */
set(DC_PLATFORM_ATOMISWAVE 4) # /* Needs to be done, DC-like hardware with possibly more ram */
set(DC_PLATFORM_HIKARU 5) # /* Needs to be done, 2xsh4, 2x aica , custom vpu */
set(DC_PLATFORM_AURORA 6) # /* Needs to be done, Uses newer 300 mhz sh4 + 150 mhz pvr mbx SoC */
set(OS_WINDOWS 0x10000001) # HOST_OS
set(OS_LINUX 0x10000002)
set(OS_DARWIN 0x10000003)
set(OS_IOS 0x10000004) # todo: iOS != OS_DARWIN
set(OS_ANDROID 0x10000005) # todo: should be SYSTEM_ANDROID but ! OS_LINUX
set(OS_UWP 0x10000011)
set(OS_NSW_HOS 0x80000001)
set(OS_PS4_BSD 0x80000002)
set(CPU_X86 0x20000001) # HOST_CPU
set(CPU_X64 0x20000004)
set(CPU_ARM 0x20000002)
set(CPU_A64 0x20000008)
set(CPU_MIPS 0x20000003)
set(CPU_MIPS64 0x20000009)
set(CPU_PPC 0x20000006)
set(CPU_PPC64 0x20000007)
set(CPU_GENERIC 0x20000005) # used for pnacl, emscripten, etc
set(DYNAREC_NONE 0x40000001) # FEAT_SHREC, FEAT_AREC, FEAT_DSPREC
set(DYNAREC_JIT 0x40000002)
set(DYNAREC_CPP 0x40000003)
set(COMPILER_VC 0x30000001) # BUILD_COMPILER
set(COMPILER_GCC 0x30000002)
set(COMPILER_CLANG 0x30000003)
set(COMPILER_INTEL 0x30000004)
## These default to host, but are used for cross so make sure not to contaminate
#
# CMAKE_SYSTEM ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}.
# CMAKE_SYSTEM_NAME CMAKE_HOST_SYSTEM_NAME uname -s Linux, Windows, and Darwin
# CMAKE_SYSTEM_VERSION CMAKE_HOST_SYSTEM_VERSION uname -r
# CMAKE_SYSTEM_PROCESSOR CMAKE_HOST_SYSTEM_PROCESSOR uname -p
#
#
#
# BOOL: CMAKE_HOST_UNIX CMAKE_HOST_WIN32 CMAKE_HOST_APPLE
#
#
# CMAKE_LIBRARY_ARCHITECTURE CMAKE_<LANG>_LIBRARY_ARCHITECTURE <prefix>/lib/<arch>
#
#
## strings are used to append to path/file names, and to filter multiple possibilities down to one
# AMD64/x86_64:x64, i*86:x86, ppc/powerpc[64][b|l]e:ppc[64] etc
#
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") # todo: check MATCHES "i.86" ?
set(host_arch "x86")
set(HOST_CPU ${CPU_X86})
#
elseif(("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64") OR
("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64"))
set(host_arch "x64")
set(HOST_CPU ${CPU_X64})
#
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64")
set(host_arch "arm64")
set(HOST_CPU ${CPU_A64})
#
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
set(host_arch "arm")
set(HOST_CPU ${CPU_ARM})
#
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ppc64")
set(host_arch "ppc64")
set(HOST_CPU ${CPU_PPC64})
#
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ppc") # has to be done after ppc64 obv
set(host_arch "ppc")
set(HOST_CPU ${CPU_PPC})
#
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips64") # todo: check , r* names?
set(host_arch "mips64")
set(HOST_CPU ${CPU_MIPS64})
#
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips") # todo: check , r* names?
set(host_arch "mips")
set(HOST_CPU ${CPU_MIPS})
#
else()
message("Warning: Unknown Host System Processor: \"${CMAKE_SYSTEM_PROCESSOR}\"")
set(host_arch "${CMAKE_SYSTEM_PROCESSOR}")
set(HOST_CPU ${CPU_GENERIC})
endif()
string(TOLOWER ${CMAKE_SYSTEM_NAME} host_os)
#message(" - testing cmake host_os: \"${host_os}\"")
## HOST_* is not TARGET_* ;; change ndc-e internal naming it's wrong , then change this ;;
if("android" STREQUAL "${host_os}" OR ANDROID)
set(HOST_OS ${OS_LINUX}) # *FIXME* we might have to keep as OS_LINUX or add to full cleanup list :|
elseif("windowsstore" STREQUAL "${host_os}")
set(HOST_OS ${OS_UWP})
set(HOST_CPU ${CPU_X64})
elseif(CMAKE_HOST_WIN32)
set(HOST_OS ${OS_WINDOWS})
elseif(CMAKE_HOST_APPLE)
if("${host_arch}" MATCHES "arm")
set(HOST_OS ${OS_IOS})
set(TARGET_IOS On)
add_definitions(-DTARGET_IPHONE -DTARGET_IOS)
else()
set(HOST_OS ${OS_DARWIN}) # todo ios check, check compiler/arch?
set(TARGET_OSX On)
add_definitions(-DTARGET_OSX)
endif()
elseif(CMAKE_HOST_UNIX) # GP UNIX MUST BE AFTER OTHER UNIX'ish options such as APPLE , it matches both
set(HOST_OS ${OS_LINUX}) # todo android check, just check android vars?
endif()
#option(TARGET_NO_REC BOOL "")
#option(TARGET_NO_AREC BOOL "")
#option(TARGET_NO_JIT BOOL "")
## Dynarec avail on x86,x64,arm and aarch64 in arm.32 compat
#
if((${HOST_CPU} EQUAL ${CPU_X86}) OR (${HOST_CPU} EQUAL ${CPU_X64}) OR
(${HOST_CPU} EQUAL ${CPU_ARM}) OR (${HOST_CPU} EQUAL ${CPU_A64}))
#
message("Dynarec Features Available")
set(FEAT_SHREC ${DYNAREC_JIT})
set(FEAT_AREC ${DYNAREC_NONE})
set(FEAT_DSPREC ${DYNAREC_NONE})
#
else()
set(FEAT_SHREC ${DYNAREC_CPP})
set(FEAT_AREC ${DYNAREC_NONE})
set(FEAT_DSPREC ${DYNAREC_NONE})
endif()
## Handle TARGET_* to FEAT_ *FIXME* stupid use one or the other and propogate : part of build cleanup , TARGET_ will only be for platform specifics and FEAT_ as OPTIONS
#
if(TARGET_NO_REC)
set(FEAT_SHREC ${DYNAREC_NONE})
set(FEAT_AREC ${DYNAREC_NONE})
set(FEAT_DSPREC ${DYNAREC_NONE})
endif()
if(TARGET_NO_AREC)
set(FEAT_SHREC ${DYNAREC_JIT})
set(FEAT_AREC ${DYNAREC_NONE})
set(FEAT_DSPREC ${DYNAREC_NONE})
endif()
if(TARGET_NO_JIT)
set(FEAT_SHREC ${DYNAREC_CPP})
set(FEAT_AREC ${DYNAREC_NONE})
set(FEAT_DSPREC ${DYNAREC_NONE})
endif()
######## Looks like something to delete, but if we're going to handle options here and NOT in libosd/lib* #########
# FindNativeCompilers()
## options BUILD_COMPILER { GCC, Clang, Intel, RealView? }
#set(CMAKE_C_COMPILER clang)
#set(CMAKE_C_COMPILER_TARGET ${triple})
#set(CMAKE_CXX_COMPILER clang++)
#set(CMAKE_CXX_COMPILER_TARGET ${triple})
if(${HOST_OS} EQUAL ${OS_LINUX})
# option SUPPORT_X11
# option FEAT_HAS_NIXPROF
# option EMSCripten
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
#
set(BUILD_COMPILER ${COMPILER_VC})
message("MSVC Platform: ${CMAKE_VS_PLATFORM_NAME}")
message("MSVC Toolset: ${CMAKE_VS_PLATFORM_TOOLSET}")
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1)
if("${HOST_OS}" STREQUAL "${OS_UWP}")
set(_CXX_FLAGS "/ZW ")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /AppContainer")
endif()
#
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(BUILD_COMPILER ${COMPILER_GCC})
#
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") # AppleClang ffs
set(BUILD_COMPILER ${COMPILER_CLANG})
#
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(BUILD_COMPILER ${COMPILER_INTEL})
#
else()
message("Unknown Compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
## Setup some common flags
#
if ((${BUILD_COMPILER} EQUAL ${COMPILER_VC}) OR
(${BUILD_COMPILER} EQUAL ${COMPILER_CLANG}) AND (${HOST_OS} STREQUAL ${OS_WINDOWS}))
add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1)
if(${BUILD_COMPILER} EQUAL ${COMPILER_CLANG})
add_definitions(/DXBYAK_NO_OP_NAMES /DTARGET_NO_OPENMP) #*FIXME* check openmp on clang-cl
remove_definitions(/U_HAS_STD_BYTE)
set(_CXX_FLAGS "/std:c++14") # /U_HAS_STD_BYTE not working, have to use c++14 not 17 :|
set(_C_FLAGS "-Wno-unused-function -Wno-unused-variable")
endif()
elseif ((${BUILD_COMPILER} EQUAL ${COMPILER_GCC}) OR
(${BUILD_COMPILER} EQUAL ${COMPILER_CLANG})) # AND NOT ${HOST_OS} EQUAL ${OS_WINDOWS}))
if(USE_32B OR TARGET_LINUX_X86)
set(_C_FLAGS "${_C_FLAGS} -m32")
endif()
if((${HOST_CPU} EQUAL ${CPU_X86}) OR (${HOST_CPU} EQUAL ${CPU_X64}))
set(_C_FLAGS "${_C_FLAGS} -msse4")
if(NOT CMAKE_HOST_APPLE)
set(_C_FLAGS "${_C_FLAGS} -fopenmp")
endif()
endif() # X86 family
set(_CXX_FLAGS "${_CXX_FLAGS} -fno-operator-names -fpermissive -std=c++11") # -fcxx-exceptions") ## xbyak needs exceptions
endif()
set(_CXX_FLAGS "${_CXX_FLAGS} ${_C_FLAGS}")
set(CMAKE_C_FLAGS " ${_C_FLAGS}") # ${CMAKE_C_FLAGS} -- these hold default VC flags for non VC Build ?
set(CMAKE_CXX_FLAGS " ${_CXX_FLAGS}") # ${CMAKE_CXX_FLAGS}
#if defined(TARGET_NO_NIXPROF)
#define FEAT_HAS_NIXPROF 0
#endif
#if defined(TARGET_NO_COREIO_HTTP)
#define FEAT_HAS_COREIO_HTTP 0
#endif
if (TARGET_NSW) # -DCMAKE_TOOLCHAIN_FILE=./cmake/devkitA64.cmake -DTARGET_NSW=ON
set(HOST_OS ${OS_NSW_HOS})
message(" DEVKITA64: ${DEVKITA64} ")
message("HOST_OS ${HOST_OS}")
add_definitions(-D__SWITCH__ -DGLES -DMESA_EGL_NO_X11_HEADERS)
add_definitions(-DTARGET_NO_THREADS -DTARGET_NO_EXCEPTIONS -DTARGET_NO_NIXPROF)
add_definitions(-DTARGET_NO_COREIO_HTTP)
add_definitions(-D_GLIBCXX_USE_C99_MATH_TR1 -D_LDBL_EQ_DBL)
endif()
if (TARGET_PS4) # -DCMAKE_TOOLCHAIN_FILE=./cmake/{ps4sdk,clang_scei}.cmake -DTARGET_PS4=ON
set(HOST_OS ${OS_PS4_BSD})
message("HOST_OS ${HOST_OS}")
add_definitions(-DPS4 -DTARGET_PS4 -DTARGET_BSD -D__ORBIS__ -DGLES -DMESA_EGL_NO_X11_HEADERS) ## last needed for __unix__ on eglplatform.h
add_definitions(-DTARGET_NO_THREADS -DTARGET_NO_EXCEPTIONS -DTARGET_NO_NIXPROF)
add_definitions(-DTARGET_NO_COREIO_HTTP)
message("*******FIXME******** LARGE PAGES !!")
endif()
if(ZBUILD)
set(DEBUG_CMAKE ON)
add_definitions(-D_Z_) # Get rid of some warnings and internal dev testing
if(NOT TARGET_PS4 AND NOT TARGET_NSW AND
NOT TARGET_OSX AND NOT TARGET_IOS )
set(USE_QT ON)
endif()
endif()
# configure options for osd/ui
# osd_default, osd_qt
# ui_default, ui_sdl, ui_qt
# USE_NATIVE , USE_SDL , USE_QT -- these (can) define multiple
option(USE_QT False "Use Qt5 for UI and support OS Deps.")
#option(BUILD_TESTS "Build tests" OFF) # todo: luserx0 this is your arena, you want tests add em
add_definitions(-DCMAKE_BUILD)
add_definitions(-DHOST_OS=${HOST_OS})
add_definitions(-DHOST_CPU=${HOST_CPU})
add_definitions(-DFEAT_AREC=${FEAT_AREC})
add_definitions(-DFEAT_SHREC=${FEAT_SHREC})
add_definitions(-DFEAT_DSPREC=${FEAT_DSPREC})
add_definitions(-DBUILD_COMPILER=${BUILD_COMPILER})
add_definitions(-DDEF_CONSOLE)
set(RE_CMAKE_CONFIGURED 1)
#add_definitions(-D=${})

View File

@ -1,41 +0,0 @@
## devkitA64.cmake - devkitpro A64 cross-compile
#
set(CMAKE_SYSTEM_NAME Linux) # this one is important // Add Platform/switch to use this name ...
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_SYSTEM_VERSION 1) # this one not so much
set(DEVKITPRO $ENV{DEVKITPRO})
set(DEVKITA64 $ENV{DEVKITA64})
if ("" STREQUAL "${DEVKITPRO}")
set(DEVKITA64 "/opt/devkitpro")
endif()
if ("" STREQUAL "${DEVKITA64}")
set(DEVKITA64 ${DEVKITPRO}/devkitA64)
endif()
## specify the cross compiler
#
set(CMAKE_C_COMPILER ${DEVKITA64}/bin/aarch64-none-elf-gcc)
set(CMAKE_CXX_COMPILER ${DEVKITA64}/bin/aarch64-none-elf-g++)
set(CMAKE_FIND_ROOT_PATH ${DEVKITA64}) # where is the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) # for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
include_directories(${DEVKITPRO}/libnx/include)
set(TARGET_NSW ON)

View File

@ -1,130 +0,0 @@
## ps4sdk.cmake - devkitpro A64 cross-compile
#
set(CMAKE_SYSTEM_NAME FreeBSD) # this one is important
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_SYSTEM_VERSION 9) # this one not so much
set(TARGET_PS4 ON)
set(TARGET_BSD ON)
### This shit is very WIP ###
#
## TODO: Check for
set(PS4SDK $ENV{PS4SDK})
set(SCESDK $ENV{SCESDK})
set(USE_SCE ON)
set(PS4_PKG ON)
if(PS4_PKG)
add_definitions(-DPS4_PKG)
endif()
if ("" STREQUAL "${PS4SDK}")
if ("Windows" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}")
set(PS4SDK "C:/Dev/SDK/PS4")
else()
set(PS4SDK "/opt/ps4")
endif()
endif()
set(TAUON_SDK ${PS4SDK}/tauon)
if(USE_SCE)
#
set(PS4SDK ${PS4SDK}/SCE/PS4SDK)
set(PS4HOST ${PS4SDK}/host_tools)
set(PS4TARGET ${PS4SDK}/target)
set(toolPrefix "orbis-")
set(toolSuffix ".exe")
set(CMAKE_C_COMPILER ${PS4HOST}/bin/${toolPrefix}clang${toolSuffix})
set(CMAKE_CXX_COMPILER ${PS4HOST}/bin/${toolPrefix}clang++${toolSuffix})
set(CMAKE_FIND_ROOT_PATH ${PS4TARGET}) # where is the target environment
set (PS4_inc_dirs
${TAUON_SDK}/include
${PS4TARGET}/include
${PS4TARGET}/include_common
)
# set (PS4_link_dirs
# "${PS4TARGET}/lib"
# "${PS4TARGET}/tauon/lib"
# )
#LDFLAGS += -L $(TAUON_SDK_DIR)/lib -L $(SCE_ORBIS_SDK_DIR)/target/lib
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s -Wl,--addressing=non-aslr,--strip-unused-data ")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L ${TAUON_SDK}/lib -L ${PS4TARGET}/lib")
message("CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}")
#
else()
#
set(triple "x86_64-scei-ps4")
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set (PS4_inc_dirs
${TAUON_SDK}/include
${PS4SDK}/include
${PS4SDK}/tauon/include
)
# set (PS4_link_dirs
# "${PS4SDK}/lib"
# "${PS4SDK}/tauon/lib"
# )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s -Wl,--addressing=non-aslr,--strip-unused-data -L${TAUON_SDK}/lib")
#
endif()
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) # for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
include_directories(${PS4_inc_dirs})
### Add a helper to add libSce PREFIX and [_tau]*_stub[_weak]*.a SUFFIX
#
link_libraries(
kernel_tau_stub_weak SceSysmodule_tau_stub_weak SceSystemService_stub_weak SceSystemService_tau_stub_weak SceShellCoreUtil_tau_stub_weak ScePigletv2VSH_tau_stub_weak kernel_util
ScePad_stub_weak SceNet_stub_weak SceCommonDialog_stub_weak ScePosix_stub_weak
)

View File

@ -1,5 +0,0 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR i686)
set(CMAKE_C_COMPILER gcc -m32)
set(CMAKE_ASM_COMPILER gcc -m32)
set(CMAKE_CXX_COMPILER g++ -m32)