blob: a65339da9e40e31f7c8e2c63e23ac2874964dcd0 [file] [log] [blame]
Nobuaki Sukegawa27378fa2015-10-29 00:41:39 +09001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
20set(hs_test_gen
21 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ConstantsDemo_Consts.hs
22 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ConstantsDemo_Types.hs
23 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/DebugProtoTest_Consts.hs
24 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/DebugProtoTest_Types.hs
25 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/EmptyService_Client.hs
26 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/EmptyService.hs
27 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/EmptyService_Iface.hs
28 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Include_Consts.hs
29 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Include_Types.hs
30 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Inherited_Client.hs
31 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Inherited.hs
32 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Inherited_Iface.hs
33 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ReverseOrderService_Client.hs
34 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ReverseOrderService.hs
35 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ReverseOrderService_Iface.hs
36 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/SecondService_Client.hs
37 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/SecondService.hs
38 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/SecondService_Iface.hs
39 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ServiceForExceptionWithAMap_Client.hs
40 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ServiceForExceptionWithAMap.hs
41 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ServiceForExceptionWithAMap_Iface.hs
42 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Srv_Client.hs
43 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Srv.hs
44 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Srv_Iface.hs
45 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ThriftTest_Client.hs
46 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ThriftTest_Consts.hs
47 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ThriftTest.hs
48 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ThriftTest_Iface.hs
49 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/ThriftTest_Types.hs
50 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Yowza_Client.hs
51 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Yowza.hs
52 ${CMAKE_CURRENT_BINARY_DIR}/gen-hs/Yowza_Iface.hs
53)
54
55set(hs_crosstest_apps
56 ${CMAKE_CURRENT_BINARY_DIR}/TestServer
57 ${CMAKE_CURRENT_BINARY_DIR}/TestClient
58)
59set(hs_crosstest_args
60 -igen-hs
61 -odir=${CMAKE_CURRENT_BINARY_DIR}
62 -hidir=${CMAKE_CURRENT_BINARY_DIR}
63)
64add_custom_command(
65 OUTPUT ${hs_crosstest_apps}
66 COMMAND ${GHC} ${hs_crosstest_args} ${CMAKE_CURRENT_SOURCE_DIR}/TestServer.hs -o TestServer
67 COMMAND ${GHC} ${hs_crosstest_args} ${CMAKE_CURRENT_SOURCE_DIR}/TestClient.hs -o TestClient
68 DEPENDS ${hs_test_gen} haskell_library TestServer.hs TestClient.hs
69)
70add_custom_target(haskell_crosstest ALL
71 COMMENT "Building Haskell cross test executables"
72 DEPENDS ${hs_crosstest_apps}
73)
74
75set(hs_test_sources
76 ConstantsDemo_Main.hs
77 DebugProtoTest_Main.hs
78 Include_Main.hs
79 ThriftTest_Main.hs
80)
81set(hs_test_args
82 -Wall
83 -XScopedTypeVariables
84 -i${PROJECT_SOURCE_DIR}/lib/hs/src
85 -i${CMAKE_CURRENT_BINARY_DIR}/gen-hs
86)
87add_custom_target(haskell_tests ALL DEPENDS ${hs_test_gen})
88foreach(SRC ${hs_test_sources})
89 get_filename_component(BASE ${SRC} NAME_WE)
90 add_test(NAME HaskellTests-${BASE}
91 COMMAND ${RUN_HASKELL} ${hs_test_args} ${SRC}
92 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
93endforeach()
94
95set(hs_test_gen_sources
96 ${PROJECT_SOURCE_DIR}/test/ConstantsDemo.thrift
97 ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
98 ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
99 ${PROJECT_SOURCE_DIR}/test/Include.thrift
100)
101add_custom_command(OUTPUT ${hs_test_gen}
Nobuaki Sukegawaca939362015-11-14 00:23:40 +0900102 COMMAND ${THRIFT_COMPILER} --gen hs ${PROJECT_SOURCE_DIR}/test/ConstantsDemo.thrift
103 COMMAND ${THRIFT_COMPILER} --gen hs ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
104 COMMAND ${THRIFT_COMPILER} --gen hs ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
105 COMMAND ${THRIFT_COMPILER} --gen hs ${PROJECT_SOURCE_DIR}/test/Include.thrift
106 DEPENDS ${hs_test_gen_sources}
Nobuaki Sukegawa27378fa2015-10-29 00:41:39 +0900107)