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

Add build support for 32 bits #39

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ artifacts/
_ReSharper.Caches/
DerivedData/
enc_temp_folder/
projects/.build
projects/.build*

# Installer
releases/
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [0.35.0] - 2023-11-27
- Add 32 bits support for Windows.

## [0.34.4] - 2023-11-09
- Add pattern zoomed view price change annotation.
- Add support for `MEDIAN(set)` expression to compute the median of a set of values.
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ endif()
# Set compiler specific flags
if(MSVC)

# Define _WIN32_WINNT to > Windows 7
add_compile_options(-D_WIN32_WINNT=0x0601)

# Enable multi-processor compilation
add_compile_options(/MP)

Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,46 @@ Note that currently the `./run` scripts only supports the `Visual Studio 2022` g
cmake --no-warn-unused-cli -DBUILD_MAX_JOB_THREADS=4 -DBUILD_MAX_QUERY_THREADS=8 -S./ -B./projects/.build -G "Visual Studio 16 2019" -A x64
```

#### Visual Studio 2022 x86 (32-bit)

##### Build the glfw library for 32-bit using cmake

```bash
cmake --no-warn-unused-cli -S./ -B.build32 -G "Visual Studio 17 2022" -A Win32 -DUSE_MSVC_RUNTIME_LIBRARY_DLL=OFF
```

##### Build the libcurl library for 32-bit using cmake

First open the **x86 Native Tools Command Prompt for VS 2022** and then run the following commands:

```bash
git clone git@github.com:wiimag/curl.git
cd curl
set RTLIBCFG=static
buildconf.bat
cd winbuild

REM Build the debug version
nmake /f MakeFile.vc mode=static DEBUG=no
REM copy builds/libcurl-vc-x86-debug-static-ipv6-sspi-schannel/lib/libcurl_a_debug.lib libcurl_a_debug.lib

REM Build the release version
nmake /f MakeFile.vc mode=static DEBUG=yes
REM copy builds/libcurl-vc-x86-release-static-ipv6-sspi-schannel/lib/libcurl_a.lib libcurl_a.lib
```

##### Generate the solution (note that it was generated in the `projects/.build32` folder):

```bash
cmake --no-warn-unused-cli -DBUILD_ENABLE_BACKEND=ON -DBUILD_MAX_JOB_THREADS=4 -DBUILD_MAX_QUERY_THREADS=8 -S./ -B./projects/.build32 -G "Visual Studio 17 2022" -A Win32
```

##### Open the solution:

```bash
start ./projects/.build32/wallet.sln
```

#### Xcode

```bash
Expand Down
4 changes: 2 additions & 2 deletions config/build.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ PRODUCT_VERSIONS_URL=https://wallet.wiimag.com/versions

# Version info
VERSION_MAJOR=0
VERSION_MINOR=34
VERSION_PATCH=4
VERSION_MINOR=35
VERSION_PATCH=0

# Build settings (Usually passed to Cmake)
BUILD_SERVICE_EXE=OFF
Expand Down
23 changes: 9 additions & 14 deletions config/locales.sjson
Original file line number Diff line number Diff line change
Expand Up @@ -4228,55 +4228,50 @@
en = "Linear Trend"
fr = "Tendance lin\xc3\xa9aire"
}
{
hash = "8fe16641715f7a93"
en = "Modifier dans l'\xc3\xa9diteur"
fr = "@TODO"
}
{
hash = "710bc2ba51994885"
en = "Min"
fr = "@TODO"
fr = "Min"
}
{
hash = "33c3ec50db3fb613"
en = "Max"
fr = "@TODO"
fr = "Max"
}
{
hash = "1e53d36773c2a9f7"
en = "Last"
fr = "@TODO"
fr = "Dernier"
}
{
hash = "a9d9b99cae3cabb5"
en = "Min %.2lf $"
fr = "@TODO"
fr = "Min %.2lf $"
}
{
hash = "bb4805d69eeee74c"
en = "Max %.2lf $"
fr = "@TODO"
fr = "Max %.2lf $"
}
{
hash = "a4edba5216e536ec"
en = "First"
fr = "@TODO"
fr = "Premier"
}
{
hash = "92264e6da32d8bbe"
en = "First %lf"
fr = "@TODO"
fr = "Premier %lf"
}
{
hash = "234154a880576fe2"
en = "Change: %.2lg %%"
fr = "@TODO"
fr = "Changement: %.2lg %%"
}
{
hash = "bcd0bcbd057101ce"
en = "Change: {0, short} %%"
fr = "@TODO"
fr = "Changement: {0, short} %%"
}
]
}
12 changes: 12 additions & 0 deletions external/astc-encoder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
# Use linker flags from parent project
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")

