Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake Error: Error: generator platform: Win32 ... previously: win32 #302

Open
wyouflf opened this issue Feb 15, 2023 · 3 comments
Open

CMake Error: Error: generator platform: Win32 ... previously: win32 #302

wyouflf opened this issue Feb 15, 2023 · 3 comments

Comments

@wyouflf
Copy link

wyouflf commented Feb 15, 2023

$ cmake-js configure
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info TOOL Using Visual Studio 17 2022 generator.
info CMD CONFIGURE
info RUN   'Visual Studio 17 2022',
info RUN   '-A',
info RUN   'Win32',
info RUN   '-DCMAKE_JS_VERSION=7.2.1',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=D:\\codes\\nan-iccard\\build',
info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
info RUN   '-DCMAKE_JS_INC=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\include\\node;D:\\codes\\nan-iccard\\node_modules\\nan',
info RUN   '-DCMAKE_JS_SRC=D:/codes/nan-iccard/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=18.14.0',
info RUN   '-DNODE_ARCH=ia32',
info RUN   '-DCMAKE_JS_LIB=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\win-x86\\node.lib',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=/DELAYLOAD:NODE.EXE /SAFESEH:NO'
info RUN ]
Not searching for unused variables given on the command line.
CMake Error: Error: generator platform: Win32
Does not match the platform used previously: win32
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
ERR! OMG Process terminated: 1
error Command failed with exit code 1.
@wyouflf
Copy link
Author

wyouflf commented Feb 15, 2023

If I ignore this error, then compile my project, build command will error, rebuild success.
Try again the configure or build command not with error.

@wyouflf
Copy link
Author

wyouflf commented Feb 15, 2023

All Logs

PS D:\codes\nan-iccard> yarn configure
yarn run v1.22.19
$ cmake-js configure
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info TOOL Using Visual Studio 17 2022 generator.
info CMD CONFIGURE
info RUN   'Visual Studio 17 2022',
info RUN   '-A',
info RUN   'Win32',
info RUN   '-DCMAKE_JS_VERSION=7.2.1',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=D:\\codes\\nan-iccard\\build',
info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
info RUN   '-DCMAKE_JS_INC=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\include\\node;D:\\codes\\nan-iccard\\node_modules\\nan',
info RUN   '-DCMAKE_JS_SRC=D:/codes/nan-iccard/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=18.14.0',
info RUN   '-DNODE_ARCH=ia32',
info RUN   '-DCMAKE_JS_LIB=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\win-x86\\node.lib',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=/DELAYLOAD:NODE.EXE /SAFESEH:NO'
info RUN ]
Not searching for unused variables given on the command line.
CMake Error: Error: generator platform: Win32
Does not match the platform used previously: win32
Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary directory.
ERR! OMG Process terminated: 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS D:\codes\nan-iccard> yarn build
yarn run v1.22.19
$ cmake-js compile
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info TOOL Using Visual Studio 17 2022 generator.
info CMD BUILD
info RUN [
info RUN   'cmake',
info RUN   '--build',
info RUN   'D:\\codes\\nan-iccard\\build',
info RUN   '--config',
info RUN   'Release'
info RUN ]
MSBuild version 17.4.1+9a89d02ff for .NET Framework
  Checking Build System
  Building Custom Rule D:/codes/nan-iccard/CMakeLists.txt
  addon.cc
D:\codes\nan-iccard\src\addon.cc(1,10): fatal  error C1083: 无法打开包括文件: “nan.h”: No such file or directory [D:\codes\nan-iccard\build\iccard.vcxproj]
  iccard.cc
D:\codes\nan-iccard\src\iccard.h(4,10): fatal  error C1083: 无法打开包括文件: “nan.h”: No such file or directory [D:\codes\nan-iccard\build\iccard.vcxproj]
  正在生成代码...
