THRIFT-3940 Visual Studio project file for compiler is broken
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 2d9529a..02ed78c 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -17,12 +17,7 @@
# under the License.
#
-# Windows has a different header
-if(MSVC)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/windows/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
-else()
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
-endif()
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)
@@ -163,6 +158,7 @@
"src/thrift/logging.h"
"src/thrift/main.h"
"src/thrift/platform.h"
+ "${CMAKE_BINARY_DIR}/compiler/cpp/thrift/version.h"
DESTINATION "${INCLUDE_INSTALL_DIR}/thrift")
install(FILES
"src/thrift/audit/t_audit.h"
@@ -202,13 +198,6 @@
install(FILES
"src/thrift/windows/config.h"
DESTINATION "${INCLUDE_INSTALL_DIR}/thrift/windows")
- install(FILES
- "${CMAKE_BINARY_DIR}/compiler/cpp/thrift/windows/version.h"
- DESTINATION "${INCLUDE_INSTALL_DIR}/thrift/windows")
-else()
- install(FILES
- "${CMAKE_BINARY_DIR}/compiler/cpp/thrift/version.h"
- DESTINATION "${INCLUDE_INSTALL_DIR}/thrift")
endif()
endif()
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 9d830d7..caf9424 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -71,9 +71,7 @@
src/thrift/parse/parse.cc \
src/thrift/generate/t_generator.h \
src/thrift/generate/t_oop_generator.h \
- src/thrift/generate/t_html_generator.h \
- src/thrift/windows/config.h \
- src/thrift/windows/version.h
+ src/thrift/generate/t_html_generator.h
thrift_SOURCES = src/thrift/main.h \
src/thrift/main.cc \
@@ -181,8 +179,7 @@
src/thrift/plugin/plugin_output.h
include_windowsdir = $(include_thriftdir)/windows
-include_windows_HEADERS = src/thrift/windows/version.h \
- src/thrift/windows/config.h
+include_windows_HEADERS = src/thrift/windows/config.h
endif
WINDOWS_DIST = \
@@ -197,7 +194,7 @@
$(WINDOWS_DIST)
clean-local:
- $(RM) version.h windows/version.h $(plugin_gen)
+ $(RM) version.h $(plugin_gen)
src/thrift/main.cc: src/thrift/version.h
diff --git a/compiler/cpp/README.md b/compiler/cpp/README.md
index ea195c7..90300ac 100644
--- a/compiler/cpp/README.md
+++ b/compiler/cpp/README.md
@@ -54,29 +54,28 @@
The Visual Studio project contains pre-build commands to generate the
thriftl.cc, thrifty.cc and thrifty.hh files which are necessary to build
the compiler. These depend on bison, flex and their dependencies to
-work properly. If this doesn't work on a system, try these manual
-pre-build steps.
+work properly.
+Download flex & bison as described above.
+Place these binaries somewhere in the path and
+rename win_flex.exe and win_bison.exe to flex.exe and bison.exe respectively.
+
+If this doesn't work on a system, try these manual pre-build steps.
Open compiler.sln and remove the Pre-build commands under the project's
Properties -> Build Events -> Pre-Build Events.
-Download flex & bison from http://jaisantonyk.wordpress.com/2008/03/16/lex-and-yaccbison-in-windows/
-Download bison.simple in addition to bison.exe . This build of bison is easier to use
-than the one on sourceforge which has a myriad of dependencies.
-Place these binaries somewhere in the path.
-
From a command prompt:
> cd thrift/compiler/cpp
-> flex -osrc\thriftl.cc src\thriftl.ll
+> flex -osrc\thrift\thriftl.cc src\thrift\thriftl.ll
In the generated thriftl.cc, comment out #include <unistd.h>
Place a copy of bison.simple in thrift/compiler/cpp
-> bison -y -o "src/thrifty.cc" --defines src/thrifty.yy
-> move src\thrifty.cc.hh src\thrifty.hh
+> bison -y -o "src/thrift/thrifty.cc" --defines src/thrift/thrifty.yy
+> move src\thrift\thrifty.cc.hh src\thrift\thrifty.hh
Bison might generate the yacc header file "thrifty.cc.h" with just one h ".h" extension; in this case you'll have to rename to "thrifty.h".
-> move src\windows\version.h.in src\windows\version.h
+> move src\thrift\version.h.in src\thrift\version.h
Download inttypes.h from the interwebs and place it in an include path
location (e.g. thrift/compiler/cpp/src).
diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj
index 3dbe42c..878e219 100644
--- a/compiler/cpp/compiler.vcxproj
+++ b/compiler/cpp/compiler.vcxproj
@@ -19,78 +19,78 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="src\audit\t_audit.h" />
- <ClInclude Include="src\common.h" />
- <ClInclude Include="src\generate\t_generator.h" />
- <ClInclude Include="src\generate\t_generator_registry.h" />
- <ClInclude Include="src\generate\t_oop_generator.h" />
- <ClInclude Include="src\generate\t_html_generator.h" />
- <ClInclude Include="src\globals.h" />
- <ClInclude Include="src\main.h" />
- <ClInclude Include="src\parse\t_base_type.h" />
- <ClInclude Include="src\parse\t_const.h" />
- <ClInclude Include="src\parse\t_const_value.h" />
- <ClInclude Include="src\parse\t_container.h" />
- <ClInclude Include="src\parse\t_doc.h" />
- <ClInclude Include="src\parse\t_enum.h" />
- <ClInclude Include="src\parse\t_enum_value.h" />
- <ClInclude Include="src\parse\t_field.h" />
- <ClInclude Include="src\parse\t_function.h" />
- <ClInclude Include="src\parse\t_list.h" />
- <ClInclude Include="src\parse\t_map.h" />
- <ClInclude Include="src\parse\t_program.h" />
- <ClInclude Include="src\parse\t_scope.h" />
- <ClInclude Include="src\parse\t_service.h" />
- <ClInclude Include="src\parse\t_set.h" />
- <ClInclude Include="src\parse\t_struct.h" />
- <ClInclude Include="src\parse\t_type.h" />
- <ClInclude Include="src\parse\t_typedef.h" />
- <ClInclude Include="src\platform.h" />
- <ClInclude Include="src\thrifty.hh" />
- <ClInclude Include="src\windows\config.h" />
- <ClInclude Include="src\windows\version.h" />
+ <ClInclude Include="src\thrift\audit\t_audit.h" />
+ <ClInclude Include="src\thrift\common.h" />
+ <ClInclude Include="src\thrift\generate\t_generator.h" />
+ <ClInclude Include="src\thrift\generate\t_generator_registry.h" />
+ <ClInclude Include="src\thrift\generate\t_oop_generator.h" />
+ <ClInclude Include="src\thrift\generate\t_html_generator.h" />
+ <ClInclude Include="src\thrift\globals.h" />
+ <ClInclude Include="src\thrift\main.h" />
+ <ClInclude Include="src\thrift\parse\t_base_type.h" />
+ <ClInclude Include="src\thrift\parse\t_const.h" />
+ <ClInclude Include="src\thrift\parse\t_const_value.h" />
+ <ClInclude Include="src\thrift\parse\t_container.h" />
+ <ClInclude Include="src\thrift\parse\t_doc.h" />
+ <ClInclude Include="src\thrift\parse\t_enum.h" />
+ <ClInclude Include="src\thrift\parse\t_enum_value.h" />
+ <ClInclude Include="src\thrift\parse\t_field.h" />
+ <ClInclude Include="src\thrift\parse\t_function.h" />
+ <ClInclude Include="src\thrift\parse\t_list.h" />
+ <ClInclude Include="src\thrift\parse\t_map.h" />
+ <ClInclude Include="src\thrift\parse\t_program.h" />
+ <ClInclude Include="src\thrift\parse\t_scope.h" />
+ <ClInclude Include="src\thrift\parse\t_service.h" />
+ <ClInclude Include="src\thrift\parse\t_set.h" />
+ <ClInclude Include="src\thrift\parse\t_struct.h" />
+ <ClInclude Include="src\thrift\parse\t_type.h" />
+ <ClInclude Include="src\thrift\parse\t_typedef.h" />
+ <ClInclude Include="src\thrift\platform.h" />
+ <ClInclude Include="src\thrift\thrifty.hh" />
+ <ClInclude Include="src\thrift\windows\config.h" />
+ <ClInclude Include="src\thrift\version.h" />
</ItemGroup>
<ItemGroup>
- <ClCompile Include="src\audit\t_audit.cpp"/>
- <ClCompile Include="src\common.cc" />
- <ClCompile Include="src\generate\t_as3_generator.cc" />
- <ClCompile Include="src\generate\t_cocoa_generator.cc" />
- <ClCompile Include="src\generate\t_cpp_generator.cc" />
- <ClCompile Include="src\generate\t_csharp_generator.cc" />
- <ClCompile Include="src\generate\t_c_glib_generator.cc" />
- <ClCompile Include="src\generate\t_d_generator.cc" />
- <ClCompile Include="src\generate\t_dart_generator.cc" />
- <ClCompile Include="src\generate\t_delphi_generator.cc" />
- <ClCompile Include="src\generate\t_erl_generator.cc" />
- <ClCompile Include="src\generate\t_generator.cc" />
- <ClCompile Include="src\generate\t_go_generator.cc" />
- <ClCompile Include="src\generate\t_gv_generator.cc" />
- <ClCompile Include="src\generate\t_haxe_generator.cc" />
- <ClCompile Include="src\generate\t_hs_generator.cc" />
- <ClCompile Include="src\generate\t_html_generator.cc" />
- <ClCompile Include="src\generate\t_javame_generator.cc" />
- <ClCompile Include="src\generate\t_java_generator.cc" />
- <ClCompile Include="src\generate\t_js_generator.cc" />
- <ClCompile Include="src\generate\t_json_generator.cc" />
- <ClCompile Include="src\generate\t_lua_generator.cc" />
- <ClCompile Include="src\generate\t_ocaml_generator.cc" />
- <ClCompile Include="src\generate\t_perl_generator.cc" />
- <ClCompile Include="src\generate\t_php_generator.cc" />
- <ClCompile Include="src\generate\t_py_generator.cc" />
- <ClCompile Include="src\generate\t_rb_generator.cc" />
- <ClCompile Include="src\generate\t_st_generator.cc" />
- <ClCompile Include="src\generate\t_swift_generator.cc" />
- <ClCompile Include="src\generate\t_xml_generator.cc" />
- <ClCompile Include="src\generate\t_xsd_generator.cc" />
- <ClCompile Include="src\main.cc" />
- <ClCompile Include="src\parse\parse.cc" />
- <ClCompile Include="src\parse\t_typedef.cc" />
- <ClCompile Include="src\thriftl.cc" />
- <ClCompile Include="src\thrifty.cc" />
+ <ClCompile Include="src\thrift\audit\t_audit.cpp"/>
+ <ClCompile Include="src\thrift\common.cc" />
+ <ClCompile Include="src\thrift\generate\t_as3_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_cocoa_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_cpp_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_csharp_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_c_glib_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_d_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_dart_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_delphi_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_erl_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_go_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_gv_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_haxe_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_hs_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_html_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_javame_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_java_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_js_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_json_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_lua_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_ocaml_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_perl_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_php_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_py_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_rb_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_st_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_swift_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_xml_generator.cc" />
+ <ClCompile Include="src\thrift\generate\t_xsd_generator.cc" />
+ <ClCompile Include="src\thrift\main.cc" />
+ <ClCompile Include="src\thrift\parse\parse.cc" />
+ <ClCompile Include="src\thrift\parse\t_typedef.cc" />
+ <ClCompile Include="src\thrift\thriftl.cc" />
+ <ClCompile Include="src\thrift\thrifty.cc" />
</ItemGroup>
<ItemGroup>
- <None Include="src\thriftl.ll" />
- <None Include="src\thrifty.yy" />
+ <None Include="src\thrift\thriftl.ll" />
+ <None Include="src\thrift\thrifty.yy" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{89975A1A-F799-4556-98B8-64E30AB39A90}</ProjectGuid>
@@ -167,7 +167,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;MINGW;YY_NO_UNISTD_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ForcedIncludeFiles>config.h</ForcedIncludeFiles>
+ <ForcedIncludeFiles>thrift\windows\config.h</ForcedIncludeFiles>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
@@ -175,8 +175,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
- <Command>flex -o "src\\thriftl.cc" src/thriftl.ll
-bison -y -o "src\thrifty.cc" --defines="src/thrifty.hh" src/thrifty.yy</Command>
+ <Command>flex -o "src\\thrift\\thriftl.cc" src/thrift/thriftl.ll && bison -y -o "src\\thrift\\thrifty.cc" --defines="src\\thrift\\thrifty.hh" src/thrift/thrifty.yy</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -186,7 +185,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;MINGW;YY_NO_UNISTD_H;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ForcedIncludeFiles>config.h</ForcedIncludeFiles>
+ <ForcedIncludeFiles>thrift\windows\config.h</ForcedIncludeFiles>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
@@ -194,8 +193,8 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
- <Command>flex -o "src\thriftl.cc" src/thriftl.ll
-bison -y -o "src\thrifty.cc" --defines="src/thrifty.hh" src/thrifty.yy</Command>
+ <Command>flex -o "src\\thrift\\thriftl.cc" src/thrift/thriftl.ll && bison -y -o "src\\thrift\\thrifty.cc" --defines="src\\thrift\\thrifty.hh" src/thrift/thrifty.yy</Command>
+
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -207,7 +206,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;MINGW;YY_NO_UNISTD_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ForcedIncludeFiles>config.h</ForcedIncludeFiles>
+ <ForcedIncludeFiles>thrift\windows\config.h</ForcedIncludeFiles>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
@@ -217,8 +216,8 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
- <Command>flex -o "src\thriftl.cc" src/thriftl.ll
-bison -y -o "src\thrifty.cc" --defines="src/thrifty.hh" src/thrifty.yy</Command>
+ <Command>flex -o "src\\thrift\\thriftl.cc" src/thrift/thriftl.ll && bison -y -o "src\\thrift\\thrifty.cc" --defines="src\\thrift\\thrifty.hh" src/thrift/thrifty.yy</Command>
+
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -230,7 +229,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;MINGW;YY_NO_UNISTD_H;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ForcedIncludeFiles>config.h</ForcedIncludeFiles>
+ <ForcedIncludeFiles>thrift\windows\config.h</ForcedIncludeFiles>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
@@ -240,8 +239,8 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
- <Command>flex -o "src\thriftl.cc" src/thriftl.ll
-bison -y -o "src\thrifty.cc" --defines="src/thrifty.hh" src/thrifty.yy</Command>
+ <Command>flex -o "src\\thrift\\thriftl.cc" src/thrift/thriftl.ll && bison -y -o "src\\thrift\\thrifty.cc" --defines="src\\thrift\\thrifty.hh" src/thrift/thrifty.yy</Command>
+
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/compiler/cpp/src/Makefile.am b/compiler/cpp/src/Makefile.am
index f1863d5..bc2c5cb 100644
--- a/compiler/cpp/src/Makefile.am
+++ b/compiler/cpp/src/Makefile.am
@@ -75,7 +75,7 @@
thrift/generate/t_oop_generator.h \
thrift/generate/t_html_generator.h \
thrift/windows/config.h \
- thrift/windows/version.h \
+ thrift/version.h \
thrift/generate/t_cpp_generator.cc \
thrift/main.h \
thrift/main.cc
diff --git a/compiler/cpp/src/thrift/version.h.in b/compiler/cpp/src/thrift/version.h.in
index 5770ec9..aef076f 100644
--- a/compiler/cpp/src/thrift/version.h.in
+++ b/compiler/cpp/src/thrift/version.h.in
@@ -1 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef _THRIFT_VERSION_H_
+#define _THRIFT_VERSION_H_ 1
+
+#if defined(_MSC_VER) && (_MSC_VER > 1200)
+#pragma once
+#endif // _MSC_VER
+
#define THRIFT_VERSION "@PACKAGE_VERSION@"
+
+#endif // _THRIFT_VERSION_H_
diff --git a/compiler/cpp/src/thrift/windows/version.h.in b/compiler/cpp/src/thrift/windows/version.h.in
deleted file mode 100644
index 00ebca6..0000000
--- a/compiler/cpp/src/thrift/windows/version.h.in
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef _THRIFT_WINDOWS_VERSION_H_
-#define _THRIFT_WINDOWS_VERSION_H_ 1
-
-#if defined(_MSC_VER) && (_MSC_VER > 1200)
-#pragma once
-#endif // _MSC_VER
-
-#ifndef _WIN32
-#error "This is a Windows header only"
-#endif
-
-#define THRIFT_VERSION "@PACKAGE_VERSION@"
-
-#endif // _THRIFT_WINDOWS_VERSION_H_