# # $Id$ # $HeadURL$ # $Author: # FIND_PACKAGE(PythonInterp 2.7 REQUIRED) SET(DB_SCRIPTS create_excon_db.py test_scenario_definitions.py test_scenario_participant_positions.py test_scenario_participant_state.py l400p2_test_scenario_participant_positions.py guez_generate_js.py ) SET(SQL_FILES create_views.sql check_connections.sql init_db_procedures.sql init_db_users_grants.sql init_db_schemas.sql insert_exm_values.sql insert_aes_values_types.sql insert_asm_values.sql insert_asm_values_test.sql insert_avm_values.sql insert_gna_values.sql insert_ism_values_test.sql insert_opm_values_test.sql insert_opm_values_initial.sql insert_oss_values_ex_35.sql insert_oss_values_ex_42.sql insert_pdm_values.sql insert_pdm_values_mil.sql insert_ppm_values_types.sql insert_ppm_values_ex_35.sql insert_ppm_values_ex_42.sql insert_flm_values.sql insert_som_values.sql insert_flm_values_test.sql test_exm_exercise.sql update_flm_used_by.sql guez_asm_values.sql guez_asm_values_workstations.sql guez_avm_values.sql guez_avm_values_test.sql guez_avm_values_frequencysets.sql guez_update_flm_used_by.sql guez_flm_values_file_content_san.sql guez_ism_values_asset.sql guez_ism_values.sql guez_opm_values.sql guez_pdm_values.sql guez_pdm_values_translation.sql guez_ppm_values_types.sql guez_ppm_values_templates.sql guez_whg_values.sql guez_ppm_values_ex_42.sql guez_ppm_values_ex_35.sql guez_rep_values_ex_42.sql guez_aes_values_types.sql guez_aes_values_ex_42.sql guez_aes_values_ex_35.sql ahtc_asm_values.sql ahtc_avm_values.sql ahtc_avm_values_test.sql ahtc_opm_values.sql ahtc_ppm_values_types.sql ahtc_ppm_values_templates.sql ahtc_pdm_values.sql ahtc_ppm_values_ex_35.sql ahtc_ppm_values_ex_42.sql ahtc_ism_values.sql l400p2_asm_values.sql l400p2_avm_values.sql l400p2_opm_values.sql l400p2_ppm_values_types.sql l400p2_ppm_values_templates.sql l400p2_pdm_values.sql l400p2_ppm_values_ex_35.sql l400p2_ppm_values_ex_42.sql qatar_asm_values.sql qatar_avm_values.sql qatar_ism_values_test.sql qatar_opm_values_initial.sql qatar_opm_values.sql qatar_opm_values_test.sql qatar_pdm_values.sql qatar_ppm_values_ex_35.sql qatar_ppm_values_ex_42.sql qatar_ppm_values_types.sql demo_asm_values.sql demo_opm_values.sql demo_pdm_values.sql demo_pdm_values_translation.sql demo_ppm_values_types.sql demo_ppm_values_templates.sql demo_ppm_values_ex_35.sql demo_ppm_values_ex_42.sql commaster_asm_values.sql commaster_pdm_values.sql commaster_ppm_values_types.sql commaster_ppm_values_ex_42.sql commaster_ppm_values_ex_35.sql commaster_ppm_values_templates.sql commaster_pdm_values_translation.sql commaster_flm_symbols.sql ) SET(out_dir "bin/test/") SET(GUEZ_DB_UPDATE_FILES guez_db_update.py guez_db_create_charge_types_foreign_keys.sql guez_db_update_charge_types_before.sql guez_db_update_charge_types_after.sql guez_db_update.sql guez_db_update_charge_types.csv guez_db_ism_save_barcodes.sql ) IF(GUEZ_MODE) NGL_INSTALL(AAR FILES ${SQL_FILES} DESTINATION ${out_dir}) ENDIF() IF(BUILD_TESTING) CONFIGURE_FILE(update_images_opm.sql.in ${CMAKE_BINARY_DIR}/${out_dir}/update_images_opm.sql) CONFIGURE_FILE(guez_flm_symbols.sql ${CMAKE_BINARY_DIR}/${out_dir}/) CONFIGURE_FILE(ahtc_flm_symbols.sql ${CMAKE_BINARY_DIR}/${out_dir}/) CONFIGURE_FILE(l400p2_flm_symbols.sql ${CMAKE_BINARY_DIR}/${out_dir}/) CONFIGURE_FILE(qatar_flm_symbols.sql ${CMAKE_BINARY_DIR}/${out_dir}/) CONFIGURE_FILE(demo_flm_symbols.sql ${CMAKE_BINARY_DIR}/${out_dir}/) CONFIGURE_FILE(commaster_flm_symbols.sql ${CMAKE_BINARY_DIR}/${out_dir}/) NGL_INSTALL(AAR SV PROGRAMS ${DB_SCRIPTS} DESTINATION ${out_dir}) NGL_INSTALL(AAR SV FILES ${SQL_FILES} DESTINATION ${out_dir}) IF(GUEZ_MODE) NGL_INSTALL(AAR SV PROGRAMS ${GUEZ_DB_UPDATE_FILES} DESTINATION ${out_dir}) ENDIF() ENDIF() MACRO(TDS_COPY_FILES target out_dir file_list) #MESSAGE(STATUS "file_list = ${${file_list}}") SET(out_file_list "") FOREACH(in_file ${${file_list}}) SET(out_file ${out_dir}/${in_file}) LIST(APPEND out_file_list ${out_file}) #MESSAGE(STATUS "COPY file ${in_file} TO ${out_file}") ADD_CUSTOM_COMMAND(OUTPUT ${out_file} COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${in_file} ${out_file} DEPENDS ${in_file} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) ENDFOREACH() #MESSAGE(STATUS "out_file_list = ${out_file_list}") ADD_CUSTOM_TARGET(copy_${target} ALL DEPENDS ${${file_list}} ${out_file_list} ) ENDMACRO(TDS_COPY_FILES) MACRO(DB_CREATION target config_file) SET(ARGS_LIST -c ${CMAKE_BINARY_DIR}/share/Lts/sql) SET(ARGS_LIST ${ARGS_LIST} -s ${config_file}) #default project = guez IF( ${target} STREQUAL "db" ) SET(ARGS_LIST ${ARGS_LIST} -p guez) ENDIF() IF( ${target} STREQUAL "test-db" ) SET(ARGS_LIST ${ARGS_LIST} -p guez --exercise-data) ENDIF() IF( ${target} STREQUAL "ahtc-db" ) SET(ARGS_LIST ${ARGS_LIST} -p ahtc) ENDIF() IF( ${target} STREQUAL "ahtc-test-db" ) SET(ARGS_LIST ${ARGS_LIST} -p ahtc --exercise-data) ENDIF() IF( ${target} STREQUAL "l400p2-db" ) SET(ARGS_LIST ${ARGS_LIST} -p l400p2) ENDIF() IF( ${target} STREQUAL "l400p2-test-db" ) SET(ARGS_LIST ${ARGS_LIST} -p l400p2 --exercise-data) ENDIF() IF( ${target} STREQUAL "qatar-db" ) SET(ARGS_LIST ${ARGS_LIST} -p qatar) ENDIF() IF( ${target} STREQUAL "qatar-test-db" ) SET(ARGS_LIST ${ARGS_LIST} -p qatar --exercise-data) ENDIF() IF( ${target} STREQUAL "demo-db" ) SET(ARGS_LIST ${ARGS_LIST} -p demo) ENDIF() IF( ${target} STREQUAL "demo-test-db" ) SET(ARGS_LIST ${ARGS_LIST} -p demo --exercise-data) ENDIF() IF( ${target} STREQUAL "commaster-db" ) SET(ARGS_LIST ${ARGS_LIST} -p commaster) ENDIF() IF( ${target} STREQUAL "commaster-test-db" ) SET(ARGS_LIST ${ARGS_LIST} -p commaster --exercise-data) ENDIF() # make => Create target automatically # i.e. 'make db' ADD_CUSTOM_COMMAND(OUTPUT ${target}_created COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_BINARY_DIR}/${out_dir}/create_excon_db.py ${ARGS_LIST} DEPENDS copy_sql-admin WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${out_dir} ) ENDMACRO() SET(_conf_file "${CMAKE_BINARY_DIR}/lts-cc.conf") IF(NOT EXISTS ${_conf_file}) SET(_conf_file "$ENV{HOME}/lts-cc.conf") ENDIF() IF(NOT EXISTS ${_conf_file}) SET(_conf_file "/etc/lts-cc.conf") ENDIF() IF(EXISTS ${_conf_file}) MESSAGE(STATUS "Using LTS config file ${_conf_file}") DB_CREATION(db "${_conf_file}" ) DB_CREATION(test-db "${_conf_file}" ) DB_CREATION(ahtc-db "${_conf_file}" ) DB_CREATION(ahtc-test-db "${_conf_file}" ) DB_CREATION(l400p2-db "${_conf_file}" ) DB_CREATION(l400p2-test-db "${_conf_file}" ) DB_CREATION(qatar-db "${_conf_file}" ) DB_CREATION(qatar-test-db "${_conf_file}" ) DB_CREATION(demo-db "${_conf_file}" ) DB_CREATION(demo-test-db "${_conf_file}" ) DB_CREATION(commaster-db "${_conf_file}" ) DB_CREATION(commaster-test-db "${_conf_file}" ) ELSE() MESSAGE(STATUS "Could not find LTS config file lts-cc.conf - can not create target 'db' and 'test-db'") ENDIF() ADD_CUSTOM_TARGET(db DEPENDS copy_sql-admin copy_db-py-scripts db_created ) ADD_CUSTOM_TARGET(test-db DEPENDS copy_sql-admin copy_db-py-scripts test-db_created ) ADD_CUSTOM_TARGET(ahtc-db DEPENDS copy_sql-admin copy_db-py-scripts ahtc-db_created ) ADD_CUSTOM_TARGET(ahtc-test-db DEPENDS copy_sql-admin copy_db-py-scripts ahtc-test-db_created ) ADD_CUSTOM_TARGET(l400p2-db DEPENDS copy_sql-admin copy_db-py-scripts l400p2-db_created ) ADD_CUSTOM_TARGET(l400p2-test-db DEPENDS copy_sql-admin copy_db-py-scripts l400p2-test-db_created ) ADD_CUSTOM_TARGET(qatar-db DEPENDS copy_sql-admin copy_db-py-scripts qatar-db_created ) ADD_CUSTOM_TARGET(qatar-test-db DEPENDS copy_sql-admin copy_db-py-scripts qatar-test-db_created ) ADD_CUSTOM_TARGET(demo-db DEPENDS copy_sql-admin copy_db-py-scripts demo-db_created ) ADD_CUSTOM_TARGET(demo-test-db DEPENDS copy_sql-admin copy_db-py-scripts demo-test-db_created ) ADD_CUSTOM_TARGET(commaster-db DEPENDS copy_sql-admin copy_db-py-scripts commaster-db_created ) ADD_CUSTOM_TARGET(commaster-test-db DEPENDS copy_sql-admin copy_db-py-scripts commaster-test-db_created ) TDS_COPY_FILES(sql-admin ${CMAKE_BINARY_DIR}/${out_dir} SQL_FILES) TDS_COPY_FILES(db-py-scripts ${CMAKE_BINARY_DIR}/${out_dir} DB_SCRIPTS)