Skip to content

Commit

Permalink
Support for exe files (#17)
Browse files Browse the repository at this point in the history
* Added ADFLib

* Initial testing of writing adf images

* working on repo

* Initial support for exe files
  • Loading branch information
emoon committed Feb 11, 2024
1 parent c13c8da commit d7358b4
Show file tree
Hide file tree
Showing 112 changed files with 20,605 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(external/zlib)
add_subdirectory(external/ADFlib)

if (APPLE OR LINUX)
find_package(SDL2 REQUIRED)
Expand Down Expand Up @@ -205,6 +206,7 @@ add_executable(quaesar
src/dummy.cpp
src/input.cpp
src/quaesar.cpp
src/adf.cpp
)

if (APPLE OR LINUX)
Expand Down Expand Up @@ -235,5 +237,5 @@ if (LINUX)
target_link_libraries(quaesar PRIVATE dl)
endif()

target_include_directories(quaesar PRIVATE "${CMAKE_SOURCE_DIR}/external/zlib")
target_link_libraries(quaesar PRIVATE ${SDL2_LIBRARIES} zlibstatic)
target_include_directories(quaesar PRIVATE "${CMAKE_SOURCE_DIR}/external/ADFlib/src")
target_link_libraries(quaesar PRIVATE ${SDL2_LIBRARIES} zlibstatic adf)
63 changes: 63 additions & 0 deletions external/ADFlib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Object files and libraries
*.o
*.a
*.lib

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Windows executables
*.exe

# generated by autogen.sh
.deps
Makefile.in
/aclocal.m4
/ar-lib
/autom4te.cache
/compile
/config.guess
/config.h.in
/config.sub
/configure
/depcomp
/install-sh
/ltmain.sh
/m4
/missing
/test-driver

# generated by configure
Makefile
/adflib.pc
/config.h
/config.log
/config.status
/libtool
/stamp-h1

# generated by automake builds
.dirstamp
.libs
*.la
*.lo

# generated by make distcheck
/adflib-*.*.*

# generated by util/cmake_* scripts
/build

# generated by cmake . (in-tree build)
CMakeFiles
CTestTestfile.cmake
cmake_install.cmake
/CMakeCache.txt
/Testing
/src/config.h

# temp / backup files
*~
41 changes: 41 additions & 0 deletions external/ADFlib/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

The main developper is
Laurent Clévy


Current maintainer (Feb 2023-):
Tomasz Wolak


Contributors are:

Bjarne Viksoe
- C++ wrapper (adfwrapper.h)
- lot of bug fixes

Gary Harris
- W32 support
- WinNT native driver
- bug fixes

Dan Sutherland
- W32 support
- WinNT native driver
- bug fixes

Stuart Caie
- utilities: unadf
- autotools conf.
- improvements and bug fixes

Tomasz Wolak (github.com/t-w)
- file write support (and improvements in read support)
- hard- and softlinks support
- linux native device
- utilities: adf_floppy_create/format, adf_show_metadata
- improvements and bug fixes
- unit tests (ie. for file read/write support)
- CMake conf. with support for Linux, Windows (Visual Studio and CygWin) and MacOs


(See git log for detailed contributions).
128 changes: 128 additions & 0 deletions external/ADFlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@

cmake_minimum_required ( VERSION 3.11 )

# version details - use utils/bump-version to update it
set ( ADFLIB_VERSION 0.8.0 )
set ( ADFLIB_DATE 2023-06-26 )

project ( adflib
VERSION ${ADFLIB_VERSION}
DESCRIPTION "A free, portable and open implementation of the Amiga filesystem"
HOMEPAGE_URL "https://gitlab.com/lclevy/ADFlib"
LANGUAGES C
)

message ( STATUS "Building version: ${PROJECT_VERSION}, ${ADFLIB_DATE}" )

set ( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )

# setting NDEBUG
# ( https://lists.debian.org/debian-mentors/2018/04/msg00244.html )
#set ( CMAKE_BUILD_TYPE Release )

message ( STATUS "Compiler ID: ${CMAKE_C_COMPILER_ID}" )

add_compile_options (
-Wall
$<$<CONFIG:RELEASE>:-O3>
# -DADFLIB_VERSION="${ADFLIB_VERSION}"
# -DADFLIB_DATE="${ADFLIB_DATE}"
)

if ( NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" )
message ( STATUS "Setting additional compiler options/checks (mainly for gcc and clang)" )
add_compile_options (
-Wextra
-Wconversion
-Werror-implicit-function-declaration
-Werror=format-security
-Wno-unused-parameter
-Wno-enum-int-mismatch
-Wno-sign-conversion
# -pedantic-errors
# $<$<CONFIG:DEBUG>:-g3>
# $<$<CONFIG:DEBUG>:-Og>
$<$<CONFIG:DEBUG>:-ggdb>
# $<$<CONFIG:DEBUG>:-pg>
)
endif()


option ( ADFLIB_ENABLE_ADDRESS_SANITIZER "Enable address sanitizer" OFF )

if ( ADFLIB_ENABLE_ADDRESS_SANITIZER )

if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND NOT MINGW AND NOT CYGWIN )
message ( STATUS "Enabling GNU address sanitizer" )
add_compile_options ( -fsanitize=address )
add_link_options (
-fsanitize=address
# for library need either this or LD_PRELOAD (-lasan does not work )
-static-libasan
)
endif()

if ( MINGW OR CYGWIN )
message ( STATUS "No address sanitizer for CygWin or MinGW (not available)")
endif()

if ( "${CMAKE_C_COMPILER_ID}" MATCHES ".*Clang" )
message ( STATUS "Enabling Clang address sanitizer" )
# https://releases.llvm.org/10.0.0/tools/clang/docs/AddressSanitizer.html
add_compile_options ( -fsanitize=address )
add_link_options ( -fsanitize=address )
endif()

if ( "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" )
# https://learn.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170
message ( STATUS "Enabling MSVC address sanitizer" )
add_compile_options ( /fsanitize=address /Zi )
add_link_options ( /fsanitize=address /Zi)
endif()

else()
message ( STATUS "Address sanitizer disabled - not configuring" )
endif()


option ( ADFLIB_BUILD_DLL "Build Windows DLL" OFF )
if ( ADFLIB_BUILD_DLL )
#if(BUILD_SHARED_LIBS)
message ( STATUS "Building a Windows DLL" )
add_definitions ( -DBUILD_DLL )
endif ( ADFLIB_BUILD_DLL )

include ( CheckFunctionExists )
check_function_exists ( backtrace HAVE_BACKTRACE )
check_function_exists ( backtrace_symbols HAVE_BACKTRACE_SYMBOLS )
#include(CheckCXXSymbolExists)
#check_cxx_symbol_exists(backtrace features HAVE_BACKTRACE)
#check_cxx_symbol_exists(backtrace_symbols features HAVE_BACKTRACE_SYMBOLS)
#message ( STATUS "HAVE_BACKTRACE: ${HAVE_BACKTRACE}" )
#message ( STATUS "HAVE_BACKTRACE_SYMBOLS: ${HAVE_BACKTRACE_SYMBOLS}" )
if ( ${HAVE_BACKTRACE} )
message ( STATUS "backtrace_symbols() available")
add_link_options ( $<$<CONFIG:DEBUG>:-rdynamic> ) # for backtrace_symbols()
endif()

option ( ADFLIB_ENABLE_NATIVE_DEV "Enable real native devices" OFF )

add_subdirectory ( src )

option ( ADFLIB_ENABLE_TESTS "Enable tests" OFF )
option ( ADFLIB_ENABLE_UNIT_TESTS "Enable units tests (require Check framework >= 0.11" OFF )

if ( ADFLIB_ENABLE_TESTS )
message ( STATUS "Testing enabled" )
enable_testing()
add_subdirectory ( regtests/Test )
if ( ADFLIB_ENABLE_UNIT_TESTS AND
NOT ( UNIX AND MINGW ) ) # cannot build tests (ie. Check) cross-compiling
message ( STATUS "Unit tests (in tests/) enabled." )
add_subdirectory ( tests )
else()
message ( STATUS "Unit tests (in tests/) disabled." )
endif()
else()
message ( STATUS "Testing disabled" )
endif()
50 changes: 50 additions & 0 deletions external/ADFlib/CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"configurations": [
{
"name": "x64-Debug-Static",
"generator": "Ninja",
"configurationType": "DEBUG",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Debug-Shared",
"generator": "Ninja",
"configurationType": "DEBUG",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DBUILD_SHARED_LIBS:BOOL=ON -DADFLIB_BUILD_DLL=ON",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ]
},
{
"name": "x64-Release-Static",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
},
{
"name": "x64-Release-Shared",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "-DBUILD_SHARED_LIBS:BOOL=ON -DADFLIB_BUILD_DLL=ON",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
}
]
}
Loading

0 comments on commit d7358b4

Please sign in to comment.