Skip to content

Commit ab86882

Browse files
committed
Make it compile again on 32/64-bit Windows
* Mozart won't compile on 32-bit Windows because it requires lot of contiguous memory and 32-bit max virtual memory is too small, so reduced its max memory usage to 512MB * The --eval of emacs command seems to do a mess when compiling. The -L paremeter do the same thing more simply. * Tests couldn't be run because ozemulator is ozengine on Windows * Updated CMakeLists to support x64 compilation on Windows * Updated platform detection function call to allow 64bit Windows to be recognized
1 parent 4b0d043 commit ab86882

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,31 @@ set(MOZART_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
1212
set(MOZART_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}")
1313

1414
# Some helpers when using MinGW
15-
1615
if(MINGW)
1716
get_filename_component(CMAKE_MAKE_PROGRAM_PATH "${CMAKE_MAKE_PROGRAM}" PATH)
1817
get_filename_component(CMAKE_MAKE_PROGRAM_PATH_PARENT "${CMAKE_MAKE_PROGRAM_PATH}" PATH)
1918

2019
set(MINGW_ROOT "${CMAKE_MAKE_PROGRAM_PATH_PARENT}"
2120
CACHE PATH "Path where MinGW is installed")
22-
set(MINGW_COMPILER_VERSION "4.7.2"
21+
set(MINGW_COMPILER_VERSION "4.9.1"
2322
CACHE STRING "Version of GCC in your MinGW installation")
2423

2524
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format -Wno-format-extra-args")
26-
set(CMAKE_CXX_STANDARD_LIBRARIES "-lwsock32 -lws2_32 ${CMAKE_CSS_STANDARD_LIBRARIES}")
27-
set(DEFAULT_MOZART_GENERATOR_FLAGS
28-
"-I${MINGW_ROOT}/include/c++/${MINGW_COMPILER_VERSION}"
29-
"-I${MINGW_ROOT}/include/c++/${MINGW_COMPILER_VERSION}/i686-pc-mingw32")
25+
set(CMAKE_CXX_STANDARD_LIBRARIES "-static -lwsock32 -lws2_32 ${CMAKE_CSS_STANDARD_LIBRARIES}")
26+
27+
# Check for gcc target architecture
28+
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE GCC_ARCH)
29+
string(STRIP "${GCC_ARCH}" GCC_ARCH_TRIPLE)
30+
message(STATUS "Target architecture : ${GCC_ARCH_TRIPLE}")
3031

32+
set(DEFAULT_MOZART_GENERATOR_FLAGS
33+
"-I${MINGW_ROOT}/${GCC_ARCH_TRIPLE}/include/c++"
34+
"-I${MINGW_ROOT}/${GCC_ARCH_TRIPLE}/include/c++/${GCC_ARCH_TRIPLE}"
35+
"-I${MINGW_ROOT}/${GCC_ARCH_TRIPLE}/include")
36+
3137
set(BOOST_ROOT "${MINGW_ROOT}"
3238
CACHE PATH "Path where Boost is installed")
39+
3340
else()
3441
set(DEFAULT_MOZART_GENERATOR_FLAGS "")
3542
endif()

boosthost/emulator/emulator.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ int main(int argc, char** argv) {
162162
std::string ozSearchPath, ozSearchLoad, appURL;
163163
std::vector<std::string> appArgs;
164164
size_t minMemoryMega = 32;
165+
#if defined(_WIN32) && !defined(_WIN64)
166+
size_t maxMemoryMega = 512;
167+
#else
165168
size_t maxMemoryMega = 768;
169+
#endif
166170
bool appGUI;
167171

168172
// DEFINE OPTIONS

lib/main/wp/Tk.oz

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ define
457457
% RS: on MS Windows we use a socket: before we used
458458
% pipes, but on NT this made problems when certain background
459459
% tasks where running: Tk could get stuck here
460-
if {Property.get 'platform.name'} == 'win32-i386' then
460+
if {Property.get 'platform.os'} == 'win32' then
461461
Stream Port
462462
in
463463
thread

opi/emacs/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ else()
2929
OUTPUT ${tgt_file}
3030
COMMAND ${CMAKE_COMMAND} -E copy "${el_file}" "${gen_el_file}"
3131
COMMAND ${EMACS}
32-
-eval "(setq load-path (append load-path '(\"${CMAKE_CURRENT_SOURCE_DIR}\")))"
32+
-L "${CMAKE_CURRENT_SOURCE_DIR}"
3333
${EMACS_OPTIONS} "${gen_el_file}"
3434
DEPENDS "${el_file}"
3535
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}

platform-test/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ if(BUILD_TESTING)
200200
# running vmtest (gtest)
201201
add_test("vmtest" "${CMAKE_CURRENT_BINARY_DIR}/../vm/vm/test/vmtest")
202202
# running tests in platform-test
203-
set(OZEMULATOR "${CMAKE_CURRENT_BINARY_DIR}/../boosthost/emulator/ozemulator")
203+
if(NOT WIN32)
204+
set(OZEMULATOR "${CMAKE_CURRENT_BINARY_DIR}/../boosthost/emulator/ozemulator")
205+
else()
206+
set(OZEMULATOR "${CMAKE_CURRENT_BINARY_DIR}/../boosthost/emulator/ozengine")
207+
endif()
204208
foreach(FUNCTOR ${TEST_FUNCTORS} ${DEBUG_FUNCTORS_OZ})
205209
set(FUNCTOR_OZF "${CMAKE_CURRENT_BINARY_DIR}${FUNCTOR}f")
206210
set(TEST_FUNCTORS_OZF ${TEST_FUNCTORS_OZF} "${FUNCTOR_OZF}")

vm/boostenv/main/modos.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ public:
11931193

11941194
static void call(VM vm, Out pid) {
11951195
#ifdef MOZART_WINDOWS
1196-
pid = build(vm, GetCurrentProcessId());
1196+
pid = SmallInt::build(vm, GetCurrentProcessId());
11971197
#else
11981198
pid = build(vm, getpid());
11991199
#endif

0 commit comments

Comments
 (0)