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