sl@0: # Copyright (c) 2009 Stéphane Lenclud. sl@0: # All rights reserved. sl@0: # This component and the accompanying materials are made available sl@0: # under the terms of the License "Eclipse Public License v1.0" sl@0: # which accompanies this distribution, and is available sl@0: # at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: # sl@0: # Initial Contributors: sl@0: # Stéphane Lenclud. sl@0: # sl@0: sl@0: #################### sl@0: push_target(hal) sl@0: #################### sl@0: sl@0: #------------------------------------------------------------------- sl@0: #Add this *.cmake file to our source tree sl@0: #------------------------------------------------------------------- sl@0: add_cmake_source() sl@0: #Make sure all the output from all projects will go in one place sl@0: set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin) sl@0: #Visual Studio IDE folders sl@0: source_group(Sources REGULAR_EXPRESSION ".+\\.cpp$") sl@0: source_group(Includes REGULAR_EXPRESSION ".+\\.h$") sl@0: source_group(Def REGULAR_EXPRESSION ".+\\.def$") sl@0: #------------------------------------------------------------------- sl@0: sl@0: sl@0: sl@0: #------------------------------------------------------------------- sl@0: #Add custom commands to generate config.cpp and values.cpp sl@0: #------------------------------------------------------------------- sl@0: #perl halcfg.pl hal_data.h values.hda values.cpp sl@0: add_custom_command ( sl@0: OUTPUT ${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp sl@0: 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: WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} sl@0: COMMENT "Generating HAL values..." sl@0: DEPENDS ./os/kernelhwsrv/halservices/hal/halcfg.pl ./os/kernelhwsrv/halservices/hal/inc/hal_data.h ./os/boardsupport/emulator/emulatorbsp/hal/values.hda sl@0: VERBATIM sl@0: ) sl@0: sl@0: #perl halcfg.pl -x hal_data.h config.hcf config.cpp sl@0: add_custom_command ( sl@0: OUTPUT ${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp sl@0: 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: WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} sl@0: COMMENT "Generating HAL config..." sl@0: DEPENDS ./os/kernelhwsrv/halservices/hal/halcfg.pl ./os/kernelhwsrv/halservices/hal/inc/hal_data.h ./os/boardsupport/emulator/emulatorbsp/hal/config.hcf sl@0: VERBATIM sl@0: ) sl@0: sl@0: #Tell cmake those files won't be available until build time sl@0: set_source_files_properties(${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp PROPERTIES GENERATED 1) sl@0: set_source_files_properties(${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp PROPERTIES GENERATED 1) sl@0: #------------------------------------------------------------------- sl@0: sl@0: sl@0: sl@0: #------------------------------------------------------------------- sl@0: #Define our source and target sl@0: #------------------------------------------------------------------- sl@0: sl@0: set (sourcepath ../../../../kernelhwsrv/halservices/hal/src/) sl@0: add_source(hal_main.cpp userhal.cpp) sl@0: sl@0: #Hoping we include the right entry point sl@0: set (sourcepath ../../../../kernelhwsrv/kernel/eka/euser/epoc/win32/) sl@0: #add_source(uc_dll.cpp) #uc_atx.cpp sl@0: sl@0: sl@0: sl@0: #TODO: add the generated CPPs sl@0: sl@0: get_source(source) sl@0: add_library (hal SHARED ${source} sl@0: ${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/config.cpp sl@0: ${PROJECT_SOURCE_DIR}/os/boardsupport/emulator/emulatorbsp/hal/values.cpp sl@0: hal.cpp hal_uid.cpp) sl@0: #set_target_properties(hal PROPERTIES LINK_FLAGS "/ENTRY:_Win32DllMain") #Change the entry point sl@0: #set_target_properties(hal PROPERTIES COMPILE_FLAGS "/Zl") #No default library sl@0: set_target_properties(hal PROPERTIES LINK_FLAGS "/INCLUDE:__E32Dll") sl@0: #set_target_properties(hal PROPERTIES LINK_FLAGS "/INCLUDE:_DllMain") sl@0: target_link_libraries(hal edll euser) sl@0: #------------------------------------------------------------------- sl@0: sl@0: #------------------------------------------------------------------- sl@0: #Fix up include directories sl@0: #------------------------------------------------------------------- sl@0: system_include(/epoc32/include) sl@0: system_include(/epoc32/include/platform) sl@0: user_include(../../../../kernelhwsrv/kernel/eka/include) sl@0: #------------------------------------------------------------------- sl@0: sl@0: #------------------------------------------------------------------- sl@0: #Fix up compiler defines sl@0: #------------------------------------------------------------------- sl@0: add_define(__DLL__) sl@0: #------------------------------------------------------------------- sl@0: sl@0: sl@0: #------------------------------------------------------------------- sl@0: #Export includes sl@0: #------------------------------------------------------------------- sl@0: sl@0: public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal_int.h /kernel) sl@0: public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal_data.h /) sl@0: public_export(${PROJECT_SOURCE_DIR}/os/kernelhwsrv/halservices/hal/inc/hal.h /) sl@0: sl@0: #------------------------------------------------------------------- sl@0: sl@0: sl@0: #################### sl@0: pop_target(hal) sl@0: #################### sl@0: sl@0: sl@0: