Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up lots of win32 crustiness #77

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu, windows, macos]
runs-on: "${{ matrix.os }}-latest"
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/[email protected]
with:
submodules: true

- uses: lukka/get-cmake@latest
- uses: lukka/run-vcpkg@v10

- name: Build
run: make
- name: Test
run: make check
uses: lukka/run-cmake@v10
with:
workflowPreset: "${{ matrix.os }}-ci"
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vcpkg"]
path = vcpkg
url = https://github.com/microsoft/vcpkg.git
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

72 changes: 0 additions & 72 deletions CIncludeDirectoryCollection.h

This file was deleted.

98 changes: 98 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
cmake_minimum_required(VERSION 3.7)
project(spasm-ng
HOMEPAGE_URL https://github.com/alberthdev/spasm-ng
)

set(
CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "vcpkg toolchain file"
)

add_compile_options(-Wall)
if(WIN32)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
# Disable warnings on spectre mitigation fence insertion points
add_compile_options(/wd5045)
endif()

add_executable(
spasm
main.cpp opcodes.cpp pass_one.cpp pass_two.cpp utils.cpp
export.cpp preop.cpp directive.cpp console.cpp expand_buf.cpp
hash.cpp list.cpp parser.cpp storage.cpp errors.cpp bitmap.cpp
modp_ascii.cpp opcodes_ez80.cpp md5.c
)
if(WIN32 OR MINGW OR MSYS)
target_sources(spasm PRIVATE spasm.exe.manifest)
endif()

set_property(TARGET spasm PROPERTY CXX_STANDARD 17)

set(ENABLE_APP_SIGNING ON CACHE BOOL "Enable support for signing applications")
if (ENABLE_APP_SIGNING)
find_package(PkgConfig REQUIRED)
pkg_check_modules(gmp REQUIRED IMPORTED_TARGET gmp)
target_link_libraries(spasm PkgConfig::gmp)
else()
add_compile_definitions(NO_APPSIGN)
endif()

set(ENABLE_DEBUG_PRINT OFF CACHE BOOL "Enable additional debug messages")
if (ENABLE_DEBUG_PRINT)
add_compile_definitions(DEBUG_PRINT)
endif()

add_compile_definitions(
USE_REUSABLES
USE_BUILTIN_FCREATE
)
if (WIN32)
add_compile_definitions(UNICODE _UNICODE)
endif()

# Version generation
find_package(Git)
if (Git_FOUND)
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --always --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE res
OUTPUT_VARIABLE GIT_TREE_DESC
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(GIT_TREE_DESC "unknown")
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h")
target_include_directories(spasm
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}"
)
# Trick from https://cmake.org/pipermail/cmake/2018-October/068389.html
# to force a reconfigure on git change so the version string is always up to date
set_property(GLOBAL APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS
"${CMAKE_SOURCE_DIR}/.git/index"
)

# Tests
include(CTest)
add_subdirectory(${PROJECT_SOURCE_DIR}/tests)

# Install target
include(GNUInstallDirs)
install(TARGETS spasm)
install(FILES README.md LICENSE
DESTINATION ${CMAKE_INSTALL_DOCDIR}/spasm
)
file(GLOB include_files "inc/*.inc")
install(FILES ${include_files}
DESTINATION ${CMAKE_INSTALL_DATADIR}/spasm/inc
)

# Distribution packaging
set(CPACK_PACKAGE_VERSION "${GIT_TREE_DESC}")
set(CPACK_PACKAGE_DESCRIPTION "SPASM-ng is a z80 assembler with extra features to support development for TI calculators.")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g, libssl1.0.0, libgmp10")
include(CPack)
74 changes: 74 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"version": 6,
"configurePresets": [
{
"name": "default",
"binaryDir": "${sourceDir}/build/default/"
},
{
"name": "vcpkg",
"binaryDir": "${sourceDir}/build/vcpkg/",
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
],
"buildPresets": [
{
"name": "default",
"configurePreset": "default"
},
{
"name": "vcpkg",
"configurePreset": "vcpkg"
}
],
"testPresets": [
{
"name": "default",
"configurePreset": "default",
"configuration": "Debug",
"output": {
"outputOnFailure": true
}
},
{
"name": "vcpkg",
"configurePreset": "vcpkg",
"inherits": "default"
}
],
"workflowPresets": [
{
"name": "ubuntu-ci",
"steps": [
{ "type": "configure",
"name": "default" },
{ "type": "build",
"name": "default" },
{ "type": "test",
"name": "default" }
]
},
{
"name": "windows-ci",
"steps": [
{ "type": "configure",
"name": "vcpkg" },
{ "type": "build",
"name": "vcpkg" },
{ "type": "test",
"name": "vcpkg" }
]
},
{
"name": "macos-ci",
"steps": [
{ "type": "configure",
"name": "default" },
{ "type": "build",
"name": "default" },
{ "type": "test",
"name": "default" }
]
}
]
}
Loading