if (MSVC)
# Remove float fast math flags
string(REPLACE "/fp:fast" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
string(REPLACE "/fp:fast" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

# If 32 bits define ASTCENC_AVX to 0
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
add_definitions(-DASTCENC_AVX=0)
endif()

endif()

# Create the bx library
add_library(astc-encoder STATIC ${ASTC_SOURCES})

Expand Down
Binary file added external/glfw/lib-vc2022-32/glfw3.lib
Binary file not shown.
Binary file added external/libcurl/lib/win32/libcurl_a.lib
Binary file not shown.
Binary file added external/libcurl/lib/win32/libcurl_a_debug.lib
Binary file not shown.
24 changes: 20 additions & 4 deletions framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,18 @@ endif()
if (WIN32)

# On Windows we use a #pragma comment(lib, "glfw3.lib") in the source code
target_link_directories(framework PUBLIC ${ROOT_DIR}/external/glfw/lib-vc2022-64)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_directories(framework PUBLIC ${ROOT_DIR}/external/glfw/lib-vc2022-64)
else()
target_link_directories(framework PUBLIC ${ROOT_DIR}/external/glfw/lib-vc2022-32)
endif()

if (BUILD_SERVICE_EXE)
target_link_directories(service-framework PUBLIC ${ROOT_DIR}/external/glfw/lib-vc2022-64)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_directories(service-framework PUBLIC ${ROOT_DIR}/external/glfw/lib-vc2022-64)
else()
target_link_directories(service-framework PUBLIC ${ROOT_DIR}/external/glfw/lib-vc2022-32)
endif()
endif()

elseif(APPLE)
Expand All @@ -222,10 +230,18 @@ endif()
if (MSVC)

# On Windows we use a #pragma comment(lib, "libcurl_a*.lib") in the source code
target_link_directories(framework PUBLIC ${ROOT_DIR}/external/libcurl/lib)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_directories(framework PUBLIC ${ROOT_DIR}/external/libcurl/lib/win64)
else()
target_link_directories(framework PUBLIC ${ROOT_DIR}/external/libcurl/lib/win32)
endif()

if (BUILD_SERVICE_EXE)
target_link_directories(service-framework PUBLIC ${ROOT_DIR}/external/libcurl/lib)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_directories(service-framework PUBLIC ${ROOT_DIR}/external/libcurl/lib/win64)
else()
target_link_directories(service-framework PUBLIC ${ROOT_DIR}/external/libcurl/lib/win32)
endif()
endif()

elseif(APPLE)
Expand Down
2 changes: 1 addition & 1 deletion framework/about.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ constexpr const char EVENT_ABOUT_OPEN_WEBSITE[] = "ABOUT_OPEN_WEBSITE";
*
* We use #FOUNDATION_LINKER_INCLUDE in order to force the linker to include the #about module.
*/
FOUNDATION_EXTERN void FOUNDATION_LINKER_INCLUDE(about_initialize)();
//FOUNDATION_EXTERN void FOUNDATION_LINKER_INCLUDE(about_initialize)();

/* Explicitly initialize the about module. */
void about_initialize();
Expand Down
2 changes: 1 addition & 1 deletion framework/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ template<typename T>
FOUNDATION_FORCEINLINE T to_opaque(void* ptr)
{
const auto v = (intptr_t)(ptr);
FOUNDATION_ASSERT(std::numeric_limits<T>::min() <= v && v <= std::numeric_limits<T>::max());
FOUNDATION_ASSERT(std::numeric_limits<T>::min() <= (T)v && (T)v <= std::numeric_limits<T>::max());
return (T)v;
}

Expand Down
26 changes: 13 additions & 13 deletions framework/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ void config_array_sort(const config_handle_t& array_handle, const function<bool(

config_value_t* values = config->values;
config_value_t* p = &values[indexes[0]];
for (int i = 1; i < element_count; ++i)
for (size_t i = 1; i < element_count; ++i)
{
config_index_t next = indexes[i];
p->sibling = next;
Expand Down Expand Up @@ -1020,7 +1020,7 @@ bool config_is_undefined(const config_handle_t& h, const char* key /*= nullptr*/
FOUNDATION_STATIC FOUNDATION_FORCEINLINE void config_sjson_add_string(config_sjson_t& sjson, const char* str, size_t length)
{
const char* s = str;
for (int i = 0; i < length && *s; ++i, ++s)
for (size_t i = 0; i < length && *s; ++i, ++s)
sjson = array_push(sjson, *s);
}

Expand Down Expand Up @@ -1064,7 +1064,7 @@ FOUNDATION_STATIC void config_sjson_write_string(config_sjson_t& sjson, string_c

config_sjson_add_char(sjson, '"');
const char* s = value.str;
for (int i = 0; i < value.length && *s; ++i, ++s)
for (size_t i = 0; i < value.length && *s; ++i, ++s)
{
char c = *s;
if (c == '"' || c == '\\')
Expand Down Expand Up @@ -1152,7 +1152,7 @@ FOUNDATION_STATIC void config_sjson_write(const config_handle_t& value_handle, c
FOUNDATION_STATIC bool config_sjson_is_simple_identifier(string_const_t value)
{
const char* s = value.str;
for (int i = 0; i < value.length && *s; ++i, ++s)
for (size_t i = 0; i < value.length && *s; ++i, ++s)
{
char c = *s;
if (c >= '0' && c <= '9')
Expand Down Expand Up @@ -1210,7 +1210,7 @@ FOUNDATION_STATIC size_t config_sjson_write_object_fields(const config_handle_t&
}
}

int element_index = 0;
size_t element_index = 0;
const size_t element_count = config_size(obj_handle);
for (auto e : obj_handle)
{
Expand Down Expand Up @@ -1294,7 +1294,7 @@ FOUNDATION_STATIC void config_sjson_write_array(const config_handle_t& array_han
const bool simple_json = (array_handle.config->options & CONFIG_OPTION_WRITE_JSON) == 0;
auto options = array_handle.config->options;

int element_index = 0;
size_t element_index = 0;
const size_t element_count = config_size(array_handle);
const config_value_t* values = array_handle.config->values;
const config_value_t* item = &values[arr->child];
Expand Down Expand Up @@ -1364,7 +1364,7 @@ void config_sjson_deallocate(config_sjson_const_t sjson)

bool config_parse_at_end(string_const_t json, int index)
{
return index >= json.length;
return index >= (int)json.length;
}

void config_parse_skip_BOM(string_const_t json, int& index)
Expand Down Expand Up @@ -1451,7 +1451,7 @@ FOUNDATION_STATIC bool config_parse_consume(string_const_t json, int& index, con
int end = index;
config_parse_skip_whitespace(json, end);
const char* t = consume;
for (int i = 0; i < consume_length && *t; ++i, ++t)
for (size_t i = 0; i < consume_length && *t; ++i, ++t)
{
if (config_parse_next(json, end) != *t)
{
Expand Down Expand Up @@ -1520,7 +1520,7 @@ string_t config_parse_string(string_const_t json, int& index, config_option_flag
throw config_parse_exception(json, index, "Invalid Unicode character or sequence");

const char* utf8c = utf8.value.str;
for (int i = 0; i < utf8.value.length && *utf8c; ++i, ++utf8c)
for (size_t i = 0; i < utf8.value.length && *utf8c; ++i, ++utf8c)
s = array_push(s, *utf8c);
index += 4;
}
Expand Down Expand Up @@ -1606,7 +1606,7 @@ FOUNDATION_STATIC string_t config_parse_identifier(string_const_t json, int& ind
char* s = nullptr;
array_reserve(s, 32);

while (index < json.length)
while (index < (int)json.length)
{
char c = config_parse_next(json, index);
if (c == ' ' || c == '\t' || c == '\n' || c == '=' || c == ':')
Expand Down Expand Up @@ -1932,18 +1932,18 @@ FOUNDATION_STATIC config_handle_t config_parse_yaml_object(stream_t* stream, con

// Check level
const size_t field_level = stream_skip_whitespace(stream);
if (field_level > level)
if ((int)field_level > level)
return obj;

FOUNDATION_ASSERT(field_level <= level);
FOUNDATION_ASSERT((int)field_level <= level);

if (field_level > 0 && stream_peek(stream) == '-')
{
stream_seek(stream, pos, STREAM_SEEK_BEGIN);
return obj; // New array element at same level}
}

if (field_level > 0 && field_level < level)
if (field_level > 0 && (int)field_level < level)
{
// End of object, set stream position back to start of line
stream_seek(stream, pos, STREAM_SEEK_BEGIN);
Expand Down
2 changes: 1 addition & 1 deletion framework/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct config_value_t;

typedef char* config_sjson_t;
typedef const char* config_sjson_const_t;
typedef unsigned int config_index_t;
typedef uint32_t config_index_t;

/*! Config value primitive types. */
typedef enum : uint8_t {
Expand Down
4 changes: 2 additions & 2 deletions framework/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ FOUNDATION_STATIC void console_render_logs(const ImRect& rect)
{
const float window_width = ImGui::GetWindowWidth();
const float item_available_width = ImGui::GetContentRegionAvail().x;
for (size_t i = clipper.DisplayStart; i < min(clipper.DisplayEnd, (int)array_size(_console_module->messages)); ++i)
for (int i = clipper.DisplayStart; i < min(clipper.DisplayEnd, (int)array_size(_console_module->messages)); ++i)
{
log_message_t& log = _console_module->messages[i];

Expand Down Expand Up @@ -313,7 +313,7 @@ FOUNDATION_STATIC void console_render_toolbar()
const size_t filter_length = string_length(_console_module->search_filter);
if (filter_length > 0)
{
size_t log_count = array_size(_console_module->messages);
int log_count = to_int(array_size(_console_module->messages));
for (_console_module->filtered_message_count = 0; _console_module->filtered_message_count < log_count;)
{
const log_message_t& log = _console_module->messages[_console_module->filtered_message_count];
Expand Down
4 changes: 2 additions & 2 deletions framework/expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ expr_result_t expr_eval_pair(const expr_result_t& key, const expr_result_t& valu

expr_result_t expr_eval_get_set_arg(const vec_expr_t* args, size_t idx, const char* message)
{
if (idx >= args->len)
if (to_int(idx) >= args->len)
throw ExprError(EXPR_ERROR_INVALID_ARGUMENT, "Missing arguments: %s", message);

expr_result_t value = expr_eval(&args->buf[idx]);
Expand All @@ -336,7 +336,7 @@ expr_result_t expr_eval_get_set_arg(const vec_expr_t* args, size_t idx, const ch

string_const_t expr_eval_get_string_arg(const vec_expr_t* args, size_t idx, const char* message)
{
if (idx >= args->len)
if (to_int(idx) >= args->len)
throw ExprError(EXPR_ERROR_INVALID_ARGUMENT, "Missing arguments: %s", message);

const auto& value = expr_eval(&args->buf[idx]);
Expand Down
Loading