info REP Build has been failed, trying to do a full rebuild.
info CMD CLEAN
info RUN [ 'cmake', '-E', 'remove_directory', 'D:\\codes\\nan-iccard\\build' ]
info CMD CONFIGURE
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info RUN [
info RUN   'cmake',
info RUN   'D:\\codes\\nan-iccard',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Visual Studio 17 2022',
info RUN   '-A',
info RUN   'Win32',
info RUN   '-DCMAKE_JS_VERSION=7.2.1',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=D:\\codes\\nan-iccard\\build',
info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
info RUN   '-DCMAKE_JS_INC=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\include\\node;D:\\codes\\nan-iccard\\node_modules\\nan',
info RUN   '-DCMAKE_JS_SRC=D:/codes/nan-iccard/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=18.14.0',
info RUN   '-DNODE_ARCH=ia32',
info RUN   '-DCMAKE_JS_LIB=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\win-x86\\node.lib',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=/DELAYLOAD:NODE.EXE /SAFESEH:NO'
info RUN ]
Not searching for unused variables given on the command line.
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
-- The C compiler identification is MSVC 19.34.31942.0
-- The CXX compiler identification is MSVC 19.34.31942.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-------------- CMAKE_JS_INC:             C:\Users\layne\.cmake-js\node-ia32\v18.14.0\include\node;D:\codes\nan-iccard\node_modules\nan
-------------- CMAKE_BUILD_TYPE:         Release
-------------- CMAKE_CURRENT_SOURCE_DIR: D:/codes/nan-iccard
-------------- CMAKE_CURRENT_BINARY_DIR: D:/codes/nan-iccard/build
-- Configuring done
-- Generating done
-- Build files have been written to: D:/codes/nan-iccard/build
info CMD BUILD
info RUN [
info RUN   'cmake',
info RUN   '--build',
info RUN   'D:\\codes\\nan-iccard\\build',
info RUN   '--config',
info RUN   'Release'
info RUN ]
MSBuild version 17.4.1+9a89d02ff for .NET Framework
  Checking Build System
  Building Custom Rule D:/codes/nan-iccard/CMakeLists.txt
  addon.cc
  iccard.cc
  正在生成代码...
    正在创建库 D:/codes/nan-iccard/build/Release/iccard.lib 和对象 D:/codes/nan-iccard/build/Release/iccard.exp
  iccard.vcxproj -> D:\codes\nan-iccard\build\Release\iccard.node
  Building Custom Rule D:/codes/nan-iccard/CMakeLists.txt
Done in 4.12s.
PS D:\codes\nan-iccard> yarn configure
yarn run v1.22.19
$ cmake-js configure
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info TOOL Using Visual Studio 17 2022 generator.
info CMD CONFIGURE
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info RUN [
info RUN   'cmake',
info RUN   'D:\\codes\\nan-iccard',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Visual Studio 17 2022',
info RUN   '-A',
info RUN   'Win32',
info RUN   '-DCMAKE_JS_VERSION=7.2.1',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=D:\\codes\\nan-iccard\\build',
info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
info RUN   '-DCMAKE_JS_INC=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\include\\node;D:\\codes\\nan-iccard\\node_modules\\nan',
info RUN   '-DCMAKE_JS_SRC=D:/codes/nan-iccard/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=18.14.0',
info RUN   '-DNODE_ARCH=ia32',
info RUN   '-DCMAKE_JS_LIB=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\win-x86\\node.lib',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=/DELAYLOAD:NODE.EXE /SAFESEH:NO'
info RUN ]
Not searching for unused variables given on the command line.
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
-------------- CMAKE_JS_INC:             C:\Users\layne\.cmake-js\node-ia32\v18.14.0\include\node;D:\codes\nan-iccard\node_modules\nan
-------------- CMAKE_BUILD_TYPE:         Release
-------------- CMAKE_CURRENT_SOURCE_DIR: D:/codes/nan-iccard
-------------- CMAKE_CURRENT_BINARY_DIR: D:/codes/nan-iccard/build
-- Configuring done
-- Generating done
-- Build files have been written to: D:/codes/nan-iccard/build
Done in 0.70s.
PS D:\codes\nan-iccard> yarn build    
yarn run v1.22.19
$ cmake-js compile
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info TOOL Using Visual Studio 17 2022 generator.
info CMD BUILD
info RUN [
info RUN   'cmake',
info RUN   '--build',
info RUN   'D:\\codes\\nan-iccard\\build',
info RUN   '--config',
info RUN   'Release'
info RUN ]
MSBuild version 17.4.1+9a89d02ff for .NET Framework
  Checking Build System
  Building Custom Rule D:/codes/nan-iccard/CMakeLists.txt
  iccard.vcxproj -> D:\codes\nan-iccard\build\Release\iccard.node
  Building Custom Rule D:/codes/nan-iccard/CMakeLists.txt
