sl@0
|
1 |
# Copyright (c) 2009 Stéphane Lenclud.
|
sl@0
|
2 |
# All rights reserved.
|
sl@0
|
3 |
# This component and the accompanying materials are made available
|
sl@0
|
4 |
# under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
# which accompanies this distribution, and is available
|
sl@0
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
#
|
sl@0
|
8 |
# Initial Contributors:
|
sl@0
|
9 |
# Stéphane Lenclud.
|
sl@0
|
10 |
#
|
sl@0
|
11 |
|
sl@0
|
12 |
####################
|
sl@0
|
13 |
push_target(hal)
|
sl@0
|
14 |
####################
|
sl@0
|
15 |
|
sl@0
|
16 |
#-------------------------------------------------------------------
|
sl@0
|
17 |
#Add this *.cmake file to our source tree
|
sl@0
|
18 |
#-------------------------------------------------------------------
|
sl@0
|
19 |
add_cmake_source()
|
sl@0
|
20 |
#Make sure all the output from all projects will go in one place
|
sl@1
|
21 |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
sl@0
|
22 |
#Visual Studio IDE folders
|
sl@0
|
23 |
source_group(Sources REGULAR_EXPRESSION ".+\\.cpp$")
|
sl@0
|
24 |
source_group(Includes REGULAR_EXPRESSION ".+\\.h$")
|
sl@0
|
25 |
source_group(Def REGULAR_EXPRESSION ".+\\.def$")
|
sl@0
|
26 |
#-------------------------------------------------------------------
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
|
sl@0
|
30 |
#-------------------------------------------------------------------
|
sl@0
|
31 |
#Add custom commands to generate config.cpp and values.cpp
|
sl@0
|
32 |
#-------------------------------------------------------------------
|
sl@0
|
33 |
#perl halcfg.pl hal_data.h values.hda values.cpp
|
sl@0
|
34 |
add_custom_command (
|
sl@0
|
35 |
OUTPUT ${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp
|
sl@0
|
36 |
COMMAND perl ./os/kernelhwsrv/halservices/hal/halcfg.pl ./os/kernelhwsrv/halservices/hal/inc/hal_data.h ./os/boardsupport/emulator/emulatorbsp/hal/values.hda ./os/boardsupport/emulator/emulatorbsp/hal/values.cpp
|
sl@0
|
37 |
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
sl@0
|
38 |
COMMENT "Generating HAL values..."
|
sl@0
|
39 |
DEPENDS ./os/kernelhwsrv/halservices/hal/halcfg.pl ./os/kernelhwsrv/halservices/hal/inc/hal_data.h ./os/boardsupport/emulator/emulatorbsp/hal/values.hda
|
sl@0
|
40 |
VERBATIM
|
sl@0
|
41 |
)
|
sl@0
|
42 |
|
sl@0
|
43 |
#perl halcfg.pl -x hal_data.h config.hcf config.cpp
|
sl@0
|
44 |
add_custom_command (
|
sl@0
|
45 |
OUTPUT ${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp
|
sl@0
|
46 |
COMMAND perl ./os/kernelhwsrv/halservices/hal/halcfg.pl -x ./os/kernelhwsrv/halservices/hal/inc/hal_data.h ./os/boardsupport/emulator/emulatorbsp/hal/config.hcf ./os/boardsupport/emulator/emulatorbsp/hal/config.cpp
|
sl@0
|
47 |
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
sl@0
|
48 |
COMMENT "Generating HAL config..."
|
sl@0
|
49 |
DEPENDS ./os/kernelhwsrv/halservices/hal/halcfg.pl ./os/kernelhwsrv/halservices/hal/inc/hal_data.h ./os/boardsupport/emulator/emulatorbsp/hal/config.hcf
|
sl@0
|
50 |
VERBATIM
|
sl@0
|
51 |
)
|
sl@0
|
52 |
|
sl@0
|
53 |
#Tell cmake those files won't be available until build time
|
sl@0
|
54 |
set_source_files_properties(${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp PROPERTIES GENERATED 1)
|
sl@0
|
55 |
set_source_files_properties(${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp PROPERTIES GENERATED 1)
|
sl@0
|
56 |
#-------------------------------------------------------------------
|
sl@0
|
57 |
|
sl@0
|
58 |
|
sl@0
|
59 |
|
sl@0
|
60 |
#-------------------------------------------------------------------
|
sl@0
|
61 |
#Define our source and target
|
sl@0
|
62 |
#-------------------------------------------------------------------
|
sl@0
|
63 |
|
sl@0
|
64 |
set (sourcepath ../../../../kernelhwsrv/halservices/hal/src/)
|
sl@0
|
65 |
add_source(hal_main.cpp userhal.cpp)
|
sl@0
|
66 |
|
sl@0
|
67 |
#Hoping we include the right entry point
|
sl@0
|
68 |
set (sourcepath ../../../../kernelhwsrv/kernel/eka/euser/epoc/win32/)
|
sl@0
|
69 |
#add_source(uc_dll.cpp) #uc_atx.cpp
|
sl@0
|
70 |
|
sl@0
|
71 |
|
sl@0
|
72 |
|
sl@0
|
73 |
#TODO: add the generated CPPs
|
sl@0
|
74 |
|
sl@0
|
75 |
get_source(source)
|
sl@0
|
76 |
add_library (hal SHARED ${source}
|
sl@0
|
77 |
${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp
|
sl@0
|
78 |
${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp
|
sl@0
|
79 |
hal.cpp hal_uid.cpp)
|
sl@0
|
80 |
#set_target_properties(hal PROPERTIES LINK_FLAGS "/ENTRY:_Win32DllMain") #Change the entry point
|
sl@0
|
81 |
#set_target_properties(hal PROPERTIES COMPILE_FLAGS "/Zl") #No default library
|
sl@0
|
82 |
set_target_properties(hal PROPERTIES LINK_FLAGS "/INCLUDE:__E32Dll")
|
sl@0
|
83 |
#set_target_properties(hal PROPERTIES LINK_FLAGS "/INCLUDE:_DllMain")
|
sl@0
|
84 |
target_link_libraries(hal edll euser)
|
sl@0
|
85 |
#-------------------------------------------------------------------
|
sl@0
|
86 |
|
sl@0
|
87 |
#-------------------------------------------------------------------
|
sl@0
|
88 |
#Fix up include directories
|
sl@0
|
89 |
#-------------------------------------------------------------------
|
sl@0
|
90 |
system_include(/epoc32/include)
|
sl@0
|
91 |
system_include(/epoc32/include/platform)
|
sl@0
|
92 |
user_include(../../../../kernelhwsrv/kernel/eka/include)
|
sl@0
|
93 |
#-------------------------------------------------------------------
|
sl@0
|
94 |
|
sl@0
|
95 |
#-------------------------------------------------------------------
|
sl@0
|
96 |
#Fix up compiler defines
|
sl@0
|
97 |
#-------------------------------------------------------------------
|
sl@0
|
98 |
add_define(__DLL__)
|
sl@0
|
99 |
#-------------------------------------------------------------------
|
sl@0
|
100 |
|
sl@0
|
101 |
|
sl@0
|
102 |
#-------------------------------------------------------------------
|
sl@0
|
103 |
#Export includes
|
sl@0
|
104 |
#-------------------------------------------------------------------
|
sl@0
|
105 |
|
sl@0
|
106 |
public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal_int.h /kernel)
|
sl@0
|
107 |
public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal_data.h /)
|
sl@0
|
108 |
public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal.h /)
|
sl@0
|
109 |
|
sl@0
|
110 |
#-------------------------------------------------------------------
|
sl@0
|
111 |
|
sl@0
|
112 |
|
sl@0
|
113 |
####################
|
sl@0
|
114 |
pop_target(hal)
|
sl@0
|
115 |
####################
|
sl@0
|
116 |
|
sl@0
|
117 |
|
sl@0
|
118 |
|