📝 add doc about how to build on windows
This commit is contained in:
parent
985dee8001
commit
260f0cb5a3
|
@ -2,7 +2,8 @@
|
|||
build/
|
||||
out/
|
||||
dist/
|
||||
cmake-build-*/
|
||||
cmake-build-*
|
||||
cmake-windows-*
|
||||
|
||||
# IDE and editor files
|
||||
.vscode/
|
||||
|
|
|
@ -11,7 +11,7 @@ set(CMAKE_CXX_FLAGS_RELEASE_INIT "-Wshadow -Wall")
|
|||
|
||||
add_compile_options(-fPIC)
|
||||
# MSVC needs this command option to really enable utf-8 output
|
||||
if(MSVC)
|
||||
if (MSVC)
|
||||
add_compile_options(/utf-8)
|
||||
endif()
|
||||
|
||||
|
@ -103,16 +103,21 @@ target_link_libraries(mat module-used-object)
|
|||
|
||||
add_library(nasock SHARED ${CMAKE_SOURCE_DIR}/module/nasocket.cpp)
|
||||
target_include_directories(nasock PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
if (WIN32)
|
||||
target_link_libraries(nasock ws2_32)
|
||||
endif()
|
||||
target_link_libraries(nasock module-used-object)
|
||||
|
||||
# Add web library
|
||||
add_library(nasal-web SHARED
|
||||
src/nasal_web.cpp
|
||||
${NASAL_OBJECT_SOURCE_FILE}
|
||||
)
|
||||
target_include_directories(nasal-web PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
set_target_properties(nasal-web PROPERTIES
|
||||
C_VISIBILITY_PRESET hidden
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
VISIBILITY_INLINES_HIDDEN ON
|
||||
)
|
||||
# Add web library, not for MSVC now
|
||||
if (NOT MSVC)
|
||||
add_library(nasal-web SHARED
|
||||
src/nasal_web.cpp
|
||||
${NASAL_OBJECT_SOURCE_FILE}
|
||||
)
|
||||
target_include_directories(nasal-web PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
||||
set_target_properties(nasal-web PROPERTIES
|
||||
C_VISIBILITY_PRESET hidden
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
VISIBILITY_INLINES_HIDDEN ON
|
||||
)
|
||||
endif()
|
|
@ -88,7 +88,7 @@ Make sure thread model is `posix thread model`, otherwise no thread library exis
|
|||
|
||||
### __Windows (Visual Studio)__
|
||||
|
||||
There is a [__CMakelists.txt__](./CMakeLists.txt) to create project.
|
||||
There is a [__CMakelists.txt__](./CMakeLists.txt) to create project. Recently we find how to build it with command line tools: [__Build Nasal-Interpreter on Windows]__(./doc/windows-build.md).
|
||||
|
||||
### __Linux / macOS / Unix__
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ Windows 平台的预览版解释器现在还没配置相关流水线,
|
|||
### __Windows 平台 (Vistual Studio)__
|
||||
|
||||
项目提供了 [__CMakeLists.txt__](../CMakeLists.txt) 用于在`Visual Studio`中创建项目。
|
||||
最近我们总结了命令行编译的方法 [__如何在 Windows 平台编译 Nasal-Interpreter__](./windows-build.md)。
|
||||
|
||||
### __Linux / macOS / Unix 平台__
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# Build Nasal-Interpreter on Windows
|
||||
|
||||
## MSVC / Visual Studio
|
||||
|
||||
Need CMake and Visual Studio 2022. Remember to add MSBuild.exe to Path.
|
||||
|
||||
Valid on powershell:
|
||||
|
||||
```sh
|
||||
mkdir cmake-windows-msvc
|
||||
cd cmake-windows-msvc
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022"
|
||||
MSbuild.exe nasal.sln /p:Configuration=Release /p:Platform=x64
|
||||
```
|
||||
|
||||
## MingW-W64
|
||||
|
||||
Need CMake and MingW-W64. Remember to add MingW-W64 bin to Path.
|
||||
|
||||
Valid on powershell:
|
||||
|
||||
```sh
|
||||
mkdir cmake-windows-mingw
|
||||
cd cmake-windows-mingw
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
|
||||
mingw32-make.exe -j6
|
||||
```
|
Loading…
Reference in New Issue