Improve Windows build

This commit is contained in:
Lorenzooone
2024-05-01 04:11:25 +02:00
parent 861c55f131
commit 4de5ac391e
3 changed files with 12 additions and 7 deletions

View File

@@ -4,7 +4,7 @@ include(ExternalProject)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
set(CMAKE_HOST_CXX_COMPILER "g++" CACHE STRING "Host Compiler")
set(CMAKE_HOST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "Host Compiler")
set(WINDOWS_FTD3XX_USE_SHARED_LIB 0)
set(FETCHCONTENT_QUIET FALSE)
set(EXTRA_LINUX_CXX_FLAGS "-DXLIB_BASED 1" CACHE STRING "Extra Linux CXX flags")
@@ -36,7 +36,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(WINDOWS_PATH_SPECIFIER Static_Lib)
set(FTD3XX_LIB FTD3XX.lib)
endif()
if(WIN32)
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(PATH_WINDOWS_ARCH Win32)
else ()
set(PATH_WINDOWS_ARCH x64)

View File

@@ -2,7 +2,6 @@
#include <fstream>
#include <vector>
#include <string>
#include <filesystem>
using namespace std;
@@ -29,7 +28,7 @@ int main(int argc, char *argv[]) {
string name_len_array = base_array_name + "_len";
int len = buffer.size();
ofstream output(output_folder + filesystem::path::preferred_separator + output_base_filename + ".cpp", ios::out);
ofstream output(output_folder + "/" + output_base_filename + ".cpp", ios::out);
if(!output) {
cout << "Couldn't open output cpp file!" << endl;
return -2;
@@ -58,7 +57,7 @@ int main(int argc, char *argv[]) {
output.close();
ofstream output2(output_folder + filesystem::path::preferred_separator + output_base_filename + ".h", ios::out);
ofstream output2(output_folder + "/" + output_base_filename + ".h", ios::out);
if(!output2) {
cout << "Couldn't open output h file!" << endl;
return -3;

View File

@@ -1,2 +1,8 @@
cp %1/%3 %2
cp %1/FTD3XX.h %2
set "a=%~1"
set "b=%~2"
set "c=%~3"
set "a=%a:/=\%"
set "b=%b:/=\%"
set "c=%c:/=\%"
copy %a%\%c% %b%\
copy %a%\FTD3XX.h %b%\