Skip to content

Latest commit

 

History

History
117 lines (101 loc) · 4.24 KB

CMakeLists.txt

File metadata and controls

117 lines (101 loc) · 4.24 KB
 
Sep 30, 2016
Sep 30, 2016
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
cmake_minimum_required(VERSION 3.4)
project(2ine)
# Note that this project doesn't work on Mac OS X because I can't mmap()
# address 0x10000, which is the usual base address for OS/2 binaries.
# It appears the address is already accessible when main() begins, but no
# objects seem to be loaded there. I don't know what it is...maybe some
# thing allocated by the C runtime at startup? Have to solve that somehow or
# give up on Mac support.
#
# Eventually, even on Linux, it might make sense to override malloc and friends
# at the dynamic loader level, so we control all allocations even if they
# happen in glibc. Once we have that, make sure they all sit in the upper
# 2 gigabytes (reserved for system use on OS/2, so this works out), probably
# with them mmap()'d there via a local copy of dlmalloc or something.
#
# Note that 32-bit OS/2 programs only got 512 megabytes of the address space
# (enormous in the days of machines with a couple megabytes of physical RAM!)
# to accomodate thunking to and from 16 bit code. We don't bother with this
# at the moment, though, but maybe we must at some point. I hope not.
#
# Also, it might be nice if we can run as a 64-bit process and thunk around in
# 32-bits as necessary, but I don't know the technical barriers to this yet.
# If we can pull that off, it would allow an OS/2 app to have the full 4
# gigabytes of memory, and we'll just put 2ine's data outside of that range,
# and run the native bits with more registers, etc. Maybe even keep the
# native functions out of low memory and only eat a few bytes of it with
# trampolines. I'm probably getting ahead of myself, though, as it's not like
# any OS/2 apps were _that_ memory hungry, and honestly? Port your software.
if(NOT CMAKE_BUILD_TYPE)
set(DEBUG_BUILD ON)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEBUG_BUILD ON)
endif()
if(DEBUG_BUILD)
add_definitions(-DDEBUG -O0)
else()
add_definitions(-D_RELEASE)
add_definitions(-DNDEBUG)
add_definitions(-DRELEASE)
endif()
Feb 28, 2018
Feb 28, 2018
46
47
48
49
50
option(LX_LEGACY "Enable OS/2 binary support (vs just native apps)" TRUE)
if(NOT LX_LEGACY)
add_definitions(-DLX_LEGACY=0)
endif()
Sep 30, 2016
Sep 30, 2016
51
add_definitions(-std=c99 -Wall -ggdb3)
Oct 6, 2016
Oct 6, 2016
52
add_definitions(-D_FILE_OFFSET_BITS=64)
Sep 30, 2016
Sep 30, 2016
53
Oct 29, 2016
Oct 29, 2016
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
set(CURSES_NEED_WIDE TRUE)
set(CURSES_NEED_NCURSES TRUE)
find_package(Curses)
if(NOT CURSES_FOUND)
message(FATAL_ERROR "ncurses not found")
endif()
include_directories(${CURSES_INCLUDE_DIR})
if(CURSES_HAVE_NCURSESW_NCURSES_H)
add_definitions(-DHAVE_NCURSESW_NCURSES_H)
elseif(CURSES_HAVE_NCURSESW_CURSES_H)
add_definitions(-DHAVE_NCURSESW_CURSES_H)
elseif(CURSES_HAVE_NCURSESW_H)
add_definitions(-DHAVE_NCURSESW_H)
elseif(CURSES_HAVE_CURSES_H)
add_definitions(-DHAVE_CURSES_H)
Jun 17, 2018
Jun 17, 2018
70
71
elseif(CURSES_HAVE_NCURSES_CURSES_H)
add_definitions(-DHAVE_NCURSESW_NCURSES_H)
Oct 29, 2016
Oct 29, 2016
72
73
endif()
Jan 15, 2018
Jan 15, 2018
74
75
76
# !!! FIXME
include_directories("/usr/local/include/SDL2")
Feb 28, 2018
Feb 28, 2018
77
add_library(2ine SHARED "lib2ine.c")
Feb 28, 2018
Feb 28, 2018
78
79
80
81
if(LX_LEGACY)
set_target_properties(2ine PROPERTIES COMPILE_FLAGS "-m32")
set_target_properties(2ine PROPERTIES LINK_FLAGS "-m32 -ggdb3")
endif()
Feb 28, 2018
Feb 28, 2018
82
83
target_link_libraries(2ine "pthread")
Dec 21, 2017
Dec 21, 2017
84
foreach(_I doscalls;msg;nls;quecalls;viocalls;kbdcalls;sesmgr;som;pmwin;pmshapi;pmgpi;tcpip32)
Sep 30, 2016
Sep 30, 2016
85
add_library(${_I} SHARED "native/${_I}.c")
Feb 28, 2018
Feb 28, 2018
86
87
88
89
if(LX_LEGACY)
set_target_properties(${_I} PROPERTIES COMPILE_FLAGS "-m32")
set_target_properties(${_I} PROPERTIES LINK_FLAGS "-m32 -ggdb3")
endif()
Feb 28, 2018
Feb 28, 2018
90
target_link_libraries(${_I} 2ine)
Sep 30, 2016
Sep 30, 2016
91
92
endforeach()
Oct 14, 2016
Oct 14, 2016
93
target_link_libraries(doscalls "pthread")
Oct 29, 2016
Oct 29, 2016
94
# FIXME target_link_libraries(viocalls ${CURSES_LIBRARIES})
Jan 29, 2022
Jan 29, 2022
95
target_link_libraries(viocalls /usr/lib/i386-linux-gnu/libncursesw.so.6)
Feb 28, 2018
Feb 28, 2018
96
97
98
# !!! FIXME: clean this up/
if(LX_LEGACY)
Jul 10, 2018
Jul 10, 2018
99
target_link_libraries(2ine "${CMAKE_CURRENT_SOURCE_DIR}/libSDL2-2.0.so.0")
Feb 28, 2018
Feb 28, 2018
100
101
target_link_libraries(pmwin "${CMAKE_CURRENT_SOURCE_DIR}/libSDL2-2.0.so.0")
else()
Jul 10, 2018
Jul 10, 2018
102
target_link_libraries(2ine "SDL2")
Feb 28, 2018
Feb 28, 2018
103
104
target_link_libraries(pmwin "SDL2")
endif()
Oct 14, 2016
Oct 14, 2016
105
Sep 30, 2016
Sep 30, 2016
106
107
add_executable(lx_dump lx_dump.c)
Feb 28, 2018
Feb 28, 2018
108
109
110
111
if(LX_LEGACY)
add_executable(lx_loader lx_loader.c)
target_link_libraries(lx_loader 2ine)
target_link_libraries(lx_loader "dl")
Jan 29, 2022
Jan 29, 2022
112
113
set_target_properties(lx_loader PROPERTIES COMPILE_FLAGS "-m32 -no-pie")
set_target_properties(lx_loader PROPERTIES LINK_FLAGS "-m32 -no-pie -ggdb3")
Feb 28, 2018
Feb 28, 2018
114
endif()
Sep 30, 2016
Sep 30, 2016
115
116
# end of CMakeLists.txt ...