1 |
# additonal cmake macros and functions |
2 |
|
3 |
#------------------------------------------------------------------------------- |
4 |
# createResourceTarget |
5 |
#------------------------------------------------------------------------------- |
6 |
# This function is used to generate header files, used as resources. |
7 |
# A list of Resources taken as input parameter. |
8 |
#------------------------------------------------------------------------------- |
9 |
function(createResourceTarget) |
10 |
# working directory |
11 |
set(workdir ${PROJECT_SOURCE_DIR}/pcsx2/gui/Resources) |
12 |
|
13 |
# create dummy target depending on bin2cpp |
14 |
add_custom_target(Resources |
15 |
DEPENDS bin2cpp) |
16 |
|
17 |
# create a custom command for every resource file |
18 |
foreach(entry IN LISTS ARGV) |
19 |
# create custom command and assign to target Resources |
20 |
add_custom_command(TARGET Resources POST_BUILD |
21 |
COMMAND bin2cpp ${entry} |
22 |
WORKING_DIRECTORY ${workdir}) |
23 |
endforeach(entry) |
24 |
endfunction(createResourceTarget) |
25 |
#------------------------------------------------------------------------------- |
26 |
|
27 |
|
28 |
#------------------------------------------------------------------------------- |
29 |
# detectOperatingSystem |
30 |
#------------------------------------------------------------------------------- |
31 |
# This function detects on which OS cmake is run and set a flag to control the |
32 |
# build process. Supported OS: Linux, MacOSX, Windows |
33 |
#------------------------------------------------------------------------------- |
34 |
function(detectOperatingSystem) |
35 |
# nothing detected yet |
36 |
set(Linux FALSE PARENT_SCOPE) |
37 |
set(MacOSX FALSE PARENT_SCOPE) |
38 |
set(Windows FALSE PARENT_SCOPE) |
39 |
|
40 |
# check if we are on Linux |
41 |
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
42 |
set(Linux TRUE PARENT_SCOPE) |
43 |
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") |
44 |
|
45 |
# check if we are on MacOSX |
46 |
if(APPLE) |
47 |
set(MacOSX TRUE PARENT_SCOPE) |
48 |
endif(APPLE) |
49 |
|
50 |
# check if we are on Windows |
51 |
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
52 |
set(Windows TRUE PARENT_SCOPE) |
53 |
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
54 |
endfunction(detectOperatingSystem) |
55 |
#------------------------------------------------------------------------------- |
56 |
|