os/boardsupport/emulator/emulatorbsp/hal/hal.cmake
changeset 0 bde4ae8d615e
child 1 260cb5ec6c19
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/boardsupport/emulator/emulatorbsp/hal/hal.cmake	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,118 @@
     1.4 +# Copyright (c) 2009 Stéphane Lenclud.
     1.5 +# All rights reserved.
     1.6 +# This component and the accompanying materials are made available
     1.7 +# under the terms of the License "Eclipse Public License v1.0"
     1.8 +# which accompanies this distribution, and is available
     1.9 +# at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +#
    1.11 +# Initial Contributors:
    1.12 +# Stéphane Lenclud.
    1.13 +#
    1.14 +
    1.15 +####################
    1.16 +push_target(hal)
    1.17 +####################
    1.18 +
    1.19 +#-------------------------------------------------------------------
    1.20 +#Add this *.cmake file to our source tree
    1.21 +#-------------------------------------------------------------------
    1.22 +add_cmake_source()
    1.23 +#Make sure all the output from all projects will go in one place
    1.24 +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
    1.25 +#Visual Studio IDE folders
    1.26 +source_group(Sources REGULAR_EXPRESSION ".+\\.cpp$")
    1.27 +source_group(Includes REGULAR_EXPRESSION ".+\\.h$") 	
    1.28 +source_group(Def REGULAR_EXPRESSION ".+\\.def$") 	
    1.29 +#-------------------------------------------------------------------
    1.30 +
    1.31 +
    1.32 +
    1.33 +#-------------------------------------------------------------------
    1.34 +#Add custom commands to generate config.cpp and values.cpp
    1.35 +#-------------------------------------------------------------------
    1.36 +#perl halcfg.pl hal_data.h values.hda values.cpp
    1.37 +add_custom_command (
    1.38 +	OUTPUT ${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp	
    1.39 +   	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
    1.40 +	WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}	
    1.41 +   	COMMENT "Generating HAL values..."
    1.42 +   	DEPENDS ./os/kernelhwsrv/halservices/hal/halcfg.pl ./os/kernelhwsrv/halservices/hal/inc/hal_data.h ./os/boardsupport/emulator/emulatorbsp/hal/values.hda
    1.43 +   	VERBATIM
    1.44 + 	)
    1.45 +
    1.46 +#perl halcfg.pl -x hal_data.h config.hcf config.cpp
    1.47 +add_custom_command (
    1.48 +	OUTPUT ${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp	
    1.49 +   	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
    1.50 +	WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}	
    1.51 +   	COMMENT "Generating HAL config..."
    1.52 +   	DEPENDS ./os/kernelhwsrv/halservices/hal/halcfg.pl ./os/kernelhwsrv/halservices/hal/inc/hal_data.h ./os/boardsupport/emulator/emulatorbsp/hal/config.hcf
    1.53 +   	VERBATIM
    1.54 + 	)	
    1.55 +	
    1.56 +#Tell cmake those files won't be available until build time
    1.57 +set_source_files_properties(${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp PROPERTIES GENERATED 1)
    1.58 +set_source_files_properties(${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp  PROPERTIES GENERATED 1)
    1.59 +#-------------------------------------------------------------------	
    1.60 +
    1.61 +
    1.62 +
    1.63 +#-------------------------------------------------------------------
    1.64 +#Define our source and target
    1.65 +#-------------------------------------------------------------------
    1.66 +
    1.67 +set (sourcepath ../../../../kernelhwsrv/halservices/hal/src/)
    1.68 +add_source(hal_main.cpp userhal.cpp)
    1.69 +
    1.70 +#Hoping we include the right entry point
    1.71 +set (sourcepath ../../../../kernelhwsrv/kernel/eka/euser/epoc/win32/)
    1.72 +#add_source(uc_dll.cpp) #uc_atx.cpp
    1.73 +
    1.74 +
    1.75 +
    1.76 +#TODO: add the generated CPPs 
    1.77 +
    1.78 +get_source(source)
    1.79 +add_library (hal SHARED ${source}
    1.80 +						${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp 
    1.81 +						${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp
    1.82 +						hal.cpp hal_uid.cpp)
    1.83 +#set_target_properties(hal PROPERTIES LINK_FLAGS "/ENTRY:_Win32DllMain") #Change the entry point						
    1.84 +#set_target_properties(hal PROPERTIES COMPILE_FLAGS "/Zl") #No default library
    1.85 +set_target_properties(hal PROPERTIES LINK_FLAGS "/INCLUDE:__E32Dll")
    1.86 +#set_target_properties(hal PROPERTIES LINK_FLAGS "/INCLUDE:_DllMain")
    1.87 +target_link_libraries(hal edll euser)
    1.88 +#-------------------------------------------------------------------
    1.89 +
    1.90 +#-------------------------------------------------------------------
    1.91 +#Fix up include directories
    1.92 +#-------------------------------------------------------------------
    1.93 +system_include(/epoc32/include)
    1.94 +system_include(/epoc32/include/platform)
    1.95 +user_include(../../../../kernelhwsrv/kernel/eka/include)
    1.96 +#-------------------------------------------------------------------
    1.97 +
    1.98 +#-------------------------------------------------------------------
    1.99 +#Fix up compiler defines
   1.100 +#-------------------------------------------------------------------
   1.101 +add_define(__DLL__)
   1.102 +#-------------------------------------------------------------------
   1.103 +
   1.104 +
   1.105 +#-------------------------------------------------------------------
   1.106 +#Export includes
   1.107 +#-------------------------------------------------------------------
   1.108 +
   1.109 +public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal_int.h /kernel)
   1.110 +public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal_data.h /)
   1.111 +public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal.h /)
   1.112 +
   1.113 +#-------------------------------------------------------------------
   1.114 +
   1.115 +
   1.116 +####################
   1.117 +pop_target(hal)
   1.118 +####################
   1.119 +
   1.120 +
   1.121 +