mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 11:02:45 +02:00
Improve buildsystem, split out generic code
This commit is contained in:
parent
5797d753bf
commit
ef5297acb3
10
Makefile
Normal file
10
Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
ATMOSPHERE_LIBRARIES := libstratosphere
|
||||
|
||||
TOPTARGETS := all clean
|
||||
|
||||
$(TOPTARGETS): $(ATMOSPHERE_LIBRARIES)
|
||||
|
||||
$(ATMOSPHERE_LIBRARIES):
|
||||
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||
|
||||
.PHONY: $(TOPTARGETS) $(ATMOSPHERE_LIBRARIES)
|
11
config/arch/arm64/arch.mk
Normal file
11
config/arch/arm64/arch.mk
Normal file
@ -0,0 +1,11 @@
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
||||
endif
|
||||
|
||||
include $(DEVKITPRO)/devkitA64/base_rules
|
||||
|
||||
export ATMOSPHERE_DEFINES += -DATMOSPHERE_ARCH_ARM64
|
||||
export ATMOSPHERE_SETTINGS += -march=armv8-a -mtp=soft
|
||||
export ATMOSPHERE_CFLAGS +=
|
||||
export ATMOSPHERE_CXXFLAGS +=
|
||||
export ATMOSPHERE_ASFLAGS +=
|
5
config/board/nintendo/switch/board.mk
Normal file
5
config/board/nintendo/switch/board.mk
Normal file
@ -0,0 +1,5 @@
|
||||
export ATMOSPHERE_DEFINES += -DATMOSPHERE_BOARD_NINTENDO_SWITCH -D__SWITCH__
|
||||
export ATMOSPHERE_SETTINGS += -mtune=cortex-a57
|
||||
export ATMOSPHERE_CFLAGS +=
|
||||
export ATMOSPHERE_CXXFLAGS +=
|
||||
export ATMOSPHERE_ASFLAGS +=
|
26
config/common.mk
Normal file
26
config/common.mk
Normal file
@ -0,0 +1,26 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
export ATMOSPHERE_CONFIG_MAKE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
||||
export ATMOSPHERE_LIBRARY_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/..
|
||||
|
||||
ifeq ($(strip $(ATMOSPHERE_BOARD)),)
|
||||
export ATMOSPHERE_BOARD := nx-hac-001
|
||||
endif
|
||||
|
||||
export ATMOSPHERE_DEFINES := -DATMOSPHERE
|
||||
export ATMOSPHERE_SETTINGS := -fPIE -g
|
||||
export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \
|
||||
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector
|
||||
export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++17
|
||||
export ATMOSPHERE_ASFLAGS :=
|
||||
|
||||
|
||||
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
||||
export ATMOSPHERE_ARCH_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/arch/arm64
|
||||
export ATMOSPHERE_BOARD_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/board/nintendo/switch
|
||||
endif
|
||||
|
||||
include $(ATMOSPHERE_ARCH_MAKE_DIR)/arch.mk
|
||||
include $(ATMOSPHERE_BOARD_MAKE_DIR)/board.mk
|
@ -1,12 +1,15 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
.SUFFIXES:
|
||||
# pull in common atmosphere configuration
|
||||
#---------------------------------------------------------------------------------
|
||||
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../config/common.mk
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# pull in switch rules
|
||||
#---------------------------------------------------------------------------------
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
||||
endif
|
||||
|
||||
TOPDIR ?= $(CURDIR)
|
||||
include $(DEVKITPRO)/libnx/switch_rules
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
@ -16,34 +19,28 @@ include $(DEVKITPRO)/libnx/switch_rules
|
||||
# INCLUDES is a list of directories containing header files
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := $(notdir $(CURDIR))
|
||||
SOURCES ?= $(shell find source -type d)
|
||||
DATA := data
|
||||
INCLUDES := include
|
||||
|
||||
DEFINES :=
|
||||
SOURCES ?= $(shell find source -type d)
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# options for code generation
|
||||
#---------------------------------------------------------------------------------
|
||||
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
|
||||
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE
|
||||
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2
|
||||
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -flto
|
||||
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
||||
|
||||
CFLAGS := -g -Wall -O2 -ffunction-sections \
|
||||
$(ARCH) $(DEFINES)
|
||||
LDFLAGS := -specs=$(DEVKITPRO)/libnx/switch.specs $(SETTINGS) -Wl,-Map,$(notdir $.map)
|
||||
|
||||
CFLAGS += $(INCLUDE) -D__SWITCH__
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++17 -flto
|
||||
|
||||
ASFLAGS := -g $(ARCH)
|
||||
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||
|
||||
LIBS := -lnx
|
||||
LIBS := -lnx
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(PORTLIBS) $(LIBNX)
|
||||
LIBDIRS := $(PORTLIBS) $(LIBNX) $(ATMOSPHERE_LIBRARY_DIR)/libvapours
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
# no real need to edit anything past this point unless you need to add additional
|
||||
@ -81,8 +78,7 @@ export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
||||
|
||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||
-I. \
|
||||
-iquote $(CURDIR)/include/switch/
|
||||
-I.
|
||||
|
||||
.PHONY: clean all
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Pulls in util, svc. */
|
||||
#include "atmosphere/common.hpp"
|
||||
/* libvapours (pulls in util, svc, results). */
|
||||
#include <vapours.hpp>
|
||||
|
||||
/* Critical modules with no dependencies. */
|
||||
#include "stratosphere/ams.hpp"
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "../sf/sf_buffer_tags.hpp"
|
||||
#include "../hos.hpp"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::boot2 {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::dd {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::dd {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "../ncm/ncm_types.hpp"
|
||||
#include "../sf/sf_buffer_tags.hpp"
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "../os.hpp"
|
||||
#include "../ncm.hpp"
|
||||
#include "../sf.hpp"
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::hos {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::kvdb {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::kvdb {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "../ncm/ncm_types.hpp"
|
||||
#include "../sf/sf_buffer_tags.hpp"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::map {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::ncm {
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::reg {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::rnd {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "../ncm/ncm_types.hpp"
|
||||
|
||||
namespace ams::ro {
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "settings_fwdbg_types.hpp"
|
||||
|
||||
namespace ams::settings::fwdbg {
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "../sf/sf_buffer_tags.hpp"
|
||||
|
||||
namespace ams::settings::fwdbg {
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::settings {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "../ams.hpp"
|
||||
#include "../os.hpp"
|
||||
#include "../sm/sm_types.hpp"
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
#include "../ncm/ncm_types.hpp"
|
||||
#include "../cfg/cfg_types.hpp"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::spl {
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <atmosphere/common.hpp>
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::updater {
|
||||
|
||||
|
@ -15,8 +15,6 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "common_includes.hpp"
|
||||
#include "defines.hpp"
|
||||
#include "util.hpp"
|
||||
#include "results.hpp"
|
||||
#include "svc.hpp"
|
||||
|
||||
#include "util/util_compression.hpp"
|
||||
#include "util/util_ini.hpp"
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../defines.hpp"
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::util {
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "../defines.hpp"
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::util::ini {
|
||||
|
23
libvapours/include/vapours.hpp
Normal file
23
libvapours/include/vapours.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2019 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "vapours/includes.hpp"
|
||||
#include "vapours/defines.hpp"
|
||||
|
||||
#include "vapours/util.hpp"
|
||||
#include "vapours/results.hpp"
|
||||
#include "vapours/svc.hpp"
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "common_includes.hpp"
|
||||
#include "includes.hpp"
|
||||
|
||||
/* Any broadly useful language defines should go here. */
|
||||
|
@ -26,17 +26,23 @@
|
||||
#include <climits>
|
||||
#include <cctype>
|
||||
|
||||
/* C++ headers. */
|
||||
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <random>
|
||||
|
||||
/* Stratosphere wants stdlib headers, others do not.. */
|
||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||
|
||||
/* C++ headers. */
|
||||
#include <atomic>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <shared_mutex>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <tuple>
|
||||
#include <array>
|
||||
@ -44,9 +50,19 @@
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
|
||||
#endif /* ATMOSPHERE_IS_STRATOSPHERE */
|
||||
|
||||
#ifdef ATMOSPHERE_BOARD_NINTENDO_SWITCH
|
||||
|
||||
/* Libnx. */
|
||||
#include <switch.h>
|
||||
|
||||
#else
|
||||
|
||||
#error "Unsupported board"
|
||||
|
||||
#endif /* ATMOSPHERE_BOARD_NINTENDO_SWITCH */
|
||||
|
||||
/* Atmosphere meta. */
|
||||
#if __has_include(<atmosphere.h>)
|
||||
#include <atmosphere.h>
|
@ -23,5 +23,3 @@
|
||||
#include "util/util_typed_storage.hpp"
|
||||
#include "util/util_intrusive_list.hpp"
|
||||
#include "util/util_intrusive_red_black_tree.hpp"
|
||||
#include "util/util_compression.hpp"
|
||||
#include "util/util_ini.hpp"
|
Loading…
Reference in New Issue
Block a user