-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
82 lines (63 loc) · 3 KB
/
CMakeLists.txt
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
cmake_minimum_required(VERSION 3.0)
project(os9fetch LANGUAGES C CXX)
# compile flags
add_compile_options(${COMPILE_FLAGS})
add_compile_definitions(
_GNU_SOURCE
CONFIG_BIGNUM
CONFIG_VERSION=${QUICKJS_VERSION}
CONFIG_AGENT=0
)
set(QJSC_CONFIG -DCONFIG_PREFIX="/usr/local" -DCONFIG_LTO)
set(QJSC_EXE "${EXECUTABLE_OUTPUT_PATH}/qjsc")
set(QJS_CONFIG ${QJSC_CONFIG} -DCONFIG_CC="clang")
###############################################################################
## file globbing ##############################################################
###############################################################################
# these instructions search the directory tree when CMake is
# invoked and put all files that match the pattern in the variables
# `sources` and `data`
file(GLOB_RECURSE sources
src/**/**/**/*.c src/**/**/**/*.h src/**/**/**/*.cpp src/**/**/**/*.hpp
src/**/**/*.c src/**/**/*.h src/**/**/*.cpp src/**/**/*.hpp
src/**/*.c src/**/*.h src/**/*.cpp src/**/*.hpp
src/*.c src/*.h src/*.cpp src/*.hpp
)
file(GLOB_RECURSE data resources/*)
# you can use set(sources src/main.cpp) etc if you don't want to
# use globbing to find files automatically
###############################################################################
## target definitions #########################################################
###############################################################################
# add the data to the target, so it becomes visible in some IDE
if(CMAKE_SYSTEM_NAME MATCHES Retro)
add_application(os9fetch ${sources} ${data})
else()
add_executable(os9fetch ${sources} ${data})
endif()
target_link_directories(os9fetch PUBLIC ${CMAKE_SOURCE_DIR}/lib )
set_property(TARGET os9fetch PROPERTY CXX_STANDARD 20)
# just for os9fetch add some compiler flags
target_compile_options(os9fetch PUBLIC -std=c++20 -Wall -Wfloat-conversion)
set_target_properties(os9fetch PROPERTIES COMPILE_OPTIONS -ffunction-sections)
#target_link_libraries(os9fetch "${RETRO68_ROOT}/InterfaceAndLibraries/Libraries/StubLibraries/ThreadsLib")
#target_link_libraries( os9fetch ThreadsLib)
if(PLATFORM MATCHES retro68)
add_compile_definitions(FOR_68K)
endif()
if(PLATFORM MATCHES retroppc)
add_compile_definitions(FOR_PPC)
set_target_properties(os9fetch PROPERTIES COMPILE_FLAGS "-ffunction-sections -mcpu=601 -O3 -Wall -Wextra -Wno-unused-parameter")
set_target_properties(os9fetch PROPERTIES LINK_FLAGS "-Wl,-gc-sections")
target_link_libraries( os9fetch PowerMgrLib)
target_link_libraries( os9fetch NameRegistryLib)
target_link_libraries( os9fetch OpenGL)
endif()
include_directories( "${RETRO68_TOOLCHAIN}universal/CIncludes/")
message(STATUS "Making for ${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
set_target_properties(os9fetch PROPERTIES LINK_FLAGS "-Wl,--mac-strip-macsbug")
endif()
# this copies all resource files in the build directory
# we need this, because we want to work with paths relative to the executable
file(COPY ${data} DESTINATION resources)