diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..50849f0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required(VERSION 3.2) +project(wut) +include(ExternalProject) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +set(DEVKITPPC $ENV{DEVKITPPC} CACHE STRING "Path to devkitPPC install") + +# Check for DEVKITPPC +if(NOT DEVKITPPC) + message(FATAL_ERROR "You must have defined DEVKITPPC before calling cmake.") +endif() + +externalproject_add(crt + SOURCE_DIR "${CMAKE_SOURCE_DIR}/crt" + CMAKE_GENERATOR "Unix Makefiles" + INSTALL_DIR "${CMAKE_BINARY_DIR}/staging" + CMAKE_CACHE_ARGS + -DDEVKITPPC:string=${DEVKITPPC} + -DWUT_ROOT:string=${CMAKE_SOURCE_DIR} + -DCMAKE_INSTALL_PREFIX:string= + -DCMAKE_TOOLCHAIN_FILE:string=${CMAKE_SOURCE_DIR}/cmake/wut-toolchain.cmake) + +externalproject_add(rpl + SOURCE_DIR "${CMAKE_SOURCE_DIR}/rpl" + CMAKE_GENERATOR "Unix Makefiles" + INSTALL_DIR "${CMAKE_BINARY_DIR}/staging" + CMAKE_CACHE_ARGS + -DDEVKITPPC:string=${DEVKITPPC} + -DWUT_ROOT:string=${CMAKE_SOURCE_DIR} + -DCMAKE_INSTALL_PREFIX:string= + -DCMAKE_TOOLCHAIN_FILE:string=${CMAKE_SOURCE_DIR}/cmake/wut-toolchain.cmake) + +add_subdirectory(tools) + +install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/" + DESTINATION "${CMAKE_INSTALL_PREFIX}/include" + FILES_MATCHING PATTERN "*.h*") + +install(DIRECTORY "${CMAKE_SOURCE_DIR}/cmake/" + DESTINATION "${CMAKE_INSTALL_PREFIX}/cmake") + +install(DIRECTORY "${CMAKE_SOURCE_DIR}/rules/" + DESTINATION "${CMAKE_INSTALL_PREFIX}/rules") + +install(DIRECTORY "${CMAKE_BINARY_DIR}/staging/" + DESTINATION "${CMAKE_INSTALL_PREFIX}") diff --git a/Makefile b/Makefile deleted file mode 100644 index 1add581..0000000 --- a/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -ifeq ($(findstring CYGWIN,$(shell uname -s)),CYGWIN) -WUT_ROOT := $(shell cygpath -w ${CURDIR}) -RPL_ROOT := $(shell cygpath -w ${SYSTEM_RPL_ROOT}) -else -WUT_ROOT := $(CURDIR) -RPL_ROOT := $(SYSTEM_RPL_ROOT) -endif - -TARGETS := tools crt rpl - -DESTDIR ?= $(CURDIR) -INSTALLDIR := $(DESTDIR) - -export WUT_ROOT -export INSTALLDIR - -all: - @for dir in $(TARGETS); do \ - echo; \ - echo "Entering Directory $$dir"; \ - $(MAKE) --no-print-directory -C $$dir; \ - echo "Leaving Directory $$dir"; \ - done - -clean: - @for dir in $(TARGETS); do \ - echo; \ - echo Cleaning $$dir; \ - $(MAKE) --no-print-directory -C $$dir clean; \ - done - -install: - @mkdir -p $(INSTALLDIR) - @cp -r include $(INSTALLDIR) || : - @for dir in $(TARGETS); do \ - echo; \ - echo Installing $$dir; \ - $(MAKE) --no-print-directory -C $$dir install; \ - done - -test: all - @tools/bin/implcheck $(RPL_ROOT)\coreinit.rpl rpl\libcoreinit\exports.h - @tools/bin/implcheck $(RPL_ROOT)\gx2.rpl rpl\libgx2\exports.h - @tools/bin/implcheck $(RPL_ROOT)\nsysnet.rpl rpl\libnsysnet\exports.h - @tools/bin/implcheck $(RPL_ROOT)\proc_ui.rpl rpl\libproc_ui\exports.h - @tools/bin/implcheck $(RPL_ROOT)\sndcore2.rpl rpl\libsndcore2\exports.h - @tools/bin/implcheck $(RPL_ROOT)\sysapp.rpl rpl\libsysapp\exports.h - @tools/bin/implcheck $(RPL_ROOT)\vpad.rpl rpl\libvpad\exports.h - -.PHONY: all clean install diff --git a/README.md b/README.md index 1274e7b..6846681 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,51 @@ Licensed under the terms of the GNU General Public License, version 2 or later ( Doxygen output can be found at https://decaf-emu.github.io/wut ## Requirements -- devkitPRO + devkitPPC -- Tested on Linux, OS X and cygwin on Windows +- Tested on Linux, OS X, Windows +- [devkitPPC](https://devkitpro.org/wiki/Getting_Started/devkitPPC) +- CMake +- Make -## Usage -- git clone --recursive https://github.com/decaf-emu/wut.git -- cd wut -- export devkitPRO=... -- export devkitPPC=... -- export WUT_ROOT=$PWD -- make install -- cd samples/helloworld -- make +## Linux / OS X +Requires CMake + Make + [devkitPPC](https://devkitpro.org/wiki/Getting_Started/devkitPPC) + libzdev + +``` +export DEVKITPPC= +git clone --recursive https://github.com/decaf-emu/wut.git +cd wut +mkdir build && cd build +cmake -DCMAKE_INSTALL_PREFIX=install ../ +make +export WUT_ROOT=$PWD/install +``` + +Then for any wut project you want to build you must use the wut-toolchain.cmake script: + +``` +cd ../samples/helloworld +mkdir build && cd build +cmake -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/cmake/wut-toolchain.cmake ../ +make +``` + +## Windows +Requires [Windows CMake](https://cmake.org/download/) + [Windows Make](http://gnuwin32.sourceforge.net/packages/make.htm) + [devkitPPC](https://devkitpro.org/wiki/Getting_Started/devkitPPC) + Visual Studio. + +``` +set DEVKITPPC= +git clone --recursive https://github.com/decaf-emu/wut.git +cd wut +cmake -DCMAKE_INSTALL_PREFIX=install -G "Visual Studio 15 2017" ../ +msbuild INSTALL.vcxproj /p:Configuration=Release /p:Platform=Win32 +set WUT_ROOT=%CD%\install +``` + +Then for any wut project you want to build you must use Unix Makefiles with the wut-toolchain.cmake script: + +``` +cd ..\samples\helloworld +mkdir build +cd build +cmake -DCMAKE_TOOLCHAIN_FILE=%WUT_ROOT%\cmake\wut-toolchain.cmake -G "Unix Makefiles" ../ +make +``` diff --git a/cmake/wut-toolchain.cmake b/cmake/wut-toolchain.cmake new file mode 100644 index 0000000..6e295df --- /dev/null +++ b/cmake/wut-toolchain.cmake @@ -0,0 +1,74 @@ +set(DEVKITPPC $ENV{DEVKITPPC} CACHE STRING "Path to devkitPPC install") +set(WUT_ROOT $ENV{WUT_ROOT} CACHE STRING "Path to wut install") + +# Check for DEVKITPPC +if(NOT DEVKITPPC) + message(FATAL_ERROR "You must have defined DEVKITPPC before calling cmake.") +endif() + +if(NOT WUT_ROOT) + # Let's try find it! + if(EXISTS "${CMAKE_SOURCE_DIR}/cmake/wut-toolchain.cmake") + # ./ for wut/CMakeLists.txt + set(FIND_WUT_ROOT ${CMAKE_SOURCE_DIR}) + elseif(EXISTS "${CMAKE_SOURCE_DIR}/../cmake/wut-toolchain.cmake") + # ../ for wut/rpl/CMakeLists.txt + set(FIND_WUT_ROOT "${CMAKE_SOURCE_DIR}/..") + elseif(EXISTS "${CMAKE_TOOLCHAIN_FILE}") + # We're a toolchain file installed in WUT_ROOT/cmake + set(FIND_WUT_ROOT "${CMAKE_TOOLCHAIN_FILE}/..") + endif() +endif() + +if(NOT WUT_ROOT) + message(FATAL_ERROR "You must have defined WUT_ROOT before calling cmake.") +endif() + +# Set it in ENV to make sure it gets passed around, cmake is a bit odd like that. +set(ENV{WUT_ROOT} ${WUT_ROOT}) +set(ENV{DEVKITPPC} ${DEVKITPPC}) + +set(CMAKE_SYSTEM_NAME Generic) + +if(WIN32) + # Because "Unix Makefiles" generator does not set this, even if on Windows + set(CMAKE_EXECUTABLE_SUFFIX ".exe") +endif() + +set(CMAKE_C_COMPILER "${DEVKITPPC}/bin/powerpc-eabi-gcc${CMAKE_EXECUTABLE_SUFFIX}") +set(CMAKE_CXX_COMPILER "${DEVKITPPC}/bin/powerpc-eabi-g++${CMAKE_EXECUTABLE_SUFFIX}") + +set(CMAKE_FIND_ROOT_PATH ${DEVKITPPC}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +set(DEVKIT_COMPILE_FLAGS "-fno-builtin -ffreestanding") +set(DEVKIT_LINKER_FLAGS "-nostartfiles -L${DEVKITPPC}/lib") + +set(RPX_COMPILE_FLAGS "\ + ${DEVKIT_COMPILE_FLAGS}") + +set(RPX_LINKER_FLAGS "\ + ${DEVKIT_LINKER_FLAGS} \ + -pie -fPIE -z common-page-size=64 -z max-page-size=64 -T ${WUT_ROOT}/rules/rpl.ld -L${WUT_ROOT}/lib \ + -Wl,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size \ + -Wl,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r \ + -Wl,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,-wrap,__eabi") + +set(ELF_TO_RPL ${WUT_ROOT}/bin/elf2rpl${CMAKE_EXECUTABLE_SUFFIX}) + +macro(add_rpx target) + add_executable(${ARGV}) + set_target_properties(${target} PROPERTIES + COMPILE_FLAGS "${RPX_COMPILE_FLAGS}" + LINK_FLAGS "${RPX_LINKER_FLAGS}") + + target_include_directories(${target} PRIVATE "${WUT_ROOT}/include") + target_link_libraries(${target} crt) + + add_custom_command(TARGET ${target} POST_BUILD + COMMAND "${ELF_TO_RPL}" "$" "$.rpx" + COMMENT "Converting elf to rpx") +endmacro() diff --git a/crt/CMakeLists.txt b/crt/CMakeLists.txt new file mode 100644 index 0000000..441a808 --- /dev/null +++ b/crt/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.2) +project(wut-crt) + +include(../cmake/wut-toolchain.cmake) + +set_property(SOURCE crt0.S PROPERTY LANGUAGE C) + +add_library(crt + crt0.S + fs_dev.c + memory.c) +set_target_properties(crt PROPERTIES + COMPILE_FLAGS "-fno-builtin -ffreestanding") +target_include_directories(crt PRIVATE "../include") + +install(TARGETS crt ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib") diff --git a/crt/Makefile b/crt/Makefile deleted file mode 100644 index adcbbcb..0000000 --- a/crt/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include $(CURDIR)/../rules/ppc.mk - -CFILES := $(wildcard *.c) -SFILES := $(wildcard *.S) -OFILES := $(CFILES:.c=.o) $(SFILES:.S=.o) -OUTPUT := libcrt - -all: $(OUTPUT).a $(OFILES) - -clean: - @echo "[RM] $(notdir $(OUTPUT))" - @rm -f $(OFILES) $(OUTPUT).a - -install: all - @mkdir -p $(INSTALLDIR)/lib - @cp -f *.a $(INSTALLDIR)/lib - -%.o: %.c - @echo "[CC] $(notdir $<)" - @$(CC) $(CFLAGS) -c $< -o $@ - -%.o: %.S - @echo "[CC] $(notdir $<)" - @$(CC) $(CFLAGS) -c $< -o $@ - -$(OUTPUT).a: $(OFILES) - -.PHONY: all clean diff --git a/make-tools.bat b/make-tools.bat deleted file mode 100755 index 8063d23..0000000 --- a/make-tools.bat +++ /dev/null @@ -1 +0,0 @@ -msbuild tools/tools.sln /p:Configuration=Release diff --git a/rpl/CMakeLists.txt b/rpl/CMakeLists.txt new file mode 100644 index 0000000..bba926e --- /dev/null +++ b/rpl/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.2) +project(wut-libraries) + +include(../cmake/wut-toolchain.cmake) + +set_property(SOURCE common/stub.S PROPERTY LANGUAGE C) + +set(WUT_RPL_COMPILE_FLAGS "-Wno-unused-variable -fno-builtin -ffreestanding") +set(WUT_RPL_LINKER_FLAGS "-nostdlib -nostartfiles") + +macro(add_wut_rpl target) + add_library(${target} + common/lib.c + common/stub.S + ${target}/config.h + ${target}/exports.h) + target_include_directories(${target} PRIVATE "common" "${target}") + set_target_properties(${target} PROPERTIES + COMPILE_FLAGS "${WUT_RPL_COMPILE_FLAGS}" + LINK_FLAGS "${WUT_RPL_LINKER_FLAGS}") + install(TARGETS ${target} ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib") +endmacro() + +add_wut_rpl(coreinit) +add_wut_rpl(gx2) +add_wut_rpl(nsysnet) +add_wut_rpl(proc_ui) +add_wut_rpl(sndcore2) +add_wut_rpl(sysapp) +add_wut_rpl(vpad) diff --git a/rpl/Makefile b/rpl/Makefile deleted file mode 100644 index fdab4f7..0000000 --- a/rpl/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TARGETS := libcoreinit libgx2 libnsysnet libvpad libproc_ui libsndcore2 libsysapp - -all: - @for dir in $(TARGETS); do \ - echo; \ - echo Entering Directory $$dir; \ - $(MAKE) --no-print-directory -C $$dir; \ - echo Leaving Directory $$dir; \ - done - -clean: - @for dir in $(TARGETS); do \ - echo Cleaning $$dir; \ - $(MAKE) --no-print-directory -C $$dir clean; \ - done - -install: all - @mkdir -p $(INSTALLDIR)/lib - @for dir in $(TARGETS); do \ - echo Installing $$dir; \ - cp $$dir/*.a $(INSTALLDIR)/lib; \ - done - -.PHONY: all install clean diff --git a/rpl/common/rules.mk b/rpl/common/rules.mk deleted file mode 100644 index fa7414c..0000000 --- a/rpl/common/rules.mk +++ /dev/null @@ -1,71 +0,0 @@ -.SUFFIXES: - -ifeq ($(findstring CYGWIN,$(shell uname -s)),CYGWIN) -CUR_DIR := $(shell cygpath -w ${CURDIR}) -else -CUR_DIR := $(CURDIR) -endif - -TARGET := $(notdir $(CUR_DIR)) -BUILD := build -SOURCE := ../common . -INCLUDE := . -DATA := data -LIBS := - -include $(WUT_ROOT)/rules/ppc.mk - -LD := $(PREFIX)ld -RPLCFLAGS := -Wno-unused-variable -fno-builtin -CFLAGS += -O2 -Wall -std=c11 $(RPLCFLAGS) -ODEPS := stub.o lib.o - -ifneq ($(BUILD),$(notdir $(CURDIR))) - -export OUTPUT := $(CUR_DIR)/$(TARGET) -export VPATH := $(foreach dir,$(SOURCE),$(CUR_DIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CUR_DIR)/$(dir)) -export BUILDDIR := $(CUR_DIR)/$(BUILD) -export DEPSDIR := $(BUILDDIR) - -CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c))) -CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp))) -SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S))) - -export OFILES := $(CFILES:.c=.o) \ - $(CXXFILES:.cpp=.o) \ - $(SFILES:.S=.o) - -export INCLUDES := $(foreach dir,$(INCLUDE),-I$(CUR_DIR)/$(dir)) \ - -I$(CUR_DIR)/$(BUILD) - -.PHONY: $(BUILD) clean - -$(BUILD): - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CUR_DIR)/Makefile - -clean: - @echo "[RM] $(notdir $(OUTPUT))" - @rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).a - -else - -DEPENDS := $(OFILES:.o=.d) -OFILES := $(filter-out $(ODEPS),$(OFILES)) - -$(OUTPUT).a: rpl.o $(OFILES) - -lib.c: exports.h - -lib.o: lib.c exports.h - @echo "[CC] $(notdir $<)" - @$(CC) $(EXTRA_OPTIONS) $(RPLCFLAGS) -S $(INCLUDES) $< -o lib.S - @$(CC) $(EXTRA_OPTIONS) $(RPLCFLAGS) -c lib.S -o $@ - -rpl.o: $(ODEPS) - @$(LD) $(EXTRA_OPTIONS) $(LDFLAGS) -r $(ODEPS) -o $@ - --include $(DEPENDS) - -endif diff --git a/rpl/libcoreinit/config.h b/rpl/coreinit/config.h similarity index 100% rename from rpl/libcoreinit/config.h rename to rpl/coreinit/config.h diff --git a/rpl/libcoreinit/exports.h b/rpl/coreinit/exports.h similarity index 100% rename from rpl/libcoreinit/exports.h rename to rpl/coreinit/exports.h diff --git a/rpl/libgx2/config.h b/rpl/gx2/config.h similarity index 100% rename from rpl/libgx2/config.h rename to rpl/gx2/config.h diff --git a/rpl/libgx2/exports.h b/rpl/gx2/exports.h similarity index 100% rename from rpl/libgx2/exports.h rename to rpl/gx2/exports.h diff --git a/rpl/libcoreinit/Makefile b/rpl/libcoreinit/Makefile deleted file mode 100644 index 0db6a68..0000000 --- a/rpl/libcoreinit/Makefile +++ /dev/null @@ -1,2 +0,0 @@ --include ../common/rules.mk --include ../../common/rules.mk diff --git a/rpl/libgx2/Makefile b/rpl/libgx2/Makefile deleted file mode 100644 index 0db6a68..0000000 --- a/rpl/libgx2/Makefile +++ /dev/null @@ -1,2 +0,0 @@ --include ../common/rules.mk --include ../../common/rules.mk diff --git a/rpl/libnsysnet/Makefile b/rpl/libnsysnet/Makefile deleted file mode 100644 index 0db6a68..0000000 --- a/rpl/libnsysnet/Makefile +++ /dev/null @@ -1,2 +0,0 @@ --include ../common/rules.mk --include ../../common/rules.mk diff --git a/rpl/libproc_ui/Makefile b/rpl/libproc_ui/Makefile deleted file mode 100644 index 0db6a68..0000000 --- a/rpl/libproc_ui/Makefile +++ /dev/null @@ -1,2 +0,0 @@ --include ../common/rules.mk --include ../../common/rules.mk diff --git a/rpl/libsndcore2/Makefile b/rpl/libsndcore2/Makefile deleted file mode 100644 index 0db6a68..0000000 --- a/rpl/libsndcore2/Makefile +++ /dev/null @@ -1,2 +0,0 @@ --include ../common/rules.mk --include ../../common/rules.mk diff --git a/rpl/libsysapp/Makefile b/rpl/libsysapp/Makefile deleted file mode 100644 index 0db6a68..0000000 --- a/rpl/libsysapp/Makefile +++ /dev/null @@ -1,2 +0,0 @@ --include ../common/rules.mk --include ../../common/rules.mk diff --git a/rpl/libvpad/Makefile b/rpl/libvpad/Makefile deleted file mode 100644 index 0db6a68..0000000 --- a/rpl/libvpad/Makefile +++ /dev/null @@ -1,2 +0,0 @@ --include ../common/rules.mk --include ../../common/rules.mk diff --git a/rpl/libnsysnet/config.h b/rpl/nsysnet/config.h similarity index 100% rename from rpl/libnsysnet/config.h rename to rpl/nsysnet/config.h diff --git a/rpl/libnsysnet/exports.h b/rpl/nsysnet/exports.h similarity index 100% rename from rpl/libnsysnet/exports.h rename to rpl/nsysnet/exports.h diff --git a/rpl/libproc_ui/config.h b/rpl/proc_ui/config.h similarity index 100% rename from rpl/libproc_ui/config.h rename to rpl/proc_ui/config.h diff --git a/rpl/libproc_ui/exports.h b/rpl/proc_ui/exports.h similarity index 100% rename from rpl/libproc_ui/exports.h rename to rpl/proc_ui/exports.h diff --git a/rpl/libsndcore2/config.h b/rpl/sndcore2/config.h similarity index 100% rename from rpl/libsndcore2/config.h rename to rpl/sndcore2/config.h diff --git a/rpl/libsndcore2/exports.h b/rpl/sndcore2/exports.h similarity index 100% rename from rpl/libsndcore2/exports.h rename to rpl/sndcore2/exports.h diff --git a/rpl/libsysapp/config.h b/rpl/sysapp/config.h similarity index 100% rename from rpl/libsysapp/config.h rename to rpl/sysapp/config.h diff --git a/rpl/libsysapp/exports.h b/rpl/sysapp/exports.h similarity index 100% rename from rpl/libsysapp/exports.h rename to rpl/sysapp/exports.h diff --git a/rpl/libvpad/config.h b/rpl/vpad/config.h similarity index 100% rename from rpl/libvpad/config.h rename to rpl/vpad/config.h diff --git a/rpl/libvpad/exports.h b/rpl/vpad/exports.h similarity index 100% rename from rpl/libvpad/exports.h rename to rpl/vpad/exports.h diff --git a/rules/base.mk b/rules/base.mk deleted file mode 100644 index 2f054c7..0000000 --- a/rules/base.mk +++ /dev/null @@ -1,51 +0,0 @@ -ifeq ($(strip $(DEVKITPRO)),) -$(error "Please ensure DEVKITPRO is in your environment.") -endif - -ifeq ($(strip $(DEVKITPPC)),) -$(error "Please ensure DEVKITPPC is in your environment.") -endif - -export PATH := $(DEVKITPPC)/bin:$(PATH) - -PREFIX := powerpc-eabi- -OBJCOPY := $(PREFIX)objcopy -AR := $(PREFIX)ar -AS := $(PREFIX)gcc -CC := $(PREFIX)gcc -CXX := $(PREFIX)g++ -STRIP := $(PREFIX)strip - -ifeq ($(findstring $(PREFIX),$(LD)),) -LD := $(CC) -endif - -EXTRA_OPTIONS = - -ifdef VERBOSE -EXTRA_OPTIONS += -v -endif - -%.o: %.c - @echo "[CC] $(notdir $<)" - @$(CC) $(EXTRA_OPTIONS) $(CFLAGS) $(INCLUDES) -c $< -o $@ - -%.o: %.cpp - @echo "[CXX] $(notdir $<)" - @$(CXX) $(EXTRA_OPTIONS) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ - -%.o: %.s - @echo "[CC] $(notdir $<)" - @$(AS) $(EXTRA_OPTIONS) -x assembler-with-cpp $(ASFLAGS) $(INCLUDES) -c $< -o $@ - -%.o: %.S - @echo "[CC] $(notdir $<)" - @$(AS) $(EXTRA_OPTIONS) -x assembler-with-cpp $(ASFLAGS) $(INCLUDES) -c $< -o $@ - -%.a: - @echo "[AR] $(notdir $@)" - @$(AR) -rcs $@ $^ - -%.elf: $(OFILES) - @echo "[LD] $(notdir $@)" - @$(LD) $^ $(LIBPATHS) $(LIBS) $(LDFLAGS) -o $@ diff --git a/rules/ppc.mk b/rules/ppc.mk deleted file mode 100644 index 642cb91..0000000 --- a/rules/ppc.mk +++ /dev/null @@ -1,9 +0,0 @@ -LIBPATHS := -L$(WUT_ROOT)/lib -CFLAGS := -I$(WUT_ROOT)/include -fno-builtin -ffreestanding -std=c11 -CXXFLAGS := $(CFLAGS) -LDFLAGS := -nostdlib -nostartfiles - -include $(WUT_ROOT)/rules/base.mk - -%.rpx: %.elf - @$(STRIP) $< -o $(BUILDDIR)/$(notdir $<) diff --git a/rules/rpl.mk b/rules/rpl.mk deleted file mode 100644 index b1fae58..0000000 --- a/rules/rpl.mk +++ /dev/null @@ -1,14 +0,0 @@ -LIBPATHS := -L$(WUT_ROOT)/lib -L$(DEVKITPPC)/lib -CFLAGS := -I$(WUT_ROOT)/include -fno-builtin -ffreestanding -CXXFLAGS := $(CFLAGS) -LDFLAGS := -nostartfiles -T $(WUT_ROOT)/rules/rpl.ld -pie -fPIE -z common-page-size=64 -z max-page-size=64 -lcrt \ - -Wl,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size \ - -Wl,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r \ - -Wl,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,-wrap,__eabi -ELF2RPL := $(WUT_ROOT)/bin/elf2rpl - -include $(WUT_ROOT)/rules/base.mk - -%.rpx: %.elf - @echo "[RPX] $(notdir $@)" - @$(ELF2RPL) $(BUILDDIR)/$(notdir $<) $@ diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt new file mode 100644 index 0000000..459a68c --- /dev/null +++ b/samples/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.2) +project(wut-samples) + +add_subdirectory(helloworld) +add_subdirectory(pong) diff --git a/samples/helloworld/CMakeLists.txt b/samples/helloworld/CMakeLists.txt new file mode 100644 index 0000000..e360f1e --- /dev/null +++ b/samples/helloworld/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.2) +project(helloworld) + +add_rpx(helloworld src/main.c) +target_link_libraries(helloworld + coreinit + proc_ui + sysapp) diff --git a/samples/helloworld/Makefile b/samples/helloworld/Makefile deleted file mode 100644 index 92025ea..0000000 --- a/samples/helloworld/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -.SUFFIXES: - -ifeq ($(strip $(WUT_ROOT)),) -$(error "Please ensure WUT_ROOT is in your environment.") -endif - -ifeq ($(findstring CYGWIN,$(shell uname -s)),CYGWIN) -ROOT := $(shell cygpath -w ${CURDIR}) -WUT_ROOT := $(shell cygpath -w ${WUT_ROOT}) -else -ROOT := $(CURDIR) -endif - -include $(WUT_ROOT)/rules/rpl.mk - -TARGET := $(notdir $(CURDIR)) -BUILD := build -SOURCE := src -INCLUDE := include -DATA := data -LIBS := -lgcc -lcrt -lcoreinit -lproc_ui -lsysapp - -CFLAGS += -O2 -Wall -std=c11 -CXXFLAGS += -O2 -Wall - -ifneq ($(BUILD),$(notdir $(CURDIR))) - -export OUTPUT := $(ROOT)/$(TARGET) -export VPATH := $(foreach dir,$(SOURCE),$(ROOT)/$(dir)) \ - $(foreach dir,$(DATA),$(ROOT)/$(dir)) -export BUILDDIR := $(ROOT) -export DEPSDIR := $(BUILDDIR) - -CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c))) -CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp))) -SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S))) - -ifeq ($(strip $(CXXFILES)),) -export LD := $(CC) -else -export LD := $(CXX) -endif - -export OFILES := $(CFILES:.c=.o) \ - $(CXXFILES:.cpp=.o) \ - $(SFILES:.S=.o) -export INCLUDES := $(foreach dir,$(INCLUDE),-I$(ROOT)/$(dir)) \ - -I$(ROOT)/$(BUILD) - -.PHONY: $(BUILD) clean - -$(BUILD): - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(ROOT)/Makefile - -clean: - @echo "[RM] $(notdir $(OUTPUT))" - @rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).rpx $(OUTPUT).a - -else - -DEPENDS := $(OFILES:.o=.d) - -$(OUTPUT).rpx: $(OUTPUT).elf -$(OUTPUT).elf: $(OFILES) - --include $(DEPENDS) - -endif diff --git a/samples/pong/CMakeLists.txt b/samples/pong/CMakeLists.txt new file mode 100644 index 0000000..dccdb79 --- /dev/null +++ b/samples/pong/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.2) +project(pong) + +include($ENV{WUT_ROOT}/cmake/wut-toolchain.cmake) + +file(GLOB_RECURSE SOURCE_FILES *.c) +file(GLOB_RECURSE HEADER_FILES *.h) + +add_rpx(pong ${SOURCE_FILES} ${HEADER_FILES}) +target_link_libraries(pong + coreinit + proc_ui + vpad) diff --git a/samples/pong/Makefile b/samples/pong/Makefile deleted file mode 100644 index ca398f6..0000000 --- a/samples/pong/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -.SUFFIXES: - -ifeq ($(strip $(WUT_ROOT)),) -$(error "Please ensure WUT_ROOT is in your environment.") -endif - -ifeq ($(findstring CYGWIN,$(shell uname -s)),CYGWIN) -ROOT := $(shell cygpath -w ${CURDIR}) -WUT_ROOT := $(shell cygpath -w ${WUT_ROOT}) -else -ROOT := $(CURDIR) -endif - -include $(WUT_ROOT)/rules/rpl.mk - -TARGET := $(notdir $(CURDIR)) -BUILD := build -SOURCE := src -INCLUDE := include -DATA := data -LIBS := -lgcc -lcrt -lcoreinit -lvpad -lproc_ui - -CFLAGS += -O2 -Wall -std=c11 -CXXFLAGS += -O2 -Wall -ASFLAGS += -mregnames - -ifneq ($(BUILD),$(notdir $(CURDIR))) - -export OUTPUT := $(ROOT)/$(TARGET) -export VPATH := $(foreach dir,$(SOURCE),$(ROOT)/$(dir)) \ - $(foreach dir,$(DATA),$(ROOT)/$(dir)) -export BUILDDIR := $(ROOT) -export DEPSDIR := $(BUILDDIR) - -CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c))) -CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp))) -SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S))) - -ifeq ($(strip $(CXXFILES)),) -export LD := $(CC) -else -export LD := $(CXX) -endif - -export OFILES := $(CFILES:.c=.o) \ - $(CXXFILES:.cpp=.o) \ - $(SFILES:.S=.o) -export INCLUDES := $(foreach dir,$(INCLUDE),-I$(ROOT)/$(dir)) \ - -I$(ROOT)/$(BUILD) - -.PHONY: $(BUILD) clean - -$(BUILD): - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(ROOT)/Makefile - -clean: - @echo "[RM] $(notdir $(OUTPUT))" - @rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).rpx $(OUTPUT).a - -else - -DEPENDS := $(OFILES:.o=.d) - -$(OUTPUT).rpx: $(OUTPUT).elf -$(OUTPUT).elf: $(OFILES) - --include $(DEPENDS) - -endif diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..95396ca --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.2) +project(wut-tools) + +set(CMAKE_CXX_STANDARD 14) +include_directories("common") + +add_subdirectory(ext) + +add_subdirectory(elf2rpl) +add_subdirectory(readrpl) +add_subdirectory(implcheck) diff --git a/tools/Makefile b/tools/Makefile deleted file mode 100644 index 3bf58f8..0000000 --- a/tools/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -.SUFFIXES: - -TARGETS := elf2rpl readrpl implcheck - -ifeq ($(OS),Windows_NT) -all: -ifeq (, $(shell which msbuild 2> /dev/null)) - $(warning "msbuild not found, try building with make-tools.bat from a vcvars prompt.") -else - $(shell msbuild tools/tools.sln /p:Configuration=Release) -endif - -clean: -ifeq (, $(shell which msbuild 2> /dev/null)) - $(shell msbuild tools/tools.sln /p:Configuration=Release /target:Clean) -else - $(warning "msbuild not found, try building with make-tools.bat from a vcvars prompt.") -endif - -install: all - @mkdir -p $(INSTALLDIR)/bin - @for dir in $(TARGETS); do \ - echo Installing $$dir; \ - cp bin/$$dir $(INSTALLDIR)/bin; \ - done - -else -all: - @mkdir -p $(CURDIR)/bin - @for dir in $(TARGETS); do \ - echo; \ - echo Entering Directory $$dir; \ - $(MAKE) --no-print-directory -C $$dir; \ - echo Leaving Directory $$dir; \ - done - -clean: - @for dir in $(TARGETS); do \ - echo Cleaning $$dir; \ - $(MAKE) --no-print-directory -C $$dir clean; \ - done - -install: all - @mkdir -p $(INSTALLDIR)/bin - @for dir in $(TARGETS); do \ - echo Installing $$dir; \ - cp bin/$$dir $(INSTALLDIR)/bin; \ - done -endif - -.PHONY: all install clean diff --git a/tools/elf2rpl/CMakeLists.txt b/tools/elf2rpl/CMakeLists.txt new file mode 100644 index 0000000..85acccf --- /dev/null +++ b/tools/elf2rpl/CMakeLists.txt @@ -0,0 +1,12 @@ +project(elf2rpl) + +file(GLOB_RECURSE SOURCE_FILES *.cpp) +file(GLOB_RECURSE HEADER_FILES *.h) + +add_executable(elf2rpl ${SOURCE_FILES} ${HEADER_FILES}) +set_target_properties(elf2rpl PROPERTIES FOLDER tools) + +target_link_libraries(elf2rpl PRIVATE + ${ZLIB_LINK}) + +install(TARGETS elf2rpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") diff --git a/tools/elf2rpl/Makefile b/tools/elf2rpl/Makefile deleted file mode 100644 index 4772e8e..0000000 --- a/tools/elf2rpl/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -TARGET := ../bin/elf2rpl -SOURCE := . -INCLUDE := ../common - -CXX := g++ - -CFILES := $(foreach dir,$(SOURCE),$(wildcard $(dir)/*.cpp)) -INCLUDES := $(foreach dir,$(INCLUDE),-I$(dir)) - -CFLAGS := -O2 -Wall --std=c++14 -LDFLAGS := -lz - -all: $(TARGET) - -clean: - @echo "[RM] $(notdir $(TARGET))" - @rm -rf $(TARGET) - @rm -rf ../$(TARGET) - -install: all - @echo Installing $(TARGET) - @cp $(TARGET) $(WUT_ROOT)/bin/$(TARGET) - -$(TARGET): $(CFILES) - @echo "[CXX] $(notdir $<)" - @$(CXX) $(CFLAGS) $(INCLUDES) $< -o $@ $(LDFLAGS) diff --git a/tools/elf2rpl/elf2rpl.vcxproj b/tools/elf2rpl/elf2rpl.vcxproj deleted file mode 100644 index d034791..0000000 --- a/tools/elf2rpl/elf2rpl.vcxproj +++ /dev/null @@ -1,172 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {F6442B08-9323-4D98-ABA6-8856467B148B} - Win32Proj - elf2rpl - 8.1 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)\bin\ - $(SolutionDir)\ext\zlib;$(IncludePath) - - - true - $(SolutionDir)\bin\ - $(SolutionDir)\ext\zlib;$(IncludePath) - - - false - $(SolutionDir)\bin\ - $(SolutionDir)\ext\zlib;$(IncludePath) - - - false - $(SolutionDir)\bin\ - $(SolutionDir)\ext\zlib;$(IncludePath) - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(SolutionDir)\common;%(AdditionalIncludeDirectories) - - - Console - true - UseLinkTimeCodeGeneration - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(SolutionDir)\common;%(AdditionalIncludeDirectories) - - - Console - true - UseLinkTimeCodeGeneration - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(SolutionDir)\common;%(AdditionalIncludeDirectories) - - - Console - true - true - No - UseLinkTimeCodeGeneration - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - $(SolutionDir)\common;%(AdditionalIncludeDirectories) - - - Console - true - true - No - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/elf2rpl/elf2rpl.vcxproj.filters b/tools/elf2rpl/elf2rpl.vcxproj.filters deleted file mode 100644 index bd1de7e..0000000 --- a/tools/elf2rpl/elf2rpl.vcxproj.filters +++ /dev/null @@ -1,39 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {36d55ffd-f33d-437b-abc1-6e26a832efb3} - - - - - Source Files - - - Source Files\ext - - - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/tools/ext/CMakeLists.txt b/tools/ext/CMakeLists.txt new file mode 100644 index 0000000..5a9de8c --- /dev/null +++ b/tools/ext/CMakeLists.txt @@ -0,0 +1,92 @@ +project(libraries) +include(ExternalProject) + +# cppformat +set(CPPFORMAT_DIR "cppformat") +externalproject_add(cppformat + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${CPPFORMAT_DIR}" + CMAKE_CACHE_ARGS + -DCMAKE_C_COMPILER:string=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:string=${CMAKE_C_FLAGS} + -DCMAKE_CXX_COMPILER:string=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:string=${CMAKE_CXX_FLAGS} + -DFMT_DOC:string=off + -DFMT_INSTALL:string=off + -DFMT_TEST:string=off + INSTALL_COMMAND "") +externalproject_get_property(cppformat BINARY_DIR) +set_target_properties(cppformat PROPERTIES FOLDER libraries) + +if(MSVC) + set(CPPFORMAT_IMPORTED_LOCATION + IMPORTED_LOCATION_DEBUG "${BINARY_DIR}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat${CMAKE_FIND_LIBRARY_SUFFIXES}" + IMPORTED_LOCATION_RELEASE "${BINARY_DIR}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat${CMAKE_FIND_LIBRARY_SUFFIXES}" + IMPORTED_LOCATION_RELWITHDEBINFO "${BINARY_DIR}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat${CMAKE_FIND_LIBRARY_SUFFIXES}" + IMPORTED_LOCATION_MINSIZEREL "${BINARY_DIR}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat${CMAKE_FIND_LIBRARY_SUFFIXES}") +else() + set(CPPFORMAT_IMPORTED_LOCATION + IMPORTED_LOCATION "${BINARY_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cppformat.a") +endif() + +add_library(cppformat_import STATIC IMPORTED GLOBAL) +add_dependencies(cppformat_import cppformat) +set_target_properties(cppformat_import PROPERTIES ${CPPFORMAT_IMPORTED_LOCATION}) + +add_library(cppformat_final INTERFACE) +target_include_directories(cppformat_final INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/${CPPFORMAT_DIR}") +target_link_libraries(cppformat_final INTERFACE cppformat_import) +set(CPPFORMAT_LINK cppformat_final PARENT_SCOPE) + +# excmd +set(EXCMD_DIR "excmd") +add_library(excmd INTERFACE) +target_include_directories(excmd INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/${EXCMD_DIR}/src") +set(EXCMD_LINK excmd PARENT_SCOPE) + +# zlib +find_package(ZLIB QUIET) + +if(NOT ZLIB_FOUND) + set(ZLIB_DIR "zlib") + externalproject_add(zlib + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${ZLIB_DIR}" + PATCH_COMMAND ${CMAKE_COMMAND} -E remove /zconf.h + CMAKE_CACHE_ARGS + -DCMAKE_C_COMPILER:string=${CMAKE_C_COMPILER} + -DCMAKE_C_FLAGS:string=${CMAKE_C_FLAGS} + -DCMAKE_CXX_COMPILER:string=${CMAKE_CXX_COMPILER} + -DCMAKE_CXX_FLAGS:string=${CMAKE_CXX_FLAGS} + -DBUILD_SHARED_LIBS:string=off + INSTALL_COMMAND "" + ) + externalproject_get_property(zlib BINARY_DIR) + externalproject_add_step(zlib + copy_to_binary + DEPENDEES build + DEPENDERS install + COMMAND ${CMAKE_COMMAND} -E copy_directory "${BINARY_DIR}/$(Configuration)" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(Configuration)") + set_target_properties(zlib PROPERTIES FOLDER libraries) + + if(MSVC) + set(ZLIB_IMPORTED_LOCATION + IMPORTED_LOCATION_DEBUG "${BINARY_DIR}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}zlibdstatic${CMAKE_FIND_LIBRARY_SUFFIXES}" + IMPORTED_LOCATION_RELEASE "${BINARY_DIR}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}zlibstatic${CMAKE_FIND_LIBRARY_SUFFIXES}" + IMPORTED_LOCATION_RELWITHDEBINFO "${BINARY_DIR}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}zlibstatic${CMAKE_FIND_LIBRARY_SUFFIXES}" + IMPORTED_LOCATION_MINSIZEREL "${BINARY_DIR}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}zlibstatic${CMAKE_FIND_LIBRARY_SUFFIXES}") + else() + set(ZLIB_IMPORTED_LOCATION + IMPORTED_LOCATION "${BINARY_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}z.a") + endif() + + add_library(zlib_import STATIC IMPORTED GLOBAL) + add_dependencies(zlib_import zlib) + set_target_properties(zlib_import PROPERTIES ${ZLIB_IMPORTED_LOCATION}) + + set(ZLIB_LIBRARIES zlib_import) + set(ZLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${ZLIB_DIR} ${BINARY_DIR}) +endif() + +add_library(zlib_final INTERFACE) +target_include_directories(zlib_final INTERFACE ${ZLIB_INCLUDE_DIRS}) +target_link_libraries(zlib_final INTERFACE ${ZLIB_LIBRARIES}) +set(ZLIB_LINK zlib_final PARENT_SCOPE) diff --git a/tools/implcheck/CMakeLists.txt b/tools/implcheck/CMakeLists.txt new file mode 100644 index 0000000..718a441 --- /dev/null +++ b/tools/implcheck/CMakeLists.txt @@ -0,0 +1,14 @@ +project(implcheck) + +file(GLOB_RECURSE SOURCE_FILES *.cpp) +file(GLOB_RECURSE HEADER_FILES *.h) + +add_executable(implcheck ${SOURCE_FILES} ${HEADER_FILES}) +set_target_properties(implcheck PROPERTIES FOLDER tools) + +target_link_libraries(implcheck PRIVATE + ${CPPFORMAT_LINK} + ${EXCMD_LINK} + ${ZLIB_LINK}) + +install(TARGETS implcheck RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") diff --git a/tools/implcheck/Makefile b/tools/implcheck/Makefile deleted file mode 100644 index 5cd43e8..0000000 --- a/tools/implcheck/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TARGET := ../bin/implcheck -SOURCE := . -INCLUDE := ../common ../ext/cppformat ../ext/excmd/src - -CXX := g++ - -CPPFORMATSRC := ../ext/cppformat/format.cc - -CFILES := $(foreach dir,$(SOURCE),$(wildcard $(dir)/*.cpp)) -INCLUDES := $(foreach dir,$(INCLUDE),-I$(dir)) - -CFLAGS := -O2 -Wall --std=c++14 -LDFLAGS := -lz - -all: $(TARGET) - -clean: - @echo "[RM] $(notdir $(TARGET))" - @rm -rf $(TARGET) - @rm -rf ../$(TARGET) - -install: all - @echo Installing $(TARGET) - @cp $(TARGET) $(WUT_ROOT)/bin/$(TARGET) - -$(TARGET): $(CFILES) - @echo "[CXX] $(notdir $<)" - @$(CXX) $(CFLAGS) $(INCLUDES) $< -o $@ $(LDFLAGS) $(CPPFORMATSRC) diff --git a/tools/implcheck/implcheck.vcxproj b/tools/implcheck/implcheck.vcxproj deleted file mode 100644 index 00e2368..0000000 --- a/tools/implcheck/implcheck.vcxproj +++ /dev/null @@ -1,164 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {08008ADA-439B-4852-8102-40A8D6EDB46D} - Win32Proj - implcheck - 8.1 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)\bin\ - - - true - $(SolutionDir)\bin\ - $(SolutionDir)\common;$(SolutionDir)\ext\cppformat;$(SolutionDir)\ext\excmd\src;$(SolutionDir)\ext\zlib;$(IncludePath) - - - false - $(SolutionDir)\bin\ - - - false - $(SolutionDir)\bin\ - $(SolutionDir)\common;$(SolutionDir)\ext\cppformat;$(SolutionDir)\ext\excmd\src;$(SolutionDir)\ext\zlib;$(IncludePath) - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - No - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - No - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/implcheck/implcheck.vcxproj.filters b/tools/implcheck/implcheck.vcxproj.filters deleted file mode 100644 index 05eb364..0000000 --- a/tools/implcheck/implcheck.vcxproj.filters +++ /dev/null @@ -1,49 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {d98b1134-aad7-462b-9790-a12b0f037971} - - - - - Source Files - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - \ No newline at end of file diff --git a/tools/readrpl/CMakeLists.txt b/tools/readrpl/CMakeLists.txt new file mode 100644 index 0000000..d9a490f --- /dev/null +++ b/tools/readrpl/CMakeLists.txt @@ -0,0 +1,14 @@ +project(readrpl) + +file(GLOB_RECURSE SOURCE_FILES *.cpp) +file(GLOB_RECURSE HEADER_FILES *.h) + +add_executable(readrpl ${SOURCE_FILES} ${HEADER_FILES}) +set_target_properties(readrpl PROPERTIES FOLDER tools) + +target_link_libraries(readrpl PRIVATE + ${CPPFORMAT_LINK} + ${EXCMD_LINK} + ${ZLIB_LINK}) + +install(TARGETS readrpl RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") diff --git a/tools/readrpl/Makefile b/tools/readrpl/Makefile deleted file mode 100644 index 8d838e4..0000000 --- a/tools/readrpl/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TARGET := ../bin/readrpl -SOURCE := . -INCLUDE := ../common ../ext/cppformat ../ext/excmd/src - -CXX := g++ - -CPPFORMATSRC := ../ext/cppformat/format.cc - -CFILES := $(foreach dir,$(SOURCE),$(wildcard $(dir)/*.cpp)) -INCLUDES := $(foreach dir,$(INCLUDE),-I$(dir)) - -CFLAGS := -O2 -Wall --std=c++14 -LDFLAGS := -lz - -all: $(TARGET) - -clean: - @echo "[RM] $(notdir $(TARGET))" - @rm -rf $(TARGET) - @rm -rf ../$(TARGET) - -install: all - @echo Installing $(TARGET) - @cp $(TARGET) $(WUT_ROOT)/bin/$(TARGET) - -$(TARGET): $(CFILES) - @echo "[CXX] $(notdir $<)" - @$(CXX) $(CFLAGS) $(INCLUDES) $< -o $@ $(LDFLAGS) $(CPPFORMATSRC) diff --git a/tools/readrpl/readrpl.vcxproj b/tools/readrpl/readrpl.vcxproj deleted file mode 100644 index 005341d..0000000 --- a/tools/readrpl/readrpl.vcxproj +++ /dev/null @@ -1,181 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {F6442B08-9323-4D98-ABA6-8856467B148A} - Win32Proj - readrpl - 8.1 - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)\bin\ - $(SolutionDir)\common;$(SolutionDir)\ext\cppformat;$(SolutionDir)\ext\excmd\src;$(SolutionDir)\ext\zlib;$(IncludePath) - - - true - $(SolutionDir)\bin\ - $(SolutionDir)\common;$(SolutionDir)\ext\cppformat;$(SolutionDir)\ext\excmd\src;$(SolutionDir)\ext\zlib;$(IncludePath) - - - false - $(SolutionDir)\bin\ - $(SolutionDir)\common;$(SolutionDir)\ext\cppformat;$(SolutionDir)\ext\excmd\src;$(SolutionDir)\ext\zlib;$(IncludePath) - - - false - $(SolutionDir)\bin\ - $(SolutionDir)\common;$(SolutionDir)\ext\cppformat;$(SolutionDir)\ext\excmd\src;$(SolutionDir)\ext\zlib;$(IncludePath) - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - - - Console - true - UseLinkTimeCodeGeneration - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - - - Console - true - UseLinkTimeCodeGeneration - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - - - Console - true - true - No - UseLinkTimeCodeGeneration - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - - - Console - true - true - No - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tools/readrpl/readrpl.vcxproj.filters b/tools/readrpl/readrpl.vcxproj.filters deleted file mode 100644 index 0e42f3a..0000000 --- a/tools/readrpl/readrpl.vcxproj.filters +++ /dev/null @@ -1,66 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {0cbae63d-c3bb-4e36-bec9-33cd38503112} - - - - - Source Files - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - Source Files\ext - - - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/tools/tools.sln b/tools/tools.sln deleted file mode 100644 index 1590fa1..0000000 --- a/tools/tools.sln +++ /dev/null @@ -1,48 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "elf2rpl", "elf2rpl\elf2rpl.vcxproj", "{F6442B08-9323-4D98-ABA6-8856467B148B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "readrpl", "readrpl\readrpl.vcxproj", "{F6442B08-9323-4D98-ABA6-8856467B148A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "implcheck", "implcheck\implcheck.vcxproj", "{08008ADA-439B-4852-8102-40A8D6EDB46D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F6442B08-9323-4D98-ABA6-8856467B148B}.Debug|x64.ActiveCfg = Debug|x64 - {F6442B08-9323-4D98-ABA6-8856467B148B}.Debug|x64.Build.0 = Debug|x64 - {F6442B08-9323-4D98-ABA6-8856467B148B}.Debug|x86.ActiveCfg = Debug|Win32 - {F6442B08-9323-4D98-ABA6-8856467B148B}.Debug|x86.Build.0 = Debug|Win32 - {F6442B08-9323-4D98-ABA6-8856467B148B}.Release|x64.ActiveCfg = Release|x64 - {F6442B08-9323-4D98-ABA6-8856467B148B}.Release|x64.Build.0 = Release|x64 - {F6442B08-9323-4D98-ABA6-8856467B148B}.Release|x86.ActiveCfg = Release|Win32 - {F6442B08-9323-4D98-ABA6-8856467B148B}.Release|x86.Build.0 = Release|Win32 - {F6442B08-9323-4D98-ABA6-8856467B148A}.Debug|x64.ActiveCfg = Debug|x64 - {F6442B08-9323-4D98-ABA6-8856467B148A}.Debug|x64.Build.0 = Debug|x64 - {F6442B08-9323-4D98-ABA6-8856467B148A}.Debug|x86.ActiveCfg = Debug|Win32 - {F6442B08-9323-4D98-ABA6-8856467B148A}.Debug|x86.Build.0 = Debug|Win32 - {F6442B08-9323-4D98-ABA6-8856467B148A}.Release|x64.ActiveCfg = Release|x64 - {F6442B08-9323-4D98-ABA6-8856467B148A}.Release|x64.Build.0 = Release|x64 - {F6442B08-9323-4D98-ABA6-8856467B148A}.Release|x86.ActiveCfg = Release|Win32 - {F6442B08-9323-4D98-ABA6-8856467B148A}.Release|x86.Build.0 = Release|Win32 - {08008ADA-439B-4852-8102-40A8D6EDB46D}.Debug|x64.ActiveCfg = Debug|x64 - {08008ADA-439B-4852-8102-40A8D6EDB46D}.Debug|x64.Build.0 = Debug|x64 - {08008ADA-439B-4852-8102-40A8D6EDB46D}.Debug|x86.ActiveCfg = Debug|Win32 - {08008ADA-439B-4852-8102-40A8D6EDB46D}.Debug|x86.Build.0 = Debug|Win32 - {08008ADA-439B-4852-8102-40A8D6EDB46D}.Release|x64.ActiveCfg = Release|x64 - {08008ADA-439B-4852-8102-40A8D6EDB46D}.Release|x64.Build.0 = Release|x64 - {08008ADA-439B-4852-8102-40A8D6EDB46D}.Release|x86.ActiveCfg = Release|Win32 - {08008ADA-439B-4852-8102-40A8D6EDB46D}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal