Skip to content

Commit 41adec1

Browse files
committed
Changes for Mac OS X build. Various fixes
- moved resources to separate directory resources/ - added empty line at the end of files - separate entry point (subprocess.cpp) for OS X
1 parent 15ebb02 commit 41adec1

27 files changed

+134
-58
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
build/
22
cef/
3+
.DS_Store

CHANGELOG.md

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
Changelog
22
===
33
### 0.2.1 (2016-12-20)
4-
* Allow only specified schemes when in server mode (ie. block file:// access)
5-
* Added option to enable JavaScript --javascript
6-
* Added --file option to load file from command line
7-
* Disabled standard input (use --file instead)
8-
* Added --background option to print html backgrounds
9-
* Bulding with CEF 3.2883.1540.gedbfb20 / Chromium 55.0.2883.59 version (Windows & Linux, 64bit)
4+
* Bulding with CEF 3.2883.1540.gedbfb20 / Chromium 55.0.2883.59 (Windows & Linux, 64bit)
5+
* Allow only specified schemes when in server mode (ie. block `file://` access)
6+
* Added option to enable JavaScript `--javascript`
7+
* Added `--file` option to load file from command line
8+
* Disabled standard input (use `--file` instead)
9+
* Added `--background` option to print html backgrounds
1010

11-
===
1211
### 0.2.0 (2016-11-29)
13-
* Added HTTP server mode (use with --server flag)
14-
* Added configurable --host and --port when running in server mode
12+
* Bulding with CEF 3.2883.1539.gd7f087e / Chromium 55.0.2883.59 (Windows & Linux, 64bit)
13+
* Added HTTP server mode (use with `--server` flag)
14+
* Added configurable `--host` and `--port` options when running in server mode
1515
* Various fixes and improvements
16-
* Bulding with CEF 3.2883.1539.gd7f087e / Chromium 55.0.2883.59 version (Windows & Linux, 64bit)
1716

18-
===
1917
### 0.1.6 (2016-09-21)
20-
* Fix: small improvements to allow building on Linux (tested on Debian 8.5.0 x64)
2118
* Small changes to build using CEF 3.2743.1449.g90ba67d build
19+
* Small improvements to allow building on Linux (tested on Debian 8.5.0 x64)
2220

23-
===
2421
### 0.1.5 (2016-09-15)
25-
* Add: option to set page margin --margin
26-
* Add: option to list available page sizes --list-sizes
27-
* Change: url is now specified with --url option
22+
* Added option to set page margin `--margin`
23+
* Added option to list available page sizes `--list-sizes`
24+
* Changed url to be specified with `--url` option
2825
* Heavy code refractoring
2926

3027
### 0.1.1 (2016-08-06)
31-
* Add: some paper sizes: US, ANSI and photo
32-
* Add: help message
33-
* Fix: url load error handling
28+
* Added some more paper sizes: US, ANSI and photo
29+
* Added help message
30+
* Fixed url load error handling
3431

3532
### 0.1.0 (2016-08-03)
3633
* Initial release. Working version :)

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113

114114
cmake_minimum_required(VERSION 2.8.12.1)
115115

116+
if(APPLE)
117+
set(PROJECT_ARCH x86_64)
118+
endif()
119+
116120
# Only generate Debug and Release configuration types.
117121
set(CMAKE_CONFIGURATION_TYPES Debug Release)
118122