Done in 0.78s.
PS D:\codes\nan-iccard> yarn clean
yarn run v1.22.19
$ cmake-js clean
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info TOOL Using Visual Studio 17 2022 generator.
info CMD CLEAN
info RUN [ 'cmake', '-E', 'remove_directory', 'D:\\codes\\nan-iccard\\build' ]
Done in 0.42s.
PS D:\codes\nan-iccard> yarn configure
yarn run v1.22.19
$ cmake-js configure
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info TOOL Using Visual Studio 17 2022 generator.
info CMD CONFIGURE
info find VS using VS2022 (17.4.33403.182) found at:
info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
info find VS run with --verbose for detailed information
info RUN [
info RUN   'cmake',
info RUN   'D:\\codes\\nan-iccard',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Visual Studio 17 2022',
info RUN   '-A',
info RUN   'Win32',
info RUN   '-DCMAKE_JS_VERSION=7.2.1',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=D:\\codes\\nan-iccard\\build',
info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
info RUN   '-DCMAKE_JS_INC=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\include\\node;D:\\codes\\nan-iccard\\node_modules\\nan',
info RUN   '-DCMAKE_JS_SRC=D:/codes/nan-iccard/node_modules/cmake-js/lib/cpp/win_delay_load_hook.cc',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=18.14.0',
info RUN   '-DNODE_ARCH=ia32',
info RUN   '-DCMAKE_JS_LIB=C:\\Users\\layne\\.cmake-js\\node-ia32\\v18.14.0\\win-x86\\node.lib',
info RUN   '-DCMAKE_SHARED_LINKER_FLAGS=/DELAYLOAD:NODE.EXE /SAFESEH:NO'
info RUN ]
Not searching for unused variables given on the command line.
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
-- The C compiler identification is MSVC 19.34.31942.0
-- The CXX compiler identification is MSVC 19.34.31942.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-------------- CMAKE_JS_INC:             C:\Users\layne\.cmake-js\node-ia32\v18.14.0\include\node;D:\codes\nan-iccard\node_modules\nan
-------------- CMAKE_BUILD_TYPE:         Release
-------------- CMAKE_CURRENT_SOURCE_DIR: D:/codes/nan-iccard
-------------- CMAKE_CURRENT_BINARY_DIR: D:/codes/nan-iccard/build
-- Configuring done
-- Generating done
-- Build files have been written to: D:/codes/nan-iccard/build
Done in 2.46s.

@wyouflf
Copy link
Author

wyouflf commented Feb 15, 2023

CMakeLists.txt

cmake_minimum_required(VERSION 3.24)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0042 NEW)

project (iccard)

set(CMAKE_C_FLAGS "-m32")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_definitions(-DNAPI_VERSION=8)

message("-------------- CMAKE_JS_INC:             ${CMAKE_JS_INC}")
message("-------------- CMAKE_BUILD_TYPE:         ${CMAKE_BUILD_TYPE}")
message("-------------- CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
message("-------------- CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")


include_directories(${CMAKE_JS_INC})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/bc750)

link_directories(${CMAKE_CURRENT_SOURCE_DIR}/bc750)

file(GLOB SOURCE_FILES "src/*.h" "src/*.c" "src/*.cc" "bc750/*.h")
file(GLOB DLL_FILES "bc750/*.dll")
file(COPY ${DLL_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})

add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB} hfrdapi) 

if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
  execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant