From b93d86be8e305a9f4ee55b7f9f1be6ab3469b9f4 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 3 Apr 2021 02:40:57 -0500 Subject: [PATCH] [gbabuildcore] Move GBA cmake files to gbabuildcore --- CMakeLists.txt | 33 +++---------------- Makefile | 4 +-- deps/gbabuildcore/base.cmake | 14 ++++++++ .../gbabuildcore/cmake}/modules/GBA.cmake | 0 4 files changed, 20 insertions(+), 31 deletions(-) create mode 100644 deps/gbabuildcore/base.cmake rename {cmake => deps/gbabuildcore/cmake}/modules/GBA.cmake (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70cbe6ef..eee646c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,50 +4,25 @@ set(CMAKE_POLICY_DEFAULT_CMP0110 NEW) # requires CMake 3.19 project(nostalgia) include(deps/buildcore/base.cmake) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) set(NOSTALGIA_BUILD_PLAYER ON CACHE BOOL "Build Player") set(NOSTALGIA_BUILD_STUDIO ON CACHE BOOL "Build Studio") set(OX_ENABLE_TRACEHOOK OFF CACHE BOOL "Generate OxTraceHook shared library for uprobes") if(BUILDCORE_TARGET STREQUAL "gba") + set(NOSTALGIA_BUILD_STUDIO OFF) set(NOSTALGIA_BUILD_TYPE "GBA") + include(deps/gbabuildcore/base.cmake) else() set(NOSTALGIA_BUILD_TYPE "Native") -endif() - -if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA") - set(OX_BARE_METAL ON) -else() set(NOSTALGIA_CONAN_PATHS ${CMAKE_SOURCE_DIR}/.conanbuild/conan_paths.cmake) - if(NOT NOSTALGIA_BUILD_TYPE STREQUAL "GBA" AND EXISTS ${NOSTALGIA_CONAN_PATHS}) + if(EXISTS ${NOSTALGIA_CONAN_PATHS}) include(${NOSTALGIA_CONAN_PATHS}) endif() -endif() - -if(OX_BARE_METAL) - set(NOSTALGIA_BUILD_STUDIO OFF) - set(OX_USE_STDLIB OFF) -else() - add_definitions(-DOX_USE_STDLIB) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR}) endif() -if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA") - include(GBA) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdinc++") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-unwind-tables") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthumb-interwork") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthumb") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=arm7tdmi") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=arm7tdmi") -endif() - if(APPLE) set(CMAKE_MACOSX_RPATH OFF) set(CMAKE_INSTALL_NAME_DIR "@executable_path/../Library/nostalgia") @@ -71,7 +46,7 @@ endif() add_subdirectory(deps/ox) include_directories(SYSTEM deps/ox/src) -if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA") +if(BUILDCORE_TARGET STREQUAL "gba") add_subdirectory(deps/gbastartup) elseif(NOSTALGIA_BUILD_STUDIO) add_subdirectory(deps/QDark) diff --git a/Makefile b/Makefile index 88425b6f..a0837eb7 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,8 @@ debug-studio: install .PHONY: configure-gba configure-gba: - ${ENV_RUN} ${SETUP_BUILD} --toolchain=cmake/modules/GBA.cmake --target=gba --current_build=0 --build_type=release + ${ENV_RUN} ${SETUP_BUILD} --toolchain=deps/gbabuildcore/cmake/modules/GBA.cmake --target=gba --current_build=0 --build_type=release .PHONY: configure-gba-debug configure-gba-debug: - ${ENV_RUN} ${SETUP_BUILD} --toolchain=cmake/modules/GBA.cmake --target=gba --current_build=0 --build_type=debug + ${ENV_RUN} ${SETUP_BUILD} --toolchain=deps/gbabuildcore/cmake/modules/GBA.cmake --target=gba --current_build=0 --build_type=debug diff --git a/deps/gbabuildcore/base.cmake b/deps/gbabuildcore/base.cmake new file mode 100644 index 00000000..b0a951d3 --- /dev/null +++ b/deps/gbabuildcore/base.cmake @@ -0,0 +1,14 @@ +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/modules) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdinc++") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-unwind-tables") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthumb-interwork") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthumb") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=arm7tdmi") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=arm7tdmi") + +set(OX_BARE_METAL ON) +set(OX_USE_STDLIB OFF) diff --git a/cmake/modules/GBA.cmake b/deps/gbabuildcore/cmake/modules/GBA.cmake similarity index 100% rename from cmake/modules/GBA.cmake rename to deps/gbabuildcore/cmake/modules/GBA.cmake