mirror of
https://github.com/Relintai/sfw.git
synced 2024-11-08 07:52:09 +01:00
Fix windows build, and windows build docs.
This commit is contained in:
parent
fb6de8909c
commit
ed5efaf32d
@ -61,5 +61,6 @@ ccache g++ -Wall \
|
||||
sfwl/object/array.o sfwl/object/dictionary.o sfwl/object/ref_ptr.o \
|
||||
sfwl/object/resource.o \
|
||||
sfwl/main.o \
|
||||
-lShlwapi -lws2_32 \
|
||||
-o game
|
||||
|
||||
|
@ -4,4 +4,4 @@ g++ -Wall -g -c main.cpp -o main.o
|
||||
|
||||
# You might need to add -lpthread and/or -latomic depending on your compiler version
|
||||
|
||||
g++ -Wall -g sfwl.o main.o -o game
|
||||
g++ -Wall -g sfwl.o main.o -lShlwapi -lws2_32 -o game
|
||||
|
@ -110,7 +110,7 @@ T *_nullptr() {
|
||||
* Windows badly defines a lot of stuff we'll never use. Undefine it.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
#undef min // override standard definition
|
||||
#undef max // override standard definition
|
||||
#undef ERROR // override (really stupid) wingdi.h standard definition
|
||||
|
@ -411,6 +411,12 @@ Variant Array::pop_at(int p_pos) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
// Windows...
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
Variant Array::min() const {
|
||||
Variant minval;
|
||||
for (int i = 0; i < size(); i++) {
|
||||
|
@ -110,7 +110,7 @@ T *_nullptr() {
|
||||
* Windows badly defines a lot of stuff we'll never use. Undefine it.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
#undef min // override standard definition
|
||||
#undef max // override standard definition
|
||||
#undef ERROR // override (really stupid) wingdi.h standard definition
|
||||
|
@ -411,6 +411,12 @@ Variant Array::pop_at(int p_pos) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(_WIN64) || defined(_WIN32)
|
||||
// Windows...
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
|
||||
Variant Array::min() const {
|
||||
Variant minval;
|
||||
for (int i = 0; i < size(); i++) {
|
||||
|
@ -8,15 +8,20 @@ without any special setting, but if your compiler is older (or set differently)
|
||||
|
||||
## IDE Setup
|
||||
|
||||
If you use an ide, just add these files to your project (so the .cpp file gets compiled), and you are done.
|
||||
If you use an ide, add these files to your project (so the .cpp file gets compiled).
|
||||
|
||||
If you are using MingW (If you use the g++ command on windows, that is MingW!), then
|
||||
find a section in your ide that says something similar to `link to libraries`. Usually
|
||||
is't under a linker settings section, and add the following entries: `Shlwapi`, `ws2_32`.
|
||||
|
||||
If you use anything else, you are done.
|
||||
|
||||
## Manual setup
|
||||
|
||||
### g++ / mingw
|
||||
### g++ - Linux / OSX
|
||||
|
||||
If you are using a compiler directly, then just add `sfw.cpp` or `sfwl.cpp` to the list of files that you are compiling:
|
||||
|
||||
|
||||
```
|
||||
g++ -g sfw.cpp main.cpp -o prog
|
||||
```
|
||||
@ -32,6 +37,27 @@ g++ -g -c main.cpp -o main.o
|
||||
g++ -g sfw.o main.o -o prog
|
||||
```
|
||||
|
||||
### g++ / mingw - Windows
|
||||
|
||||
If you are using a compiler directly, then add `sfw.cpp` or `sfwl.cpp` to the list of files that you are compiling,
|
||||
and link to `lShlwapi` and `ws2_32`:
|
||||
|
||||
|
||||
```
|
||||
g++ -g sfw.cpp main.cpp -lShlwapi -lws2_32 -o prog
|
||||
```
|
||||
|
||||
Note: -g means add debug information to the executable.
|
||||
|
||||
If you are creating object files:
|
||||
|
||||
```
|
||||
g++ -g -c sfw.cpp -o sfw.o
|
||||
g++ -g -c main.cpp -o main.o
|
||||
|
||||
g++ -g sfw.o main.o -lShlwapi -lws2_32 -o prog
|
||||
```
|
||||
|
||||
### MSVC
|
||||
|
||||
If you are using a compiler directly, then just add `sfw.cpp` or `sfwl.cpp` to the list of files that you are compiling:
|
||||
|
@ -13,14 +13,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstring>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <ctime>
|
||||
#include <wchar.h>
|
||||
#include <cstdint>
|
||||
#include <memory.h>
|
||||
|
||||
#if !defined(_WIN64) && !defined(_WIN32)
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef SFWL_H
|
||||
#include "sfwl.h"
|
||||
#endif
|
||||
|
@ -13,14 +13,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstring>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <ctime>
|
||||
#include <wchar.h>
|
||||
#include <cstdint>
|
||||
#include <memory.h>
|
||||
|
||||
#if !defined(_WIN64) && !defined(_WIN32)
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef SFWL_H
|
||||
#include "sfwl.h"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user