Change CMake Script to allow installing

This commit is contained in:
Wally4000 2022-06-13 20:59:43 +10:00
parent 1a0d148c6d
commit bb7d13ca06
11 changed files with 45 additions and 44 deletions

8
CMakeLists.txt Normal file
View file

@ -0,0 +1,8 @@
set(CMAKE_FIND_NO_INSTALL_PREFIX TRUE)
project (DaedalusX64 LANGUAGES C CXX ASM)
cmake_minimum_required(VERSION 3.16)
message(${CMAKE_SYSTEM_PROCESSOR} " Detected")
add_subdirectory(Source)

View file

View file

@ -1,12 +1,7 @@
project (DaedalusX64 LANGUAGES C CXX ASM)
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
message("DaedalusX64 Build")
message(${CMAKE_SYSTEM_PROCESSOR} " Detected")
#Build Type
#Build Type
if(DEBUG)
set(CMAKE_BUILD_TYPE Debug)
add_compile_definitions(DAEDALUS_CONFIG_VERSION="Dev") ## Perhaps we can remove this. It's only used in the PSP UI and model doesn't matter as much
@ -95,6 +90,7 @@ message(${CMAKE_SYSTEM_PROCESSOR} " Detected")
add_compile_definitions(DAEDALUS_ENDIAN_MODE DAEDALUS_ENDIAN_LITTLE)
endif()
## These build options are required so we define as nothing until needed
if(NOT WIN32)
add_compile_definitions(R4300_CALL_TYPE=${})
@ -111,11 +107,10 @@ message(${CMAKE_SYSTEM_PROCESSOR} " Detected")
#PSP Build
set (GPROF_SRCS SysPSP/Debug/prof.c SysPSP/Debug/mcount.S )
set (PSP_MAIN_FILES SysPSP/main.cpp)
if (PSP)
add_definitions(-DDAEDALUS_PSP)
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/SysPSP/Include .)
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/Source/SysPSP/Include .)
set(PLAT_LIBS psppower pspgu pspctrl pspdebug pspsdk pspdisplay pspge -lpspaudiolib -lpspaudio -lintrafont -lpspkubridge -lpspfpu -lpspge)
set(SDL_LIBS SDL2 SDL2main pspvram psphprm GL pspvfpu )
add_executable(daedalus SysPSP/main.cpp)
@ -127,8 +122,8 @@ message(${CMAKE_SYSTEM_PROCESSOR} " Detected")
create_pbp_file(
TARGET daedalus
ICON_PATH ${PROJECT_SOURCE_DIR}/SysPSP/Resources/eboot_icons/icon0.png
BACKGROUND_PATH ${PROJECT_SOURCE_DIR}/SysPSP/Resources/eboot_icons/pic1.png
ICON_PATH ${PROJECT_SOURCE_DIR}/Source/SysPSP/Resources/eboot_icons/icon0.png
BACKGROUND_PATH ${PROJECT_SOURCE_DIR}/Source/SysPSP/Resources/eboot_icons/pic1.png
PREVIEW_PATH NULL
TITLE DaedalusX64
BUILD_PRX
@ -159,7 +154,7 @@ message(${CMAKE_SYSTEM_PROCESSOR} " Detected")
if (UNIX)
find_package(SDL2 CONFIG REQUIRED)
add_definitions(-DDAEDALUS_POSIX -DDAEDALUS_GL)
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/SysPosix/Include . ${PROJECT_SOURCE_DIR}/third_party/imgui ${SDL2_INCLUDE_DIRS})
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/Source/SysPosix/Include . ${PROJECT_SOURCE_DIR}/Source/third_party/imgui ${SDL2_INCLUDE_DIRS})
add_executable(daedalus SysPosix/main.cpp)
@ -184,7 +179,7 @@ message(${CMAKE_SYSTEM_PROCESSOR} " Detected")
#add_compile_options("/Od")
##Windows todo
# Pull in modules for glew / SDL2 / ZLib / LibPNG / Minizip
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/SysW32/Include .)
include_directories(BEFORE ${PROJECT_SOURCE_DIR}/Source/SysW32/Include .)
# add_library(sysGL OBJECT ${SYSGL_BUILD})
# target_link_libraries(sysGL OpenGL32 glfw3 glew32s SDL2 Xinput ${OS_LIBS})
@ -230,4 +225,13 @@ message(${CMAKE_SYSTEM_PROCESSOR} " Detected")
add_subdirectory(SysCTR)
else(PSP)
add_subdirectory(SysPSP)
endif()
endif()
## Install and setup basic directories
set(CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR}/..) ## Need to change this to be out of tree
install(DIRECTORY DESTINATION DaedalusX64)
install(DIRECTORY DESTINATION DaedalusX64/Roms)
install(DIRECTORY DESTINATION DaedalusX64/SaveGames)
install(DIRECTORY DESTINATION DaedalusX64/SaveStates)

View file

@ -29,4 +29,3 @@ pspDveManager_driver.S : $(PRX_EXPORTS)
psp-build-exports --build-stubs $(PRX_EXPORTS)
all: $(FINAL_TARGET) pspDveManager.S pspDveManager_driver.S
cp $(FINAL_TARGET) "../../../../DaedalusX64/Plugins"

View file

@ -22,4 +22,3 @@ PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
all: $(FINAL_TARGET)
cp $(FINAL_TARGET) "../../../../DaedalusX64/Plugins"

View file

@ -30,4 +30,4 @@ imposectrl.S : $(PRX_EXPORTS)
psp-build-exports --build-stubs $(PRX_EXPORTS)
all: $(FINAL_TARGET) imposectrl.S
cp $(FINAL_TARGET) "../../../../DaedalusX64/Plugins"

View file

@ -30,4 +30,4 @@ MediaEngine.S : $(PRX_EXPORTS)
psp-build-exports --build-stubs $(PRX_EXPORTS)
all: $(FINAL_TARGET) MediaEngine.S
cp $(FINAL_TARGET) "../../../../DaedalusX64/Plugins"

View file

@ -9,7 +9,7 @@ add_library(Utility_PSP OBJECT
ModulePSP.cpp
Translate.cpp
VolatileMemPSP.cpp
${PROJECT_SOURCE_DIR}/SysPosix/Utility/TimingPosix.cpp
${PROJECT_SOURCE_DIR}/SysPosix/Utility/ThreadPosix.cpp
${PROJECT_SOURCE_DIR}/SysPosix/Utility/IOPosix.cpp
${PROJECT_SOURCE_DIR}/Source/SysPosix/Utility/TimingPosix.cpp
${PROJECT_SOURCE_DIR}/Source/SysPosix/Utility/ThreadPosix.cpp
${PROJECT_SOURCE_DIR}/Source/SysPosix/Utility/IOPosix.cpp
)

View file

@ -4,3 +4,5 @@ add_subdirectory(HLEAudio)
add_subdirectory(HLEGraphics)
add_subdirectory(Utility)
install(FILES ${PROJECT_SOURCE_DIR}/daedalus DESTINATION DaedalusX64)
install(FILES ${PROJECT_SOURCE_DIR}/SysGL/HLEGraphics/n64.psh DESTINATION DaedalusX64)

View file

@ -1,37 +1,26 @@
#!/bin/bash
## This file is the standard way of building Daedalus, you may build manually using cmake but your milage may vary on certain platforms.
PROC_NR=$(getconf _NPROCESSORS_ONLN)
## This file is the standard way of building Daedalus, you may build manually using cmake but your milage may vary on certain platforms.
function pre_prep() {
# Start Fresh, remove any existing builds
rm -r $PWD/build $PWD/DaedalusX64/EBOOT.PBP $PWD/DaedalusX64/daedalus >/dev/null 2>&1
mkdir -p $PWD/DaedalusX64
rm -r $PWD/build $PWD/DaedalusX64/EBOOT.PBP $PWD/DaedalusX64/daedalus >/dev/null 2>&1
}
function finalPrep() {
if [[ -f "$PWD/EBOOT.PBP" ]]; then
mv "$PWD/EBOOT.PBP" ../DaedalusX64
else
cp -r "$PWD/daedalus" ../DaedalusX64
cp ../Source/SysGL/HLEGraphics/n64.psh ../DaedalusX64
fi
cp -r ../Data/* ../DaedalusX64/
}
function psp_plugins() {
make --quiet -j $PROC_NR -C "$PWD/../Source/SysPSP/PRX/DveMgr" || { exit 1; }
make --quiet -j $PROC_NR -C "$PWD/../Source/SysPSP/PRX/ExceptionHandler" || { exit 1; }
make --quiet -j $PROC_NR -C "$PWD/../Source/SysPSP/PRX/KernelButtons" || { exit 1; }
make --quiet -j $PROC_NR -C "$PWD/../Source/SysPSP/PRX/MediaEngine" || { exit 1; }
}
function psp_plugins() {
make --quiet -j $PROC_NR -C "$PWD/Source/SysPSP/PRX/DveMgr" || { exit 1; }
make --quiet -j $PROC_NR -C "$PWD/Source/SysPSP/PRX/ExceptionHandler" || { exit 1; }
make --quiet -j $PROC_NR -C "$PWD/Source/SysPSP/PRX/KernelButtons" || { exit 1; }
make --quiet -j $PROC_NR -C "$PWD/Source/SysPSP/PRX/MediaEngine" || { exit 1; }
}
function build() {
## Compile and install.
make --quiet -j $PROC_NR || { exit 1; }
finalPrep
}
if [[ $1 = "DEBUG" ]] || [[ $2 = "DEBUG" ]]; then
@ -41,14 +30,14 @@ fi
## Main Loop
pre_prep
mkdir -p build && cd build
case "$1" in
PSP)
mkdir -p "$PWD/DaedalusX64/Plugins"
psp_plugins
cmake -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake $CMAKEDEFINES ../Source
build
cmake -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake $CMAKEDEFINES -S . -B build
cmake --build build -j${PROC_NR}
cmake --install build --prefix .
# cmake --install build
;;
**) ## Not Cross Compiling (macOS, Windows (Not yet), Linux)
cmake ../Source $CMAKEDEFINES