README.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,7 @@ In addition to POSTing content inside the request body, special HTTP header `Con
4444

4545
### Building
4646

47-
In order to build, [CEF build distribution files](http://opensource.spotify.com/cefbuilds/index.html) must be placed in cef/ subdirectory. `cef-pdf` should compile without problems with cmake/ninja on Windows 7+ and Linux (tested on Debian 8.5.0 x64), using decent C++11 compiler. Mac OS X needs some work (contributors welcome).
48-
49-
### TODO
50-
51-
- Mac OS X versions
52-
- Improve performance
47+
In order to build, [CEF build distribution files](http://opensource.spotify.com/cefbuilds/index.html) must be placed in cef/ subdirectory. `cef-pdf` should compile without problems with cmake/ninja on Windows (7, x64), Linux (tested on Debian 8.5.0, x64) and Mac OS X (10.11.6) using decent C++11 compiler.
5348

5449
### License
5550

resource/Info.plist

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>${PRODUCT_NAME}</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${PRODUCT_NAME}</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>org.cef.cef-pdf.helper</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>${PRODUCT_NAME}</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0.0</string>
21+
<key>CFBundleVersion</key>
22+
<string>1.0.0</string>
23+
<key>LSMinimumSystemVersion</key>
24+
<string>10.9.0</string>
25+
<key>LSUIElement</key>
26+
<string>1</string>
27+
<key>NSSupportsAutomaticGraphicsSwitching</key>
28+
<true/>
29+
<key>NSHumanReadableCopyright</key>
30+
<string>© 2017, cef-pdf</string>
31+
</dict>
32+
</plist>
File renamed without changes.
File renamed without changes.

resource/helper-Info.plist

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>${PRODUCT_NAME}</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${PRODUCT_NAME}</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>org.cef.cefsimple.helper</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>${PRODUCT_NAME}</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0.0</string>
21+
<key>CFBundleVersion</key>
22+
<string>1.0.0</string>
23+
<key>LSFileQuarantineEnabled</key>
24+
<true/>
25+
<key>LSMinimumSystemVersion</key>
26+
<string>10.9.0</string>
27+
<key>LSUIElement</key>
28+
<string>1</string>
29+
<key>NSSupportsAutomaticGraphicsSwitching</key>
30+
<true/>
31+
<key>NSHumanReadableCopyright</key>
32+
<string>© 2017, cef-pdf</string>
33+
</dict>
34+
</plist>

src/CMakeLists.txt

+21-15
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,24 @@
33
# can be found in the LICENSE file.
44

55
#
6-
# Source files.
6+
# Targets and source files.
77
#
88

9-
# cef-pdf sources.
9+
set(CEF_TARGET "cef-pdf")
10+
set(CEF_HELPER_TARGET "cef-pdf Helper")
11+
1012
file(GLOB_RECURSE CEFPDF_SRCS "*.cpp")
11-
source_group(cef-pdf FILES ${CEFPDF_SRCS})
13+
set(CEFPDF_HELPER_SRCS ${CEFPDF_SRCS})
14+
list(FILTER CEFPDF_SRCS EXCLUDE REGEX "subprocess\\.cpp$")
15+
list(FILTER CEFPDF_HELPER_SRCS EXCLUDE REGEX "main\\.cpp$")
16+
17+
source_group("${CEF_TARGET}" FILES ${CEFPDF_SRCS})
18+
#source_group("${CEF_HELPER_TARGET}" FILES ${CEFPDF_HELPER_SRCS})
1219

1320
#
1421
# Shared configuration.
1522
#
1623

17-
# Target executable names.
18-
set(CEF_TARGET "cef-pdf")
19-
if(OS_MACOSX)
20-
set(CEF_HELPER_TARGET "cef-pdf Helper")
21-
endif()
22-
2324
# Logical target used to link the libcef library.
2425
ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
2526

@@ -71,8 +72,9 @@ if(OS_MACOSX)
7172
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
7273
target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
7374
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
74-
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/helper-Info.plist
75-
)
75+
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/resource/helper-Info.plist
76+
)
77+
target_compile_options(${CEF_HELPER_TARGET} PUBLIC -fexceptions -Wno-unused-local-typedef)
7678

7779
# Fix the framework rpath in the helper executable.
7880
FIX_MACOSX_HELPER_FRAMEWORK_RPATH(${CEF_HELPER_TARGET})
@@ -84,8 +86,9 @@ if(OS_MACOSX)
8486
target_link_libraries(${CEF_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
8587
set_target_properties(${CEF_TARGET} PROPERTIES
8688
RESOURCE "${CEFPDF_RESOURCES_SRCS}"
87-
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist
88-
)
89+
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/resource/Info.plist
90+
)
91+
target_compile_options(${CEF_TARGET} PUBLIC -fexceptions -Wno-unused-local-typedef)
8992

9093
# Copy files into the main app bundle.
9194
add_custom_command(
@@ -95,12 +98,15 @@ if(OS_MACOSX)
9598
COMMAND ${CMAKE_COMMAND} -E copy_directory
9699
"${CEF_HELPER_APP}"
97100
"${CEF_APP}/Contents/Frameworks/${CEF_HELPER_TARGET}.app"
101+
# Remove helper bundle
102+
COMMAND ${CMAKE_COMMAND} -E remove_directory
103+
"${CEF_HELPER_APP}"
98104
# Copy the CEF framework into the Frameworks directory.
99105
COMMAND ${CMAKE_COMMAND} -E copy_directory
100106
"${CEF_BINARY_DIR}/Chromium Embedded Framework.framework"
101107
"${CEF_APP}/Contents/Frameworks/Chromium Embedded Framework.framework"
102108
VERBATIM
103-
)
109+
)
104110

105111
# Fix the framework rpath in the main executable.
106112
FIX_MACOSX_MAIN_FRAMEWORK_RPATH(${CEF_TARGET})
@@ -146,7 +152,7 @@ if(OS_WINDOWS)
146152
endif()
147153

148154
# Add the custom manifest files to the executable.
149-
ADD_WINDOWS_MANIFEST("${CMAKE_CURRENT_SOURCE_DIR}" "${CEF_TARGET}" "exe")
155+
ADD_WINDOWS_MANIFEST("${CMAKE_SOURCE_DIR}/resource" "${CEF_TARGET}" "exe")
150156

151157
# Copy binary and resource files to the target output directory.
152158
COPY_FILES("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${CEF_TARGET_OUT_DIR}")

src/Common.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,4 +322,4 @@ bool deleteTempFile(const std::string& path)
322322
return 0 == std::remove(path.c_str());
323323
}
324324

325-
} // namespace cefpdf
325+
} // namespace cefpdf

src/Job/ContentProvider.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ class ContentProvider : public Visitor
4545
} // namespace job
4646
} // namespace cefpdf
4747

48-
#endif // JOB_CONTENT_PROVIDER_H_
48+
#endif // JOB_CONTENT_PROVIDER_H_

src/Job/Loader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ class Loader : public Visitor
4141
} // namespace job
4242
} // namespace cefpdf
4343

44-
#endif // JOB_LOADER_H_
44+
#endif // JOB_LOADER_H_

src/Job/Local.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ class Local : public Job
3434
} // namespace job
3535
} // namespace cefpdf
3636

37-
#endif // JOB_LOCAL_H_
37+
#endif // JOB_LOCAL_H_

src/Job/Manager.h

-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ class Manager : public CefBaseRefCounted
4949

5050
void Resolve(Manager::Iterator it, const std::string&);
5151

52-
unsigned int m_counter = 0;
53-
5452
// Include the default reference counting implementation.
5553
IMPLEMENT_REFCOUNTING(Manager)
5654
};

src/Job/Printer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ class Printer : public Visitor,
5555
} // namespace job
5656
} // namespace cefpdf
5757

58-
#endif // JOB_PRINTER_H_
58+
#endif // JOB_PRINTER_H_

src/Job/Remote.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ class Remote : public Job
3131
} // namespace job
3232
} // namespace cefpdf
3333

34-
#endif // JOB_REMOTE_H_
34+
#endif // JOB_REMOTE_H_

src/Job/StdInput.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ class StdInput : public Job
2222
} // namespace job
2323
} // namespace cefpdf
2424

25-
#endif // JOB_STDINPUT_H_
25+
#endif // JOB_STDINPUT_H_

src/Job/StdInputStreamReader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ int StdInputStreamReader::Seek(int64 offset, int whence)
3939
}
4040

4141
} // namespace job
42-
} // namespace cefpdf
42+
} // namespace cefpdf

src/Job/StdInputStreamReader.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ class StdInputStreamReader : public CefReadHandler
4545
} // namespace job
4646
} // namespace cefpdf
4747

48-
#endif // JOB_STDINPUT_STREAM_READER_H_
48+
#endif // JOB_STDINPUT_STREAM_READER_H_

src/Job/Visitor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ class Visitor : public CefBaseRefCounted
2828
} // namespace job
2929
} // namespace cefpdf
3030

31-
#endif // JOB_VISITOR_H_
31+
#endif // JOB_VISITOR_H_

src/PrintHandler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ void PrintHandler::OnPrintStart(CefRefPtr<CefBrowser> browser)
5050

5151
}
5252

53-
} // namespace cefpdf
53+
} // namespace cefpdf

src/RenderHandler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ void RenderHandler::OnPaint(
2424

2525
}
2626

27-
} // namespace cefpdf
27+
} // namespace cefpdf

src/RequestHandler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ bool RequestHandler::OnBeforeBrowse(
3434
return !std::regex_search(url, re, std::regex_constants::match_continuous);
3535
}
3636

37-
} // namespace cefpdf
37+
} // namespace cefpdf

src/Server/Connection.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ class Connection : public CefBaseRefCounted
7474
} // namespace server
7575
} // namespace cefpdf
7676

77-
#endif // SERVER_CONNECTION_H_
77+
#endif // SERVER_CONNECTION_H_

src/Server/Http.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ struct Response {
3434
} // namespace server
3535
} // namespace cefpdf
3636

37-
#endif // SERVER_HTTP_H_
37+
#endif // SERVER_HTTP_H_

src/Server/RequestHandler.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ class RequestHandler : public CefBaseRefCounted
3434
} // namespace server
3535
} // namespace cefpdf
3636

37-
#endif // SERVER_REQUEST_HANDLER_H_
37+
#endif // SERVER_REQUEST_HANDLER_H_

src/subprocess.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "Client.h"
2+
3+
// This entry point is for Mac OS X only
4+
int main(int argc, char* argv[])
5+
{
6+
CefRefPtr<cefpdf::Client> app = new cefpdf::Client();
7+
CefMainArgs mainArgs(argc, argv);
8+
return app->ExecuteSubProcess(mainArgs);
9+
}

0 commit comments

Comments
 (0)