Skip to content

Commit

Permalink
Make it compile again on 32/64-bit Windows
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
anthonygego committed Sep 2, 2014
1 parent 4b0d043 commit ab86882
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
19 changes: 13 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,31 @@ set(MOZART_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(MOZART_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}")

# Some helpers when using MinGW

if(MINGW)
get_filename_component(CMAKE_MAKE_PROGRAM_PATH "${CMAKE_MAKE_PROGRAM}" PATH)
get_filename_component(CMAKE_MAKE_PROGRAM_PATH_PARENT "${CMAKE_MAKE_PROGRAM_PATH}" PATH)

set(MINGW_ROOT "${CMAKE_MAKE_PROGRAM_PATH_PARENT}"
CACHE PATH "Path where MinGW is installed")
set(MINGW_COMPILER_VERSION "4.7.2"
set(MINGW_COMPILER_VERSION "4.9.1"
CACHE STRING "Version of GCC in your MinGW installation")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format -Wno-format-extra-args")
set(CMAKE_CXX_STANDARD_LIBRARIES "-lwsock32 -lws2_32 ${CMAKE_CSS_STANDARD_LIBRARIES}")
set(DEFAULT_MOZART_GENERATOR_FLAGS
"-I${MINGW_ROOT}/include/c++/${MINGW_COMPILER_VERSION}"
"-I${MINGW_ROOT}/include/c++/${MINGW_COMPILER_VERSION}/i686-pc-mingw32")
set(CMAKE_CXX_STANDARD_LIBRARIES "-static -lwsock32 -lws2_32 ${CMAKE_CSS_STANDARD_LIBRARIES}")

# Check for gcc target architecture
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE GCC_ARCH)
string(STRIP "${GCC_ARCH}" GCC_ARCH_TRIPLE)
message(STATUS "Target architecture : ${GCC_ARCH_TRIPLE}")

set(DEFAULT_MOZART_GENERATOR_FLAGS
"-I${MINGW_ROOT}/${GCC_ARCH_TRIPLE}/include/c++"
"-I${MINGW_ROOT}/${GCC_ARCH_TRIPLE}/include/c++/${GCC_ARCH_TRIPLE}"
"-I${MINGW_ROOT}/${GCC_ARCH_TRIPLE}/include")

set(BOOST_ROOT "${MINGW_ROOT}"
CACHE PATH "Path where Boost is installed")

else()
set(DEFAULT_MOZART_GENERATOR_FLAGS "")
endif()
Expand Down
4 changes: 4 additions & 0 deletions boosthost/emulator/emulator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ int main(int argc, char** argv) {
std::string ozSearchPath, ozSearchLoad, appURL;
std::vector<std::string> appArgs;
size_t minMemoryMega = 32;
#if defined(_WIN32) && !defined(_WIN64)
size_t maxMemoryMega = 512;
#else
size_t maxMemoryMega = 768;
#endif
bool appGUI;

// DEFINE OPTIONS
Expand Down
2 changes: 1 addition & 1 deletion lib/main/wp/Tk.oz
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ define
% RS: on MS Windows we use a socket: before we used
% pipes, but on NT this made problems when certain background
% tasks where running: Tk could get stuck here
if {Property.get 'platform.name'} == 'win32-i386' then
if {Property.get 'platform.os'} == 'win32' then
Stream Port
in
thread
Expand Down
2 changes: 1 addition & 1 deletion opi/emacs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ else()
OUTPUT ${tgt_file}
COMMAND ${CMAKE_COMMAND} -E copy "${el_file}" "${gen_el_file}"
COMMAND ${EMACS}
-eval "(setq load-path (append load-path '(\"${CMAKE_CURRENT_SOURCE_DIR}\")))"
-L "${CMAKE_CURRENT_SOURCE_DIR}"
${EMACS_OPTIONS} "${gen_el_file}"
DEPENDS "${el_file}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Expand Down
6 changes: 5 additions & 1 deletion platform-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ if(BUILD_TESTING)
# running vmtest (gtest)
add_test("vmtest" "${CMAKE_CURRENT_BINARY_DIR}/../vm/vm/test/vmtest")
# running tests in platform-test
set(OZEMULATOR "${CMAKE_CURRENT_BINARY_DIR}/../boosthost/emulator/ozemulator")
if(NOT WIN32)
set(OZEMULATOR "${CMAKE_CURRENT_BINARY_DIR}/../boosthost/emulator/ozemulator")
else()
set(OZEMULATOR "${CMAKE_CURRENT_BINARY_DIR}/../boosthost/emulator/ozengine")
endif()
foreach(FUNCTOR ${TEST_FUNCTORS} ${DEBUG_FUNCTORS_OZ})
set(FUNCTOR_OZF "${CMAKE_CURRENT_BINARY_DIR}${FUNCTOR}f")
set(TEST_FUNCTORS_OZF ${TEST_FUNCTORS_OZF} "${FUNCTOR_OZF}")
Expand Down
2 changes: 1 addition & 1 deletion vm/boostenv/main/modos.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ public:

static void call(VM vm, Out pid) {
#ifdef MOZART_WINDOWS
pid = build(vm, GetCurrentProcessId());
pid = SmallInt::build(vm, GetCurrentProcessId());
#else
pid = build(vm, getpid());
#endif
Expand Down

0 comments on commit ab86882

Please sign in to comment.