Better README and better build script

This commit is contained in:
OmniaX 2023-12-28 01:34:43 +01:00
parent 43e9e82264
commit ddc3b9b0cd
11 changed files with 108 additions and 62 deletions

1
.gitignore vendored
View file

@ -1,4 +1,3 @@
bin
tools/win-release-tools
win-release

View file

@ -1,3 +1,10 @@
#Variables
#-----------------------------------------------------------------------------------------
set(PROJ_NAME DragonVM)
set(MAJOR_VER 0)
set(MINOR_VER 1)
#-----------------------------------------------------------------------------------------
#Setup
#-----------------------------------------------------------------------------------------
set(CMAKE_CXX_COMPILER "clang++")
@ -7,27 +14,15 @@ cmake_minimum_required(VERSION 3.18)
project(${PROJ_NAME} LANGUAGES C CXX)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_STANDARD 20)
file(STRINGS "./tools/build.nr" BUILD_NUMBER)
file(STRINGS "./build.nr" BUILD_NUMBER)
#-----------------------------------------------------------------------------------------
#Variables
#-----------------------------------------------------------------------------------------
set(PROJ_NAME DragonVM)
set(MAJOR_VER 0)
set(MINOR_VER 1)
message("** Building ${PROJ_NAME} ${MAJOR_VER}.${MINOR_VER}.${BUILD_NUMBER}")
#-----------------------------------------------------------------------------------------
#Sources
#-----------------------------------------------------------------------------------------
list(APPEND INCLUDE_DIRS
${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/../omnia-framework/src
)
list(APPEND RUNTIME_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/src/runtime/runtime_main.cpp
@ -88,8 +83,6 @@ list(APPEND TOOLS_SOURCE_FILES
)
#-----------------------------------------------------------------------------------------
#Targets
#-----------------------------------------------------------------------------------------
set(RUNTIME_TARGET dvm)
@ -117,11 +110,10 @@ target_compile_definitions(${RUNTIME_TARGET} PUBLIC BUILD_NR=${BUILD_NUMBER} MA
add_compile_options(-O3 -m32 -MMD -MP -Wall -ggdb)
if (UNIX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'")
#target_link_libraries(${RUNTIME_TARGET} X11 GL)
target_link_libraries(${RUNTIME_TARGET} xcb xcb-randr)
target_link_libraries(${ASSEMBLER_TARGET} xcb xcb-randr)
target_link_libraries(${TOOLS_TARGET} xcb xcb-randr)
target_link_libraries(${DEBUGGER_TARGET} xcb xcb-randr)
target_link_libraries(${RUNTIME_TARGET} xcb xcb-randr boost_regex)
target_link_libraries(${ASSEMBLER_TARGET} xcb xcb-randr boost_regex)
target_link_libraries(${TOOLS_TARGET} xcb xcb-randr boost_regex)
target_link_libraries(${DEBUGGER_TARGET} xcb xcb-randr boost_regex)
endif (UNIX)
if (WIN32)
target_link_libraries(${RUNTIME_TARGET} mingw32)
@ -131,49 +123,16 @@ if (WIN32)
endif (WIN32)
target_link_libraries(${RUNTIME_TARGET} SDL2main SDL2 SDL2_mixer SDL2_image)
target_link_libraries(${DEBUGGER_TARGET} SDL2main SDL2 SDL2_mixer SDL2_image)
# target_link_libraries(${RUNTIME_TARGET} sfml-system sfml-window sfml-graphics)
#-----------------------------------------------------------------------------------------
#Linking
#-----------------------------------------------------------------------------------------
find_library(OMNIA_STD_LIB
NAMES ostd
HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../omnia-framework/bin/"
NO_CACHE
)
target_link_libraries(${RUNTIME_TARGET} ${OMNIA_STD_LIB})
target_link_libraries(${DEBUGGER_TARGET} ${OMNIA_STD_LIB})
target_link_libraries(${ASSEMBLER_TARGET} ${OMNIA_STD_LIB})
target_link_libraries(${TOOLS_TARGET} ${OMNIA_STD_LIB})
target_link_libraries(${RUNTIME_TARGET} ostd)
target_link_libraries(${DEBUGGER_TARGET} ostd)
target_link_libraries(${ASSEMBLER_TARGET} ostd)
target_link_libraries(${TOOLS_TARGET} ostd)
#-----------------------------------------------------------------------------------------
#BuildNumber Target
#-----------------------------------------------------------------------------------------
if (WIN32)
add_custom_command ( OUTPUT ./tools/build.nr
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/inc_bnr.exe
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/
)
endif (WIN32)
if (UNIX)
add_custom_command ( OUTPUT ./tools/build.nr
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/inc_bnr
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools/
)
endif (UNIX)
add_custom_target(
IncBnr ALL
DEPENDS ./tools/build.nr
)
#-----------------------------------------------------------------------------------------
add_custom_command(TARGET ${RUNTIME_TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/extra/ $<TARGET_FILE_DIR:${RUNTIME_TARGET}>

View file

@ -1,7 +1,12 @@
# DragonVM
Compile instructions on Windows
An amulator for a 16-bit machine that never existed
## Build instructions - All
This project requires the OmniaFramework library I wrote, which can be found at https://github.com/OmniaX-dev/OmniaFramework
This library must be correctly installed in clang's search paths (include, lib, bin) before compiling this project.
## Build instructions - Windows
**Step 1:**
download MSYS2 from https://www.msys2.org/ and install it
@ -9,7 +14,7 @@ download MSYS2 from https://www.msys2.org/ and install it
run MSYS2, and in the terminal run:
```
pacman -Syuu
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-clang mingw-w64-ucrt-x86_64-gdb mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-sfml mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-SDL2
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-clang mingw-w64-ucrt-x86_64-gdb mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-SDL2 mingw-w64-ucrt-x86_64-SDL2_mixer mingw-w64-ucrt-x86_64-SDL2_image
```
**Step 3:**
@ -20,3 +25,31 @@ execute this command:
```
./compile
```
## Build instructions - Linux (Arch)
**Step 1:**
open a terminal and run:
```
sudo pacman -Syuu
sudo pacman -S --needed base-devel clang gdb cmake make sdl2 sdl2_mixer sdl2_image
```
**Step 2:**
open a terminal inside the root directory of the project and run this command:
```
./compile
```
## Build instructions - Linux (Ubuntu)
**Step 1:**
open a terminal and run:
```
sudo apt update && sudo apt upgrade
sudo apt install clang gdb make cmake libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev libxcb-randr0-dev
```
**Step 2:**
open a terminal inside the root directory of the project and run this command:
```
./compile
```
#### For other Linux distros, install the dependencies using your package manager.

1
build.nr Normal file
View file

@ -0,0 +1 @@
1542

View file

@ -12,5 +12,4 @@ elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
cd bin
mingw32-make.exe
cd ..
cp ../omnia-framework/bin/libostd.dll ./bin
fi

55
create_win_release.sh Normal file
View file

@ -0,0 +1,55 @@
#!/bin/bash
rm -r ./win-release
./compile
cd bin
printf "${green}Compiling vBIOS...\n${clear}"
./dasm dss/bios.dss -o dragon/bios.bin --save-disassembly disassembly/bios.dds
printf "\n${green}Creating Virtual Disk...\n${clear}"
rm dragon/disk1.dr
./dtools new-vdisk dragon/disk1.dr 1048576
printf "\n${green}Compiling MBR Block...\n${clear}"
./dasm dss/mbr.dss -o dragon/mbr.bin --save-disassembly disassembly/mbr.dds
printf "\n${green}Loading MBR Block...\n${clear}"
./dtools load-program dragon/disk1.dr dragon/mbr.bin 0x00000000
printf "${green}Compiling Test Program...\n"
./dasm dss/test.dss -o test.bin --save-disassembly disassembly/test.dds
printf "${green}Creating Windows Release...\n"
cd ..
mkdir win-release
cp ./bin/dasm.exe ./win-release
cp ./bin/ddb.exe ./win-release
cp ./bin/dtools.exe ./win-release
cp ./bin/dvm.exe ./win-release
cp ./bin/font.bmp ./win-release
cp ./bin/test.bin ./win-release
cp -r ./bin/config ./win-release
cp -r ./bin/disassembly ./win-release
cp -r ./bin/dragon ./win-release
mkdir ./win-release/dss
cp ./bin/dss/bios.dss ./win-release/dss
cp ./bin/dss/mbr.dss ./win-release/dss
cp ./bin/dss/test.dss ./win-release/dss
cp C:/msys64/ucrt64/bin/libgcc_s_seh-1.dll ./win-release
cp C:/msys64/ucrt64/bin/libstdc++-6.dll ./win-release
cp C:/msys64/ucrt64/bin/libwinpthread-1.dll ./win-release
cp C:/msys64/ucrt64/bin/SDL2.dll ./win-release
cp C:/msys64/ucrt64/bin/libostd.dll ./win-release
cp ./run-test.bat ./win-release
typeset -i build_number=$(cat build.nr)
((build_number++))
truncate -s 0 build.nr
echo $build_number >> build.nr

1
run-test.bat Normal file
View file

@ -0,0 +1 @@
ddb config/testMachine.dvm --force-load test.bin 0x00 --verbose-load --track-step-diff --hide-vdisplay

Binary file not shown.

View file

@ -1 +0,0 @@
1536

Binary file not shown.

Binary file not shown.