generated from LizardByte/template-base
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67ddd72
commit 9c9a8f1
Showing
3 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,8 @@ | |
|
||
# VSCode IDE | ||
.vscode/ | ||
|
||
# build directories | ||
build/ | ||
cmake-*/ | ||
docs/doxyconfig* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
# much of this file is borrowed from https://github.com/Ryzee119/Xenium-Tools/blob/master/CMakeLists.txt | ||
|
||
project(Moonlight C CXX) | ||
set(XBE_TITLE ${CMAKE_PROJECT_NAME}) | ||
message(STATUS "XBE_TITLE: ${XBE_TITLE}") | ||
|
||
set(NXDK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third-party/nxdk") | ||
message(STATUS "NXDK_DIR: ${NXDK_DIR}") | ||
|
||
set(XBOX_ISO_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}") | ||
message(STATUS "XBOX_ISO_DIR: ${XBOX_ISO_DIR}") | ||
|
||
# create the xiso directory if it doesn't exist | ||
file(MAKE_DIRECTORY ${XBOX_ISO_DIR}) | ||
|
||
include(FindPkgConfig) | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
set(CMAKE_CXX_FLAGS_RELEASE "-O2") | ||
set(CMAKE_C_FLAGS_RELEASE "-O2") | ||
|
||
# Stop lots of warning spam | ||
add_compile_options(-Wno-builtin-macro-redefined) | ||
add_definitions(-DXBOX -DNXDK) | ||
|
||
set(MOONLIGHT_SOURCES | ||
"${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp" | ||
) | ||
|
||
add_executable(${CMAKE_PROJECT_NAME} | ||
${MOONLIGHT_SOURCES} | ||
) | ||
include_directories("${NXDK_DIR}/lib") | ||
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC ${NXDK_DIR}/lib/libpbkit.lib) | ||
|
||
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "") | ||
|
||
#Post-build exe to xbe conversion | ||
add_custom_target(cxbe_convert ALL | ||
VERBATIM COMMAND "${CMAKE_COMMAND}" -E env ./tools/cxbe/cxbe -OUT:${XBOX_ISO_DIR}/default.xbe -TITLE:${XBE_TITLE} ${CMAKE_CURRENT_BINARY_DIR}/${XBE_TITLE}.exe | ||
WORKING_DIRECTORY ${NXDK_DIR} | ||
COMMENT "CXBE Conversion: [EXE -> XBE]" | ||
) | ||
add_dependencies(cxbe_convert ${CMAKE_PROJECT_NAME}) | ||
|
||
#Post-build xbe to xiso conversion | ||
add_custom_target(xbe_iso ALL | ||
VERBATIM COMMAND "${CMAKE_COMMAND}" -E env ${NXDK_DIR}/tools/extract-xiso/build/extract-xiso -c ${XBOX_ISO_DIR} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
COMMENT "CXBE Conversion: [XBE -> XISO]" | ||
) | ||
add_dependencies(xbe_iso cxbe_convert) | ||
|
||
set_target_properties(cxbe_convert PROPERTIES OUTPUT_QUIET ON) | ||
set_target_properties(xbe_iso PROPERTIES OUTPUT_QUIET ON) |