-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcc65-toolchain.cmake
More file actions
41 lines (33 loc) · 1.66 KB
/
cc65-toolchain.cmake
File metadata and controls
41 lines (33 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# CMake toolchain file for cc65
# https://github.com/jviskari/cc65_cmake by Joonas Viskari
# This is largely a result of experimentation, so some things may be done
# suboptimally/wrong. Some compilation options/CMake features may not work.
# Some generators will also not work (like MSVS). Ninja has been tested to work.
# What is supported: C, assembly, static libraries
set( CMAKE_SYSTEM_NAME Generic )
macro( __compilerCc65 lang )
set( CMAKE_${lang}_COMPILER cl65 CACHE PATH "${lang} compiler" )
set( CMAKE_${lang}_COMPILER_ID cc65 )
# We cannot run tests for the cc65 compiler, because of cross-compilation,
# so force the compiler tests to passed.
set( CMAKE_${lang}_COMPILER_ID_RUN TRUE )
# Don't know if these are necessary.
set( CMAKE_${lang}_COMPILER_ID_WORKS TRUE )
set( CMAKE_${lang}_COMPILER_ID_FORCED TRUE )
set( CMAKE_DEPFILE_FLAGS_${lang} "--create-dep <DEP_FILE>")
set( CMAKE_${lang}_VERBOSE_FLAG "-v" )
set( CMAKE_${lang}_FLAGS_DEBUG_INIT "-g -D DEBUG --asm-define DEBUG --target none" )
endmacro()
__compilerCc65( C )
__compilerCc65( ASM )
set( CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;asm )
# Not sure why CMake by default looks for the compilers, but not the archiver.
# Force it to try to find the archiver.
find_program( CMAKE_AR ar65 )
# \note Need to delete the old file first because ar65 can only add files
# into an archive (or remove named files, but we don't know the names).
set( CMAKE_C_CREATE_STATIC_LIBRARY
"<CMAKE_COMMAND> -E remove <TARGET> "
"<CMAKE_AR> a <TARGET> <LINK_FLAGS> <OBJECTS>"
)
set( CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY} )